sprite 0.1.7 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (71) hide show
  1. data/Gemfile +9 -0
  2. data/Gemfile.lock +50 -0
  3. data/README.md +27 -23
  4. data/Rakefile +37 -20
  5. data/lib/sprite.rb +5 -0
  6. data/lib/sprite/builder.rb +90 -101
  7. data/lib/sprite/config.rb +48 -0
  8. data/lib/sprite/image_combiner.rb +17 -10
  9. data/lib/sprite/image_config.rb +40 -0
  10. data/lib/sprite/image_reader.rb +14 -0
  11. data/lib/sprite/image_resizer.rb +19 -0
  12. data/lib/sprite/image_writer.rb +29 -0
  13. data/lib/sprite/runner.rb +6 -4
  14. data/lib/sprite/sass_extensions.rb +93 -48
  15. data/lib/sprite/styles.rb +3 -1
  16. data/lib/sprite/styles/css_generator.rb +19 -15
  17. data/lib/sprite/styles/sass_generator.rb +5 -4
  18. data/lib/sprite/styles/sass_mixin_generator.rb +7 -7
  19. data/lib/sprite/styles/sass_yml_generator.rb +15 -16
  20. data/lib/sprite/styles/templated_css_generator.rb +41 -0
  21. data/spec/output/android_horizontal/images/sprites/android-icons.png +0 -0
  22. data/spec/output/android_horizontal/stylesheets/android-icons.css +1 -0
  23. data/spec/output/android_vertical/images/sprites/android-icons.png +0 -0
  24. data/spec/output/android_vertical/stylesheets/android-icons.css +1 -0
  25. data/spec/resources/android_css.erb +5 -0
  26. data/spec/resources/configs/android-icons.yml +19 -0
  27. data/spec/resources/configs/config-test.yml +26 -0
  28. data/spec/resources/images/android-icons/LICENSE +1 -0
  29. data/spec/resources/images/android-icons/barcode.png +0 -0
  30. data/spec/resources/images/android-icons/cards.png +0 -0
  31. data/spec/resources/images/android-icons/chart.png +0 -0
  32. data/spec/resources/images/android-icons/clock.png +0 -0
  33. data/spec/resources/images/android-icons/cloud.png +0 -0
  34. data/spec/resources/images/android-icons/colour-picker.png +0 -0
  35. data/spec/resources/images/android-icons/dialog.png +0 -0
  36. data/spec/resources/images/android-icons/dice.png +0 -0
  37. data/spec/resources/images/android-icons/disc.png +0 -0
  38. data/spec/resources/images/android-icons/equalizer.png +0 -0
  39. data/spec/resources/images/android-icons/filter.png +0 -0
  40. data/spec/resources/images/android-icons/flag.png +0 -0
  41. data/spec/resources/images/android-icons/flash.png +0 -0
  42. data/spec/resources/images/android-icons/globe.png +0 -0
  43. data/spec/resources/images/android-icons/happy.png +0 -0
  44. data/spec/resources/images/android-icons/large-tiles.png +0 -0
  45. data/spec/resources/images/android-icons/light.png +0 -0
  46. data/spec/resources/images/android-icons/love.png +0 -0
  47. data/spec/resources/images/android-icons/magnet.png +0 -0
  48. data/spec/resources/images/android-icons/monitor.png +0 -0
  49. data/spec/resources/images/android-icons/music.png +0 -0
  50. data/spec/resources/images/android-icons/pie-chart.png +0 -0
  51. data/spec/resources/images/android-icons/ruler.png +0 -0
  52. data/spec/resources/images/android-icons/sad.png +0 -0
  53. data/spec/resources/images/android-icons/seal.png +0 -0
  54. data/spec/resources/images/android-icons/shopping.png +0 -0
  55. data/spec/resources/images/android-icons/small-tiles.png +0 -0
  56. data/spec/resources/images/android-icons/sun.png +0 -0
  57. data/spec/resources/images/android-icons/tag.png +0 -0
  58. data/spec/resources/images/android-icons/umbrella.png +0 -0
  59. data/spec/resources/images/topics/good-topic.gif +0 -0
  60. data/spec/resources/images/topics/mid-topic.gif +0 -0
  61. data/spec/spec_helper.rb +32 -0
  62. data/spec/sprite/builder_spec.rb +76 -0
  63. data/spec/sprite/config_spec.rb +64 -0
  64. data/spec/sprite/image_combiner_spec.rb +40 -0
  65. data/spec/sprite/image_reader_spec.rb +16 -0
  66. data/spec/sprite/styles/css_spec.rb +0 -0
  67. data/spec/sprite/styles/sass_mixin_spec.rb +0 -0
  68. data/spec/sprite/styles/sass_spec.rb +0 -0
  69. data/sprite.gemspec +30 -49
  70. metadata +142 -21
  71. data/VERSION +0 -1
