jbundle 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -25,12 +25,14 @@ Define a set of javascript files to bundle and minify
25
25
  filter do |src, config|
26
26
  src.gsub!(/<VERSION>/, config.version)
27
27
  end
28
+
29
+ target_dir 'dist'
28
30
 
29
31
  end
30
32
 
31
- Then write them to a directory
33
+ Then write them to the configured target directory
32
34
 
33
- JBundle.write_to './dist'
35
+ JBundle.write!
34
36
 
35
37
  This will write the following files:
36
38
 
@@ -1,3 +1,3 @@
1
1
  module JBundle
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
data/lib/jbundle.rb CHANGED
@@ -31,9 +31,9 @@ module JBundle
31
31
  self
32
32
  end
33
33
 
34
- def write_to(target_dir)
34
+ def write!
35
35
  output.each do |compiler|
36
- Writer.new(compiler, config.version, target_dir).write
36
+ Writer.new(compiler, config.version, config.target_dir || './dist').write
37
37
  end
38
38
  end
39
39
 
@@ -45,7 +45,7 @@ module JBundle
45
45
 
46
46
  def run(content)
47
47
  config.instance_eval content
48
- write_to config.target_dir || './dist'
48
+ write!
49
49
  end
50
50
 
51
51
  end
data/spec/jbundle_spec.rb CHANGED
@@ -1,16 +1,18 @@
1
1
  require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
2
2
  require 'fileutils'
3
3
 
4
+ DIST = File.dirname(__FILE__)+'/dist'
5
+
4
6
  describe "JBundle" do
5
7
 
6
8
  before do
7
9
 
8
10
  JBundle.reset!
9
-
10
11
  JBundle.config do
11
12
  version '1.6.1'
12
13
 
13
14
  src_dir File.dirname(__FILE__) + '/test_src'
15
+ target_dir DIST
14
16
 
15
17
  bundle 'foo.js' do
16
18
  file 'file1.js'
@@ -68,30 +70,29 @@ describe "JBundle" do
68
70
  context 'writing' do
69
71
 
70
72
  before do
71
- @dist = File.dirname(__FILE__)+'/dist'
72
- FileUtils.rm_rf @dist
73
+ FileUtils.rm_rf DIST
73
74
  end
74
75
 
75
76
  it 'should write files' do
76
- JBundle.write_to(@dist)
77
+ JBundle.write!
77
78
 
78
- File.exist?(@dist + '/1.6.1/foo.js').should be_true
79
- File.exist?(@dist + '/1.6.1/foo.min.js').should be_true
80
- File.exist?(@dist + '/1.6.1/foo2.js').should be_true
81
- File.exist?(@dist + '/1.6.1/foo2.min.js').should be_true
82
- File.exist?(@dist + '/1.6.1/file4.js').should be_true
83
- File.exist?(@dist + '/1.6.1/file4.min.js').should be_true
84
- File.exist?(@dist + '/1.6.1/text.txt').should be_true
85
- File.exist?(@dist + '/1.6.1/text.min.txt').should be_false
86
-
87
- File.exist?(@dist + '/1.6/foo.js').should be_true
88
- File.exist?(@dist + '/1.6/foo.min.js').should be_true
89
- File.exist?(@dist + '/1.6/foo2.js').should be_true
90
- File.exist?(@dist + '/1.6/foo2.min.js').should be_true
91
- File.exist?(@dist + '/1.6/file4.js').should be_true
92
- File.exist?(@dist + '/1.6/file4.min.js').should be_true
93
- File.exist?(@dist + '/1.6/text.txt').should be_true
94
- File.exist?(@dist + '/1.6/text.min.txt').should be_false
79
+ File.exist?(DIST + '/1.6.1/foo.js').should be_true
80
+ File.exist?(DIST + '/1.6.1/foo.min.js').should be_true
81
+ File.exist?(DIST + '/1.6.1/foo2.js').should be_true
82
+ File.exist?(DIST + '/1.6.1/foo2.min.js').should be_true
83
+ File.exist?(DIST + '/1.6.1/file4.js').should be_true
84
+ File.exist?(DIST + '/1.6.1/file4.min.js').should be_true
85
+ File.exist?(DIST + '/1.6.1/text.txt').should be_true
86
+ File.exist?(DIST + '/1.6.1/text.min.txt').should be_false
87
+
88
+ File.exist?(DIST + '/1.6/foo.js').should be_true
89
+ File.exist?(DIST + '/1.6/foo.min.js').should be_true
90
+ File.exist?(DIST + '/1.6/foo2.js').should be_true
91
+ File.exist?(DIST + '/1.6/foo2.min.js').should be_true
92
+ File.exist?(DIST + '/1.6/file4.js').should be_true
93
+ File.exist?(DIST + '/1.6/file4.min.js').should be_true
94
+ File.exist?(DIST + '/1.6/text.txt').should be_true
95
+ File.exist?(DIST + '/1.6/text.min.txt').should be_false
95
96
  end
96
97
  end
97
98
 
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: 29
4
+ hash: 27
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 1
10
- version: 0.0.1
9
+ - 2
10
+ version: 0.0.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Ismael Celis