Skip to content

Commit 3f81658

Browse files
committed
Adding specs (with icon files for testing)
1 parent b0e564f commit 3f81658

40 files changed

+53
-19
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
pkg/**
2+
spec/output

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,9 @@ Running `sprite` with no configuration file will generate the following new file
7979
black_icons.png
8080
weather.png
8181

82-
Any folders within `public/images/sprites/` will get compressed into a merged image file at the same location. Then `sprites.css` got generated in the stylesheets folder with all the class definitions for these files. Just include `sprites.css` into your stylesheet and you're ready to go!
82+
Any folders within `public/images/sprites/` will get compressed into a merged image file at the same
83+
location. Then `sprites.css` will get generated in the stylesheets folder with all the class definitions for
84+
these files. Just include `sprites.css` into your stylesheet and you're ready to go!
8385

8486

8587
## CONFIGURATION ##

Rakefile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ Jeweler::Tasks.new do |gemspec|
1818
gemspec.homepage = "http://github.com/merbjedi/sprite"
1919
gemspec.authors = ["Jacques Crocker", "Richard Huang"]
2020
gemspec.files.exclude '.gitignore'
21+
22+
# removing test files and specs from the gem to save space
23+
gemspec.files -= Dir.glob("spec/**/*")
24+
gemspec.test_files = []
2125
end
2226
Jeweler::GemcutterTasks.new
2327

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.1.0
1+
0.1.1
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
config:
2+
style: css
3+
output_path: output/stylesheets/android_cions
4+
image_output_path: output/images/sprites/
5+
source_path: resources/images/
6+
class_separator: '_'
7+
default_format: png
8+
9+
# defines what sprite collections get created
10+
images:
11+
- name: android_icons
12+
format: png
13+
align: vertical
14+
spaced_by: 50
15+
sources:
16+
- android_icons/*.png

spec/resources/configs/config1.yml

Whitespace-only changes.

spec/resources/configs/full_config.yml renamed to spec/resources/configs/config_test.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
config:
22
style: css
3-
output_path: output/stylesheets/sprites.css
3+
output_path: output/stylesheets/sprites
44
image_output_path: output/images/sprites/
55
source_path: resources/images/
66
class_separator: '_'
77
default_format: png
88

99
# defines what sprite collections get created
1010
images:
11-
- name: android
11+
- name: android_icons
1212
format: png
1313
align: vertical
1414
spaced_by: 50
1515
sources:
16-
- android/*.png
16+
- android_icons/*.png
1717

1818
- name: topics
1919
format: gif

spec/sprite/builder_spec.rb

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
context "configuration parsing" do
66
before(:all) do
7-
@sprite = Sprite::Builder.from_config("resources/configs/full_config.yml")
7+
@sprite = Sprite::Builder.from_config("resources/configs/config_test.yml")
88
end
99

1010
it "should load the settings keys from file" do
@@ -48,8 +48,23 @@
4848

4949
it "'class_separator:' setting should default to '_'" do
5050
@sprite.config['class_separator'].should == "_"
51+
end
52+
end
53+
54+
55+
context "generate android icon sprites" do
56+
before(:all) do
57+
@sprite = Sprite::Builder.from_config("resources/configs/android_icons.yml")
58+
@sprite.build
5159
end
5260

61+
it "should generate android.png" do
62+
File.exists?("#{Sprite.root}/output/images/sprites/android_icons.png")
63+
end
64+
65+
it "should generate android_icons.css" do
66+
File.exists?("#{Sprite.root}/output/stylesheets/android_icons.css")
67+
end
5368
end
5469

5570
end

sprite.gemspec

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,15 @@
55

66
Gem::Specification.new do |s|
77
s.name = %q{sprite}
8-
s.version = "0.1.0"
8+
s.version = "0.1.1"
99

1010
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
1111
s.authors = ["Jacques Crocker", "Richard Huang"]
12-
s.date = %q{2009-11-13}
12+
s.date = %q{2009-11-17}
13+
s.default_executable = %q{sprite}
1314
s.description = %q{sprite is a rails/merb plugin that generates sprites for css, sass}
1415
s.email = %q{[email protected]}
16+
s.executables = ["sprite"]
1517
s.extra_rdoc_files = [
1618
"README.md"
1719
]
@@ -20,14 +22,12 @@ Gem::Specification.new do |s|
2022
"README.md",
2123
"Rakefile",
2224
"VERSION",
23-
"config/css_sprite_example_config.yml",
25+
"bin/sprite",
2426
"lib/sprite.rb",
25-
"lib/sprite/sprite.rb",
26-
"spec/resources/good_topic.gif",
27-
"spec/resources/mid_topic.gif",
28-
"spec/spec.opts",
29-
"spec/spec_helper.rb",
30-
"spec/sprite_spec.rb",
27+
"lib/sprite/builder.rb",
28+
"lib/sprite/image_combiner.rb",
29+
"lib/sprite/runner.rb",
30+
"rails/init.rb",
3131
"sprite.gemspec",
3232
"tasks/sprite_tasks.rake"
3333
]
@@ -36,10 +36,6 @@ Gem::Specification.new do |s|
3636
s.require_paths = ["lib"]
3737
s.rubygems_version = %q{1.3.5}
3838
s.summary = %q{generate your css sprites automagically}
39-
s.test_files = [
40-
"spec/spec_helper.rb",
41-
"spec/sprite_spec.rb"
42-
]
4339

4440
if s.respond_to? :specification_version then
4541
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION

0 commit comments

Comments
 (0)