@@ -0,0 +1,40 @@
1
+ require File.dirname(__FILE__) + '/../spec_helper'
2
+
3
+ describe Sprite::ImageCombiner do
4
+ before(:all) do
5
+ # build a sprite object with empty config
6
+ image_config = Object.new
7
+ def image_config.background_color; nil; end
8
+ @combiner = Sprite::ImageCombiner.new(image_config)
9
+
10
+ @image_paths = {
11
+ :good => "#{Sprite.root}/resources/images/topics/good-topic.gif",
12
+ :mid => "#{Sprite.root}/resources/images/topics/mid-topic.gif"
13
+ }
14
+ end
15
+
16
+ context "image handling" do
17
+ context "image_properties" do
18
+ it "should get image properties" do
19
+ image = Sprite::ImageReader.read(@image_paths[:good])
20
+ @combiner.image_properties(image).should == {:name => 'good-topic', :width => 20, :height => 19}
21
+ end
22
+ end
23
+
24
+ context "composite_images" do
25
+ it "should composite two images into one horizontally" do
26
+ image1 = Sprite::ImageReader.read(@image_paths[:good])
27
+ image2 = Sprite::ImageReader.read(@image_paths[:mid])
28
+ image = @combiner.composite_images(image1, image2, image1.columns, 0)
29
+ @combiner.image_properties(image).should == {:name => nil, :width => 40, :height => 19}
30
+ end
31
+
32
+ it "should composite two images into one verically" do
33
+ image1 = Sprite::ImageReader.read(@image_paths[:good])
34
+ image2 = Sprite::ImageReader.read(@image_paths[:mid])
35
+ image = @combiner.composite_images(image1, image2, 0, image1.rows)
36
+ @combiner.image_properties(image).should == {:name => nil, :width => 20, :height => 38}
37
+ end
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,16 @@
1
+ require File.dirname(__FILE__) + '/../spec_helper'
2
+
3
+ describe Sprite::ImageReader do
4
+ before(:all) do
5
+ @image_paths = {
6
+ :good => "#{Sprite.root}/resources/images/topics/good-topic.gif",
7
+ :mid => "#{Sprite.root}/resources/images/topics/mid-topic.gif"
8
+ }
9
+ end
10
+
11
+ context "read" do
12
+ it "should get a image from disk" do
13
+ Sprite::ImageReader.read(@image_paths[:good]).class.name.should == 'Magick::Image'
14
+ end
15
+ end
16
+ end
File without changes
File without changes
File without changes
data/sprite.gemspec CHANGED
@@ -1,56 +1,37 @@
1
- # Generated by jeweler
2
- # DO NOT EDIT THIS FILE DIRECTLY
3
- # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
4
- # -*- encoding: utf-8 -*-
5
-
6
1
  Gem::Specification.new do |s|
7
- s.name = %q{sprite}
8
- s.version = "0.1.7"
2
+ s.name = "sprite"
3
+ s.version = "0.2.0"
9
4
 
10
- s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
- s.authors = ["Jacques Crocker"]
12
- s.date = %q{2009-12-22}
13
- s.default_executable = %q{sprite}
14
- s.description = %q{sprite is a rails/merb plugin that generates sprites for css, sass}
15
- s.email = %q{merbjedi@gmail.com}
5
+ s.default_executable = "sprite"
16
6
  s.executables = ["sprite"]
