lemonlime 0.0.1
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.
- checksums.yaml +7 -0
- data/Gemfile +3 -0
- data/Gemfile.lock +16 -0
- data/README.md +4 -0
- data/lemonlime.gemspec +14 -0
- data/lib/lemonlime.rb +4 -0
- data/lib/lemonlime/lemonlime.rb +74 -0
- data/lib/tasks/lemonlime.rake +26 -0
- data/license.txt +20 -0
- metadata +64 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 03711bbed82c8886a579fe0841aeb3735b10a507
|
4
|
+
data.tar.gz: 045fe663d2c265fac8ee4263126f0a646a6cebbc
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: ce09a354a87d40155251a1f43a563d6c4e22c55276d8f9c81b7e92217f66b5cad45cb8cc55c4c4f42e42b4ca685b44554cc1e56665637ae143ede600a65b20f4
|
7
|
+
data.tar.gz: 5a16c47c441adcaaaa0029710244e0775da4cf8f50ecaeb4a72fd8f36f02188badb4f420a836d05139a0bfaaf46f69220332f88e7b7686e617cbbdc4633810b5
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
data/README.md
ADDED
data/lemonlime.gemspec
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
Gem::Specification.new do |s|
|
2
|
+
s.name = "lemonlime"
|
3
|
+
s.version = "0.0.1"
|
4
|
+
s.author = "Pete Brousalis"
|
5
|
+
s.email = "brousapg@gmail.com"
|
6
|
+
s.summary = "Gem for spriting images and outputting mixins"
|
7
|
+
s.description = "Gem for spriting mixins and outputting mixins. Built ontop of sprite-factory"
|
8
|
+
s.homepage = "http://github.com/brousalis/lemonlime/"
|
9
|
+
|
10
|
+
s.add_runtime_dependency 'sprite-factory', '~> 1.6.2'
|
11
|
+
|
12
|
+
s.files = `git ls-files`.split($\)
|
13
|
+
s.require_paths = ['lib']
|
14
|
+
end
|
data/lib/lemonlime.rb
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
require 'colors'
|
2
|
+
require 'sprite_factory'
|
3
|
+
require 'fileutils'
|
4
|
+
|
5
|
+
IMAGE_FOLDER = 'app/assets/images'
|
6
|
+
SPRITE_FOLDER = 'app/assets/stylesheets/sprites'
|
7
|
+
|
8
|
+
SpriteFactory.report = true
|
9
|
+
SpriteFactory.nocomments = true
|
10
|
+
SpriteFactory.pngcrush = true
|
11
|
+
SpriteFactory.layout = :packed
|
12
|
+
SpriteFactory.cssurl = "image-url('$IMAGE')"
|
13
|
+
|
14
|
+
module Lemonlime
|
15
|
+
include Colors
|
16
|
+
|
17
|
+
def sprite_images
|
18
|
+
# make sprite folder if it doesn't exist
|
19
|
+
FileUtils.mkdir_p(SPRITE_FOLDER) unless File.directory?(SPRITE_FOLDER)
|
20
|
+
|
21
|
+
# check dependencies for sprite-factory
|
22
|
+
return unless dependency_check
|
23
|
+
|
24
|
+
# sprite the images
|
25
|
+
get_dirs.each do |dir|
|
26
|
+
warn("Spriting images in folder #{dir}")
|
27
|
+
|
28
|
+
images = IMAGE_FOLDER + dir
|
29
|
+
|
30
|
+
options = {
|
31
|
+
style: 'scss',
|
32
|
+
output_style: "#{SPRITE_FOLDER}/#{dir}.scss"
|
33
|
+
}
|
34
|
+
|
35
|
+
SpriteFactory.run!(images, options) do |images|
|
36
|
+
images.map do |name, data|
|
37
|
+
prefix = dir.sub('/sprite-','')
|
38
|
+
"@mixin sprite-#{prefix}-#{name} {#{data[:style].gsub(/[\n]+/, ';')}}"
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
private
|
45
|
+
|
46
|
+
def get_dirs
|
47
|
+
Dir["#{IMAGE_FOLDER}/sprite-*"]
|
48
|
+
.select { |f| File.directory? f }
|
49
|
+
.map { |d| d.sub(IMAGE_FOLDER,'') }
|
50
|
+
end
|
51
|
+
|
52
|
+
def command?(name)
|
53
|
+
`which #{name}`
|
54
|
+
$?.success?
|
55
|
+
end
|
56
|
+
|
57
|
+
def dependency_check
|
58
|
+
unless command?('convert')
|
59
|
+
error('You are missing the `imagemagic` library required for spriting')
|
60
|
+
hint("We're going to try and install the dependencies for sprite-factory now..")
|
61
|
+
|
62
|
+
if (/darwin/ =~ RUBY_PLATFORM) != nil
|
63
|
+
system('brew install imagemagick')
|
64
|
+
elsif (/linux/ =~ RUBY_PLATFORM) != nil
|
65
|
+
system('sudo apt-get install imagemagick-dev')
|
66
|
+
end
|
67
|
+
|
68
|
+
warn("Re-run the sprite rake task and cross your fingers")
|
69
|
+
|
70
|
+
return false
|
71
|
+
end
|
72
|
+
return true
|
73
|
+
end
|
74
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
task :sprite => :environment do
|
2
|
+
require 'sprite_factory'
|
3
|
+
require 'fileutils'
|
4
|
+
|
5
|
+
SpriteFactory.report = true
|
6
|
+
SpriteFactory.nocomments = true
|
7
|
+
SpriteFactory.pngcrush = true
|
8
|
+
SpriteFactory.layout = :packed
|
9
|
+
SpriteFactory.cssurl = "image-url('<%= asset_path '$IMAGE' %>')"
|
10
|
+
|
11
|
+
stylesheets = 'app/assets/stylesheets/sprites'
|
12
|
+
FileUtils.mkdir_p(stylesheets) unless File.directory?(stylesheets)
|
13
|
+
|
14
|
+
Dir['app/assets/images/sprite-*'].select {|f| File.directory? f}
|
15
|
+
.map {|d| d.sub('app/assets/images/','')}.each do |dir|
|
16
|
+
|
17
|
+
SpriteFactory.run!("app/assets/images/#{dir}",
|
18
|
+
style: 'scss',
|
19
|
+
output_style: "#{stylesheets}/#{dir}.css.scss.erb") do |images|
|
20
|
+
|
21
|
+
images.map do |name, data|
|
22
|
+
"@mixin sprite-#{name} {#{data[:style].gsub(/[\n]+/, ";")}}"
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
data/license.txt
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2014 Pete Brousalis http://github.com/brousalis/lemonlime/
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
metadata
ADDED
@@ -0,0 +1,64 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: lemonlime
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Pete Brousalis
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-02-19 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: sprite-factory
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 1.6.2
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 1.6.2
|
27
|
+
description: Gem for spriting mixins and outputting mixins. Built ontop of sprite-factory
|
28
|
+
email: brousapg@gmail.com
|
29
|
+
executables: []
|
30
|
+
extensions: []
|
31
|
+
extra_rdoc_files: []
|
32
|
+
files:
|
33
|
+
- Gemfile
|
34
|
+
- Gemfile.lock
|
35
|
+
- README.md
|
36
|
+
- lemonlime.gemspec
|
37
|
+
- lib/lemonlime.rb
|
38
|
+
- lib/lemonlime/lemonlime.rb
|
39
|
+
- lib/tasks/lemonlime.rake
|
40
|
+
- license.txt
|
41
|
+
homepage: http://github.com/brousalis/lemonlime/
|
42
|
+
licenses: []
|
43
|
+
metadata: {}
|
44
|
+
post_install_message:
|
45
|
+
rdoc_options: []
|
46
|
+
require_paths:
|
47
|
+
- lib
|
48
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
49
|
+
requirements:
|
50
|
+
- - ">="
|
51
|
+
- !ruby/object:Gem::Version
|
52
|
+
version: '0'
|
53
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
54
|
+
requirements:
|
55
|
+
- - ">="
|
56
|
+
- !ruby/object:Gem::Version
|
57
|
+
version: '0'
|
58
|
+
requirements: []
|
59
|
+
rubyforge_project:
|
60
|
+
rubygems_version: 2.4.2
|
61
|
+
signing_key:
|
62
|
+
specification_version: 4
|
63
|
+
summary: Gem for spriting images and outputting mixins
|
64
|
+
test_files: []
|