jbundle 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.md +4 -2
- data/lib/jbundle/version.rb +1 -1
- data/lib/jbundle.rb +3 -3
- data/spec/jbundle_spec.rb +22 -21
- metadata +3 -3
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
|
33
|
+
Then write them to the configured target directory
|
32
34
|
|
33
|
-
JBundle.
|
35
|
+
JBundle.write!
|
34
36
|
|
35
37
|
This will write the following files:
|
36
38
|
|
data/lib/jbundle/version.rb
CHANGED
data/lib/jbundle.rb
CHANGED
@@ -31,9 +31,9 @@ module JBundle
|
|
31
31
|
self
|
32
32
|
end
|
33
33
|
|
34
|
-
def
|
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
|
-
|
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
|
-
|
72
|
-
FileUtils.rm_rf @dist
|
73
|
+
FileUtils.rm_rf DIST
|
73
74
|
end
|
74
75
|
|
75
76
|
it 'should write files' do
|
76
|
-
JBundle.
|
77
|
+
JBundle.write!
|
77
78
|
|
78
|
-
File.exist?(
|
79
|
-
File.exist?(
|
80
|
-
File.exist?(
|
81
|
-
File.exist?(
|
82
|
-
File.exist?(
|
83
|
-
File.exist?(
|
84
|
-
File.exist?(
|
85
|
-
File.exist?(
|
86
|
-
|
87
|
-
File.exist?(
|
88
|
-
File.exist?(
|
89
|
-
File.exist?(
|
90
|
-
File.exist?(
|
91
|
-
File.exist?(
|
92
|
-
File.exist?(
|
93
|
-
File.exist?(
|
94
|
-
File.exist?(
|
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:
|
4
|
+
hash: 27
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 2
|
10
|
+
version: 0.0.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Ismael Celis
|