beerdb-labels 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/History.md +3 -0
- data/Manifest.txt +7 -0
- data/README.md +23 -0
- data/Rakefile +87 -0
- data/lib/beerdb/labels.rb +15 -0
- data/lib/beerdb/labels/engine.rb +15 -0
- data/lib/beerdb/labels/version.rb +6 -0
- metadata +80 -0
data/History.md
ADDED
data/Manifest.txt
ADDED
data/README.md
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
# beer.db.labels
|
2
|
+
|
3
|
+
beerdb-labels gem - beer labels (24x24, 32x32, 48x48, 64x64) bundled for reuse w/ asset pipeline
|
4
|
+
|
5
|
+
* home :: [github.com/geraldb/beer.db.labels](https://github.com/geraldb/beer.db.labels)
|
6
|
+
* bugs :: [github.com/geraldb/beer.db.labels/issues](https://github.com/geraldb/beer.db.labels/issues)
|
7
|
+
* gem :: [rubygems.org/gems/beerdb-labels](https://rubygems.org/gems/beerdb-labels)
|
8
|
+
* forum :: [groups.google.com/group/beerdb](https://groups.google.com/group/beerdb)
|
9
|
+
|
10
|
+
## Usage
|
11
|
+
|
12
|
+
TBD
|
13
|
+
|
14
|
+
|
15
|
+
|
16
|
+
## Dev Notes
|
17
|
+
|
18
|
+
Use
|
19
|
+
|
20
|
+
$ rake debug_gem > beerdb-labels.gemspec
|
21
|
+
|
22
|
+
to update (auto-generate) gemspec.
|
23
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1,87 @@
|
|
1
|
+
|
2
|
+
require 'hoe'
|
3
|
+
require './lib/beerdb/labels/version.rb'
|
4
|
+
|
5
|
+
|
6
|
+
Hoe.spec 'beerdb-labels' do
|
7
|
+
|
8
|
+
self.version = BeerDb::Labels::VERSION
|
9
|
+
|
10
|
+
self.summary = 'beerdb-labels gem - beer labels (24x24, 32x32, 48x48, 64x64) bundled for reuse w/ asset pipeline'
|
11
|
+
self.description = summary
|
12
|
+
|
13
|
+
self.urls = ['https://github.com/geraldb/beer.db.labels']
|
14
|
+
|
15
|
+
self.author = 'Gerald Bauer'
|
16
|
+
self.email = 'beerdb@googlegroups.com'
|
17
|
+
|
18
|
+
self.readme_file = 'README.md'
|
19
|
+
self.history_file = 'History.md'
|
20
|
+
|
21
|
+
end
|
22
|
+
|
23
|
+
|
24
|
+
################################
|
25
|
+
#
|
26
|
+
|
27
|
+
|
28
|
+
# ls *.jpg | xargs -r -I FILE convert FILE -thumbnail 64x64 FILE_thumb.png
|
29
|
+
|
30
|
+
BEER_LABEL_SIZES = [24,32,48,64] # e.g. 24x24, 32x32, etc.
|
31
|
+
BEER_LABEL_INPUT_DIR = 'originals'
|
32
|
+
BEER_LABEL_OUTPUT_DIR = 'vendor/assets/images/labels'
|
33
|
+
|
34
|
+
|
35
|
+
|
36
|
+
desc 'beerdb-labels - build thumbs'
|
37
|
+
task :build_thumbs do
|
38
|
+
|
39
|
+
files = Dir[ "#{BEER_LABEL_INPUT_DIR}/*.jpg" ]
|
40
|
+
|
41
|
+
files.each do |filename|
|
42
|
+
basename = File.basename( filename, '.jpg' )
|
43
|
+
|
44
|
+
puts "filename: #{filename}, basename: #{basename}"
|
45
|
+
|
46
|
+
BEER_LABEL_SIZES.each do |size|
|
47
|
+
# e.g. convert #{filename} -thumbnail 48x48 vendor/assets/images/labels/48x48/#{basename}.png"
|
48
|
+
cmd = "convert #{filename} -thumbnail #{size}x#{size} #{BEER_LABEL_OUTPUT_DIR}/#{size}x#{size}/#{basename}.png"
|
49
|
+
puts " #{cmd}"
|
50
|
+
system( cmd )
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
## todo: generate lookup list of all available labels (lets us check if label exists)
|
55
|
+
puts 'Done.'
|
56
|
+
end
|
57
|
+
|
58
|
+
|
59
|
+
desc 'beerdb-labels - build manifest'
|
60
|
+
task :build_manifest do
|
61
|
+
|
62
|
+
txt = File.read( 'Manifest.txt.tpl' )
|
63
|
+
|
64
|
+
## append all thumbnails (24x24,32x32,48x48,64x64)
|
65
|
+
|
66
|
+
files = Dir[ "#{BEER_LABEL_INPUT_DIR}/*.jpg" ]
|
67
|
+
files.sort!
|
68
|
+
|
69
|
+
BEER_LABEL_SIZES.each do |size|
|
70
|
+
files.each do |filename|
|
71
|
+
basename = File.basename( filename, '.jpg' )
|
72
|
+
|
73
|
+
# puts "filename: #{filename}, basename: #{basename}"
|
74
|
+
txt << "#{BEER_LABEL_OUTPUT_DIR}/#{size}x#{size}/#{basename}.png\n"
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
File.open( 'Manifest.txt', 'w') do |file|
|
79
|
+
file.write( txt )
|
80
|
+
end
|
81
|
+
|
82
|
+
puts 'Done.'
|
83
|
+
end
|
84
|
+
|
85
|
+
|
86
|
+
desc 'beerdb-labels - build thumbnails from originals'
|
87
|
+
task :build => [:build_thumbs, :build_manifest]
|
@@ -0,0 +1,15 @@
|
|
1
|
+
|
2
|
+
require 'beerdb/labels/version'
|
3
|
+
|
4
|
+
module BeerDb::Labels
|
5
|
+
|
6
|
+
def self.banner
|
7
|
+
"beerdb-labels #{VERSION} on Ruby #{RUBY_VERSION} (#{RUBY_RELEASE_DATE}) [#{RUBY_PLATFORM}]"
|
8
|
+
end
|
9
|
+
|
10
|
+
end # module BeerDb::Labels
|
11
|
+
|
12
|
+
require 'beerdb/labels/engine'
|
13
|
+
|
14
|
+
## say hello
|
15
|
+
puts BeerDb::Labels.banner
|
@@ -0,0 +1,15 @@
|
|
1
|
+
|
2
|
+
module BeerDb::Labels
|
3
|
+
|
4
|
+
class Engine < Rails::Engine
|
5
|
+
# NB: get rails to add app/assets, lib/assets and vendor/assets
|
6
|
+
# to the search path of Sprockets (asset pipeline)
|
7
|
+
#
|
8
|
+
# see Gemify Assets for Rails
|
9
|
+
# - http://prioritized.net/blog/gemify-assets-for-rails
|
10
|
+
# or
|
11
|
+
# Adding Assets to Your Gems (Asset Pipeline Guide)
|
12
|
+
# - http://guides.rubyonrails.org/asset_pipeline.html#adding-assets-to-your-gems
|
13
|
+
end
|
14
|
+
|
15
|
+
end # module BeerDb::Labels
|
metadata
ADDED
@@ -0,0 +1,80 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: beerdb-labels
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Gerald Bauer
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2013-08-10 00:00:00.000000000Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: rdoc
|
16
|
+
requirement: &18450252 !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ~>
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '4.0'
|
22
|
+
type: :development
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: *18450252
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: hoe
|
27
|
+
requirement: &18449712 !ruby/object:Gem::Requirement
|
28
|
+
none: false
|
29
|
+
requirements:
|
30
|
+
- - ~>
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '3.6'
|
33
|
+
type: :development
|
34
|
+
prerelease: false
|
35
|
+
version_requirements: *18449712
|
36
|
+
description: beerdb-labels gem - beer labels (24x24, 32x32, 48x48, 64x64) bundled
|
37
|
+
for reuse w/ asset pipeline
|
38
|
+
email: beerdb@googlegroups.com
|
39
|
+
executables: []
|
40
|
+
extensions: []
|
41
|
+
extra_rdoc_files:
|
42
|
+
- History.md
|
43
|
+
- Manifest.txt
|
44
|
+
- README.md
|
45
|
+
files:
|
46
|
+
- History.md
|
47
|
+
- Manifest.txt
|
48
|
+
- README.md
|
49
|
+
- Rakefile
|
50
|
+
- lib/beerdb/labels.rb
|
51
|
+
- lib/beerdb/labels/engine.rb
|
52
|
+
- lib/beerdb/labels/version.rb
|
53
|
+
homepage: https://github.com/geraldb/beer.db.labels
|
54
|
+
licenses: []
|
55
|
+
post_install_message:
|
56
|
+
rdoc_options:
|
57
|
+
- --main
|
58
|
+
- README.md
|
59
|
+
require_paths:
|
60
|
+
- lib
|
61
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
62
|
+
none: false
|
63
|
+
requirements:
|
64
|
+
- - ! '>='
|
65
|
+
- !ruby/object:Gem::Version
|
66
|
+
version: '0'
|
67
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
68
|
+
none: false
|
69
|
+
requirements:
|
70
|
+
- - ! '>='
|
71
|
+
- !ruby/object:Gem::Version
|
72
|
+
version: '0'
|
73
|
+
requirements: []
|
74
|
+
rubyforge_project: beerdb-labels
|
75
|
+
rubygems_version: 1.7.2
|
76
|
+
signing_key:
|
77
|
+
specification_version: 3
|
78
|
+
summary: beerdb-labels gem - beer labels (24x24, 32x32, 48x48, 64x64) bundled for
|
79
|
+
reuse w/ asset pipeline
|
80
|
+
test_files: []
|