naoticon 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 36ce53053e6be6e39d44518f9375edfd0bc0aec9
4
- data.tar.gz: 978f94cc4ce0b3da58ad467c15f7b590bda24ab4
3
+ metadata.gz: 32446c6c5417c16b9c01f325685765a262ffd248
4
+ data.tar.gz: ab5b3e692316253e0f79d63e8d1d70e3c7d14f95
5
5
  SHA512:
6
- metadata.gz: 236bcd58ed8c5f4589457261abfbd8fa23465b5d6f22a20e15723e96728be106983d8dd02f140fe95e342ad5d4b1b9a37264d877d68f3cc310447a2d3c5a8396
7
- data.tar.gz: e74bcf7f7db11bbb16a4227860eb7063fadaaee51c9c280b8398a8bfbae7e7af6a1520ba76a50e12f98d6d0de3561c35f82ab6ccf6c38afca4260293a28422a0
6
+ metadata.gz: ec24856f3dc400049a91940ad3ecf3aaf5db40cfb8e960e61b310483d1228d9d9bacde76f82ac772380f9ce81af23914139de58d8dde0f2544080d1f0819dd24
7
+ data.tar.gz: 199ab7befe4dca7495b7af0ad8f670808b6d73dc70a5a579504008be7d1226b1ce5b6a8a36f72964d4e37336db78c1ce6923705ba33e1b229137813c088f8276
data/README.md CHANGED
@@ -1,29 +1,23 @@
1
- # Naoticon
1
+ # naoticon
2
2
 
3
- TODO: Write a gem description
3
+ ![naoticon4](naoticon4.png)
4
4
 
5
- ## Installation
5
+ naoticon is a generator of identicon for naoty (it's me).
6
6
 
7
- Add this line to your application's Gemfile:
8
-
9
- gem 'naoticon'
10
-
11
- And then execute:
12
-
13
- $ bundle
7
+ ## Usage
14
8
 
15
- Or install it yourself as:
9
+ ```
10
+ $ gem install naoticon
11
+ $ naoticon
12
+ ```
16
13
 
17
- $ gem install naoticon
14
+ ![naoticon1](naoticon1.png)
18
15
 
19
- ## Usage
16
+ `naoticon` command generates `naoticon.png`. The scale of icon can be passed to the command arguement.
20
17
 
21
- TODO: Write usage instructions here
18
+ ```
19
+ $ naoticon 4
20
+ ```
22
21
 
23
- ## Contributing
22
+ ![naoticon4](naoticon4.png)
24
23
 
25
- 1. Fork it
26
- 2. Create your feature branch (`git checkout -b my-new-feature`)
27
- 3. Commit your changes (`git commit -am 'Add some feature'`)
28
- 4. Push to the branch (`git push origin my-new-feature`)
29
- 5. Create new Pull Request
data/bin/naoticon CHANGED
@@ -1,4 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
3
  require_relative "../lib/naoticon"
4
- Naoticon::Builder.build
4
+
5
+ scale = ARGV[0].nil? ? 1 : ARGV[0].to_i
6
+ Naoticon::Builder.build(scale)
@@ -1,3 +1,3 @@
1
1
  module Naoticon
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
data/lib/naoticon.rb CHANGED
@@ -3,6 +3,7 @@ require "chunky_png"
3
3
 
4
4
  module Naoticon
5
5
  module Builder
6
+ MIN_LENGTH = 16
6
7
  DOTS = [
7
8
  [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
8
9
  [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
@@ -22,11 +23,17 @@ module Naoticon
22
23
  [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
23
24
  ].freeze
24
25
 
25
- def self.build(filename = "naoticon.png")
26
- icon = ChunkyPNG::Image.new(16, 16, ChunkyPNG::Color::BLACK)
27
- 16.times do |x|
28
- 16.times do |y|
29
- icon[y, x] = DOTS[x][y] == 1 ? ChunkyPNG::Color::WHITE : ChunkyPNG::Color::BLACK
26
+ def self.build(scale = 1, filename = "naoticon.png")
27
+ length = MIN_LENGTH * scale
28
+ icon = ChunkyPNG::Image.new(length, length, ChunkyPNG::Color::BLACK)
29
+ MIN_LENGTH.times do |x|
30
+ scale.times do |i|
31
+ MIN_LENGTH.times do |y|
32
+ scale.times do |j|
33
+ color = DOTS[x][y] == 1 ? ChunkyPNG::Color::WHITE : ChunkyPNG::Color::BLACK
34
+ icon[y * scale + j, x * scale + i] = color
35
+ end
36
+ end
30
37
  end
31
38
  end
32
39
  icon.save(filename)
File without changes
data/naoticon4.png ADDED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: naoticon
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Naoto Kaneko
@@ -83,7 +83,8 @@ files:
83
83
  - lib/naoticon.rb
84
84
  - lib/naoticon/version.rb
85
85
  - naoticon.gemspec
86
- - naoticon.png
86
+ - naoticon1.png
87
+ - naoticon4.png
87
88
  homepage: https://github.com/naoty/naoticon
88
89
  licenses:
89
90
  - MIT