montage 0.2.1 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/History.md +23 -0
- data/Rakefile +2 -4
- data/VERSION +1 -1
- data/bin/montage +11 -4
- data/lib/montage/commands/generate.rb +72 -11
- data/lib/montage/commands/init.rb +5 -11
- data/lib/montage/commands.rb +51 -18
- data/lib/montage/project.rb +54 -39
- data/lib/montage/source.rb +15 -44
- data/lib/montage/sprite.rb +25 -37
- data/lib/montage/sprite_definition.rb +127 -0
- data/lib/montage/templates/montage.yml +29 -19
- data/lib/montage/templates/sass_mixins.erb +1 -1
- data/lib/montage/templates/sources/{book.png → one/book.png} +0 -0
- data/lib/montage/templates/sources/{box-label.png → one/box-label.png} +0 -0
- data/lib/montage/templates/sources/{calculator.png → one/calculator.png} +0 -0
- data/lib/montage/templates/sources/{calendar-month.png → one/calendar-month.png} +0 -0
- data/lib/montage/templates/sources/{camera.png → one/camera.png} +0 -0
- data/lib/montage/templates/sources/{eraser.png → one/eraser.png} +0 -0
- data/lib/montage/templates/sources/two/inbox-image.png +0 -0
- data/lib/montage/templates/sources/two/magnet.png +0 -0
- data/lib/montage/templates/sources/two/newspaper.png +0 -0
- data/lib/montage/templates/sources/two/television.png +0 -0
- data/lib/montage/templates/sources/two/wand-hat.png +0 -0
- data/lib/montage/templates/sources/two/wooden-box-label.png +0 -0
- data/lib/montage.rb +10 -1
- data/montage.gemspec +17 -34
- data/spec/lib/project_helper.rb +41 -6
- data/spec/lib/shared_project_specs.rb +10 -11
- data/spec/montage/commands/generate_spec.rb +86 -132
- data/spec/montage/commands/init_spec.rb +18 -43
- data/spec/montage/project_spec.rb +77 -63
- data/spec/montage/sass_builder_spec.rb +33 -57
- data/spec/montage/source_spec.rb +10 -31
- data/spec/montage/sprite_definition_spec.rb +361 -0
- data/spec/montage/sprite_spec.rb +58 -57
- metadata +31 -70
- data/spec/fixtures/custom_dirs/montage.yml +0 -8
- data/spec/fixtures/default/montage.yml +0 -7
- data/spec/fixtures/default/public/images/sprites/src/one.png +0 -0
- data/spec/fixtures/default/public/images/sprites/src/three.png +0 -0
- data/spec/fixtures/default/public/images/sprites/src/two.png +0 -0
- data/spec/fixtures/directory_config/config/montage.yml +0 -5
- data/spec/fixtures/missing_source/montage.yml +0 -3
- data/spec/fixtures/missing_source_dir/montage.yml +0 -5
- data/spec/fixtures/root_config/montage.yml +0 -5
- data/spec/fixtures/root_config/public/images/sprites/src/source_one.png +0 -0
- data/spec/fixtures/root_config/public/images/sprites/src/source_three.jpg +0 -0
- data/spec/fixtures/root_config/public/images/sprites/src/source_two +0 -0
- data/spec/fixtures/sources/hundred.png +0 -0
- data/spec/fixtures/sources/mammoth.png +0 -0
- data/spec/fixtures/sources/other.png +0 -0
- data/spec/fixtures/sources/twenty.png +0 -0
- data/spec/fixtures/subdirs/montage.yml +0 -5
- data/spec/fixtures/subdirs/sub/sub/keep +0 -0
- data/spec/lib/fixtures.rb +0 -7
data/spec/montage/sprite_spec.rb
CHANGED
@@ -3,6 +3,52 @@ require File.expand_path('../../spec_helper', __FILE__)
|
|
3
3
|
describe Montage::Sprite do
|
4
4
|
subject { Montage::Sprite }
|
5
5
|
|
6
|
+
# --- initialization -------------------------------------------------------
|
7
|
+
|
8
|
+
describe 'when initialized' do
|
9
|
+
before(:all) do
|
10
|
+
@helper = Montage::Spec::ProjectHelper.new
|
11
|
+
@helper.write_simple_config
|
12
|
+
end
|
13
|
+
|
14
|
+
it 'should set the name' do
|
15
|
+
sprite = Montage::Sprite.new('wheee', [], '_', @helper.project)
|
16
|
+
sprite.name.should == 'wheee'
|
17
|
+
end
|
18
|
+
|
19
|
+
it 'should set the padding' do
|
20
|
+
sprite = Montage::Sprite.new('_', [], '_', @helper.project)
|
21
|
+
sprite.padding.should == @helper.project.padding
|
22
|
+
end
|
23
|
+
|
24
|
+
it 'should set the save_path' do
|
25
|
+
sprite = Montage::Sprite.new('_', [],
|
26
|
+
@helper.path_to_file('bye'), @helper.project)
|
27
|
+
|
28
|
+
sprite.save_path.should == @helper.path_to_file('bye')
|
29
|
+
end
|
30
|
+
|
31
|
+
it 'should set the url' do
|
32
|
+
sprite = Montage::Sprite.new('_', [], '_', @helper.project)
|
33
|
+
sprite.url.should == @helper.project.paths.url
|
34
|
+
end
|
35
|
+
|
36
|
+
describe 'with custom options' do
|
37
|
+
before(:all) do
|
38
|
+
@sprite = Montage::Sprite.new('wheee', [], '_', @helper.project,
|
39
|
+
:padding => 50, :url => '/omicron_persei_8')
|
40
|
+
end
|
41
|
+
|
42
|
+
it 'should set the custom padding' do
|
43
|
+
@sprite.padding.should == 50
|
44
|
+
end
|
45
|
+
|
46
|
+
it 'should set the url' do
|
47
|
+
@sprite.url.should == '/omicron_persei_8'
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
6
52
|
# --- images ---------------------------------------------------------------
|
7
53
|
|
8
54
|
it { should have_public_method_defined(:images) }
|
@@ -10,23 +56,17 @@ describe Montage::Sprite do
|
|
10
56
|
describe '#images' do
|
11
57
|
before(:each) do
|
12
58
|
@helper = Montage::Spec::ProjectHelper.new
|
13
|
-
@helper.
|
14
|
-
---
|
15
|
-
sprite_one:
|
16
|
-
- one
|
17
|
-
- two
|
18
|
-
CONFIG
|
59
|
+
@helper.write_simple_config
|
19
60
|
|
20
|
-
@helper.write_source('one', 100, 25)
|
21
|
-
@helper.write_source('two', 100, 25)
|
61
|
+
@helper.write_source('sprite_one/one', 100, 25)
|
62
|
+
@helper.write_source('sprite_one/two', 100, 25)
|
22
63
|
|
23
64
|
@sprite = @helper.project.sprite('sprite_one')
|
24
65
|
end
|
25
66
|
|
26
67
|
describe 'when the sprite contains no sources' do
|
27
68
|
before(:each) do
|
28
|
-
@sprite = Montage::Sprite.new('sprite', [],
|
29
|
-
@helper.project.paths.sources)
|
69
|
+
@sprite = Montage::Sprite.new('sprite', [], 'path', @helper.project)
|
30
70
|
end
|
31
71
|
|
32
72
|
it 'should return an array' do
|
@@ -57,15 +97,10 @@ describe Montage::Sprite do
|
|
57
97
|
describe '#position_of' do
|
58
98
|
before(:each) do
|
59
99
|
@helper = Montage::Spec::ProjectHelper.new
|
60
|
-
@helper.
|
61
|
-
---
|
62
|
-
sprite_one:
|
63
|
-
- one
|
64
|
-
- two
|
65
|
-
CONFIG
|
100
|
+
@helper.write_simple_config
|
66
101
|
|
67
|
-
@helper.write_source('one', 100, 25)
|
68
|
-
@helper.write_source('two', 100, 25)
|
102
|
+
@helper.write_source('sprite_one/one', 100, 25)
|
103
|
+
@helper.write_source('sprite_one/two', 100, 25)
|
69
104
|
|
70
105
|
@sprite = @helper.project.sprite('sprite_one')
|
71
106
|
end
|
@@ -97,56 +132,22 @@ describe Montage::Sprite do
|
|
97
132
|
describe '#digest' do
|
98
133
|
before(:each) do
|
99
134
|
@helper = Montage::Spec::ProjectHelper.new
|
100
|
-
@helper.
|
101
|
-
---
|
102
|
-
sprite_one:
|
103
|
-
- one
|
104
|
-
- two
|
105
|
-
|
106
|
-
sprite_two:
|
107
|
-
- three
|
108
|
-
CONFIG
|
135
|
+
@helper.write_simple_config
|
109
136
|
|
110
|
-
@helper.write_source('one', 100, 25)
|
111
|
-
@helper.write_source('two', 100, 25)
|
112
|
-
@helper.write_source('three', 100, 25)
|
137
|
+
@helper.write_source('sprite_one/one', 100, 25)
|
138
|
+
@helper.write_source('sprite_one/two', 100, 25)
|
139
|
+
@helper.write_source('sprite_two/three', 100, 25)
|
113
140
|
end
|
114
141
|
|
115
142
|
it 'should return a string' do
|
116
143
|
@helper.project.sprites.first.digest.should be_a(String)
|
117
144
|
end
|
118
145
|
|
119
|
-
context 'when changing the source order for a sprite' do
|
120
|
-
before(:each) do
|
121
|
-
@sprite_one_digest = @helper.project.sprite('sprite_one').digest
|
122
|
-
@sprite_two_digest = @helper.project.sprite('sprite_two').digest
|
123
|
-
@helper.write_config <<-CONFIG
|
124
|
-
---
|
125
|
-
sprite_one:
|
126
|
-
- two
|
127
|
-
- one
|
128
|
-
|
129
|
-
sprite_two:
|
130
|
-
- three
|
131
|
-
CONFIG
|
132
|
-
end
|
133
|
-
|
134
|
-
it 'should return something different when it is affected' do
|
135
|
-
@helper.project.sprite('sprite_one').digest.should_not ==
|
136
|
-
@sprite_one_digest
|
137
|
-
end
|
138
|
-
|
139
|
-
it 'should return the same value when unaffected' do
|
140
|
-
@helper.project.sprite('sprite_two').digest.should ==
|
141
|
-
@sprite_two_digest
|
142
|
-
end
|
143
|
-
end # when changing the source order for a sprite
|
144
|
-
|
145
146
|
context 'when changing the image for a source' do
|
146
147
|
before(:each) do
|
147
148
|
@sprite_one_digest = @helper.project.sprite('sprite_one').digest
|
148
149
|
@sprite_two_digest = @helper.project.sprite('sprite_two').digest
|
149
|
-
@helper.write_source('one', 100, 30)
|
150
|
+
@helper.write_source('sprite_one/one', 100, 30)
|
150
151
|
end
|
151
152
|
|
152
153
|
it 'should return something different when it is affected' do
|
metadata
CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
|
|
4
4
|
prerelease: false
|
5
5
|
segments:
|
6
6
|
- 0
|
7
|
-
-
|
8
|
-
-
|
9
|
-
version: 0.
|
7
|
+
- 3
|
8
|
+
- 0
|
9
|
+
version: 0.3.0
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Anthony Williams
|
@@ -14,28 +14,13 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-04-
|
17
|
+
date: 2010-04-12 00:00:00 +01:00
|
18
18
|
default_executable: montage
|
19
19
|
dependencies:
|
20
|
-
- !ruby/object:Gem::Dependency
|
21
|
-
name: activesupport
|
22
|
-
prerelease: false
|
23
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
24
|
-
requirements:
|
25
|
-
- - ">="
|
26
|
-
- !ruby/object:Gem::Version
|
27
|
-
segments:
|
28
|
-
- 3
|
29
|
-
- 0
|
30
|
-
- 0
|
31
|
-
- beta
|
32
|
-
version: 3.0.0.beta
|
33
|
-
type: :runtime
|
34
|
-
version_requirements: *id001
|
35
20
|
- !ruby/object:Gem::Dependency
|
36
21
|
name: rmagick
|
37
22
|
prerelease: false
|
38
|
-
requirement: &
|
23
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
39
24
|
requirements:
|
40
25
|
- - ">="
|
41
26
|
- !ruby/object:Gem::Version
|
@@ -44,11 +29,11 @@ dependencies:
|
|
44
29
|
- 12
|
45
30
|
version: "2.12"
|
46
31
|
type: :runtime
|
47
|
-
version_requirements: *
|
32
|
+
version_requirements: *id001
|
48
33
|
- !ruby/object:Gem::Dependency
|
49
34
|
name: highline
|
50
35
|
prerelease: false
|
51
|
-
requirement: &
|
36
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
52
37
|
requirements:
|
53
38
|
- - ">="
|
54
39
|
- !ruby/object:Gem::Version
|
@@ -57,11 +42,11 @@ dependencies:
|
|
57
42
|
- 5
|
58
43
|
version: "1.5"
|
59
44
|
type: :runtime
|
60
|
-
version_requirements: *
|
45
|
+
version_requirements: *id002
|
61
46
|
- !ruby/object:Gem::Dependency
|
62
47
|
name: rspec
|
63
48
|
prerelease: false
|
64
|
-
requirement: &
|
49
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
65
50
|
requirements:
|
66
51
|
- - ">="
|
67
52
|
- !ruby/object:Gem::Version
|
@@ -71,24 +56,11 @@ dependencies:
|
|
71
56
|
- 0
|
72
57
|
version: 1.3.0
|
73
58
|
type: :development
|
74
|
-
version_requirements: *
|
75
|
-
- !ruby/object:Gem::Dependency
|
76
|
-
name: cucumber
|
77
|
-
prerelease: false
|
78
|
-
requirement: &id005 !ruby/object:Gem::Requirement
|
79
|
-
requirements:
|
80
|
-
- - ">="
|
81
|
-
- !ruby/object:Gem::Version
|
82
|
-
segments:
|
83
|
-
- 0
|
84
|
-
- 6
|
85
|
-
version: "0.6"
|
86
|
-
type: :development
|
87
|
-
version_requirements: *id005
|
59
|
+
version_requirements: *id003
|
88
60
|
- !ruby/object:Gem::Dependency
|
89
61
|
name: open4
|
90
62
|
prerelease: false
|
91
|
-
requirement: &
|
63
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
92
64
|
requirements:
|
93
65
|
- - ">="
|
94
66
|
- !ruby/object:Gem::Version
|
@@ -97,11 +69,11 @@ dependencies:
|
|
97
69
|
- 0
|
98
70
|
version: "1.0"
|
99
71
|
type: :development
|
100
|
-
version_requirements: *
|
72
|
+
version_requirements: *id004
|
101
73
|
- !ruby/object:Gem::Dependency
|
102
74
|
name: haml
|
103
75
|
prerelease: false
|
104
|
-
requirement: &
|
76
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
105
77
|
requirements:
|
106
78
|
- - ">="
|
107
79
|
- !ruby/object:Gem::Version
|
@@ -113,11 +85,11 @@ dependencies:
|
|
113
85
|
- 1
|
114
86
|
version: 3.0.0.beta.1
|
115
87
|
type: :development
|
116
|
-
version_requirements: *
|
88
|
+
version_requirements: *id005
|
117
89
|
- !ruby/object:Gem::Dependency
|
118
90
|
name: yard
|
119
91
|
prerelease: false
|
120
|
-
requirement: &
|
92
|
+
requirement: &id006 !ruby/object:Gem::Requirement
|
121
93
|
requirements:
|
122
94
|
- - ">="
|
123
95
|
- !ruby/object:Gem::Version
|
@@ -126,7 +98,7 @@ dependencies:
|
|
126
98
|
- 5
|
127
99
|
version: "0.5"
|
128
100
|
type: :development
|
129
|
-
version_requirements: *
|
101
|
+
version_requirements: *id006
|
130
102
|
description: Even Rocky had a montage.
|
131
103
|
email: hi@antw.me
|
132
104
|
executables:
|
@@ -154,36 +126,24 @@ files:
|
|
154
126
|
- lib/montage/sass_builder.rb
|
155
127
|
- lib/montage/source.rb
|
156
128
|
- lib/montage/sprite.rb
|
129
|
+
- lib/montage/sprite_definition.rb
|
157
130
|
- lib/montage/templates/montage.yml
|
158
131
|
- lib/montage/templates/sass_mixins.erb
|
159
|
-
- lib/montage/templates/sources/book.png
|
160
|
-
- lib/montage/templates/sources/box-label.png
|
161
|
-
- lib/montage/templates/sources/calculator.png
|
162
|
-
- lib/montage/templates/sources/calendar-month.png
|
163
|
-
- lib/montage/templates/sources/camera.png
|
164
|
-
- lib/montage/templates/sources/eraser.png
|
132
|
+
- lib/montage/templates/sources/one/book.png
|
133
|
+
- lib/montage/templates/sources/one/box-label.png
|
134
|
+
- lib/montage/templates/sources/one/calculator.png
|
135
|
+
- lib/montage/templates/sources/one/calendar-month.png
|
136
|
+
- lib/montage/templates/sources/one/camera.png
|
137
|
+
- lib/montage/templates/sources/one/eraser.png
|
138
|
+
- lib/montage/templates/sources/two/inbox-image.png
|
139
|
+
- lib/montage/templates/sources/two/magnet.png
|
140
|
+
- lib/montage/templates/sources/two/newspaper.png
|
141
|
+
- lib/montage/templates/sources/two/television.png
|
142
|
+
- lib/montage/templates/sources/two/wand-hat.png
|
143
|
+
- lib/montage/templates/sources/two/wooden-box-label.png
|
165
144
|
- lib/montage/version.rb
|
166
145
|
- montage.gemspec
|
167
|
-
- spec/fixtures/custom_dirs/montage.yml
|
168
|
-
- spec/fixtures/default/montage.yml
|
169
|
-
- spec/fixtures/default/public/images/sprites/src/one.png
|
170
|
-
- spec/fixtures/default/public/images/sprites/src/three.png
|
171
|
-
- spec/fixtures/default/public/images/sprites/src/two.png
|
172
|
-
- spec/fixtures/directory_config/config/montage.yml
|
173
|
-
- spec/fixtures/missing_source/montage.yml
|
174
|
-
- spec/fixtures/missing_source_dir/montage.yml
|
175
|
-
- spec/fixtures/root_config/montage.yml
|
176
|
-
- spec/fixtures/root_config/public/images/sprites/src/source_one.png
|
177
|
-
- spec/fixtures/root_config/public/images/sprites/src/source_three.jpg
|
178
|
-
- spec/fixtures/root_config/public/images/sprites/src/source_two
|
179
|
-
- spec/fixtures/sources/hundred.png
|
180
|
-
- spec/fixtures/sources/mammoth.png
|
181
|
-
- spec/fixtures/sources/other.png
|
182
|
-
- spec/fixtures/sources/twenty.png
|
183
|
-
- spec/fixtures/subdirs/montage.yml
|
184
|
-
- spec/fixtures/subdirs/sub/sub/keep
|
185
146
|
- spec/lib/command_runner.rb
|
186
|
-
- spec/lib/fixtures.rb
|
187
147
|
- spec/lib/have_public_method_defined.rb
|
188
148
|
- spec/lib/project_helper.rb
|
189
149
|
- spec/lib/shared_project_specs.rb
|
@@ -195,6 +155,7 @@ files:
|
|
195
155
|
- spec/montage/sass_builder_spec.rb
|
196
156
|
- spec/montage/source_spec.rb
|
197
157
|
- spec/montage/spec/have_public_method_defined_spec.rb
|
158
|
+
- spec/montage/sprite_definition_spec.rb
|
198
159
|
- spec/montage/sprite_spec.rb
|
199
160
|
- spec/rcov.opts
|
200
161
|
- spec/spec.opts
|
@@ -233,7 +194,6 @@ specification_version: 3
|
|
233
194
|
summary: Montage
|
234
195
|
test_files:
|
235
196
|
- spec/lib/command_runner.rb
|
236
|
-
- spec/lib/fixtures.rb
|
237
197
|
- spec/lib/have_public_method_defined.rb
|
238
198
|
- spec/lib/project_helper.rb
|
239
199
|
- spec/lib/shared_project_specs.rb
|
@@ -245,5 +205,6 @@ test_files:
|
|
245
205
|
- spec/montage/sass_builder_spec.rb
|
246
206
|
- spec/montage/source_spec.rb
|
247
207
|
- spec/montage/spec/have_public_method_defined_spec.rb
|
208
|
+
- spec/montage/sprite_definition_spec.rb
|
248
209
|
- spec/montage/sprite_spec.rb
|
249
210
|
- spec/spec_helper.rb
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
File without changes
|