smallvictories 0.0.17 → 0.0.18
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +0 -16
- data/bin/sv +0 -1
- data/lib/smallvictories/builder.rb +0 -6
- data/lib/smallvictories/compiler.rb +0 -28
- data/lib/smallvictories/configuration.rb +0 -16
- data/lib/smallvictories/constants.rb +0 -3
- data/lib/smallvictories/server.rb +0 -1
- data/lib/smallvictories/version.rb +1 -1
- data/lib/smallvictories/watcher.rb +0 -2
- data/smallvictories.gemspec +0 -3
- data/spec/builder_spec.rb +1 -1
- data/spec/compiler_spec.rb +0 -21
- data/spec/configuration_spec.rb +0 -33
- metadata +3 -45
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b4af17d60952b2ae6fdd1580c06a1740d24534ed
|
4
|
+
data.tar.gz: bd16fffe77d48d1d050481290c1667788540ec3a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 48c3676fc46b779c3c254829deecc01cb09e3cb4faf014323b412c8e2bf49b1ecc7b990ec21e43ef8ad0374a8d8d731355edb883b5ee3f3f80cff684aeb96998
|
7
|
+
data.tar.gz: 52a70efd4d1861556da513a65f73c064ffb609ac07eb6fe15c53e52c6d2b4ab836cf4abb97b14527d7a2ddc1e06f312cd34486a2bc6f4b3a17ec95eafe54cec5
|
data/README.md
CHANGED
@@ -20,10 +20,6 @@ includes folder.
|
|
20
20
|
You don't have to use a layout file if you don't want to, the files will still
|
21
21
|
be copied to the destination folder.
|
22
22
|
|
23
|
-
[Sprite Factory](https://github.com/jakesgordon/sprite-factory) looks for image
|
24
|
-
files in the sprite folder and generates a single sprite png and sprite
|
25
|
-
stylesheet.
|
26
|
-
|
27
23
|
[Guard LiveReload](https://github.com/guard/guard-livereload) is used to notify
|
28
24
|
the browser to automatically reload. It needs to be used with
|
29
25
|
the [LiveReload Safari/Chrome/Firefox extension](http://livereload.com/extensions#installing-sections).
|
@@ -34,14 +30,6 @@ the [LiveReload Safari/Chrome/Firefox extension](http://livereload.com/extension
|
|
34
30
|
gem install smallvictories
|
35
31
|
```
|
36
32
|
|
37
|
-
To use the [Sprite Factory](https://github.com/jakesgordon/sprite-factory) to
|
38
|
-
generate Sprite CSS you will need to install image magick which you can do with
|
39
|
-
homebrew:
|
40
|
-
|
41
|
-
```
|
42
|
-
brew install imagemagick
|
43
|
-
```
|
44
|
-
|
45
33
|
## Commands
|
46
34
|
|
47
35
|
### Bootstrap
|
@@ -103,15 +91,12 @@ Dropbox
|
|
103
91
|
└── _sv
|
104
92
|
│ ├── _includes
|
105
93
|
│ │ └── _head.liquid
|
106
|
-
│ ├── _sprite
|
107
94
|
│ ├── _layout.liquid
|
108
95
|
│ ├── applscation.css
|
109
96
|
│ ├── application.js
|
110
97
|
│ ├── index.liquid
|
111
|
-
│ └── sprite.css
|
112
98
|
├── _sv_custom.css
|
113
99
|
├── _sv_custom.js
|
114
|
-
├── _sv_sprite.png
|
115
100
|
└── index.html
|
116
101
|
```
|
117
102
|
|
@@ -166,7 +151,6 @@ You can set the following options:
|
|
166
151
|
+ `compile_css`: Should Small Victories compile Sass/css? Default is true.
|
167
152
|
+ `compile_js`: Should Small Victories compile CoffeeScript/JavaScript? Default is true.
|
168
153
|
+ `compile_html`: Should Small Victories compile HTML? Default is true.
|
169
|
-
+ `compile_sprite`: Should Small Victories compile Sprite? Default is true.
|
170
154
|
|
171
155
|
### Default Configuration
|
172
156
|
|
data/bin/sv
CHANGED
@@ -18,7 +18,6 @@ module SmallVictories
|
|
18
18
|
setup_stylesheet
|
19
19
|
setup_javascript
|
20
20
|
setup_html
|
21
|
-
setup_sprite
|
22
21
|
end
|
23
22
|
|
24
23
|
def folder_path
|
@@ -82,10 +81,5 @@ module SmallVictories
|
|
82
81
|
create_src_file('layout.liquid', File.join(folder_source_path, config.layout))
|
83
82
|
create_src_file('index.liquid', File.join(folder_source_path, 'index.liquid'))
|
84
83
|
end
|
85
|
-
|
86
|
-
def setup_sprite
|
87
|
-
setup_directory File.join(folder_source_path, config.source_sprite)
|
88
|
-
create_src_file('empty.png', File.join(folder_source_path, config.source_sprite, 'empty.png'))
|
89
|
-
end
|
90
84
|
end
|
91
85
|
end
|
@@ -2,8 +2,6 @@ require 'sprockets'
|
|
2
2
|
require 'autoprefixer-rails'
|
3
3
|
require 'liquid'
|
4
4
|
require 'premailer'
|
5
|
-
require 'sprite_factory'
|
6
|
-
require 'rails-sass-images'
|
7
5
|
|
8
6
|
module SmallVictories
|
9
7
|
class Compiler
|
@@ -25,10 +23,6 @@ module SmallVictories
|
|
25
23
|
liquid if config.compile_html
|
26
24
|
end
|
27
25
|
|
28
|
-
def compile_sprite
|
29
|
-
sprite if config.compile_sprite
|
30
|
-
end
|
31
|
-
|
32
26
|
def inline_html
|
33
27
|
premail
|
34
28
|
end
|
@@ -86,7 +80,6 @@ module SmallVictories
|
|
86
80
|
environment.js_compressor = options[:js_compressor] || :uglify
|
87
81
|
environment.css_compressor = options[:css_compressor] || :sass
|
88
82
|
end
|
89
|
-
RailsSassImages.install(sprockets)
|
90
83
|
|
91
84
|
sprockets.append_path('.')
|
92
85
|
bundles.each do |bundle|
|
@@ -154,26 +147,5 @@ module SmallVictories
|
|
154
147
|
end
|
155
148
|
end
|
156
149
|
end
|
157
|
-
|
158
|
-
def sprite
|
159
|
-
SmallVictories.logger.debug "Spriting"
|
160
|
-
sprite_directory = File.join(config.full_source_path, config.source_sprite)
|
161
|
-
return unless Dir.exists?(sprite_directory)
|
162
|
-
css = "@import 'rails-sass-images';\n"
|
163
|
-
css += SpriteFactory.run!(sprite_directory,
|
164
|
-
output_image: File.join(config.full_source_path, config.destination_sprite_file),
|
165
|
-
style: :scss,
|
166
|
-
margin: 20,
|
167
|
-
layout: :vertical,
|
168
|
-
nocss: true,
|
169
|
-
sanitizer: true) do |images|
|
170
|
-
images.map do |image_name, image_data|
|
171
|
-
".sprite-#{image_name} { background-image: url('#{config.destination_sprite_file}'); background-size: (image-width('#{File.join(config.destination_sprite_file)}')/2) auto; background-repeat: no-repeat; background-position: (#{image_data[:cssx]}px/-2) (#{image_data[:cssy]}px/-2); height: (#{image_data[:cssh]}px/2) + 1px; width: (#{image_data[:cssw]}px/2) + 1px;}"
|
172
|
-
end.join("\n")
|
173
|
-
end
|
174
|
-
FileUtils.cp(File.join(config.full_source_path, config.destination_sprite_file), File.join(config.full_destination_path, config.destination_sprite_file))
|
175
|
-
File.open(File.join(config.full_source_path, config.destination_sprite_style), 'w') { |file| file.write(css) }
|
176
|
-
SmallVictories.logger.info "compiled #{File.join(config.destination, config.destination_sprite_style)}"
|
177
|
-
end
|
178
150
|
end
|
179
151
|
end
|
@@ -60,18 +60,6 @@ module SmallVictories
|
|
60
60
|
[source_stylesheet, destination_stylesheet]
|
61
61
|
end
|
62
62
|
|
63
|
-
def source_sprite
|
64
|
-
config_file(:source_sprite) || DEFAULT_SOURCE_SPRITE
|
65
|
-
end
|
66
|
-
|
67
|
-
def destination_sprite_file
|
68
|
-
config_file(:destination_sprite_file) || DEFAULT_DESTINATION_SPRITE_FILE
|
69
|
-
end
|
70
|
-
|
71
|
-
def destination_sprite_style
|
72
|
-
config_file(:destination_sprite_style) || DEFAULT_DESTINATION_SPRITE_STYLE
|
73
|
-
end
|
74
|
-
|
75
63
|
def layout
|
76
64
|
config_file(:layout) || DEFAULT_LAYOUT
|
77
65
|
end
|
@@ -99,9 +87,5 @@ module SmallVictories
|
|
99
87
|
def compile_js
|
100
88
|
eval config_file(:compile_js) || 'true'
|
101
89
|
end
|
102
|
-
|
103
|
-
def compile_sprite
|
104
|
-
eval config_file(:compile_sprite) || 'true'
|
105
|
-
end
|
106
90
|
end
|
107
91
|
end
|
@@ -6,11 +6,8 @@ module SmallVictories
|
|
6
6
|
DEFAULT_DESTINATION = ''
|
7
7
|
DEFAULT_SOURCE_STYLESHEET = 'application.scss'
|
8
8
|
DEFAULT_SOURCE_JAVASCRIPT = 'application.js'
|
9
|
-
DEFAULT_SOURCE_SPRITE = '_sprite'
|
10
9
|
DEFAULT_DESTINATION_STYLESHEET = '_sv_custom.css'
|
11
10
|
DEFAULT_DESTINATION_JAVASCRIPT = '_sv_custom.js'
|
12
|
-
DEFAULT_DESTINATION_SPRITE_FILE = '_sv_sprite.png'
|
13
|
-
DEFAULT_DESTINATION_SPRITE_STYLE = 'sprite.scss'
|
14
11
|
DEFAULT_LAYOUT = '_layout.liquid'
|
15
12
|
DEFAULT_INCLUDES = '_includes'
|
16
13
|
ROOT = Dir.pwd
|
@@ -28,8 +28,6 @@ module SmallVictories
|
|
28
28
|
compiler.compile_js
|
29
29
|
when '.liquid', '.html'
|
30
30
|
compiler.compile_html
|
31
|
-
when '.png', '.jpg', '.jpeg', '.gif'
|
32
|
-
compiler.compile_sprite unless paths.find { |path| path == File.join(compiler.config.full_source_path, compiler.config.destination_sprite_file) }
|
33
31
|
else
|
34
32
|
end
|
35
33
|
end
|
data/smallvictories.gemspec
CHANGED
@@ -31,9 +31,6 @@ Gem::Specification.new do |spec|
|
|
31
31
|
spec.add_runtime_dependency 'closure-compiler', '~> 1.1'
|
32
32
|
spec.add_runtime_dependency 'premailer', '~> 1.8'
|
33
33
|
spec.add_runtime_dependency 'nokogiri', '~> 1.4'
|
34
|
-
spec.add_runtime_dependency 'sprite-factory', '~> 1.7'
|
35
|
-
spec.add_runtime_dependency 'rmagick', '~> 2.15'
|
36
|
-
spec.add_runtime_dependency 'rails-sass-images', '~> 1.0'
|
37
34
|
spec.add_runtime_dependency 'mime-types'
|
38
35
|
|
39
36
|
spec.add_development_dependency "bundler", "~> 1.7"
|
data/spec/builder_spec.rb
CHANGED
@@ -2,7 +2,7 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe SmallVictories do
|
4
4
|
let(:builder) { SmallVictories::Builder.new(config: SmallVictories::Configuration.new) }
|
5
|
-
let(:files) { %w(fixtures/new/_sv_config.yml fixtures/new/Guardfile fixtures/new/_sv/index.liquid fixtures/new/_sv/application.scss fixtures/new/_sv/application.js fixtures/new/_sv/_includes/_head.liquid fixtures/new/_sv/_layout.liquid
|
5
|
+
let(:files) { %w(fixtures/new/_sv_config.yml fixtures/new/Guardfile fixtures/new/_sv/index.liquid fixtures/new/_sv/application.scss fixtures/new/_sv/application.js fixtures/new/_sv/_includes/_head.liquid fixtures/new/_sv/_layout.liquid) }
|
6
6
|
|
7
7
|
context 'with folder' do
|
8
8
|
it 'sets up default files' do
|
data/spec/compiler_spec.rb
CHANGED
@@ -4,9 +4,6 @@ describe SmallVictories do
|
|
4
4
|
let(:destination_css) { './fixtures/destination/_sv_custom.css' }
|
5
5
|
let(:destination_js) { './fixtures/destination/_sv_custom.js' }
|
6
6
|
let(:destination_html) { './fixtures/destination/index.html' }
|
7
|
-
let(:destination_sprite_file) { './fixtures/destination/_sv_sprite.png' }
|
8
|
-
let(:source_sprite_file) { './fixtures/source/_sv_sprite.png' }
|
9
|
-
let(:destination_sprite_style) { './fixtures/source/sprite.scss' }
|
10
7
|
let(:compiler) { SmallVictories::Compiler.new(config: SmallVictories::Configuration.new) }
|
11
8
|
|
12
9
|
before do
|
@@ -151,23 +148,5 @@ describe SmallVictories do
|
|
151
148
|
compiler.compile_html
|
152
149
|
expect(File.open(destination_html).read).to include "<html>\n<h1>Index</h1>\nLiquid error: No such template 'snippet'\n\n</html>"
|
153
150
|
end
|
154
|
-
|
155
|
-
it 'ignores the sprite' do
|
156
|
-
compiler.compile_sprite
|
157
|
-
expect(File.exists?(destination_sprite_style)).to eq false
|
158
|
-
end
|
159
|
-
end
|
160
|
-
|
161
|
-
describe '#compile_sprite' do
|
162
|
-
it 'compiles the image files into a sprite' do
|
163
|
-
compiler.compile_sprite
|
164
|
-
expect(File.exists?(destination_sprite_file)).to eq true
|
165
|
-
expect(File.exists?(source_sprite_file)).to eq true
|
166
|
-
end
|
167
|
-
|
168
|
-
it 'compiles the css for the image sprite' do
|
169
|
-
compiler.compile_sprite
|
170
|
-
expect(File.exists?(destination_sprite_style)).to eq true
|
171
|
-
end
|
172
151
|
end
|
173
152
|
end
|
data/spec/configuration_spec.rb
CHANGED
@@ -32,18 +32,6 @@ describe SmallVictories do
|
|
32
32
|
expect(configuration.destination_javascript).to eq '_sv_custom.js'
|
33
33
|
end
|
34
34
|
|
35
|
-
it 'defaults source sprite folder' do
|
36
|
-
expect(configuration.source_sprite).to eq '_sprite'
|
37
|
-
end
|
38
|
-
|
39
|
-
it 'defaults destination sprite file' do
|
40
|
-
expect(configuration.destination_sprite_file).to eq '_sv_sprite.png'
|
41
|
-
end
|
42
|
-
|
43
|
-
it 'defaults destination sprite style' do
|
44
|
-
expect(configuration.destination_sprite_style).to eq 'sprite.scss'
|
45
|
-
end
|
46
|
-
|
47
35
|
it 'defaults layout file' do
|
48
36
|
expect(configuration.layout).to eq '_layout.liquid'
|
49
37
|
end
|
@@ -63,10 +51,6 @@ describe SmallVictories do
|
|
63
51
|
it 'defaults compile html' do
|
64
52
|
expect(configuration.compile_html).to eq true
|
65
53
|
end
|
66
|
-
|
67
|
-
it 'defaults compile sprite' do
|
68
|
-
expect(configuration.compile_sprite).to eq true
|
69
|
-
end
|
70
54
|
end
|
71
55
|
|
72
56
|
context 'with config file' do
|
@@ -94,19 +78,6 @@ describe SmallVictories do
|
|
94
78
|
expect(configuration.source_javascript).to eq 'my-javascript.js'
|
95
79
|
end
|
96
80
|
|
97
|
-
it 'reads source sprite folder' do
|
98
|
-
expect(configuration.source_sprite).to eq 'my-sprite'
|
99
|
-
end
|
100
|
-
|
101
|
-
it 'reads destination sprite file' do
|
102
|
-
expect(configuration.destination_sprite_file).to eq 'my-sprite.png'
|
103
|
-
end
|
104
|
-
|
105
|
-
it 'reads destination sprite style' do
|
106
|
-
expect(configuration.destination_sprite_style).to eq 'my-sprite.css'
|
107
|
-
end
|
108
|
-
|
109
|
-
|
110
81
|
it 'reads layout file' do
|
111
82
|
expect(configuration.layout).to eq '_my-template.liquid'
|
112
83
|
end
|
@@ -126,9 +97,5 @@ describe SmallVictories do
|
|
126
97
|
it 'reads compile html' do
|
127
98
|
expect(configuration.compile_html).to eq false
|
128
99
|
end
|
129
|
-
|
130
|
-
it 'reads compile sprite' do
|
131
|
-
expect(configuration.compile_sprite).to eq false
|
132
|
-
end
|
133
100
|
end
|
134
101
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: smallvictories
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.18
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Dijkstra
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-11-
|
11
|
+
date: 2016-11-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: autoprefixer-rails
|
@@ -192,48 +192,6 @@ dependencies:
|
|
192
192
|
- - "~>"
|
193
193
|
- !ruby/object:Gem::Version
|
194
194
|
version: '1.4'
|
195
|
-
- !ruby/object:Gem::Dependency
|
196
|
-
name: sprite-factory
|
197
|
-
requirement: !ruby/object:Gem::Requirement
|
198
|
-
requirements:
|
199
|
-
- - "~>"
|
200
|
-
- !ruby/object:Gem::Version
|
201
|
-
version: '1.7'
|
202
|
-
type: :runtime
|
203
|
-
prerelease: false
|
204
|
-
version_requirements: !ruby/object:Gem::Requirement
|
205
|
-
requirements:
|
206
|
-
- - "~>"
|
207
|
-
- !ruby/object:Gem::Version
|
208
|
-
version: '1.7'
|
209
|
-
- !ruby/object:Gem::Dependency
|
210
|
-
name: rmagick
|
211
|
-
requirement: !ruby/object:Gem::Requirement
|
212
|
-
requirements:
|
213
|
-
- - "~>"
|
214
|
-
- !ruby/object:Gem::Version
|
215
|
-
version: '2.15'
|
216
|
-
type: :runtime
|
217
|
-
prerelease: false
|
218
|
-
version_requirements: !ruby/object:Gem::Requirement
|
219
|
-
requirements:
|
220
|
-
- - "~>"
|
221
|
-
- !ruby/object:Gem::Version
|
222
|
-
version: '2.15'
|
223
|
-
- !ruby/object:Gem::Dependency
|
224
|
-
name: rails-sass-images
|
225
|
-
requirement: !ruby/object:Gem::Requirement
|
226
|
-
requirements:
|
227
|
-
- - "~>"
|
228
|
-
- !ruby/object:Gem::Version
|
229
|
-
version: '1.0'
|
230
|
-
type: :runtime
|
231
|
-
prerelease: false
|
232
|
-
version_requirements: !ruby/object:Gem::Requirement
|
233
|
-
requirements:
|
234
|
-
- - "~>"
|
235
|
-
- !ruby/object:Gem::Version
|
236
|
-
version: '1.0'
|
237
195
|
- !ruby/object:Gem::Dependency
|
238
196
|
name: mime-types
|
239
197
|
requirement: !ruby/object:Gem::Requirement
|
@@ -401,7 +359,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
401
359
|
version: '0'
|
402
360
|
requirements: []
|
403
361
|
rubyforge_project:
|
404
|
-
rubygems_version: 2.6.
|
362
|
+
rubygems_version: 2.6.8
|
405
363
|
signing_key:
|
406
364
|
specification_version: 4
|
407
365
|
summary: A command line utility for building websites.
|