sphere 0.1.2 → 0.1.3

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/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.2
1
+ 0.1.3
@@ -10,25 +10,23 @@ namespace :sphere do
10
10
  AWS::S3::Base.establish_connection!(config)
11
11
  Dir[Sphere.config.asset_root.join('**', '*')].sort.each do |source|
12
12
  source = Pathname.new(source)
13
- local = source.to_s.sub(/^#{Regexp.escape(Sphere.config.public_path)}\//, '')
13
+ target = source.to_s.sub(/^#{Regexp.escape(Sphere.config.public_path)}\//, '')
14
14
 
15
15
  if source.directory?
16
- puts " ignoring #{local}"
16
+ puts " ignoring #{target}"
17
17
  next
18
18
  end
19
19
 
20
- target = source.to_s.sub(/^#{Regexp.escape(Sphere.config.asset_root)}\//, '')
21
20
  etag = Digest::MD5.hexdigest(source.read)
21
+ meta = AWS::S3::S3Object.about(target, bucket) rescue { "last-modified" => '01/01/1970' }
22
22
 
23
- meta = AWS::S3::S3Object.about(target, bucket) rescue { "last-modified" => '01/01/1970' }
24
- if meta['etag'] != etag && Time.parse(meta["last-modified"]) < source.mtime
25
- puts "\e[32m S3/store #{local}\e[0m"
23
+ if meta['etag'] != etag || Time.parse(meta["last-modified"]) < source.mtime
24
+ puts "\e[32m S3/store #{target}\e[0m"
26
25
  AWS::S3::S3Object.store(target, source.open, bucket, :access => :public_read)
27
26
  else
28
27
  puts " S3/skip #{local}"
29
28
  end
30
29
  end
31
-
32
30
  end
33
31
 
34
32
  desc "Compile and deploy assets to AWS/S3"
@@ -14,3 +14,5 @@ stylesheets:
14
14
  - stylesheets/compiled/*.css
15
15
  print:
16
16
  - http://www.blueprintcss.org/blueprint/src/print.css
17
+ sub/folder/screen:
18
+ - stylesheets/sub/folder/*.css
@@ -0,0 +1 @@
1
+ h1 { color: #000; }
@@ -28,6 +28,10 @@ describe Sphere::Helper do
28
28
  it 'should package CSS' do
29
29
  helper.include_stylesheets(:screen).should == %Q(<link href="/assets/screen.css" media="screen" rel="stylesheet" type="text/css" />)
30
30
  end
31
+
32
+ it 'should package files in sub-directories' do
33
+ helper.include_stylesheets('sub/folder/screen').should == %Q(<link href="/assets/sub/folder/screen.css" media="screen" rel="stylesheet" type="text/css" />)
34
+ end
31
35
  end
32
36
 
33
37
  describe "with packaging disabled" do
@@ -51,6 +55,13 @@ describe Sphere::Helper do
51
55
  "/stylesheets/compiled/custom.css", "/stylesheets/compiled/print.css"
52
56
  ]
53
57
  end
58
+
59
+ it 'should package files in sub-directories' do
60
+ helper.include_stylesheets('sub/folder/screen').scan(/link href=\"([^"]+\.css)/).flatten.should == [
61
+ "/stylesheets/sub/folder/custom.css"
62
+ ]
63
+ end
64
+
54
65
  end
55
66
 
56
67
  end
@@ -9,6 +9,12 @@ describe Sphere::Package::Base do
9
9
  it 'should have a target file location' do
10
10
  javascripts['application'].file.should be_a(Pathname)
11
11
  javascripts['application'].file.to_s.should include('/public/assets/application.js')
12
+ stylesheets['sub/folder/screen'].file.to_s.should include('/public/assets/sub/folder/screen.css')
13
+ end
14
+
15
+ it 'should have a public file name' do
16
+ javascripts['application'].public_file_name.should == 'assets/application.js'
17
+ stylesheets['sub/folder/screen'].public_file_name.should == 'assets/sub/folder/screen.css'
12
18
  end
13
19
 
14
20
  it 'should have source locations' do
@@ -17,6 +23,9 @@ describe Sphere::Package::Base do
17
23
  "http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js",
18
24
  "http://jquery-ui.googlecode.com/svn/tags/latest/ui/minified/jquery.ui.core.min.js",
19
25
  "javascripts/custom/file_a.js", "javascripts/custom/file_b.js", "javascripts/file.js"]
26
+
27
+ stylesheets['sub/folder/screen'].should have(1).source
28
+ stylesheets['sub/folder/screen'].sources.should == ["stylesheets/sub/folder/custom.css"]
20
29
  end
21
30
 
22
31
  it 'should separate URLs and files' do
@@ -5,8 +5,8 @@ describe Sphere::Packager do
5
5
  it 'should create packages from configuration content' do
6
6
  Sphere::Packager.instance.send(:javascripts).should have(2).items
7
7
  Sphere::Packager.instance.send(:javascripts).values.map(&:name).sort.should == ['application', 'mobile']
8
- Sphere::Packager.instance.send(:stylesheets).should have(2).items
9
- Sphere::Packager.instance.send(:stylesheets).values.map(&:name).sort.should == ['print', 'screen']
8
+ Sphere::Packager.instance.send(:stylesheets).should have(3).items
9
+ Sphere::Packager.instance.send(:stylesheets).values.map(&:name).sort.should == ['print', 'screen', 'sub/folder/screen']
10
10
  end
11
11
 
12
12
  it 'should check if any of the packages is out of date' do
@@ -29,14 +29,16 @@ describe Sphere::Packager do
29
29
  end
30
30
 
31
31
  it 'should package all CSS packages' do
32
- css_files.should have(2).items
32
+ css_files.should have(3).items
33
33
  css_files.first.exist?.should be(false)
34
34
  css_files.last.exist?.should be(false)
35
35
  Sphere::Packager.instance.compile(:css)
36
- css_files.first.exist?.should be(true)
37
- css_files.first.size.should == 933
38
- css_files.last.exist?.should be(true)
39
- css_files.last.size.should == 22
36
+ css_files[0].exist?.should be(true)
37
+ css_files[0].size.should == 933
38
+ css_files[1].exist?.should be(true)
39
+ css_files[1].size.should == 22
40
+ css_files[2].exist?.should be(true)
41
+ css_files[2].size.should == 20
40
42
  Sphere::Packager.instance.out_of_date?(:css).should be(false)
41
43
  end
42
44
 
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{sphere}
8
- s.version = "0.1.2"
8
+ s.version = "0.1.3"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Dimitrij Denissenko"]
12
- s.date = %q{2010-07-13}
12
+ s.date = %q{2010-07-15}
13
13
  s.description = %q{Rails asset packer and compressor. Supports Compass, built (primarily) to be used with Heroku & AWS/S3}
14
14
  s.email = %q{dimitrij@blacksquaremedia.com}
15
15
  s.extra_rdoc_files = [
@@ -47,6 +47,7 @@ Gem::Specification.new do |s|
47
47
  "spec/scenario/public/javascripts/file.js",
48
48
  "spec/scenario/public/stylesheets/compiled/custom.css",
49
49
  "spec/scenario/public/stylesheets/compiled/print.css",
50
+ "spec/scenario/public/stylesheets/sub/folder/custom.css",
50
51
  "spec/spec_helper.rb",
51
52
  "spec/sphere/config_spec.rb",
52
53
  "spec/sphere/css_minifier_spec.rb",
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 1
8
- - 2
9
- version: 0.1.2
8
+ - 3
9
+ version: 0.1.3
10
10
  platform: ruby
11
11
  authors:
12
12
  - Dimitrij Denissenko
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-07-13 00:00:00 +01:00
17
+ date: 2010-07-15 00:00:00 +01:00
18
18
  default_executable:
19
19
  dependencies: []
20
20
 
@@ -58,6 +58,7 @@ files:
58
58
  - spec/scenario/public/javascripts/file.js
59
59
  - spec/scenario/public/stylesheets/compiled/custom.css
60
60
  - spec/scenario/public/stylesheets/compiled/print.css
61
+ - spec/scenario/public/stylesheets/sub/folder/custom.css
61
62
  - spec/spec_helper.rb
62
63
  - spec/sphere/config_spec.rb
63
64
  - spec/sphere/css_minifier_spec.rb