quilt 0.0.7 → 0.0.8
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 +15 -0
- data/.travis.yml +14 -0
- data/Gemfile +5 -0
- data/README.md +49 -0
- data/Rakefile +31 -127
- data/quilt.gemspec +37 -0
- data/test/quilt_test.rb +1 -0
- metadata +78 -67
- data/README.rdoc +0 -59
- data/examples/gen.rb +0 -44
checksums.yaml
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
---
|
|
2
|
+
!binary "U0hBMQ==":
|
|
3
|
+
metadata.gz: !binary |-
|
|
4
|
+
M2UwNjYzYmU1MTJkNTg3MzljZDkyOTY0NjViZTlhYTg2MzY1MjhjOQ==
|
|
5
|
+
data.tar.gz: !binary |-
|
|
6
|
+
ZTAyNGU1N2U1YTAwMzQ1ZWRmN2VhZWJhODNmMjZlNThjMjIxMWZjZA==
|
|
7
|
+
!binary "U0hBNTEy":
|
|
8
|
+
metadata.gz: !binary |-
|
|
9
|
+
NDVlMmJjNzljNjAyMWRkY2FjNGJmMGE2ZTY1NjAzNTUyOTEwNmU2NWNlYzRm
|
|
10
|
+
MzFkYmM3ZWIzYTk4MDY0MGJmNmJmYWRkNDk3MDcxZDQzNGFkZDJhN2ZmMGU2
|
|
11
|
+
ZjUwMzUwODVlZDhlYTdmZGRiMDc0NjY4YjA3ZmIyZmZmNDM1MWI=
|
|
12
|
+
data.tar.gz: !binary |-
|
|
13
|
+
N2QwOThlNjk4ZDBlY2Q4ZWZjYzA2NWMyYWNhN2UzZGRhNTAyZDJiZTc1NGY4
|
|
14
|
+
MTgxNjg4MzFhMWFmMDc5NTUyMWUxNzc0YzIyMjM4YWJmYmIxYjk0MWNmYjc2
|
|
15
|
+
YjZiY2M5Y2MzOWRmODI1NmE3ZTkxNGQ1NWM3OTliMDNjZDZhNjc=
|
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/README.md
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# quilt
|
|
2
|
+
|
|
3
|
+
   
