namna 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +15 -0
- data/.travis.yml +3 -0
- data/Gemfile +3 -0
- data/LICENSE.txt +22 -0
- data/README.md +38 -0
- data/Rakefile +8 -0
- data/bin/namna +16 -0
- data/lib/namna.rb +6 -0
- data/lib/namna/generator.rb +11 -0
- data/lib/namna/string.rb +18 -0
- data/lib/namna/version.rb +3 -0
- data/namna.gemspec +24 -0
- data/test/generator_test.rb +20 -0
- data/test/string_test.rb +25 -0
- data/test/test_helper.rb +2 -0
- metadata +105 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 88875ba589b38bf48c968caaff07fcd1a9a9a065
|
4
|
+
data.tar.gz: e6ae08ae68ff77a6c27c16a60499e2b32d9202ec
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: fcfb246b23484a02fecae130fb8b026aefa85d78c67ebc95ca84e9f5983cc5555ce23b1e38baabba73d4f80411eda2b1b60f8460b629c3d6572a5c1a10075cf3
|
7
|
+
data.tar.gz: c7f38bc4f1430d1b2a7b3dd0ef3e1ab9c125316666618772a1b98ad75c8b62f4085f85a31d3045a7772f4be3a57c48404b18aa6a32601f66d508c62f22e1bb61
|
data/.gitignore
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2014 David Boot
|
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,38 @@
|
|
1
|
+
[![Build Status](https://travis-ci.org/kodnin/namna.svg?branch=master)](https://travis-ci.org/kodnin/namna)
|
2
|
+
|
3
|
+
# Namna
|
4
|
+
|
5
|
+
Namna is a simple formatted name generator for the command line written in Ruby.
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
gem 'namna'
|
13
|
+
```
|
14
|
+
|
15
|
+
And then execute:
|
16
|
+
|
17
|
+
$ bundle
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
|
21
|
+
$ gem install namna
|
22
|
+
|
23
|
+
## Usage
|
24
|
+
|
25
|
+
Generate a name by invoking the ```namna``` command with a format argument. For example:
|
26
|
+
|
27
|
+
$ namna 'a?*#z'
|
28
|
+
=> adebz
|
29
|
+
|
30
|
+
results in a name of five characters starting with an 'a', followed by a random character (?), a vowel (*), a consonant (#) and ending with a 'z'.
|
31
|
+
|
32
|
+
## Contributing
|
33
|
+
|
34
|
+
1. Fork it ( https://github.com/kodnin/namna/fork )
|
35
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
36
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
37
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
38
|
+
5. Create a new Pull Request
|
data/Rakefile
ADDED
data/bin/namna
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'namna'
|
4
|
+
|
5
|
+
if ARGV.empty? || ARGV.first == '-h' || ARGV.first == '--help'
|
6
|
+
puts "namna '<format>'"
|
7
|
+
puts " where:"
|
8
|
+
puts " a-z remains a-z"
|
9
|
+
puts " ? becomes random"
|
10
|
+
puts " * becomes vowel"
|
11
|
+
puts " # becomes consonant"
|
12
|
+
elsif ARGV.first == '-v' || ARGV.first == '--version'
|
13
|
+
puts Namna::VERSION
|
14
|
+
else
|
15
|
+
puts Generator.new(ARGV.first).generate
|
16
|
+
end
|
data/lib/namna.rb
ADDED
data/lib/namna/string.rb
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
class String
|
2
|
+
ALPHABET = ('a'..'z').to_a
|
3
|
+
VOWELS = %w(a e i o u)
|
4
|
+
CONSONANTS = ALPHABET - VOWELS
|
5
|
+
|
6
|
+
def namna_sub
|
7
|
+
case self
|
8
|
+
when '?'
|
9
|
+
ALPHABET.sample
|
10
|
+
when '*'
|
11
|
+
VOWELS.sample
|
12
|
+
when '#'
|
13
|
+
CONSONANTS.sample
|
14
|
+
else
|
15
|
+
self
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
data/namna.gemspec
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'namna/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = 'namna'
|
8
|
+
spec.version = Namna::VERSION
|
9
|
+
spec.authors = ['David Boot']
|
10
|
+
spec.email = ['kodnin@gmail.com']
|
11
|
+
spec.summary = %q{Simple formatted name generator.}
|
12
|
+
spec.description = %q{A simple formatted name generator for the command line.}
|
13
|
+
spec.homepage = 'https://github.com/kodnin/namna'
|
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
|
+
|
21
|
+
spec.add_development_dependency 'bundler', '~> 1.7'
|
22
|
+
spec.add_development_dependency 'rake', '~> 10.0'
|
23
|
+
spec.add_development_dependency 'minitest', '~> 5.4.2'
|
24
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
require_relative './test_helper'
|
2
|
+
|
3
|
+
class TestGenerator < Minitest::Test
|
4
|
+
def setup
|
5
|
+
@generator = Generator.new('a?*#z')
|
6
|
+
end
|
7
|
+
|
8
|
+
def test_initialize
|
9
|
+
assert_equal 5, @generator.format.length
|
10
|
+
end
|
11
|
+
|
12
|
+
def test_generate
|
13
|
+
assert_equal 5, @generator.generate.length
|
14
|
+
assert_equal 'a', @generator.generate[0]
|
15
|
+
assert_includes String::ALPHABET, @generator.generate[1]
|
16
|
+
assert_includes String::VOWELS, @generator.generate[2]
|
17
|
+
assert_includes String::CONSONANTS, @generator.generate[3]
|
18
|
+
assert_equal 'z', @generator.generate[4]
|
19
|
+
end
|
20
|
+
end
|
data/test/string_test.rb
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
require_relative './test_helper'
|
2
|
+
|
3
|
+
class TestString < Minitest::Test
|
4
|
+
def test_constants
|
5
|
+
assert_equal 26, String::ALPHABET.length
|
6
|
+
assert_includes String::ALPHABET, 'a'.namna_sub
|
7
|
+
assert_includes String::ALPHABET, 'b'.namna_sub
|
8
|
+
assert_equal 5, String::VOWELS.length
|
9
|
+
assert_includes String::VOWELS, 'a'.namna_sub
|
10
|
+
refute_includes String::VOWELS, 'b'.namna_sub
|
11
|
+
assert_equal 21, String::CONSONANTS.length
|
12
|
+
assert_includes String::CONSONANTS, 'b'.namna_sub
|
13
|
+
refute_includes String::CONSONANTS, 'a'.namna_sub
|
14
|
+
end
|
15
|
+
|
16
|
+
def test_namna_sub
|
17
|
+
assert_equal 'a', 'a'.namna_sub
|
18
|
+
assert_equal 'b', 'b'.namna_sub
|
19
|
+
assert_includes String::ALPHABET, '?'.namna_sub
|
20
|
+
assert_includes String::VOWELS, '*'.namna_sub
|
21
|
+
refute_includes String::CONSONANTS, '*'.namna_sub
|
22
|
+
assert_includes String::CONSONANTS, '#'.namna_sub
|
23
|
+
refute_includes String::VOWELS, '#'.namna_sub
|
24
|
+
end
|
25
|
+
end
|
data/test/test_helper.rb
ADDED
metadata
ADDED
@@ -0,0 +1,105 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: namna
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.3
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- David Boot
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-11-07 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: '1.7'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.7'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: minitest
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 5.4.2
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 5.4.2
|
55
|
+
description: A simple formatted name generator for the command line.
|
56
|
+
email:
|
57
|
+
- kodnin@gmail.com
|
58
|
+
executables:
|
59
|
+
- namna
|
60
|
+
extensions: []
|
61
|
+
extra_rdoc_files: []
|
62
|
+
files:
|
63
|
+
- ".gitignore"
|
64
|
+
- ".travis.yml"
|
65
|
+
- Gemfile
|
66
|
+
- LICENSE.txt
|
67
|
+
- README.md
|
68
|
+
- Rakefile
|
69
|
+
- bin/namna
|
70
|
+
- lib/namna.rb
|
71
|
+
- lib/namna/generator.rb
|
72
|
+
- lib/namna/string.rb
|
73
|
+
- lib/namna/version.rb
|
74
|
+
- namna.gemspec
|
75
|
+
- test/generator_test.rb
|
76
|
+
- test/string_test.rb
|
77
|
+
- test/test_helper.rb
|
78
|
+
homepage: https://github.com/kodnin/namna
|
79
|
+
licenses:
|
80
|
+
- MIT
|
81
|
+
metadata: {}
|
82
|
+
post_install_message:
|
83
|
+
rdoc_options: []
|
84
|
+
require_paths:
|
85
|
+
- lib
|
86
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
87
|
+
requirements:
|
88
|
+
- - ">="
|
89
|
+
- !ruby/object:Gem::Version
|
90
|
+
version: '0'
|
91
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
92
|
+
requirements:
|
93
|
+
- - ">="
|
94
|
+
- !ruby/object:Gem::Version
|
95
|
+
version: '0'
|
96
|
+
requirements: []
|
97
|
+
rubyforge_project:
|
98
|
+
rubygems_version: 2.4.2
|
99
|
+
signing_key:
|
100
|
+
specification_version: 4
|
101
|
+
summary: Simple formatted name generator.
|
102
|
+
test_files:
|
103
|
+
- test/generator_test.rb
|
104
|
+
- test/string_test.rb
|
105
|
+
- test/test_helper.rb
|