jbundle 0.0.4 → 0.0.5
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/Gemfile.lock +1 -1
- data/README.md +4 -2
- data/bin/jbundle +5 -7
- data/lib/jbundle/version.rb +1 -1
- data/lib/jbundle.rb +6 -3
- data/spec/JFile +23 -0
- data/spec/jbundle_spec.rb +1 -29
- metadata +5 -4
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -55,14 +55,16 @@ This will write the following files:
|
|
55
55
|
'dist/1.6/text.txt'
|
56
56
|
|
57
57
|
Or you can build a single bundle/file dinamically (ie. for testing, or for serving and caching dinamically)
|
58
|
-
|
58
|
+
|
59
|
+
JBundle.config_from_file './JFile'
|
59
60
|
JBundle.build('foo.js').src
|
60
61
|
|
61
62
|
Or
|
62
63
|
|
64
|
+
JBundle.config_from_file './JFile'
|
63
65
|
JBundle.build('foo.js').min
|
64
66
|
|
65
|
-
You can bundle licenses in bundles. Licenses will not be minified even
|
67
|
+
You can bundle licenses in bundles. Licenses will not be minified even though they end up being part of minified files
|
66
68
|
|
67
69
|
bundle 'foo2.js' do
|
68
70
|
license 'license.txt'
|
data/bin/jbundle
CHANGED
@@ -2,11 +2,9 @@ require 'jbundle'
|
|
2
2
|
|
3
3
|
JBUNDLE_FILE = 'Jfile'
|
4
4
|
|
5
|
-
|
6
|
-
JBundle.
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
else
|
11
|
-
puts "You need to define ./#{JBUNDLE_FILE}"
|
5
|
+
begin
|
6
|
+
JBundle.config_from_file(JBUNDLE_FILE)
|
7
|
+
JBundle.write!
|
8
|
+
rescue JBundle::NoJFileError => boom
|
9
|
+
puts boom.message
|
12
10
|
end
|
data/lib/jbundle/version.rb
CHANGED
data/lib/jbundle.rb
CHANGED
@@ -7,6 +7,8 @@ require 'jbundle/writer'
|
|
7
7
|
|
8
8
|
module JBundle
|
9
9
|
|
10
|
+
class NoJFileError < StandardError;end
|
11
|
+
|
10
12
|
class << self
|
11
13
|
|
12
14
|
attr_accessor :logger
|
@@ -43,9 +45,10 @@ module JBundle
|
|
43
45
|
Builder.new(config).build_one found
|
44
46
|
end
|
45
47
|
|
46
|
-
def
|
47
|
-
|
48
|
-
|
48
|
+
def config_from_file(file)
|
49
|
+
raise NoJFileError, "You need to define #{file}" unless ::File.exists?(file)
|
50
|
+
reset!
|
51
|
+
config.instance_eval( ::File.read(file), file )
|
49
52
|
end
|
50
53
|
|
51
54
|
end
|
data/spec/JFile
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
version '1.6.1'
|
2
|
+
|
3
|
+
src_dir ::File.dirname(__FILE__) + '/test_src'
|
4
|
+
target_dir DIST
|
5
|
+
|
6
|
+
bundle 'foo.js' do
|
7
|
+
file 'file1.js'
|
8
|
+
file 'file2.js'
|
9
|
+
end
|
10
|
+
|
11
|
+
bundle 'foo2.js' do
|
12
|
+
license 'license.txt'
|
13
|
+
file 'file3.js'
|
14
|
+
file 'file4.js'
|
15
|
+
end
|
16
|
+
|
17
|
+
file 'file4.js'
|
18
|
+
|
19
|
+
file 'text.txt'
|
20
|
+
|
21
|
+
filter do |src, config|
|
22
|
+
src.gsub!(/<VERSION>/, config.version)
|
23
|
+
end
|
data/spec/jbundle_spec.rb
CHANGED
@@ -6,35 +6,7 @@ DIST = File.dirname(__FILE__)+'/dist'
|
|
6
6
|
describe "JBundle" do
|
7
7
|
|
8
8
|
before do
|
9
|
-
|
10
|
-
JBundle.reset!
|
11
|
-
JBundle.config do
|
12
|
-
version '1.6.1'
|
13
|
-
|
14
|
-
src_dir File.dirname(__FILE__) + '/test_src'
|
15
|
-
target_dir DIST
|
16
|
-
|
17
|
-
bundle 'foo.js' do
|
18
|
-
file 'file1.js'
|
19
|
-
file 'file2.js'
|
20
|
-
end
|
21
|
-
|
22
|
-
bundle 'foo2.js' do
|
23
|
-
license 'license.txt'
|
24
|
-
file 'file3.js'
|
25
|
-
file 'file4.js'
|
26
|
-
end
|
27
|
-
|
28
|
-
file 'file4.js'
|
29
|
-
|
30
|
-
file 'text.txt'
|
31
|
-
|
32
|
-
filter do |src, config|
|
33
|
-
src.gsub!(/<VERSION>/, config.version)
|
34
|
-
end
|
35
|
-
|
36
|
-
end
|
37
|
-
|
9
|
+
JBundle.config_from_file ::File.join(::File.dirname(__FILE__),'JFile')
|
38
10
|
end
|
39
11
|
|
40
12
|
it 'should have a version' do
|
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: 21
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 5
|
10
|
+
version: 0.0.5
|
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:
|
18
|
+
date: 2011-01-19 00:00:00 -03:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -89,6 +89,7 @@ files:
|
|
89
89
|
- lib/jbundle/version.rb
|
90
90
|
- lib/jbundle/writer.rb
|
91
91
|
- spec/.rspec
|
92
|
+
- spec/JFile
|
92
93
|
- spec/jbundle_spec.rb
|
93
94
|
- spec/spec_helper.rb
|
94
95
|
- spec/test_src/file1.js
|