favidenticon 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +17 -0
- data/.rspec +2 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +50 -0
- data/Rakefile +1 -0
- data/bin/favidenticon +5 -0
- data/favidenticon.gemspec +29 -0
- data/lib/favidenticon.rb +25 -0
- data/lib/favidenticon/cli.rb +24 -0
- data/lib/favidenticon/version.rb +3 -0
- data/spec/spec_helper.rb +23 -0
- metadata +156 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: bf7390b6cf66ac4e75c1706c694532b2923d78cd
|
4
|
+
data.tar.gz: 2f4323ae081a166f15ad2264e5c96bdf255394c1
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: db99afb79ecfaf483be61f48f95793322039fd25bcf99d6f2224b36f9afad18651bd373d924932009e8e696843520f1fd2da38d2ad1b0d905465ac09b4db3beb
|
7
|
+
data.tar.gz: 93ad94aac0c1c5e7e10f45b077bc1984c16f5a9753f85ecf38f0e179d5fafa1b636ffaa6a099105a5ed23f185211de5bd3830f687df13f38fd5ca2b921d3dddc
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2013 fukayatsu
|
2
|
+
|
3
|
+
MIT License
|
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
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,50 @@
|
|
1
|
+
# Favidenticon
|
2
|
+
|
3
|
+
favicon.ico generator
|
4
|
+
|
5
|
+
![](https://raw.github.com/fukayatsu/favidenticon/master/screenshots/5_2.png)
|
6
|
+
|
7
|
+
## Requirements
|
8
|
+
|
9
|
+
ImageMagick
|
10
|
+
|
11
|
+
## Installation
|
12
|
+
|
13
|
+
Add this line to your application's Gemfile:
|
14
|
+
|
15
|
+
gem 'favidenticon'
|
16
|
+
|
17
|
+
And then execute:
|
18
|
+
|
19
|
+
$ bundle
|
20
|
+
|
21
|
+
Or install it yourself as:
|
22
|
+
|
23
|
+
$ gem install favidenticon
|
24
|
+
|
25
|
+
## Usage
|
26
|
+
|
27
|
+
```
|
28
|
+
$ favidenticon
|
29
|
+
#=> show usage
|
30
|
+
|
31
|
+
$ favidenticon generate
|
32
|
+
#=> generate favicon.ico (16x16)
|
33
|
+
|
34
|
+
$ favidenticon g 'foo bar baz'
|
35
|
+
#=> generate favicon.ico from given string
|
36
|
+
|
37
|
+
$ favidenticon g --size=48
|
38
|
+
#=> generate favicon.ico (48x48)
|
39
|
+
|
40
|
+
$ favidenticon g --grid=5
|
41
|
+
#=> generate favicon.ico which has 5 grids
|
42
|
+
```
|
43
|
+
|
44
|
+
## Contributing
|
45
|
+
|
46
|
+
1. Fork it ( http://github.com/<my-github-username>/favidenticon/fork )
|
47
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
48
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
49
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
50
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
data/bin/favidenticon
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'favidenticon/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "favidenticon"
|
8
|
+
spec.version = Favidenticon::VERSION
|
9
|
+
spec.authors = ["fukayatsu"]
|
10
|
+
spec.email = ["fukayatsu@gmail.com"]
|
11
|
+
spec.summary = %q{favicon.ico generator}
|
12
|
+
spec.description = %q{favicon.ico generator}
|
13
|
+
spec.homepage = "https://github.com/fukayatsu/favidenticon"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files`.split($/).delete_if { |file| file.match /^screenshots/ }
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_dependency "thor", "~> 0.18.1"
|
22
|
+
spec.add_dependency "mini_magick", "~> 3.7.0"
|
23
|
+
spec.add_dependency "ruby_identicon", "~> 0.0.1"
|
24
|
+
|
25
|
+
spec.add_development_dependency "bundler", "~> 1.5"
|
26
|
+
spec.add_development_dependency "rake"
|
27
|
+
spec.add_development_dependency "pry"
|
28
|
+
spec.add_development_dependency "rspec", "~> 3.0.0beta1"
|
29
|
+
end
|
data/lib/favidenticon.rb
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
require "favidenticon/version"
|
2
|
+
require 'ruby_identicon'
|
3
|
+
require 'mini_magick'
|
4
|
+
|
5
|
+
module Favidenticon
|
6
|
+
class Generator
|
7
|
+
class << self
|
8
|
+
def generate(identity, size, grid_size)
|
9
|
+
square_size = (size - 2) / grid_size / 2 * 2
|
10
|
+
border_size = (size - grid_size * square_size) / 2
|
11
|
+
|
12
|
+
blob = RubyIdenticon.create(identity,
|
13
|
+
background_color: 0,
|
14
|
+
border_size: border_size,
|
15
|
+
grid_size: grid_size,
|
16
|
+
square_size: square_size,
|
17
|
+
)
|
18
|
+
|
19
|
+
image = MiniMagick::Image.read(blob)
|
20
|
+
image.format "ico"
|
21
|
+
image.to_blob
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'thor'
|
2
|
+
require 'favidenticon'
|
3
|
+
require 'securerandom'
|
4
|
+
|
5
|
+
module Favidenticon
|
6
|
+
class CLI < Thor
|
7
|
+
|
8
|
+
desc 'version', 'show gem version'
|
9
|
+
def version
|
10
|
+
puts Favidenticon::VERSION
|
11
|
+
end
|
12
|
+
|
13
|
+
map 'g' => 'generate'
|
14
|
+
desc 'generate [identity] [options]', 'generate favicon (short-cut alias: "g")'
|
15
|
+
option :size, type: :numeric, desc: 'favicon size (default to 16)', aliases: '-s'
|
16
|
+
option :grid, type: :numeric, desc: 'grid size min: 4, max: 9 (default to 5)'
|
17
|
+
def generate(identity = SecureRandom.hex)
|
18
|
+
size = options[:size] || 16
|
19
|
+
grid = options[:grid] || 5
|
20
|
+
blob = Generator.generate(identity, size, grid)
|
21
|
+
File.open("favicon.ico", "wb") { |f| f.write(blob) }
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
# This file was generated by the `rspec --init` command. Conventionally, all
|
2
|
+
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
|
3
|
+
# Require this file using `require "spec_helper"` to ensure that it is only
|
4
|
+
# loaded once.
|
5
|
+
#
|
6
|
+
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
|
7
|
+
RSpec.configure do |config|
|
8
|
+
# Limit the spec run to only specs with the focus metadata. If no specs have
|
9
|
+
# the filtering metadata and `run_all_when_everything_filtered = true` then
|
10
|
+
# all specs will run.
|
11
|
+
#config.filter_run :focus
|
12
|
+
|
13
|
+
# Run all specs when none match the provided filter. This works well in
|
14
|
+
# conjunction with `config.filter_run :focus`, as it will run the entire
|
15
|
+
# suite when no specs have `:filter` metadata.
|
16
|
+
#config.run_all_when_everything_filtered = true
|
17
|
+
|
18
|
+
# Run specs in random order to surface order dependencies. If you find an
|
19
|
+
# order dependency and want to debug it, you can fix the order by providing
|
20
|
+
# the seed, which is printed after each run.
|
21
|
+
# --seed 1234
|
22
|
+
#config.order = 'random'
|
23
|
+
end
|
metadata
ADDED
@@ -0,0 +1,156 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: favidenticon
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- fukayatsu
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2013-12-28 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: thor
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 0.18.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.18.1
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: mini_magick
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 3.7.0
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 3.7.0
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: ruby_identicon
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 0.0.1
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 0.0.1
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: bundler
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '1.5'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '1.5'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rake
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: pry
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: rspec
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - "~>"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: 3.0.0beta1
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - "~>"
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: 3.0.0beta1
|
111
|
+
description: favicon.ico generator
|
112
|
+
email:
|
113
|
+
- fukayatsu@gmail.com
|
114
|
+
executables:
|
115
|
+
- favidenticon
|
116
|
+
extensions: []
|
117
|
+
extra_rdoc_files: []
|
118
|
+
files:
|
119
|
+
- ".gitignore"
|
120
|
+
- ".rspec"
|
121
|
+
- Gemfile
|
122
|
+
- LICENSE.txt
|
123
|
+
- README.md
|
124
|
+
- Rakefile
|
125
|
+
- bin/favidenticon
|
126
|
+
- favidenticon.gemspec
|
127
|
+
- lib/favidenticon.rb
|
128
|
+
- lib/favidenticon/cli.rb
|
129
|
+
- lib/favidenticon/version.rb
|
130
|
+
- spec/spec_helper.rb
|
131
|
+
homepage: https://github.com/fukayatsu/favidenticon
|
132
|
+
licenses:
|
133
|
+
- MIT
|
134
|
+
metadata: {}
|
135
|
+
post_install_message:
|
136
|
+
rdoc_options: []
|
137
|
+
require_paths:
|
138
|
+
- lib
|
139
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
140
|
+
requirements:
|
141
|
+
- - ">="
|
142
|
+
- !ruby/object:Gem::Version
|
143
|
+
version: '0'
|
144
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
145
|
+
requirements:
|
146
|
+
- - ">="
|
147
|
+
- !ruby/object:Gem::Version
|
148
|
+
version: '0'
|
149
|
+
requirements: []
|
150
|
+
rubyforge_project:
|
151
|
+
rubygems_version: 2.2.0
|
152
|
+
signing_key:
|
153
|
+
specification_version: 4
|
154
|
+
summary: favicon.ico generator
|
155
|
+
test_files:
|
156
|
+
- spec/spec_helper.rb
|