sportdb-logos 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 +24 -0
- data/Rakefile +98 -0
- data/lib/sportdb/logos.rb +14 -0
- data/lib/sportdb/logos/engine.rb +14 -0
- data/lib/sportdb/logos/version.rb +5 -0
- metadata +80 -0
data/History.md
ADDED
data/Manifest.txt
ADDED
data/README.md
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
# sport.db.logos
|
2
|
+
|
3
|
+
sportdb-logos gem - sport team logos bundled for reuse w/ asset pipeline
|
4
|
+
|
5
|
+
* home :: [github.com/geraldb/sport.db.logos](https://github.com/geraldb/sport.db.logos)
|
6
|
+
* bugs :: [github.com/geraldb/sport.db.logos/issues](https://github.com/geraldb/sport.db.logos/issues)
|
7
|
+
* gem :: [rubygems.org/gems/sportdb-logos](https://rubygems.org/gems/sportdb-logos)
|
8
|
+
* forum :: [groups.google.com/group/opensport](https://groups.google.com/group/opensport)
|
9
|
+
|
10
|
+
## Usage
|
11
|
+
|
12
|
+
TBD
|
13
|
+
|
14
|
+
|
15
|
+
|
16
|
+
|
17
|
+
## Dev Notes
|
18
|
+
|
19
|
+
Use
|
20
|
+
|
21
|
+
$ rake debug_gem > sportdb-logos.gemspec
|
22
|
+
|
23
|
+
to update (auto-generate) gemspec.
|
24
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1,98 @@
|
|
1
|
+
require 'hoe'
|
2
|
+
require './lib/sportdb/logos/version.rb'
|
3
|
+
|
4
|
+
|
5
|
+
Hoe.spec 'sportdb-logos' do
|
6
|
+
|
7
|
+
self.version = SportDb::Logos::VERSION
|
8
|
+
|
9
|
+
self.summary = 'sportdb-logos gem - sports team logos (24x24, 32x32, 48x48, 64x64) bundled for reuse w/ asset pipeline'
|
10
|
+
self.description = summary
|
11
|
+
|
12
|
+
self.urls = ['https://github.com/geraldb/sport.db.logos']
|
13
|
+
|
14
|
+
self.author = 'Gerald Bauer'
|
15
|
+
self.email = 'opensport@googlegroups.com'
|
16
|
+
|
17
|
+
self.readme_file = 'README.md'
|
18
|
+
self.history_file = 'History.md'
|
19
|
+
|
20
|
+
end
|
21
|
+
|
22
|
+
|
23
|
+
################################
|
24
|
+
#
|
25
|
+
|
26
|
+
|
27
|
+
# ls *.jpg | xargs -r -I FILE convert FILE -thumbnail 64x64 FILE_thumb.png
|
28
|
+
|
29
|
+
LOGO_SIZES = [24,32,48,64] # e.g. 24x24, 32x32, etc.
|
30
|
+
LOGO_INPUT_DIR = 'originals'
|
31
|
+
LOGO_OUTPUT_DIR = 'vendor/assets/images/logos'
|
32
|
+
|
33
|
+
|
34
|
+
desc 'sportdb-logos - build thumbs'
|
35
|
+
task :build_thumbs do
|
36
|
+
|
37
|
+
files = Dir[ "#{LOGO_INPUT_DIR}/**/*.{png,gif,jpg}" ]
|
38
|
+
|
39
|
+
files.each do |filename|
|
40
|
+
extname = File.extname( filename )
|
41
|
+
basename = File.basename( filename, extname ) # NB: remove extname (that is, suffix e.g. .png,.jpg,.gif etc.)
|
42
|
+
|
43
|
+
puts "filename: #{filename}, basename: #{basename}, extname: #{extname}"
|
44
|
+
|
45
|
+
LOGO_SIZES.each do |size|
|
46
|
+
|
47
|
+
## make sure outputdir exits
|
48
|
+
FileUtils.mkpath( "#{LOGO_OUTPUT_DIR}/#{size}x#{size}" ) unless File.exists?( "#{LOGO_OUTPUT_DIR}/#{size}x#{size}" )
|
49
|
+
|
50
|
+
# e.g. convert #{filename} -thumbnail 48x48 vendor/assets/images/labels/48x48/#{basename}.png"
|
51
|
+
cmd = "convert #{filename} -thumbnail #{size}x#{size} #{LOGO_OUTPUT_DIR}/#{size}x#{size}/#{basename}.png"
|
52
|
+
puts " #{cmd}"
|
53
|
+
system( cmd )
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
## todo: generate lookup list of all available labels (lets us check if label exists)
|
58
|
+
puts 'Done.'
|
59
|
+
end
|
60
|
+
|
61
|
+
|
62
|
+
desc 'sportdb-logos - build manifest'
|
63
|
+
task :build_manifest do
|
64
|
+
|
65
|
+
txt = File.read( 'Manifest.txt.tpl' )
|
66
|
+
|
67
|
+
## append all thumbnails (24x24,32x32,48x48,64x64)
|
68
|
+
|
69
|
+
files = Dir[ "#{LOGO_INPUT_DIR}/**/*.{png,gif,jpg}" ]
|
70
|
+
files = files.map do |filename|
|
71
|
+
# strip folders
|
72
|
+
# force extension to .png
|
73
|
+
|
74
|
+
extname = File.extname( filename )
|
75
|
+
basename = File.basename( filename, extname ) # NB: remove extname (that is, suffix e.g. .png,.jpg,.gif etc.)
|
76
|
+
|
77
|
+
puts "filename: #{filename}, basename: #{basename}, extname: #{extname}"
|
78
|
+
"#{basename}.png"
|
79
|
+
end
|
80
|
+
files.sort!
|
81
|
+
|
82
|
+
LOGO_SIZES.each do |size|
|
83
|
+
files.each do |filename|
|
84
|
+
txt << "#{LOGO_OUTPUT_DIR}/#{size}x#{size}/#{filename}\n"
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
88
|
+
File.open( 'Manifest.txt', 'w') do |file|
|
89
|
+
file.write( txt )
|
90
|
+
end
|
91
|
+
|
92
|
+
puts 'Done.'
|
93
|
+
end
|
94
|
+
|
95
|
+
|
96
|
+
|
97
|
+
desc 'sportdb-logos - build thumbnails from originals'
|
98
|
+
task :build => [:build_thumbs, :build_manifest]
|
@@ -0,0 +1,14 @@
|
|
1
|
+
require 'sportdb/logos/version'
|
2
|
+
|
3
|
+
module SportDb::Logos
|
4
|
+
|
5
|
+
def self.banner
|
6
|
+
"sportdb-logos #{VERSION} on Ruby #{RUBY_VERSION} (#{RUBY_RELEASE_DATE}) [#{RUBY_PLATFORM}]"
|
7
|
+
end
|
8
|
+
|
9
|
+
end # module SportDb::Logos
|
10
|
+
|
11
|
+
require 'sportdb/logos/engine'
|
12
|
+
|
13
|
+
## say hello
|
14
|
+
puts SportDb::Logos.banner
|
@@ -0,0 +1,14 @@
|
|
1
|
+
module SportDb::Logos
|
2
|
+
|
3
|
+
class Engine < Rails::Engine
|
4
|
+
# NB: get rails to add app/assets, lib/assets and vendor/assets
|
5
|
+
# to the search path of Sprockets (asset pipeline)
|
6
|
+
#
|
7
|
+
# see Gemify Assets for Rails
|
8
|
+
# - http://prioritized.net/blog/gemify-assets-for-rails
|
9
|
+
# or
|
10
|
+
# Adding Assets to Your Gems (Asset Pipeline Guide)
|
11
|
+
# - http://guides.rubyonrails.org/asset_pipeline.html#adding-assets-to-your-gems
|
12
|
+
end
|
13
|
+
|
14
|
+
end # module SportDb::Logos
|
metadata
ADDED
@@ -0,0 +1,80 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: sportdb-logos
|
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: &18766356 !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: *18766356
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: hoe
|
27
|
+
requirement: &18765996 !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: *18765996
|
36
|
+
description: sportdb-logos gem - sports team logos (24x24, 32x32, 48x48, 64x64) bundled
|
37
|
+
for reuse w/ asset pipeline
|
38
|
+
email: opensport@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/sportdb/logos.rb
|
51
|
+
- lib/sportdb/logos/engine.rb
|
52
|
+
- lib/sportdb/logos/version.rb
|
53
|
+
homepage: https://github.com/geraldb/sport.db.logos
|
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: sportdb-logos
|
75
|
+
rubygems_version: 1.7.2
|
76
|
+
signing_key:
|
77
|
+
specification_version: 3
|
78
|
+
summary: sportdb-logos gem - sports team logos (24x24, 32x32, 48x48, 64x64) bundled
|
79
|
+
for reuse w/ asset pipeline
|
80
|
+
test_files: []
|