jbundle 0.0.8 → 0.0.9

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -97,9 +97,10 @@ You can declare filters that run on un-minified output only
97
97
 
98
98
  All filters must return a copy of the source, so use src.gsub instead of src.gsub!
99
99
 
100
- ## Jfile
101
100
 
102
- You can add configuration in a Jfile in the root of your project.
101
+ ## JFile
102
+
103
+ You can add configuration in a JFile in the root of your project.
103
104
 
104
105
  version '1.0.1'
105
106
 
@@ -1,3 +1,3 @@
1
1
  module JBundle
2
- VERSION = "0.0.8"
2
+ VERSION = "0.0.9"
3
3
  end
data/lib/jbundle.rb CHANGED
@@ -34,8 +34,10 @@ module JBundle
34
34
  end
35
35
 
36
36
  def write!
37
+ _dist = config.target_dir || './dist'
38
+ clear_current_dist_dir(_dist)
37
39
  out = output.map do |compiler|
38
- Writer.new(compiler, config.version, config.target_dir || './dist').write
40
+ Writer.new(compiler, config.version, _dist).write
39
41
  end.flatten
40
42
  run_after_write unless config.after_write_blocks.empty?
41
43
  out
@@ -57,6 +59,12 @@ module JBundle
57
59
  config.after_write_blocks.each {|block| block.call(config)}
58
60
  end
59
61
 
62
+ def clear_current_dist_dir(dist_dir)
63
+ config.version.releaseable.each do |version_dir|
64
+ FileUtils.rm_rf ::File.join(dist_dir, version_dir)
65
+ end
66
+ end
67
+
60
68
  end
61
69
 
62
70
  self.logger = lambda {|msg| puts "#{msg}\n"}
data/spec/jbundle_spec.rb CHANGED
@@ -39,10 +39,20 @@ describe "JBundle" do
39
39
 
40
40
  end
41
41
 
42
+ context 'before writing' do
43
+ it 'should clear distribution directories before writing' do
44
+ afile = DIST + '/1.6.1/shouldnotbehere.txt'
45
+ File.open(afile, 'w+'){|f| f.write('Hi')}
46
+ File.exists?(afile).should be_true
47
+ JBundle.write!
48
+ File.exists?(afile).should be_false
49
+ end
50
+ end
51
+
42
52
  context 'writing' do
43
53
 
44
54
  before do
45
- FileUtils.rm_rf DIST
55
+ #FileUtils.rm_rf DIST
46
56
  @written_files = JBundle.write!
47
57
  end
48
58
 
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jbundle
3
3
  version: !ruby/object:Gem::Version
4
- hash: 15
4
+ hash: 13
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 8
10
- version: 0.0.8
9
+ - 9
10
+ version: 0.0.9
11
11
  platform: ruby
12
12
  authors:
13
13
  - Ismael Celis
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-01-21 00:00:00 -03:00
18
+ date: 2011-04-15 00:00:00 +01:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency