favicon-ruby 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: d5db5d4cde3f3c229fb62918f0fcf1a953353cce
4
+ data.tar.gz: bceebac2bafab41aabe2af2e51a187d64df50594
5
+ SHA512:
6
+ metadata.gz: 6cfa612c66fa02c6fc5d1c34d8ee407d3135a62aaf703ca349e6aea080ba8bd8c889e0c5ceb3ca2f7ea3003a00575172f5339667c4b6b6613daeb2e71771394c
7
+ data.tar.gz: 2e76db4cd3e27ad4dfd47b59a0c7e4a1b1b370f51006f1ab541a87301b0a2dceaafc108a4019e39e83c1b877bc9ed493b1191d563b7abadcf33fef6c0a8527ca
data/.autotest ADDED
@@ -0,0 +1,25 @@
1
+ # -*- ruby -*-
2
+
3
+ require "autotest/restart"
4
+
5
+ # Autotest.add_hook :initialize do |at|
6
+ # at.testlib = "minitest/unit"
7
+ #
8
+ # at.extra_files << "../some/external/dependency.rb"
9
+ #
10
+ # at.libs << ":../some/external"
11
+ #
12
+ # at.add_exception "vendor"
13
+ #
14
+ # at.add_mapping(/dependency.rb/) do |f, _|
15
+ # at.files_matching(/test_.*rb$/)
16
+ # end
17
+ #
18
+ # %w(TestA TestB).each do |klass|
19
+ # at.extra_class_map[klass] = "test/test_misc.rb"
20
+ # end
21
+ # end
22
+
23
+ # Autotest.add_hook :run_command do |at|
24
+ # system "rake build"
25
+ # end
data/.gitignore ADDED
@@ -0,0 +1,54 @@
1
+ *.gem
2
+ *.rbc
3
+ /.config
4
+ /coverage/
5
+ /InstalledFiles
6
+ /pkg/
7
+ /spec/reports/
8
+ /spec/examples.txt
9
+ /test/tmp/
10
+ /test/version_tmp/
11
+ /tmp/
12
+
13
+ # Used by dotenv library to load environment variables.
14
+ # .env
15
+
16
+ ## Specific to RubyMotion:
17
+ .dat*
18
+ .repl_history
19
+ build/
20
+ *.bridgesupport
21
+ build-iPhoneOS/
22
+ build-iPhoneSimulator/
23
+
24
+ ## Specific to RubyMotion (use of CocoaPods):
25
+ #
26
+ # We recommend against adding the Pods directory to your .gitignore. However
27
+ # you should judge for yourself, the pros and cons are mentioned at:
28
+ # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
29
+ #
30
+ # vendor/Pods/
31
+
32
+ ## Documentation cache and generated files:
33
+ /.yardoc/
34
+ /_yardoc/
35
+ /doc/
36
+ /rdoc/
37
+
38
+ ## Environment normalization:
39
+ /.bundle/
40
+ /vendor/bundle
41
+ /lib/bundler/man/
42
+
43
+ # for a library or gem, you might want to ignore these files since the code is
44
+ # intended to run in multiple environments; otherwise, check them in:
45
+ # Gemfile.lock
46
+ # .ruby-version
47
+ # .ruby-gemset
48
+
49
+ # unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
50
+ .rvmrc
51
+
52
+ .DS_Store
53
+ *.swp
54
+ *.swo
data/.hoeignore ADDED
@@ -0,0 +1,15 @@
1
+ test/*
2
+ bin/*
3
+ .git/*
4
+
5
+ *.swp
6
+ .*.swp
7
+ **/*.swp
8
+ **/.*.swp
9
+ *.sw?
10
+ .*.sw?
11
+ **/*.sw?
12
+ **/.*.sw?
13
+
14
+ .DS_Store
15
+ **/.DS_Store
data/Gemfile ADDED
@@ -0,0 +1,19 @@
1
+ # -*- ruby -*-
2
+
3
+ # DO NOT EDIT THIS FILE. Instead, edit Rakefile, and run `rake bundler:gemfile`.
4
+
5
+ source "https://rubygems.org/"
6
+
7
+ gem "ico", "0.1.1"
8
+
9
+ gem "minitest", "~>5.10", :group => [:development, :test]
10
+ gem "hoe-yard", ">=0.1.3", :group => [:development, :test]
11
+ gem "hoe-ignore", "~>1.0", :group => [:development, :test]
12
+ gem "hoe-bundler", "~>1.2", :group => [:development, :test]
13
+ gem "hoe-gemspec", "~>1.0", :group => [:development, :test]
14
+ gem "hoe-git", "~>1.6", :group => [:development, :test]
15
+ gem "yard", "~>0.8", :group => [:development, :test]
16
+ gem "redcarpet", "~>3.3", :group => [:development, :test]
17
+ gem "hoe", "~>3.16", :group => [:development, :test]
18
+
19
+ # vim: syntax=ruby
data/History.txt ADDED
@@ -0,0 +1,6 @@
1
+ === 0.0.1 / 2017-04-02
2
+
3
+ * It's alive!
4
+
5
+ * Bornday!
6
+
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2017 Bordee Inc.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ 'Software'), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
19
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
20
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
21
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
22
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/Manifest.txt ADDED
@@ -0,0 +1,11 @@
1
+ .autotest
2
+ .gitignore
3
+ .hoeignore
4
+ Gemfile
5
+ History.txt
6
+ LICENSE
7
+ Manifest.txt
8
+ README.md
9
+ Rakefile
10
+ lib/favicon.rb
11
+ lib/favicon/version.rb
data/README.md ADDED
@@ -0,0 +1,126 @@
1
+ # Favicon
2
+
3
+ favicon.ico generator in Ruby without imagemagick
4
+
5
+ ## Usage
6
+
7
+ ```
8
+ #
9
+ # PNG to favicon.ico standard sizes for 2017
10
+ #
11
+ # https://github.com/audreyr/favicon-cheat-sheet#ico-file
12
+ # SIZES_ARRAY = [16, 24, 32, 48, 64]
13
+ #
14
+ # @param input_filename [String] "/path/to/example.png"
15
+ # @param output_filename [String] "/path/to/favicon.ico"
16
+ # @param sizes_array [Array<Array<Int,Int>>, Array<Int>]
17
+ # rectangles use Array with XY: `[x,y]`
18
+ # squares use single Integer `N`
19
+ # mixed indices is valid
20
+ # example: `[24, [24,24], [480,270], 888] # a[0] => 24x24; a[1] => 24x24; a[2] => 480x270; a[3] => 888x888`
21
+ # @return [String] filename of generated ico
22
+ #
23
+ #def png_to_favicon(input_filename, output_filename, sizes_array=SIZES_ARRAY)
24
+ # ...
25
+
26
+ require 'favicon'
27
+
28
+ input_filename = "/path/to/example.png"
29
+ output_filename = "/path/to/favicon.ico"
30
+
31
+ # standard sizes
32
+ Favicon.png_to_ico(input_filename, output_filename)
33
+
34
+ # custom sizes
35
+ Favicon.png_to_ico(input_filename, output_filename, [16,92,256])
36
+
37
+ ```
38
+
39
+ ## Installation
40
+
41
+ Command Line
42
+
43
+ ```
44
+ gem install favicon-ruby
45
+ ```
46
+
47
+ Gemfile
48
+
49
+ ```
50
+ gem "favicon-ruby", "~>0.1"
51
+ ```
52
+
53
+ ## Development
54
+
55
+ (soon)
56
+
57
+ ### Dev Requirements
58
+
59
+ * [hoe](https://github.com/seattlerb/hoe) gem manager
60
+ * [hoe-bundler] may need `gem install hoe-bundler` installation before using `rake bundler:gemfile`
61
+ * [YARD](http://yardoc.org) docs
62
+ * [redcarpet](https://github.com/vmg/redcarpet) for yardoc
63
+
64
+ [hoe-bundler]: https://github.com/flavorjones/hoe-bundler
65
+
66
+ ### Testing
67
+
68
+ Tests written with [minitest]
69
+
70
+ ```
71
+ rake test
72
+ ```
73
+
74
+ [minitest]: https://github.com/seattlerb/minitest
75
+
76
+ ### Contributing
77
+
78
+ Send tested code.
79
+ Thank you, [contributors]!
80
+
81
+ [contributors]: https://github.com/bordeeinc/favicon-ruby/graphs/contributors
82
+
83
+ ### To Do
84
+
85
+ * (soon)
86
+
87
+ ## License
88
+
89
+ MIT License
90
+
91
+ Copyright (c) 2017 Bordee Inc.
92
+
93
+ Permission is hereby granted, free of charge, to any person obtaining
94
+ a copy of this software and associated documentation files (the
95
+ 'Software'), to deal in the Software without restriction, including
96
+ without limitation the rights to use, copy, modify, merge, publish,
97
+ distribute, sublicense, and/or sell copies of the Software, and to
98
+ permit persons to whom the Software is furnished to do so, subject to
99
+ the following conditions:
100
+
101
+ The above copyright notice and this permission notice shall be
102
+ included in all copies or substantial portions of the Software.
103
+
104
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
105
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
106
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
107
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
108
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
109
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
110
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
111
+
112
+ ## About
113
+
114
+ ![bordee](http://bordee.com/src/img/surf-with-bordee-github.png)
115
+
116
+ favicon-ruby is maintained and funded by Bordee Inc.
117
+ The names and logos for Bordee are trademarks of [Bordee Inc.][bordeeinc]
118
+
119
+ [bordeeinc]: http://bordee.com
120
+
121
+ We love open source software!
122
+ See [our other projects][bordee-github]
123
+ and [check out Seattle.rb!][community]
124
+
125
+ [bordee-github]: https://github.com/bordeeinc
126
+ [community]: https://seattlerb.org
data/Rakefile ADDED
@@ -0,0 +1,61 @@
1
+ # -*- ruby -*-
2
+
3
+ require "rubygems"
4
+ require "hoe"
5
+ require './lib/favicon/version.rb'
6
+
7
+ Hoe.plugin :gemspec
8
+ Hoe.plugin :minitest
9
+ Hoe.plugin :yard
10
+ Hoe.plugin :bundler
11
+ Hoe.plugin :git
12
+ Hoe.plugin :ignore
13
+
14
+ Hoe.spec "favicon" do
15
+ developer("So Awesome Man", "callme@1800aweso.me")
16
+
17
+ license "MIT" # this matches the license in the README
18
+
19
+ self.email = 'support@bordee.com'
20
+
21
+ self.name = 'favicon-ruby'
22
+ self.version = Favicon::VERSION
23
+ self.summary = 'favicon.ico generator in Ruby without imagemagick'
24
+ self.description = self.summary
25
+ self.urls = ['https://github.com/bordeeinc/favicon-ruby']
26
+ self.testlib = :minitest
27
+ self.readme_file = 'README.md'
28
+ self.history_file = 'History.txt'
29
+
30
+ # third-party
31
+ self.yard_title = self.name
32
+ self.yard_markup = 'markdown'
33
+
34
+ self.extra_deps += [
35
+ ['ico', '0.1.1']
36
+ ]
37
+
38
+ self.extra_dev_deps += [
39
+ ["hoe-yard", "~> 0.1"],
40
+ ["hoe-ignore", "~> 1.0"],
41
+ ["hoe-bundler", "~> 1.2"],
42
+ ["hoe-gemspec", "~> 1.0"],
43
+ ["hoe-git", "~> 1.6"],
44
+ ["minitest", "~> 5.9"],
45
+ ["yard", "~> 0.8"],
46
+ ["redcarpet", "~> 3.3"] # yard/markdown
47
+ ]
48
+
49
+ self.clean_globs += [
50
+ '.yardoc',
51
+ 'vendor',
52
+ 'Gemfile.lock',
53
+ '.bundle',
54
+ ]
55
+
56
+ self.spec_extras = {
57
+ :required_ruby_version => '>= 1.9.2'
58
+ }
59
+ end
60
+
61
+ # vim: syntax=ruby
data/lib/favicon.rb ADDED
@@ -0,0 +1,36 @@
1
+ require 'core_ext/array/extract_options.rb' unless Array.method_defined?(:extract_options!)
2
+ require 'ico'
3
+ require 'favicon/version'
4
+
5
+ module Favicon
6
+ # https://github.com/audreyr/favicon-cheat-sheet#ico-file
7
+ SIZES_ARRAY = [16, 24, 32, 48, 64]
8
+
9
+ # make all methods class-methods
10
+ extend self
11
+
12
+ # PNG to favicon.ico in supplied sizes
13
+ #
14
+ # @param input_filename [String] "/path/to/example.png"
15
+ # @param output_filename [String] "/path/to/favicon.ico"
16
+ # @param sizes_array [Array<Array<Int,Int>>, Array<Int>]
17
+ # rectangles use Array with XY: `[x,y]`
18
+ # squares use single Integer `N`
19
+ # mixed indices is valid
20
+ # example: `[24, [24,24], [480,270], 888] # a[0] => 24x24; a[1] => 24x24; a[2] => 480x270; a[3] => 888x888`
21
+ # @return [String] filename of generated ico
22
+ #
23
+ def png_to_favicon(input_filename, output_filename, sizes_array=SIZES_ARRAY)
24
+ dir = Dir.mktmpdir
25
+
26
+ begin
27
+ output_dir = ICO::Utils.png_to_sizes(input_filename, sizes_array, dir)
28
+
29
+ filename_array = Dir.glob(File.join(output_dir, '**/*'))
30
+
31
+ ICO.png_to_ico(filename_array, output_filename)
32
+ ensure
33
+ FileUtils.remove_entry dir
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,3 @@
1
+ module Favicon
2
+ VERSION = '0.1.0'
3
+ end
metadata ADDED
@@ -0,0 +1,202 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: favicon-ruby
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - So Awesome Man
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2017-04-02 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: ico
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - '='
18
+ - !ruby/object:Gem::Version
19
+ version: 0.1.1
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - '='
25
+ - !ruby/object:Gem::Version
26
+ version: 0.1.1
27
+ - !ruby/object:Gem::Dependency
28
+ name: minitest
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '5.10'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '5.10'
41
+ - !ruby/object:Gem::Dependency
42
+ name: hoe-yard
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: 0.1.3
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: 0.1.3
55
+ - !ruby/object:Gem::Dependency
56
+ name: hoe-ignore
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '1.0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '1.0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: hoe-bundler
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '1.2'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '1.2'
83
+ - !ruby/object:Gem::Dependency
84
+ name: hoe-gemspec
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '1.0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '1.0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: hoe-git
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: '1.6'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: '1.6'
111
+ - !ruby/object:Gem::Dependency
112
+ name: yard
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - "~>"
116
+ - !ruby/object:Gem::Version
117
+ version: '0.8'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - "~>"
123
+ - !ruby/object:Gem::Version
124
+ version: '0.8'
125
+ - !ruby/object:Gem::Dependency
126
+ name: redcarpet
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - "~>"
130
+ - !ruby/object:Gem::Version
131
+ version: '3.3'
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - "~>"
137
+ - !ruby/object:Gem::Version
138
+ version: '3.3'
139
+ - !ruby/object:Gem::Dependency
140
+ name: hoe
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - "~>"
144
+ - !ruby/object:Gem::Version
145
+ version: '3.16'
146
+ type: :development
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - "~>"
151
+ - !ruby/object:Gem::Version
152
+ version: '3.16'
153
+ description: favicon.ico generator in Ruby without imagemagick
154
+ email: support@bordee.com
155
+ executables: []
156
+ extensions: []
157
+ extra_rdoc_files:
158
+ - History.txt
159
+ - Manifest.txt
160
+ - README.md
161
+ files:
162
+ - ".autotest"
163
+ - ".gitignore"
164
+ - ".hoeignore"
165
+ - Gemfile
166
+ - History.txt
167
+ - LICENSE
168
+ - Manifest.txt
169
+ - README.md
170
+ - Rakefile
171
+ - lib/favicon.rb
172
+ - lib/favicon/version.rb
173
+ homepage: https://github.com/bordeeinc/favicon-ruby
174
+ licenses:
175
+ - MIT
176
+ metadata: {}
177
+ post_install_message:
178
+ rdoc_options:
179
+ - "--title"
180
+ - favicon-ruby
181
+ - "--markup"
182
+ - markdown
183
+ - "--quiet"
184
+ require_paths:
185
+ - lib
186
+ required_ruby_version: !ruby/object:Gem::Requirement
187
+ requirements:
188
+ - - ">="
189
+ - !ruby/object:Gem::Version
190
+ version: 1.9.2
191
+ required_rubygems_version: !ruby/object:Gem::Requirement
192
+ requirements:
193
+ - - ">="
194
+ - !ruby/object:Gem::Version
195
+ version: '0'
196
+ requirements: []
197
+ rubyforge_project:
198
+ rubygems_version: 2.2.5
199
+ signing_key:
200
+ specification_version: 4
201
+ summary: favicon.ico generator in Ruby without imagemagick
202
+ test_files: []