jbundle 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- jbundle (0.0.3)
4
+ jbundle (0.0.4)
5
5
  closure-compiler
6
6
 
7
7
  GEM
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 if though they end up as part of minified files
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
- if ::File.exists?(JBUNDLE_FILE)
6
- JBundle.run( ::File.read(JBUNDLE_FILE) )
7
- elsif ::File.exists?('JBundlefile')
8
- puts "JBundlefile is deprecated. Please rename it to #{JBUNDLE_FILE}. Sorry! I'll run it this time anyway."
9
- JBundle.run( ::File.read('JBundlefile') )
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
@@ -1,3 +1,3 @@
1
1
  module JBundle
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
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 run(content)
47
- config.instance_eval content
48
- write!
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: 23
4
+ hash: 21
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 4
10
- version: 0.0.4
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: 2010-11-15 00:00:00 -03:00
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