|
|
4
|
+
|
|
5
|
+
[](https://travis-ci.org/swdyh/quilt)
|
|
6
|
+
|
|
7
|
+
A Ruby library for generating identicon.
|
|
8
|
+
|
|
9
|
+
Identicon: http://en.wikipedia.org/wiki/Identicon
|
|
10
|
+
|
|
11
|
+
## Installation
|
|
12
|
+
Required rmagick or ruby-gd.
|
|
13
|
+
|
|
14
|
+
gem install quilt
|
|
15
|
+
|
|
16
|
+
## Example
|
|
17
|
+
|
|
18
|
+
# input: any string
|
|
19
|
+
# output: 15 * 15 png (default)
|
|
20
|
+
identicon = Quilt::Identicon.new 'sample'
|
|
21
|
+
identicon.write 'sample15_15.png'
|
|
22
|
+
|
|
23
|
+
# input: identicon code(32 bit integer)
|
|
24
|
+
# output: 15 * 15 png (default)
|
|
25
|
+
identicon = Quilt::Identicon.new 1, :type => :code
|
|
26
|
+
identicon.write 'sample15_15_code.png'
|
|
27
|
+
|
|
28
|
+
# input: ip address
|
|
29
|
+
identicon = Quilt::Identicon.new '100.100.100.100', :type => :ip
|
|
30
|
+
identicon.write 'sample15_15_ip.png'
|
|
31
|
+
|
|
32
|
+
# output: 150 * 150 png
|
|
33
|
+
identicon = Quilt::Identicon.new 'sample', :scale => 10
|
|
34
|
+
identicon.write 'sample150_150.png'
|
|
35
|
+
|
|
36
|
+
# output: blob
|
|
37
|
+
identicon = Quilt::Identicon.new 'sample'
|
|
38
|
+
print identicon.to_blob
|
|
39
|
+
|
|
40
|
+
# change image library to Rmagick to GD
|
|
41
|
+
Quilt::Identicon.image_lib = Quilt::ImageGD
|
|
42
|
+
identicon = Quilt::Identicon.new 'sample'
|
|
43
|
+
identicon.write 'sample15_15_gd.png'
|
|
44
|
+
|
|
45
|
+
## Information
|
|
46
|
+
|
|
47
|
+
Copyright (c) 2008 swdyh
|
|
48
|
+
The MIT License
|
|
49
|
+
https://github.com/swdyh/quilt
|
data/Rakefile
CHANGED
|
@@ -1,142 +1,46 @@
|
|
|
1
1
|
require 'rubygems'
|
|
2
|
-
require 'rake'
|
|
3
|
-
require 'rake/clean'
|
|
4
2
|
require 'rake/testtask'
|
|
5
|
-
require '
|
|
6
|
-
require 'rake/gempackagetask'
|
|
7
|
-
require 'rake/rdoctask'
|
|
8
|
-
require 'rake/contrib/rubyforgepublisher'
|
|
9
|
-
require 'rake/contrib/sshpublisher'
|
|
10
|
-
require 'fileutils'
|
|
11
|
-
require 'date'
|
|
12
|
-
include FileUtils
|
|
13
|
-
|
|
14
|
-
NAME = "quilt"
|
|
15
|
-
AUTHOR = "swdyh"
|
|
16
|
-
EMAIL = "youhei@gmail.com"
|
|
17
|
-
DESCRIPTION = "a library for generating identicon."
|
|
18
|
-
RUBYFORGE_PROJECT = "quilt"
|
|
19
|
-
HOMEPATH = "http://#{RUBYFORGE_PROJECT}.rubyforge.org"
|
|
20
|
-
BIN_FILES = %w( )
|
|
21
|
-
VERS = "0.0.7"
|
|
22
|
-
|
|
23
|
-
REV = File.read(".svn/entries")[/committed-rev="(d+)"/, 1] rescue nil
|
|
24
|
-
CLEAN.include ['**/.*.sw?', '*.gem', '.config']
|
|
25
|
-
RDOC_OPTS = [
|
|
26
|
-
'--title', "#{NAME} documentation",
|
|
27
|
-
"--charset", "utf-8",
|
|
28
|
-
"--opname", "index.html",
|
|
29
|
-
"--line-numbers",
|
|
30
|
-
"--main", "README.rdoc",
|
|
31
|
-
"--inline-source",
|
|
32
|
-
]
|
|
33
|
-
|
|
34
|
-
task :default => [:test]
|
|
35
|
-
task :package => [:clean]
|
|
36
|
-
|
|
37
|
-
Rake::TestTask.new("test") do |t|
|
|
38
|
-
t.libs << "test"
|
|
39
|
-
t.pattern = "test/**/*_test.rb"
|
|
40
|
-
t.verbose = true
|
|
41
|
-
end
|
|
3
|
+
require 'bundler/gem_tasks'
|
|
42
4
|
|
|
43
5
|
spec = Gem::Specification.new do |s|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
#s.required_ruby_version = '>= 1.8.2'
|
|
64
|
-
|
|
65
|
-
s.files = %w(README.rdoc ChangeLog Rakefile) +
|
|
66
|
-
Dir.glob("{bin,doc,test,lib,templates,generator,extras,website,script}/**/*") +
|
|
67
|
-
Dir.glob("ext/**/*.{h,c,rb}") +
|
|
68
|
-
Dir.glob("examples/**/*.rb") +
|
|
69
|
-
Dir.glob("tools/*.rb")
|
|
70
|
-
|
|
71
|
-
s.extensions = FileList["ext/**/extconf.rb"].to_a
|
|
72
|
-
end
|
|
73
|
-
|
|
74
|
-
Rake::GemPackageTask.new(spec) do |p|
|
|
75
|
-
p.need_tar = true
|
|
76
|
-
p.gem_spec = spec
|
|
6
|
+
s.name = "quilt"
|
|
7
|
+
s.version = "0.0.8"
|
|
8
|
+
s.platform = Gem::Platform::RUBY
|
|
9
|
+
s.has_rdoc = false
|
|
10
|
+
s.summary = "A Ruby library for generating identicon."
|
|
11
|
+
s.homepage = "https://github.com/swdyh/quilt"
|
|
12
|
+
s.description = s.summary + "\n" + s.homepage
|
|
13
|
+
s.author = "swdyh"
|
|
14
|
+
s.email = "youhei@gmail.com"
|
|
15
|
+
s.executables = %w( )
|
|
16
|
+
s.bindir = "bin"
|
|
17
|
+
s.require_path = "lib"
|
|
18
|
+
s.test_files = Dir["test/test_*.rb"]
|
|
19
|
+
s.license = "MIT"
|
|
20
|
+
s.files = `git ls-files`.split("\n")
|
|
21
|
+
s.add_development_dependency "bundler"
|
|
22
|
+
s.add_development_dependency "rake"
|
|
23
|
+
s.add_development_dependency "rmagick"
|
|
24
|
+
# 'Spakman/ruby-gd' in Gemfile
|
|
77
25
|
end
|
|
78
26
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
end
|
|
84
|
-
|
|
85
|
-
task :uninstall => [:clean] do
|
|
86
|
-
sh %{sudo gem uninstall #{NAME}}
|
|
87
|
-
end
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
Rake::RDocTask.new do |rdoc|
|
|
91
|
-
rdoc.rdoc_dir = 'html'
|
|
92
|
-
rdoc.options += RDOC_OPTS
|
|
93
|
-
rdoc.template = "resh"
|
|
94
|
-
#rdoc.template = "#{ENV['template']}.rb" if ENV['template']
|
|
95
|
-
if ENV['DOC_FILES']
|
|
96
|
-
rdoc.rdoc_files.include(ENV['DOC_FILES'].split(/,\s*/))
|
|
97
|
-
else
|
|
98
|
-
rdoc.rdoc_files.include('README.rdoc', 'ChangeLog')
|
|
99
|
-
rdoc.rdoc_files.include('lib/**/*.rb')
|
|
100
|
-
rdoc.rdoc_files.include('ext/**/*.c')
|
|
101
|
-
end
|
|
102
|
-
end
|
|
103
|
-
|
|
104
|
-
desc "Publish to RubyForge"
|
|
105
|
-
task :rubyforge => [:rdoc, :package] do
|
|
106
|
-
require 'rubyforge'
|
|
107
|
-
Rake::RubyForgePublisher.new(RUBYFORGE_PROJECT, 'swdyh').upload
|
|
108
|
-
end
|
|
109
|
-
|
|
110
|
-
desc 'Package and upload the release to rubyforge.'
|
|
111
|
-
task :release => [:clean, :package] do |t|
|
|
112
|
-
v = ENV["VERSION"] or abort "Must supply VERSION=x.y.z"
|
|
113
|
-
abort "Versions don't match #{v} vs #{VERS}" unless v == VERS
|
|
114
|
-
pkg = "pkg/#{NAME}-#{VERS}"
|
|
115
|
-
|
|
116
|
-
rf = RubyForge.new
|
|
117
|
-
puts "Logging in"
|
|
118
|
-
rf.login
|
|
119
|
-
|
|
120
|
-
c = rf.userconfig
|
|
121
|
-
# c["release_notes"] = description if description
|
|
122
|
-
# c["release_changes"] = changes if changes
|
|
123
|
-
c["preformatted"] = true
|
|
124
|
-
|
|
125
|
-
files = [
|
|
126
|
-
"#{pkg}.tgz",
|
|
127
|
-
"#{pkg}.gem"
|
|
128
|
-
].compact
|
|
129
|
-
|
|
130
|
-
puts "Releasing #{NAME} v. #{VERS}"
|
|
131
|
-
rf.add_release RUBYFORGE_PROJECT, NAME, VERS, *files
|
|
27
|
+
Rake::TestTask.new("test") do |t|
|
|
28
|
+
t.libs << "test"
|
|
29
|
+
t.pattern = "test/**/*_test.rb"
|
|
30
|
+
t.verbose = true
|
|
132
31
|
end
|
|
133
32
|
|
|
134
33
|
desc 'Show information about the gem.'
|
|
135
34
|
task :debug_gemspec do
|
|
136
|
-
|
|
35
|
+
puts spec.to_ruby
|
|
137
36
|
end
|
|
138
37
|
|
|
139
38
|
desc 'Update information about the gem.'
|
|
140
39
|
task :update_gemspec do
|
|
141
|
-
open("#{
|
|
40
|
+
open("#{spec.name}.gemspec", 'w') { |f| f.puts spec.to_ruby }
|
|
142
41
|
end
|
|
42
|
+
|
|
43
|
+
desc 'Update gem'
|
|
44
|
+
task :update => [:update_gemspec, :build]
|
|
45
|
+
|
|
46
|
+
task :default => [:test]
|
data/quilt.gemspec
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
|
2
|
+
|
|
3
|
+
Gem::Specification.new do |s|
|
|
4
|
+
s.name = "quilt"
|
|
5
|
+
s.version = "0.0.8"
|
|
6
|
+
|
|
7
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
|
8
|
+
s.authors = ["swdyh"]
|
|
9
|
+
s.date = "2013-08-22"
|
|
10
|
+
s.description = "A Ruby library for generating identicon.\nhttps://github.com/swdyh/quilt"
|
|
11
|
+
s.email = "youhei@gmail.com"
|
|
12
|
+
s.files = [".travis.yml", "ChangeLog", "Gemfile", "MIT-LICENSE", "README.md", "Rakefile", "lib/quilt.rb", "quilt.gemspec", "test/quilt_test.rb", "test/test_helper.rb"]
|
|
13
|
+
s.homepage = "https://github.com/swdyh/quilt"
|
|
14
|
+
s.licenses = ["MIT"]
|
|
15
|
+
s.require_paths = ["lib"]
|
|
16
|
+
s.rubygems_version = "2.0.7"
|
|
17
|
+
s.summary = "A Ruby library for generating identicon."
|
|
18
|
+
s.test_files = ["test/test_helper.rb"]
|
|
19
|
+
|
|
20
|
+
if s.respond_to? :specification_version then
|
|
21
|
+
s.specification_version = 4
|
|
22
|
+
|
|
23
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
|
24
|
+
s.add_development_dependency(%q<bundler>, [">= 0"])
|
|
25
|
+
s.add_development_dependency(%q<rake>, [">= 0"])
|
|
26
|
+
s.add_development_dependency(%q<rmagick>, [">= 0"])
|
|
27
|
+
else
|
|
28
|
+
s.add_dependency(%q<bundler>, [">= 0"])
|
|
29
|
+
s.add_dependency(%q<rake>, [">= 0"])
|
|
30
|
+
s.add_dependency(%q<rmagick>, [">= 0"])
|
|
31
|
+
end
|
|
32
|
+
else
|
|
33
|
+
s.add_dependency(%q<bundler>, [">= 0"])
|
|
34
|
+
s.add_dependency(%q<rake>, [">= 0"])
|
|
35
|
+
s.add_dependency(%q<rmagick>, [">= 0"])
|
|
36
|
+
end
|
|
37
|
+
end
|
data/test/quilt_test.rb
CHANGED
|
@@ -80,6 +80,7 @@ class QultTest < Test::Unit::TestCase
|
|
|
80
80
|
end
|
|
81
81
|
|
|
82
82
|
def test_size_opt_gd
|
|
83
|
+
size = 100
|
|
83
84
|
Quilt::Identicon.image_lib = Quilt::ImageGD
|
|
84
85
|
identicon = Quilt::Identicon.new 'foo', :size => size
|
|
85
86
|
assert_equal size, identicon.instance_variable_get(:@image).instance_variable_get(:@image).width
|
metadata
CHANGED
|
@@ -1,87 +1,98 @@
|
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: quilt
|
|
3
|
-
version: !ruby/object:Gem::Version
|
|
4
|
-
|
|
5
|
-
prerelease: false
|
|
6
|
-
segments:
|
|
7
|
-
- 0
|
|
8
|
-
- 0
|
|
9
|
-
- 7
|
|
10
|
-
version: 0.0.7
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.0.8
|
|
11
5
|
platform: ruby
|
|
12
|
-
authors:
|
|
6
|
+
authors:
|
|
13
7
|
- swdyh
|
|
14
8
|
autorequire:
|
|
15
9
|
bindir: bin
|
|
16
10
|
cert_chain: []
|
|
11
|
+
date: 2013-08-22 00:00:00.000000000 Z
|
|
12
|
+
dependencies:
|
|
13
|
+
- !ruby/object:Gem::Dependency
|
|
14
|
+
name: bundler
|
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
|
16
|
+
requirements:
|
|
17
|
+
- - ! '>='
|
|
18
|
+
- !ruby/object:Gem::Version
|
|
19
|
+
version: '0'
|
|
20
|
+
type: :development
|
|
21
|
+
prerelease: false
|
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
23
|
+
requirements:
|
|
24
|
+
- - ! '>='
|
|
25
|
+
- !ruby/object:Gem::Version
|
|
26
|
+
version: '0'
|
|
27
|
+
- !ruby/object:Gem::Dependency
|
|
28
|
+
name: rake
|
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
|
30
|
+
requirements:
|
|
31
|
+
- - ! '>='
|
|
32
|
+
- !ruby/object:Gem::Version
|
|
33
|
+
version: '0'
|
|
34
|
+
type: :development
|
|
35
|
+
prerelease: false
|
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
37
|
+
requirements:
|
|
38
|
+
- - ! '>='
|
|
39
|
+
- !ruby/object:Gem::Version
|
|
40
|
+
version: '0'
|
|
41
|
+
- !ruby/object:Gem::Dependency
|
|
42
|
+
name: rmagick
|
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
|
44
|
+
requirements:
|
|
45
|
+
- - ! '>='
|
|
46
|
+
- !ruby/object:Gem::Version
|
|
47
|
+
version: '0'
|
|
48
|
+
type: :development
|
|
49
|
+
prerelease: false
|
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
51
|
+
requirements:
|
|
52
|
+
- - ! '>='
|
|
53
|
+
- !ruby/object:Gem::Version
|
|
54
|
+
version: '0'
|
|
55
|
+
description: ! 'A Ruby library for generating identicon.
|
|
17
56
|
|
|
18
|
-
|
|
19
|
-
default_executable:
|
|
20
|
-
dependencies: []
|
|
21
|
-
|
|
22
|
-
description: a library for generating identicon.
|
|
57
|
+
https://github.com/swdyh/quilt'
|
|
23
58
|
email: youhei@gmail.com
|
|
24
59
|
executables: []
|
|
25
|
-
|
|
26
60
|
extensions: []
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
-
|
|
61
|
+
extra_rdoc_files: []
|
|
62
|
+
files:
|
|
63
|
+
- .travis.yml
|
|
30
64
|
- ChangeLog
|
|
65
|
+
- Gemfile
|
|
31
66
|
- MIT-LICENSE
|
|
32
|
-
|
|
33
|
-
- README.rdoc
|
|
34
|
-
- ChangeLog
|
|
67
|
+
- README.md
|
|
35
68
|
- Rakefile
|
|
69
|
+
- lib/quilt.rb
|
|
70
|
+
- quilt.gemspec
|
|
36
71
|
- test/quilt_test.rb
|
|
37
72
|
- test/test_helper.rb
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
- MIT
|
|
41
|
-
|
|
42
|
-
homepage: http://quilt.rubyforge.org
|
|
43
|
-
licenses: []
|
|
44
|
-
|
|
73
|
+
homepage: https://github.com/swdyh/quilt
|
|
74
|
+
licenses:
|
|
75
|
+
- MIT
|
|
76
|
+
metadata: {}
|
|
45
77
|
post_install_message:
|
|
46
|
-
rdoc_options:
|
|
47
|
-
|
|
48
|
-
- quilt documentation
|
|
49
|
-
- --charset
|
|
50
|
-
- utf-8
|
|
51
|
-
- --opname
|
|
52
|
-
- index.html
|
|
53
|
-
- --line-numbers
|
|
54
|
-
- --main
|
|
55
|
-
- README.rdoc
|
|
56
|
-
- --inline-source
|
|
57
|
-
- --exclude
|
|
58
|
-
- ^(examples|extras)/
|
|
59
|
-
require_paths:
|
|
78
|
+
rdoc_options: []
|
|
79
|
+
require_paths:
|
|
60
80
|
- lib
|
|
61
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
none: false
|
|
72
|
-
requirements:
|
|
73
|
-
- - ">="
|
|
74
|
-
- !ruby/object:Gem::Version
|
|
75
|
-
hash: 3
|
|
76
|
-
segments:
|
|
77
|
-
- 0
|
|
78
|
-
version: "0"
|
|
81
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
82
|
+
requirements:
|
|
83
|
+
- - ! '>='
|
|
84
|
+
- !ruby/object:Gem::Version
|
|
85
|
+
version: '0'
|
|
86
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
87
|
+
requirements:
|
|
88
|
+
- - ! '>='
|
|
89
|
+
- !ruby/object:Gem::Version
|
|
90
|
+
version: '0'
|
|
79
91
|
requirements: []
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
rubygems_version: 1.3.7
|
|
92
|
+
rubyforge_project:
|
|
93
|
+
rubygems_version: 2.0.7
|
|
83
94
|
signing_key:
|
|
84
|
-
specification_version:
|
|
85
|
-
summary:
|
|
86
|
-
test_files:
|
|
95
|
+
specification_version: 4
|
|
96
|
+
summary: A Ruby library for generating identicon.
|
|
97
|
+
test_files:
|
|
87
98
|
- test/test_helper.rb
|
data/README.rdoc
DELETED
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
= quilt
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
== Description
|
|
6
|
-
a library for generating identicon.
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
Identicon: http://en.wikipedia.org/wiki/Identicon
|
|
10
|
-
|
|
11
|
-
== Installation
|
|
12
|
-
Required RMagick or ruby-gd.
|
|
13
|
-
|
|
14
|
-
=== Archive Installation
|
|
15
|
-
|
|
16
|
-
rake install
|
|
17
|
-
|
|
18
|
-
=== Gem Installation
|
|
19
|
-
|
|
20
|
-
gem install quilt
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
== Features/Problems
|
|
24
|
-
* Output file type is PNG only.
|
|
25
|
-
|
|
26
|
-
== Synopsis
|
|
27
|
-
|
|
28
|
-
# input: any string
|
|
29
|
-
# output: 15 * 15 png (default)
|
|
30
|
-
identicon = Quilt::Identicon.new 'sample'
|
|
31
|
-
identicon.write 'sample15_15.png'
|
|
32
|
-
|
|
33
|
-
# input: identicon code(32 bit integer)
|
|
34
|
-
# output: 15 * 15 png (default)
|
|
35
|
-
identicon = Quilt::Identicon.new 1, :type => :code
|
|
36
|
-
identicon.write 'sample15_15_code.png'
|
|
37
|
-
|
|
38
|
-
# input: ip address
|
|
39
|
-
identicon = Quilt::Identicon.new '100.100.100.100', :type => :ip
|
|
40
|
-
identicon.write 'sample15_15_ip.png'
|
|
41
|
-
|
|
42
|
-
# output: 150 * 150 png
|
|
43
|
-
identicon = Quilt::Identicon.new 'sample', :scale => 10
|
|
44
|
-
identicon.write 'sample150_150.png'
|
|
45
|
-
|
|
46
|
-
# output: blob
|
|
47
|
-
identicon = Quilt::Identicon.new 'sample'
|
|
48
|
-
print identicon.to_blob
|
|
49
|
-
|
|
50
|
-
# change image library to Rmagick to GD
|
|
51
|
-
Quilt::Identicon.image_lib = Quilt::ImageGD
|
|
52
|
-
identicon = Quilt::Identicon.new 'sample'
|
|
53
|
-
identicon.write 'sample15_15_gd.png'
|
|
54
|
-
|
|
55
|
-
== Copyright
|
|
56
|
-
|
|
57
|
-
Author:: swdyh <youhei@gmail.com>
|
|
58
|
-
Copyright:: Copyright (c) 2008 swdyh
|
|
59
|
-
License:: The MIT License
|
data/examples/gen.rb
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
# -*- coding: utf-8 -*-
|
|
2
|
-
require 'rubygems'
|
|
3
|
-
|
|
4
|
-
#require 'quilt'
|
|
5
|
-
require '../lib/quilt'
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
# 15.times do |i|
|
|
9
|
-
# icon = Quilt::Identicon.new rand(10000).to_s, :size => 100
|
|
10
|
-
# icon.write "file/#{i}.png"
|
|
11
|
-
# end
|
|
12
|
-
|
|
13
|
-
icon = Quilt::Identicon.new 'motemen'
|
|
14
|
-
icon.write "file/motemen.png"
|
|
15
|
-
|
|
16
|
-
icon = Quilt::Identicon.new 'motemen', :size => 30
|
|
17
|
-
icon.write "file/motemen30.png"
|
|
18
|
-
|
|
19
|
-
icon = Quilt::Identicon.new 'motemen', :size => 40
|
|
20
|
-
icon.write "file/motemen40.png"
|
|
21
|
-
|
|
22
|
-
icon = Quilt::Identicon.new 'motemen', :size => 100
|
|
23
|
-
icon.write "file/motemen100.png"
|
|
24
|
-
|
|
25
|
-
icon = Quilt::Identicon.new 'motemen', :size => 150
|
|
26
|
-
icon.write "file/motemen150.png"
|
|
27
|
-
|
|
28
|
-
icon = Quilt::Identicon.new 'ああ', :size => 150
|
|
29
|
-
icon.write "file/aa.png"
|
|
30
|
-
|
|
31
|
-
=begin
|
|
32
|
-
Encoding.default_internal = Encoding.default_external
|
|
33
|
-
p [Encoding.default_external, Encoding.default_internal]
|
|
34
|
-
|
|
35
|
-
s = "\x89"
|
|
36
|
-
s.force_encoding('ASCII-8BIT')
|
|
37
|
-
p [s, s.encoding]
|
|
38
|
-
open('aa', 'wb') { |f|
|
|
39
|
-
p f.external_encoding
|
|
40
|
-
p f.internal_encoding
|
|
41
|
-
f.write s
|
|
42
|
-
}
|
|
43
|
-
=end
|
|
44
|
-
# str.force_encoding('ASCII-8BIT')
|