zfben_libjs 0.0.23 → 0.0.24

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.
@@ -24,19 +24,22 @@ class Zfben_libjs::Libjs
24
24
 
25
25
  Default_options[:support_source] = Dir[File.join(File.dirname(__FILE__), 'support_source', '*.rb')]
26
26
 
27
- def initialize *opts
28
-
27
+ def initialize *options
29
28
  # recive path or hash options
30
- case opts[0].class.to_s
29
+ case options[0].class.to_s
31
30
  when 'String'
32
- opts = read_config_file(opts[0])
31
+ opts = read_config_file(options[0])
33
32
  when 'Hash'
34
- opts = opts[0]
33
+ opts = options[0]
35
34
  else
36
- opts = {}
35
+ opts = Default_options.clone
37
36
  end
38
37
 
39
38
  @opts = merge_and_convert_options(opts)
39
+
40
+ if options[1].class.to_s == 'Hash'
41
+ @opts = @opts.deep_merge(options[1])
42
+ end
40
43
 
41
44
  @path_gem = File.realpath(File.dirname(__FILE__))
42
45
 
@@ -49,8 +52,6 @@ class Zfben_libjs::Libjs
49
52
  @opts[:config]['url/' + path] = @opts[:config]['url'] + '/' + path unless @opts[:config].has_key?('url/' + path)
50
53
  end
51
54
 
52
- p @opts
53
-
54
55
  # Merge default libs
55
56
  @libs = {
56
57
  'lazyload' => 'https://raw.github.com/rgrove/lazyload/master/lazyload.js'
@@ -71,7 +72,7 @@ class Zfben_libjs::Libjs
71
72
  def read_config_file filepath
72
73
  config_file = File.exists?(filepath) && !File.directory?(filepath) ? [filepath] : Dir[filepath + '*'].select{ |f| !File.directory?(f) }
73
74
  if config_file.length == 0
74
- err config_file + ' is not exist!'
75
+ err filepath + ' is not exist!'
75
76
  end
76
77
 
77
78
  begin
@@ -1,6 +1,6 @@
1
1
  class Zfben_libjs::Css < Zfben_libjs::Source
2
2
 
3
- REGEXP_REMOTE_CSS = /@import[^"]+"([^"]+)"/
3
+ REGEXP_REMOTE_CSS = /@import[^"]+"([^"]+)"\)?;?/
4
4
  REGEXP_REMOTE_IMAGE = /url\("?'?([^'")]+)'?"?\)/
5
5
 
6
6
  def after_initialize
@@ -1,6 +1,6 @@
1
1
  class Zfben_libjs::Sass < Zfben_libjs::Source
2
2
  def after_initialize
3
- @options = @options.merges({ :syntax => :sass, :cache => false }, Compass.sass_engine_options)
3
+ @options = @options.merges({ :syntax => :sass }, Compass.sass_engine_options)
4
4
  @options[:load_paths].push File.dirname(@filepath)
5
5
  @source = "@import compass\n" + @source
6
6
  end
@@ -1,6 +1,6 @@
1
1
  class Zfben_libjs::Scss < Zfben_libjs::Source
2
2
  def after_initialize
3
- @options = @options.merges({ :syntax => :scss, :cache => false }, Compass.sass_engine_options)
3
+ @options = @options.merges({ :syntax => :scss }, Compass.sass_engine_options)
4
4
  @options[:load_paths].push File.dirname(@filepath)
5
5
  @source = "@import \"compass\";\n" + @source
6
6
  end
@@ -1,6 +1,6 @@
1
1
  class TestLibjs < Test::Unit::TestCase
2
2
  def test
3
- assert_equal Zfben_libjs::Libjs.new.opts, Zfben_libjs::Libjs.defaults
4
3
  assert_equal Zfben_libjs::Libjs.new('test').opts, Zfben_libjs::Libjs.new('t').opts
4
+ assert_equal Zfben_libjs::Libjs.new('test', :config => { 'minify' => false} ).opts[:config]['minify'], false
5
5
  end
6
6
  end
@@ -1 +1 @@
1
- .css{ color: rgb(0,0,1) !important }
1
+ .css{ color: rgb(0,0,1) !important; }
data/test.yml CHANGED
@@ -2,7 +2,6 @@
2
2
  config:
3
3
  src: src # which folder to save files
4
4
  download: false # if file isn't exists, it will be downloaded always
5
- minify: false # use uglifier and sass engine to minify files
6
5
  changeImageUrl: true # change image urls in css
7
6
 
8
7
  # Files to be download and writen in lib.js
data/zfben_libjs.gemspec CHANGED
@@ -3,7 +3,7 @@ $:.push File.expand_path("../lib", __FILE__)
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = 'zfben_libjs'
6
- s.version = '0.0.23'
6
+ s.version = '0.0.24'
7
7
  s.authors = ["Ben"]
8
8
  s.email = ["ben@zfben.com"]
9
9
  s.homepage = "https://github.com/benz303/zfben_libjs"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zfben_libjs
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.23
4
+ version: 0.0.24
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2011-09-18 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rainbow
16
- requirement: &10800640 !ruby/object:Gem::Requirement
16
+ requirement: &11622880 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *10800640
24
+ version_requirements: *11622880
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: json
27
- requirement: &10798980 !ruby/object:Gem::Requirement
27
+ requirement: &11621900 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *10798980
35
+ version_requirements: *11621900
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: compass
38
- requirement: &10796720 !ruby/object:Gem::Requirement
38
+ requirement: &11621000 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '0'
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *10796720
46
+ version_requirements: *11621000
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: coffee-script
49
- requirement: &10794440 !ruby/object:Gem::Requirement
49
+ requirement: &11620380 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: '0'
55
55
  type: :runtime
56
56
  prerelease: false
57
- version_requirements: *10794440
57
+ version_requirements: *11620380
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: uglifier
60
- requirement: &10792860 !ruby/object:Gem::Requirement
60
+ requirement: &11619760 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ! '>='
@@ -65,10 +65,10 @@ dependencies:
65
65
  version: '0'
66
66
  type: :runtime
67
67
  prerelease: false
68
- version_requirements: *10792860
68
+ version_requirements: *11619760
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: activesupport
71
- requirement: &10789880 !ruby/object:Gem::Requirement
71
+ requirement: &11619060 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ! '>='
@@ -76,7 +76,7 @@ dependencies:
76
76
  version: '0'
77
77
  type: :runtime
78
78
  prerelease: false
79
- version_requirements: *10789880
79
+ version_requirements: *11619060
80
80
  description: ''
81
81
  email:
82
82
  - ben@zfben.com