zfben_libjs 0.0.25 → 0.0.26

Sign up to get free protection for your applications and to get access to all the features.
@@ -11,7 +11,7 @@ class Zfben_libjs::Css < Zfben_libjs::Source
11
11
  if @remote_path || @filepath
12
12
  remote_url = File.dirname(@remote_path || @filepath)
13
13
  @source = import_remote_css @source, remote_url
14
- download_images! remote_url
14
+ @source = download_images! remote_url
15
15
  end
16
16
  end
17
17
 
@@ -40,17 +40,14 @@ class Zfben_libjs::Css < Zfben_libjs::Source
40
40
  if REGEXP_REMOTE_IMAGE =~ line
41
41
  path = line.match(REGEXP_REMOTE_IMAGE)[1]
42
42
  filename = File.basename(path)
43
- if File.exists?(File.join(@options['src/images'], filename))
44
- if @options['url'] == ''
45
- url = '../images/' + filename
46
- else
47
- url = @options['url/images'] + '/' + filename
48
- end
43
+ path = File.join(@options['src/images'], filename)
44
+ if File.exists?(path)
45
+ url = @options['url/images'] + '/' + filename
49
46
  line = 'url("' << url << '")'
50
47
  end
51
48
  end
52
49
  line
53
- }.join ''
50
+ }.join "\n"
54
51
  end
55
52
 
56
53
  private
@@ -73,20 +70,18 @@ class Zfben_libjs::Css < Zfben_libjs::Source
73
70
  end
74
71
 
75
72
  def download_images! remote_url
76
- @source = @source.partition_all(REGEXP_REMOTE_IMAGE).map{ |line|
77
- if REGEXP_REMOTE_IMAGE =~ line
78
- url = REGEXP_REMOTE_IMAGE.match(line)[1]
79
- path = File.join(@options['src/source'], '.download', self.name + '_' + File.basename(url))
80
- unless File.exists?(url) && File.exists?(path)
81
- url = File.join(remote_url, url)
82
- download(url, path)
83
- else
84
- path = url
85
- end
86
- @images.push path
87
- line = 'url(../' + File.basename(path) + ')'
73
+ @source = @source.gsub(REGEXP_REMOTE_IMAGE){ |line|
74
+ url = REGEXP_REMOTE_IMAGE.match(line)[1]
75
+ path = File.join(@options['src/source'], '.download', self.name + '_' + File.basename(url))
76
+ unless File.exists?(path)
77
+ url = File.join(remote_url, url)
78
+ download(url, path)
79
+ end
80
+ if File.exists?(path)
81
+ line = "url('#{path}')"
82
+ @images.push File.realpath(path)
88
83
  end
89
84
  line
90
- }.join("\n")
85
+ }
91
86
  end
92
87
  end
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.25'
6
+ s.version = '0.0.26'
7
7
  s.authors = ["Ben"]
8
8
  s.email = ["ben@zfben.com"]
9
9
  s.homepage = "https://github.com/benz303/zfben_libjs"
@@ -32,5 +32,7 @@ Gem::Specification.new do |s|
32
32
  s.add_dependency 'coffee-script'
33
33
  s.add_dependency 'uglifier'
34
34
  s.add_dependency 'activesupport'
35
+
36
+ s.add_development_dependency 'zfben_hanoi'
35
37
 
36
38
  end
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.25
4
+ version: 0.0.26
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-09-20 00:00:00.000000000Z
12
+ date: 2011-09-22 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rainbow
16
- requirement: &18608060 !ruby/object:Gem::Requirement
16
+ requirement: &13459540 !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: *18608060
24
+ version_requirements: *13459540
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: json
27
- requirement: &18607000 !ruby/object:Gem::Requirement
27
+ requirement: &13455860 !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: *18607000
35
+ version_requirements: *13455860
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: compass
38
- requirement: &18606140 !ruby/object:Gem::Requirement
38
+ requirement: &13386320 !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: *18606140
46
+ version_requirements: *13386320
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: coffee-script
49
- requirement: &18605540 !ruby/object:Gem::Requirement
49
+ requirement: &13383200 !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: *18605540
57
+ version_requirements: *13383200
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: uglifier
60
- requirement: &18604920 !ruby/object:Gem::Requirement
60
+ requirement: &13381060 !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: *18604920
68
+ version_requirements: *13381060
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: activesupport
71
- requirement: &18604220 !ruby/object:Gem::Requirement
71
+ requirement: &13348780 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ! '>='
@@ -76,7 +76,18 @@ dependencies:
76
76
  version: '0'
77
77
  type: :runtime
78
78
  prerelease: false
79
- version_requirements: *18604220
79
+ version_requirements: *13348780
80
+ - !ruby/object:Gem::Dependency
81
+ name: zfben_hanoi
82
+ requirement: &13346760 !ruby/object:Gem::Requirement
83
+ none: false
84
+ requirements:
85
+ - - ! '>='
86
+ - !ruby/object:Gem::Version
87
+ version: '0'
88
+ type: :development
89
+ prerelease: false
90
+ version_requirements: *13346760
80
91
  description: ''
81
92
  email:
82
93
  - ben@zfben.com