spriteful 0.0.1 → 0.0.2

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.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 4b4afd4331ff36f10f6b759ac9f0e4bcf896d9b0
4
+ data.tar.gz: fa28b01a1fc02c7d0760ad30009d560eeca3eefe
5
+ SHA512:
6
+ metadata.gz: 29d488e6bb8db434a4cde7806ef4fe8c70c68014a3b24c134434d45ca8e4621a4d9b68f9b639003d48841b7f6b21fdffb49149345fc499b3ca64c6ba1509f8a1
7
+ data.tar.gz: fc40aa9a782002afa88bdaaa056a9629219b21f160223a18622d71b9c8b4788687a862655a522c3ff112f70e39af1da1e512af287b76a593548b7d5960d6c81c
data/README.md CHANGED
@@ -1,6 +1,7 @@
1
1
  # Spriteful
2
2
 
3
- Spriteful is a command line sprite generator tool, meant to be used regardless of your programming language, application stack or Web framework.
3
+ Spriteful is a command line sprite generator tool, meant to be used regardless of your programming language,
4
+ application stack or Web framework.
4
5
 
5
6
  ## Usage
6
7
 
@@ -17,8 +18,7 @@ for your sprite in the `icons.css` file.
17
18
 
18
19
  If you want a bit more of control on where we should place the combined image and the CSS, you
19
20
  can use the `s` (for `stylesheets`) and `d` ( for `destination`) flags and Spriteful will place
20
- your `icons.png` in a specific directory and will save the CSS in the `icons.css` file instead
21
- of copying it to your clipboard.
21
+ your `icons.png` and `icons.css` in the desired directories.
22
22
 
23
23
  ```bash
24
24
  spriteful images/icons -s stylesheets -d images
@@ -38,7 +38,7 @@ and `new` class.
38
38
 
39
39
  ### SCSS support
40
40
 
41
- Spriteful can generate SCSS-ish code with the `-f` flag. This way the generated code will use
41
+ Spriteful can generate SCSS code with the `-f` flag. This way the generated code will use
42
42
  [Placeholder Selectors](http://sass-lang.com/docs/yardoc/file.SASS_REFERENCE.html#placeholder_selectors_)
43
43
  instead of generating a class for each image in your sprite.
44
44
 
@@ -72,9 +72,12 @@ spriteful images/icons images/flags -s stylesheets -d images
72
72
  ### Spriteful and Rails
73
73
 
74
74
  If you are working on a Ruby on Rails application Spriteful can provide some extra goodies for
75
- you. If run you the `spriteful` command with the `--rails` flag, all sprites under `app/assets/images/sprites` will be generated with respective stylesheets at `app/assets/stylesheets/sprites`, using the proper `image_url` helper for the format of your choice.
75
+ you. If run you the `spriteful` command with the `--rails` flag, all sprites under `app/assets/images/sprites`
76
+ will be generated with respective stylesheets at `app/assets/stylesheets/sprites`, using the proper `image_url`
77
+ helper for the format of your choice.
76
78
 
77
- So, given that you have the `icons` and `flags` directories with your images under `app/assets/images`, you might get a similar output when generating these two sprites.
79
+ So, given that you have the `icons` and `flags` directories with your images under `app/assets/images/sprites`,
80
+ you might get a similar output when generating these two sprites.
78
81
 
79
82
  ```bash
80
83
  spriteful --rails
@@ -84,6 +87,13 @@ spriteful --rails
84
87
  # create app/assets/stylesheets/sprites/icons.css.erb