7
+
8
+ s.authors = ["Jacques Crocker", "Alf Mikula"]
9
+ s.summary = "generate your css and sass sprites automagically"
10
+ s.description = "sprite is a ruby executable that to easily generate sprites along with css, sass"
11
+
12
+ s.email = "railsjedi@gmail.com"
13
+ s.homepage = "http://github.com/railsjedi/sprite"
14
+ s.rubyforge_project = "none"
15
+
16
+ s.require_paths = ["lib"]
17
+ s.files = Dir['bin/*',
18
+ 'lib/**/*',
19
+ 'MIT-LICENSE',
20
+ 'rails/**/*',
21
+ 'Rakefile',
22
+ 'README.md',
23
+ 'spec/**/*',
24
+ 'tasks/**/*',
25
+ 'sprite.gemspec',
26
+ 'Gemfile',
27
+ 'Gemfile.lock']
28
+
29
+ s.test_files = Dir['spec/**/*']
30
+ s.rdoc_options = ["--charset=UTF-8"]
17
31
  s.extra_rdoc_files = [
18
- "README.md"
19
- ]
20
- s.files = [
21
32
  "MIT-LICENSE",
22
- "README.md",
23
- "Rakefile",
24
- "VERSION",
25
- "bin/sprite",
26
- "lib/sprite.rb",
27
- "lib/sprite/builder.rb",
28
- "lib/sprite/image_combiner.rb",
29
- "lib/sprite/runner.rb",
30
- "lib/sprite/sass_extensions.rb",
31
- "lib/sprite/styles.rb",
32
- "lib/sprite/styles/css_generator.rb",
33
- "lib/sprite/styles/sass_generator.rb",
34
- "lib/sprite/styles/sass_mixin_generator.rb",
35
- "lib/sprite/styles/sass_yml_generator.rb",
36
- "rails/init.rb",
37
- "sprite.gemspec",
38
- "tasks/sprite_tasks.rake"
33
+ "README.md"
39
34
  ]
