haikunator 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 59f2f9946d675d7350256fdb52681202ba198a8d
4
+ data.tar.gz: 733807587635fc4329402cf4e5c2cfa74d2a76f0
5
+ SHA512:
6
+ metadata.gz: 22aab462e057562af2edd01aa457020b15d88b136fd9acd78955497195edac97d4100c396ec0e65d0fc087c80b50e2d037cf50ca83ede061373590bb4932117c
7
+ data.tar.gz: 896d8fd618177659dc4a223065160d0b0e3d93235bb94e0a24b71fc9a81f6a6523c29ed7fe62f3e9378ea13e3e4e94ee521542bfccd80ed9a355060d1a46e55d
@@ -0,0 +1,22 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
18
+ *.bundle
19
+ *.so
20
+ *.o
21
+ *.a
22
+ mkmf.log
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in haikunator.gemspec
4
+ gemspec
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2015 Usman Bashir
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.
@@ -0,0 +1,29 @@
1
+ # Haikunator
2
+
3
+ TODO: Write a gem description
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'haikunator'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install haikunator
18
+
19
+ ## Usage
20
+
21
+ TODO: Write usage instructions here
22
+
23
+ ## Contributing
24
+
25
+ 1. Fork it ( https://github.com/[my-github-username]/haikunator/fork )
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 a new Pull Request
@@ -0,0 +1,2 @@
1
+ require "bundler/gem_tasks"
2
+
@@ -0,0 +1,20 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'haikunator/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "haikunator"
8
+ spec.version = Haikunator::VERSION
9
+ spec.authors = ["Usman Bashir"]
10
+ spec.email = ["me@usmanbashir.com"]
11
+ spec.summary = %q{Heroku-like random name generator.}
12
+ spec.description = %q{Generate memorable random names to use in your apps or anywhere else.}
13
+ spec.homepage = "https://github.com/usmanbashir/haikunator"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files -z`.split("\x0")
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
+ end
@@ -0,0 +1,54 @@
1
+ require 'haikunator/version'
2
+ require 'securerandom'
3
+
4
+ module Haikunator
5
+ class << self
6
+
7
+ def generate(token_range = 9999, delimiter = '-')
8
+ rnd = (rand * (2 ** 12)).floor
9
+
10
+ sections = []
11
+ sections << adjectives[rnd % adjectives.length]
12
+ sections << nouns[rnd % nouns.length]
13
+ sections << token(token_range)
14
+
15
+ sections.compact.join(delimiter)
16
+ end
17
+ alias_method :haikunate, :generate
18
+
19
+ private
20
+
21
+ def token(range)
22
+ SecureRandom.random_number(range) if range > 0
23
+ end
24
+
25
+ def adjectives
26
+ %w[
27
+ autumn hidden bitter misty silent empty dry dark
28
+ summer icy delicate quiet white cool spring winter
29
+ patient twilight dawn crimson wispy weathered blue
30
+ billowing broken cold damp falling frosty green
31
+ long late lingering bold little morning muddy old
32
+ red rough still small sparkling throbbing shy
33
+ wandering withered wild black young holy solitary
34
+ fragrant aged snowy proud floral restless divine
35
+ polished ancient purple lively nameless
36
+ ]
37
+ end
38
+
39
+ def nouns
40
+ %w[
41
+ waterfall river breeze moon rain wind sea morning
42
+ snow lake sunset pine shadow leaf dawn glitter
43
+ forest hill cloud meadow sun glade bird brook
44
+ butterfly bush dew dust field fire flower firefly
45
+ feather grass haze mountain night pond darkness
46
+ snowflake silence sound sky shape surf thunder
47
+ violet water wildflower wave water resonance sun
48
+ wood dream cherry tree fog frost voice paper
49
+ frog smoke star
50
+ ]
51
+ end
52
+
53
+ end
54
+ end
@@ -0,0 +1,3 @@
1
+ module Haikunator
2
+ VERSION = "1.0.0"
3
+ end
metadata ADDED
@@ -0,0 +1,52 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: haikunator
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Usman Bashir
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-01-18 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: Generate memorable random names to use in your apps or anywhere else.
14
+ email:
15
+ - me@usmanbashir.com
16
+ executables: []
17
+ extensions: []
18
+ extra_rdoc_files: []
19
+ files:
20
+ - ".gitignore"
21
+ - Gemfile
22
+ - LICENSE.txt
23
+ - README.md
24
+ - Rakefile
25
+ - haikunator.gemspec
26
+ - lib/haikunator.rb
27
+ - lib/haikunator/version.rb
28
+ homepage: https://github.com/usmanbashir/haikunator
29
+ licenses:
30
+ - MIT
31
+ metadata: {}
32
+ post_install_message:
33
+ rdoc_options: []
34
+ require_paths:
35
+ - lib
36
+ required_ruby_version: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ required_rubygems_version: !ruby/object:Gem::Requirement
42
+ requirements:
43
+ - - ">="
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
46
+ requirements: []
47
+ rubyforge_project:
48
+ rubygems_version: 2.2.2
49
+ signing_key:
50
+ specification_version: 4
51
+ summary: Heroku-like random name generator.
52
+ test_files: []