85
88
  ```
86
89
 
90
+ ## Naming conventions
91
+
92
+ Stylesheets and combined images will **always** follow the name of their source directories -
93
+ images under `icons` will generate the `icons.png` and `icons.css` files. This convention
94
+ enforces previsibility over generated files and helps when regenating existing sprites whenever
95
+ you need to add a new source to an existing sprite.
96
+
87
97
  ## Available options
88
98
 
89
99
  * `--stylesheets` (`-s`) - Directory to save the generated stylesheet(s), instead of copying them to the clipboard.
@@ -94,7 +104,8 @@ spriteful --rails
94
104
  * `--save` - Saves the provided arguments for later use.
95
105
  * `--spacing` - Add some spacing between the images in the sprite.
96
106
 
97
- You can add a `.spritefulrc` file with default options to your home directory or the current one that they will be picked up whenever you run the `spriteful` command.
107
+ You can add a `.spritefulrc` file with default options to your home directory or the current one that they will
108
+ be picked up whenever you run the `spriteful` command.
98
109
 
99
110
  ### Examples
100
111
 
@@ -118,14 +118,13 @@ module Spriteful
118
118
  images = []
119
119
  sources.each_with_index do |(path, chunky_image), index|
120
120
  image = Image.new(chunky_image, path)
121
- padding = index * spacing
122
121
 
123
122
  if vertical?
124
123
  image.top = sprite_position
125
- sprite_position -= image.height + padding
124
+ sprite_position -= image.height + spacing
126
125
  else
127
126
  image.left = sprite_position
128
- sprite_position -= image.width + padding
127
+ sprite_position -= image.width + spacing
129
128
  end
130
129
  images << image
131
130
  end
@@ -91,5 +91,13 @@ describe Spriteful::Sprite do
91
91
  expect(red.top).to eq(-10)
92
92
  expect(red.left).to eq(0)
93
93
  end
94
+
95
+ it 'accounts the spacing option when setting the "top" attribute of each image' do
96
+ sprite = Spriteful::Sprite.new(source, destination, spacing: 10)
97
+ blue, red = sprite.images.to_a
98
+
99
+ expect(blue.top).to eq(0)
100
+ expect(red.top).to eq(-20)
101
+ end
94
102
  end
95
103
  end
metadata CHANGED
@@ -1,22 +1,20 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spriteful
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
5
- prerelease:
4
+ version: 0.0.2
6
5
  platform: ruby
7
6
  authors:
8
7
  - Lucas Mazza
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-08-21 00:00:00.000000000 Z
11
+ date: 2013-08-28 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: thor
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ! '>='
17
+ - - '>='
20
18
  - !ruby/object:Gem::Version
21
19
  version: 0.18.1
22
20
  - - <
@@ -25,9 +23,8 @@ dependencies:
25
23
  type: :runtime
26
24
  prerelease: false
27
25
  version_requirements: !ruby/object:Gem::Requirement
28
- none: false
29
26
  requirements:
30
- - - ! '>='
27
+ - - '>='
31
28
  - !ruby/object:Gem::Version
32
29
  version: 0.18.1
33
30
  - - <
@@ -36,7 +33,6 @@ dependencies:
36
33
  - !ruby/object:Gem::Dependency
37
34
  name: chunky_png
38
35
  requirement: !ruby/object:Gem::Requirement
39
- none: false
40
36
  requirements:
41
37
  - - ~>
42
38
  - !ruby/object:Gem::Version
@@ -44,7 +40,6 @@ dependencies:
44
40
  type: :runtime
45
41
  prerelease: false
46
42
  version_requirements: !ruby/object:Gem::Requirement
47
- none: false
48
43
  requirements:
49
44
  - - ~>
50
45
  - !ruby/object:Gem::Version
@@ -52,7 +47,6 @@ dependencies:
52
47
  - !ruby/object:Gem::Dependency
53
48
  name: rspec
54
49
  requirement: !ruby/object:Gem::Requirement
55
- none: false
56
50
  requirements:
57
51
  - - ~>
58
52
  - !ruby/object:Gem::Version
@@ -60,7 +54,6 @@ dependencies:
60
54
  type: :development
61
55
  prerelease: false
62
56
  version_requirements: !ruby/object:Gem::Requirement
63
- none: false
64
57
  requirements:
65
58
  - - ~>
66
59
  - !ruby/object:Gem::Version
@@ -68,7 +61,6 @@ dependencies:
68
61
  - !ruby/object:Gem::Dependency
69
62
  name: bundler
70
63
  requirement: !ruby/object:Gem::Requirement
71
- none: false
72
64
  requirements:
73
65
  - - ~>
74
66
  - !ruby/object:Gem::Version
@@ -76,7 +68,6 @@ dependencies:
76
68
  type: :development
77
69
  prerelease: false
78
70
  version_requirements: !ruby/object:Gem::Requirement
79
- none: false
80
71
  requirements:
81
72
  - - ~>
82
73
  - !ruby/object:Gem::Version
@@ -84,17 +75,15 @@ dependencies:
84
75
  - !ruby/object:Gem::Dependency
85
76
  name: rake
86
77
  requirement: !ruby/object:Gem::Requirement
87
- none: false
88
78
  requirements:
89
- - - ! '>='
79
+ - - '>='
90
80
  - !ruby/object:Gem::Version
91
81
  version: '0'
92
82
  type: :development
93
83
  prerelease: false
94
84
  version_requirements: !ruby/object:Gem::Requirement
95
- none: false
96
85
  requirements:
97
- - - ! '>='
86
+ - - '>='
98
87
  - !ruby/object:Gem::Version
99
88
  version: '0'
100
89
  description: A sprite generation tool
@@ -124,27 +113,26 @@ files:
124
113
  homepage: https://github.com/lucasmazza/spriteful
125
114
  licenses:
126
115
  - Apache 2.0
116
+ metadata: {}
127
117
  post_install_message:
128
118
  rdoc_options: []
129
119
  require_paths:
130
120
  - lib
131
121
  required_ruby_version: !ruby/object:Gem::Requirement
132
- none: false
133
122
  requirements:
134
- - - ! '>='
123
+ - - '>='
135
124
  - !ruby/object:Gem::Version
136
125
  version: '0'
137
126
  required_rubygems_version: !ruby/object:Gem::Requirement
138
- none: false
139
127
  requirements:
140
- - - ! '>='
128
+ - - '>='
141
129
  - !ruby/object:Gem::Version
142
130
  version: '0'
143
131
  requirements: []
144
132
  rubyforge_project:
145
- rubygems_version: 1.8.23
133
+ rubygems_version: 2.0.3
146
134
  signing_key:
147
- specification_version: 3
135
+ specification_version: 4
148
136
  summary: ''
149
137
  test_files:
150
138
  - spec/fixtures/simple/blue.png