40
- s.homepage = %q{http://github.com/merbjedi/sprite}
41
- s.rdoc_options = ["--charset=UTF-8"]
42
- s.require_paths = ["lib"]
43
- s.rubygems_version = %q{1.3.5}
44
- s.summary = %q{generate your css sprites automagically}
45
-
46
- if s.respond_to? :specification_version then
47
- current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
48
- s.specification_version = 3
49
-
50
- if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
51
- else
52
- end
53
- else
54
- end
55
- end
56
35
 
36
+ s.add_development_dependency "rspec", "~> 2.0"
37
+ end
metadata CHANGED
@@ -1,47 +1,115 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sprite
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.7
4
+ prerelease:
5
+ version: 0.2.0
5
6
  platform: ruby
6
7
  authors:
7
8
  - Jacques Crocker
9
+ - Alf Mikula
8
10
  autorequire:
9
11
  bindir: bin
10
12
  cert_chain: []
11
13
 
12
- date: 2009-12-22 00:00:00 -08:00
14
+ date: 2011-03-12 00:00:00 -08:00
13
15
  default_executable: sprite
14
- dependencies: []
15
-
16
- description: sprite is a rails/merb plugin that generates sprites for css, sass
17
- email: merbjedi@gmail.com
16
+ dependencies:
17
+ - !ruby/object:Gem::Dependency
18
+ name: rspec
19
+ requirement: &id001 !ruby/object:Gem::Requirement
20
+ none: false
21
+ requirements:
22
+ - - ~>
23
+ - !ruby/object:Gem::Version
24
+ version: "2.0"
25
+ type: :development
26
+ prerelease: false
27
+ version_requirements: *id001
28
+ description: sprite is a ruby executable that to easily generate sprites along with css, sass
29
+ email: railsjedi@gmail.com
18
30
  executables:
19
31
  - sprite
20
32
  extensions: []
21
33
 
22
34
  extra_rdoc_files:
23
- - README.md
24
- files:
25
35
  - MIT-LICENSE
26
36
  - README.md
27
- - Rakefile
28
- - VERSION
37
+ files:
29
38
  - bin/sprite
30
- - lib/sprite.rb
31
39
  - lib/sprite/builder.rb
40
+ - lib/sprite/config.rb
32
41
  - lib/sprite/image_combiner.rb
42
+ - lib/sprite/image_config.rb
43
+ - lib/sprite/image_reader.rb
44
+ - lib/sprite/image_resizer.rb
45
+ - lib/sprite/image_writer.rb
33
46
  - lib/sprite/runner.rb
34
47
  - lib/sprite/sass_extensions.rb
35
- - lib/sprite/styles.rb
36
48
  - lib/sprite/styles/css_generator.rb
37
49
  - lib/sprite/styles/sass_generator.rb
38
50
  - lib/sprite/styles/sass_mixin_generator.rb
39
51
  - lib/sprite/styles/sass_yml_generator.rb
52
+ - lib/sprite/styles/templated_css_generator.rb
53
+ - lib/sprite/styles.rb
54
+ - lib/sprite.rb
55
+ - MIT-LICENSE
40
56
  - rails/init.rb
41
- - sprite.gemspec
57
+ - Rakefile
58
+ - README.md
59
+ - spec/output/android_horizontal/images/sprites/android-icons.png
60
+ - spec/output/android_horizontal/stylesheets/android-icons.css
61
+ - spec/output/android_vertical/images/sprites/android-icons.png
62
+ - spec/output/android_vertical/stylesheets/android-icons.css
63
+ - spec/resources/android_css.erb
64
+ - spec/resources/configs/android-icons.yml
65
+ - spec/resources/configs/config-test.yml
66
+ - spec/resources/images/android-icons/barcode.png
67
+ - spec/resources/images/android-icons/cards.png
68
+ - spec/resources/images/android-icons/chart.png
69
+ - spec/resources/images/android-icons/clock.png
70
+ - spec/resources/images/android-icons/cloud.png
71
+ - spec/resources/images/android-icons/colour-picker.png
72
+ - spec/resources/images/android-icons/dialog.png
73
+ - spec/resources/images/android-icons/dice.png
74
+ - spec/resources/images/android-icons/disc.png
75
+ - spec/resources/images/android-icons/equalizer.png
76
+ - spec/resources/images/android-icons/filter.png
77
+ - spec/resources/images/android-icons/flag.png
78
+ - spec/resources/images/android-icons/flash.png
79
+ - spec/resources/images/android-icons/globe.png
80
+ - spec/resources/images/android-icons/happy.png
81
+ - spec/resources/images/android-icons/large-tiles.png
82
+ - spec/resources/images/android-icons/LICENSE
83
+ - spec/resources/images/android-icons/light.png
84
+ - spec/resources/images/android-icons/love.png
85
+ - spec/resources/images/android-icons/magnet.png
86
+ - spec/resources/images/android-icons/monitor.png
87
+ - spec/resources/images/android-icons/music.png
88
+ - spec/resources/images/android-icons/pie-chart.png
89
+ - spec/resources/images/android-icons/ruler.png
90
+ - spec/resources/images/android-icons/sad.png
91
+ - spec/resources/images/android-icons/seal.png
92
+ - spec/resources/images/android-icons/shopping.png
93
+ - spec/resources/images/android-icons/small-tiles.png
94
+ - spec/resources/images/android-icons/sun.png
95
+ - spec/resources/images/android-icons/tag.png
96
+ - spec/resources/images/android-icons/umbrella.png
97
+ - spec/resources/images/topics/good-topic.gif
98
+ - spec/resources/images/topics/mid-topic.gif
99
+ - spec/spec_helper.rb
100
+ - spec/sprite/builder_spec.rb
101
+ - spec/sprite/config_spec.rb
102
+ - spec/sprite/image_combiner_spec.rb
103
+ - spec/sprite/image_reader_spec.rb
104
+ - spec/sprite/styles/css_spec.rb
105
+ - spec/sprite/styles/sass_mixin_spec.rb
106
+ - spec/sprite/styles/sass_spec.rb
42
107
  - tasks/sprite_tasks.rake
108
+ - sprite.gemspec
109
+ - Gemfile
110
+ - Gemfile.lock
43
111
  has_rdoc: true
44
- homepage: http://github.com/merbjedi/sprite
112
+ homepage: http://github.com/railsjedi/sprite
45
113
  licenses: []
46
114
 
47
115
  post_install_message:
@@ -50,23 +118,76 @@ rdoc_options:
50
118
  require_paths:
51
119
  - lib
52
120
  required_ruby_version: !ruby/object:Gem::Requirement
121
+ none: false
53
122
  requirements:
54
123
  - - ">="
55
124
  - !ruby/object:Gem::Version
125
+ hash: 754007334119260414
126
+ segments:
127
+ - 0
56
128
  version: "0"
57
- version:
58
129
  required_rubygems_version: !ruby/object:Gem::Requirement
130
+ none: false
59
131
  requirements:
60
132
  - - ">="
61
133
  - !ruby/object:Gem::Version
134
+ hash: 754007334119260414
135
+ segments:
136
+ - 0
62
137
  version: "0"
63
- version:
64
138
  requirements: []
65
139
 
66
- rubyforge_project:
67
- rubygems_version: 1.3.5
140
+ rubyforge_project: none
141
+ rubygems_version: 1.5.2
68
142
  signing_key:
69
143
  specification_version: 3
70
- summary: generate your css sprites automagically
71
- test_files: []
72
-
144
+ summary: generate your css and sass sprites automagically
145
+ test_files:
146
+ - spec/output/android_horizontal/images/sprites/android-icons.png
147
+ - spec/output/android_horizontal/stylesheets/android-icons.css
148
+ - spec/output/android_vertical/images/sprites/android-icons.png
149
+ - spec/output/android_vertical/stylesheets/android-icons.css
150
+ - spec/resources/android_css.erb
151
+ - spec/resources/configs/android-icons.yml
152
+ - spec/resources/configs/config-test.yml
153
+ - spec/resources/images/android-icons/barcode.png
154
+ - spec/resources/images/android-icons/cards.png
155
+ - spec/resources/images/android-icons/chart.png
156
+ - spec/resources/images/android-icons/clock.png
157
+ - spec/resources/images/android-icons/cloud.png
158
+ - spec/resources/images/android-icons/colour-picker.png
159
+ - spec/resources/images/android-icons/dialog.png
160
+ - spec/resources/images/android-icons/dice.png
161
+ - spec/resources/images/android-icons/disc.png
162
+ - spec/resources/images/android-icons/equalizer.png
163
+ - spec/resources/images/android-icons/filter.png
164
+ - spec/resources/images/android-icons/flag.png
165
+ - spec/resources/images/android-icons/flash.png
166
+ - spec/resources/images/android-icons/globe.png
167
+ - spec/resources/images/android-icons/happy.png
168
+ - spec/resources/images/android-icons/large-tiles.png
169
+ - spec/resources/images/android-icons/LICENSE
170
+ - spec/resources/images/android-icons/light.png
171
+ - spec/resources/images/android-icons/love.png
172
+ - spec/resources/images/android-icons/magnet.png
173
+ - spec/resources/images/android-icons/monitor.png
174
+ - spec/resources/images/android-icons/music.png
175
+ - spec/resources/images/android-icons/pie-chart.png
176
+ - spec/resources/images/android-icons/ruler.png
177
+ - spec/resources/images/android-icons/sad.png
178
+ - spec/resources/images/android-icons/seal.png
179
+ - spec/resources/images/android-icons/shopping.png
180
+ - spec/resources/images/android-icons/small-tiles.png
181
+ - spec/resources/images/android-icons/sun.png
182
+ - spec/resources/images/android-icons/tag.png
183
+ - spec/resources/images/android-icons/umbrella.png
184
+ - spec/resources/images/topics/good-topic.gif
185
+ - spec/resources/images/topics/mid-topic.gif
186
+ - spec/spec_helper.rb
187
+ - spec/sprite/builder_spec.rb
188
+ - spec/sprite/config_spec.rb
189
+ - spec/sprite/image_combiner_spec.rb
190
+ - spec/sprite/image_reader_spec.rb
191
+ - spec/sprite/styles/css_spec.rb
192
+ - spec/sprite/styles/sass_mixin_spec.rb
193
+ - spec/sprite/styles/sass_spec.rb
data/VERSION DELETED
@@ -1 +0,0 @@
1
- 0.1.7