namey 0.0.10 → 0.0.13
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.travis.yml +5 -2
- data/Gemfile +0 -2
- data/LICENSE +21 -0
- data/bin/namey-load-data +1 -1
- data/lib/namey/generator.rb +8 -7
- data/lib/namey/version.rb +1 -1
- data/namey.gemspec +3 -13
- data/spec/generator_spec.rb +23 -12
- data/specs.watchr +60 -0
- metadata +30 -104
- data/api/Gemfile +0 -12
- data/api/config.ru.example +0 -10
- data/api/namey_app.rb +0 -78
- data/api/public/LICENSE +0 -176
- data/api/public/Makefile +0 -30
- data/api/public/README.md +0 -105
- data/api/public/ajax-loader.gif +0 -0
- data/api/public/api.js +0 -90
- data/api/public/bootstrap.css +0 -2467
- data/api/public/bootstrap.min.css +0 -356
- data/api/public/docs/assets/css/docs.css +0 -317
- data/api/public/docs/assets/ico/bootstrap-apple-114x114.png +0 -0
- data/api/public/docs/assets/ico/bootstrap-apple-57x57.png +0 -0
- data/api/public/docs/assets/ico/bootstrap-apple-72x72.png +0 -0
- data/api/public/docs/assets/ico/favicon.ico +0 -0
- data/api/public/docs/assets/img/bird.png +0 -0
- data/api/public/docs/assets/img/browsers.png +0 -0
- data/api/public/docs/assets/img/example-diagram-01.png +0 -0
- data/api/public/docs/assets/img/example-diagram-02.png +0 -0
- data/api/public/docs/assets/img/example-diagram-03.png +0 -0
- data/api/public/docs/assets/img/grid-18px.png +0 -0
- data/api/public/docs/assets/img/twitter-logo-no-bird.png +0 -0
- data/api/public/docs/assets/js/application.js +0 -52
- data/api/public/docs/assets/js/google-code-prettify/prettify.css +0 -94
- data/api/public/docs/assets/js/google-code-prettify/prettify.js +0 -28
- data/api/public/docs/index.html +0 -2037
- data/api/public/docs/javascript.html +0 -798
- data/api/public/examples/container-app.html +0 -119
- data/api/public/examples/fluid.html +0 -122
- data/api/public/examples/hero.html +0 -79
- data/api/public/js/bootstrap-alerts.js +0 -113
- data/api/public/js/bootstrap-buttons.js +0 -62
- data/api/public/js/bootstrap-dropdown.js +0 -55
- data/api/public/js/bootstrap-modal.js +0 -260
- data/api/public/js/bootstrap-popover.js +0 -86
- data/api/public/js/bootstrap-scrollspy.js +0 -107
- data/api/public/js/bootstrap-tabs.js +0 -80
- data/api/public/js/bootstrap-twipsy.js +0 -310
- data/api/public/js/tests/index.html +0 -40
- data/api/public/js/tests/unit/bootstrap-alerts.js +0 -41
- data/api/public/js/tests/unit/bootstrap-buttons.js +0 -42
- data/api/public/js/tests/unit/bootstrap-dropdown.js +0 -52
- data/api/public/js/tests/unit/bootstrap-modal.js +0 -151
- data/api/public/js/tests/unit/bootstrap-popover.js +0 -76
- data/api/public/js/tests/unit/bootstrap-scrollspy.js +0 -31
- data/api/public/js/tests/unit/bootstrap-tabs.js +0 -77
- data/api/public/js/tests/unit/bootstrap-twipsy.js +0 -81
- data/api/public/js/tests/vendor/qunit.css +0 -232
- data/api/public/js/tests/vendor/qunit.js +0 -1510
- data/api/public/lib/bootstrap.less +0 -26
- data/api/public/lib/forms.less +0 -479
- data/api/public/lib/mixins.less +0 -222
- data/api/public/lib/patterns.less +0 -1060
- data/api/public/lib/reset.less +0 -141
- data/api/public/lib/scaffolding.less +0 -137
- data/api/public/lib/tables.less +0 -224
- data/api/public/lib/type.less +0 -187
- data/api/public/lib/variables.less +0 -60
- data/api/public/namey.css +0 -33
- data/api/public/ui.js +0 -55
- data/api/views/index.erb +0 -203
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 9d50b961a35208f7fdc074a1fd00eff2889c75530f03aa795cfc81d89ed51afb
|
4
|
+
data.tar.gz: 9475f71231d6b3668441befb529f074b41a17fa558bc543a072a600e1a25b236
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 14dcfd4f6ab34a69bacbed9673a7d190de08ba5bbb6bf6d1e61149dbf9f70970d08f52d4b633b8e1be7d4feb6fda3737fd19782f1d7237333223523037a0422e
|
7
|
+
data.tar.gz: 723dd9abac5baf13e16879d2e78d9c199a680bcc445d40c1e62741d5bc514ce7a68554c19c9f32861becf1b6787d2d61d31acbaf2aaa25758586cec1182d8e52
|
data/.travis.yml
CHANGED
@@ -2,7 +2,10 @@ language: ruby
|
|
2
2
|
rvm:
|
3
3
|
- 1.9.3
|
4
4
|
- 2.0.0
|
5
|
+
- 2.3.0
|
6
|
+
- 2.4.1
|
5
7
|
- jruby-head
|
6
8
|
- jruby-19mode
|
7
|
-
#
|
8
|
-
|
9
|
+
before_install: # For jruby-head to work.
|
10
|
+
- gem install bundler
|
11
|
+
- gem update bundler
|
data/Gemfile
CHANGED
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2017 Colin Mitchell
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
data/bin/namey-load-data
CHANGED
@@ -15,7 +15,7 @@ puts "Load data to #{dest}"
|
|
15
15
|
#@parser.load_female_names("data/dist.female.first")
|
16
16
|
#@parser.load_surnames("data/dist.all.last")
|
17
17
|
|
18
|
-
base_url = "http://
|
18
|
+
base_url = "http://www2.census.gov/topics/genealogy/1990surnames"
|
19
19
|
@parser.load_male_names("#{base_url}/dist.male.first")
|
20
20
|
@parser.load_female_names("#{base_url}/dist.female.first")
|
21
21
|
@parser.load_surnames("#{base_url}/dist.all.last")
|
data/lib/namey/generator.rb
CHANGED
@@ -139,13 +139,14 @@ module Namey
|
|
139
139
|
# randomly sort a result set according to the data adapter class
|
140
140
|
#
|
141
141
|
def random_sort(set)
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
142
|
+
set.order do
|
143
|
+
# this is a bit of a hack obviously, but it checks the sort of
|
144
|
+
# data engine being used to figure out how to randomly sort
|
145
|
+
if set.class.name !~ /mysql/i
|
146
|
+
random.function
|
147
|
+
else
|
148
|
+
rand.function
|
149
|
+
end
|
149
150
|
end
|
150
151
|
end
|
151
152
|
|
data/lib/namey/version.rb
CHANGED
data/namey.gemspec
CHANGED
@@ -9,7 +9,7 @@ Gem::Specification.new do |s|
|
|
9
9
|
s.email = ["colin@muffinlabs.com"]
|
10
10
|
s.homepage = "https://github.com/muffinista/namey"
|
11
11
|
s.summary = %q{Simple name generator based on US Census Data}
|
12
|
-
s.description = %q{Simple name generator, which can generate
|
12
|
+
s.description = %q{Simple name generator, which can generate names based on US Census Data}
|
13
13
|
|
14
14
|
s.rubyforge_project = "namey"
|
15
15
|
|
@@ -25,21 +25,11 @@ Gem::Specification.new do |s|
|
|
25
25
|
s.platform = Gem::Platform::RUBY
|
26
26
|
sqlite = "sqlite3"
|
27
27
|
end
|
28
|
-
|
29
|
-
if RUBY_VERSION < "1.9"
|
30
|
-
spec.add_dependency "activesupport", "~> 3.0.11"
|
31
|
-
end
|
32
28
|
|
33
|
-
#s.specification_version = 3
|
34
|
-
|
35
29
|
s.add_development_dependency(%q<rake>, [">= 0"])
|
36
|
-
s.add_development_dependency(%q<rspec>, [">=
|
30
|
+
s.add_development_dependency(%q<rspec>, [">= 3"])
|
37
31
|
|
38
|
-
s.add_runtime_dependency(%q<sequel>, ["
|
32
|
+
s.add_runtime_dependency(%q<sequel>, ["~> 5.73.0"])
|
39
33
|
s.add_runtime_dependency(sqlite, [">= 0"])
|
40
|
-
s.add_development_dependency(%q<shoulda>, [">= 0"])
|
41
34
|
s.add_development_dependency(%q<yard>, [">= 0"])
|
42
35
|
end
|
43
|
-
|
44
|
-
|
45
|
-
# http://www.census.gov/genealogy/names/
|
data/spec/generator_spec.rb
CHANGED
@@ -2,7 +2,8 @@ require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
|
2
2
|
|
3
3
|
describe "Namey::Generator" do
|
4
4
|
before(:each) do
|
5
|
-
|
5
|
+
#@uri = "#{'jdbc:' if RUBY_PLATFORM == 'java'}#{Namey.db_path}"
|
6
|
+
@uri = Namey.db_path
|
6
7
|
@gen = Namey::Generator.new(@uri)
|
7
8
|
end
|
8
9
|
|
@@ -15,47 +16,57 @@ describe "Namey::Generator" do
|
|
15
16
|
|
16
17
|
describe "name" do
|
17
18
|
it "should pass params to generate" do
|
18
|
-
@gen.
|
19
|
+
expect(@gen).to receive(:generate).with(:frequency => :common, :with_surname => true)
|
19
20
|
@gen.name
|
20
21
|
end
|
21
22
|
end
|
22
23
|
|
23
24
|
describe "male" do
|
24
25
|
it "should pass params to generate" do
|
25
|
-
@gen.
|
26
|
+
expect(@gen).to receive(:generate).with(:type => :male, :frequency => :common, :with_surname => true)
|
26
27
|
@gen.male
|
27
28
|
end
|
28
29
|
end
|
29
30
|
|
30
31
|
describe "female" do
|
31
32
|
it "should pass params to generate" do
|
32
|
-
@gen.
|
33
|
+
expect(@gen).to receive(:generate).with(:type => :female, :frequency => :common, :with_surname => true)
|
33
34
|
@gen.female
|
34
35
|
end
|
35
36
|
end
|
36
37
|
|
37
38
|
describe "surname" do
|
38
39
|
it "should pass params to generate" do
|
39
|
-
@gen.
|
40
|
+
expect(@gen).to receive(:generate).with(:type => :surname, :frequency => :common)
|
40
41
|
@gen.surname
|
41
42
|
end
|
42
43
|
end
|
43
44
|
|
44
45
|
describe "generate" do
|
45
46
|
it "should pass to get_name once for surnames" do
|
46
|
-
@gen.
|
47
|
-
@gen.generate(:type => :surname).
|
47
|
+
expect(@gen).to receive(:get_name).with(:surname, 0, 20).and_return("Chuck")
|
48
|
+
expect(@gen.generate(:type => :surname)).to eq("Chuck")
|
48
49
|
end
|
49
50
|
|
50
51
|
it "should pass to get_name once when with_surname is false" do
|
51
|
-
@gen.
|
52
|
-
@gen.generate(:type => :male, :with_surname => false).
|
52
|
+
expect(@gen).to receive(:get_name).with(:male, 0, 20).and_return("Chuck")
|
53
|
+
expect(@gen.generate(:type => :male, :with_surname => false)).to eq("Chuck")
|
53
54
|
end
|
54
55
|
|
55
56
|
it "should pass to get_name twice for full names" do
|
56
|
-
@gen.
|
57
|
-
@gen.
|
58
|
-
@gen.generate(:type => :male).
|
57
|
+
expect(@gen).to receive(:get_name).with(:male, 0, 20).and_return("Chuck")
|
58
|
+
expect(@gen).to receive(:get_name).with(:surname, 0, 20).and_return("Smith")
|
59
|
+
expect(@gen.generate(:type => :male)).to eq("Chuck Smith")
|
60
|
+
end
|
61
|
+
|
62
|
+
it "should work" do
|
63
|
+
expect(@gen.generate).to_not be_nil
|
64
|
+
end
|
65
|
+
|
66
|
+
it "should work even for bad frequencies" do
|
67
|
+
expect(@gen.generate(:frequency => :foo)).to_not be_nil
|
68
|
+
expect(@gen.generate(:min_freq => 50, :max_freq => 2)).to_not be_nil
|
59
69
|
end
|
60
70
|
end
|
71
|
+
|
61
72
|
end
|
data/specs.watchr
ADDED
@@ -0,0 +1,60 @@
|
|
1
|
+
# Run me with:
|
2
|
+
#
|
3
|
+
# $ watchr specs.watchr
|
4
|
+
|
5
|
+
# --------------------------------------------------
|
6
|
+
# Convenience Methods
|
7
|
+
# --------------------------------------------------
|
8
|
+
def all_spec_files
|
9
|
+
Dir['spec/**/*_spec.rb']
|
10
|
+
end
|
11
|
+
|
12
|
+
def run_spec_matching(thing_to_match)
|
13
|
+
matches = all_spec_files.grep(/#{thing_to_match}/i)
|
14
|
+
if matches.empty?
|
15
|
+
puts "Sorry, thanks for playing, but there were no matches for #{thing_to_match}"
|
16
|
+
else
|
17
|
+
run matches.join(' ')
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
def run(files_to_run)
|
22
|
+
puts("Running: #{files_to_run}")
|
23
|
+
system("clear;rspec -cfs #{files_to_run}")
|
24
|
+
no_int_for_you
|
25
|
+
end
|
26
|
+
|
27
|
+
def run_all_specs
|
28
|
+
run(all_spec_files.join(' '))
|
29
|
+
end
|
30
|
+
|
31
|
+
# --------------------------------------------------
|
32
|
+
# Watchr Rules
|
33
|
+
# --------------------------------------------------
|
34
|
+
watch('^spec/(.*)_spec\.rb') { |m| run_spec_matching(m[1]) }
|
35
|
+
#watch('^spec/controllers/(.*)_spec\.rb') { |m| run_spec_matching(m[1]) }
|
36
|
+
|
37
|
+
watch("^lib/chatterbot/(.*)\.rb") { |m| run_spec_matching(m[1]) }
|
38
|
+
#watch('^spec/spec_helper\.rb') { run_all_specs }
|
39
|
+
|
40
|
+
# --------------------------------------------------
|
41
|
+
# Signal Handling
|
42
|
+
# --------------------------------------------------
|
43
|
+
|
44
|
+
def no_int_for_you
|
45
|
+
@sent_an_int = nil
|
46
|
+
end
|
47
|
+
|
48
|
+
Signal.trap 'INT' do
|
49
|
+
if @sent_an_int then
|
50
|
+
puts " A second INT? Ok, I get the message. Shutting down now."
|
51
|
+
exit
|
52
|
+
else
|
53
|
+
puts " Did you just send me an INT? Ugh. I'll quit for real if you do it again."
|
54
|
+
@sent_an_int = true
|
55
|
+
Kernel.sleep 1.5
|
56
|
+
run_all_specs
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
run_all_specs
|
metadata
CHANGED
@@ -1,101 +1,86 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: namey
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.13
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Colin Mitchell
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-12-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '0'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rspec
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
33
|
+
version: '3'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version:
|
40
|
+
version: '3'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: sequel
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version:
|
47
|
+
version: 5.73.0
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version:
|
54
|
+
version: 5.73.0
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: sqlite3
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- -
|
59
|
+
- - ">="
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '0'
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- -
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version: '0'
|
69
|
-
- !ruby/object:Gem::Dependency
|
70
|
-
name: shoulda
|
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
|
-
- - '>='
|
66
|
+
- - ">="
|
81
67
|
- !ruby/object:Gem::Version
|
82
68
|
version: '0'
|
83
69
|
- !ruby/object:Gem::Dependency
|
84
70
|
name: yard
|
85
71
|
requirement: !ruby/object:Gem::Requirement
|
86
72
|
requirements:
|
87
|
-
- -
|
73
|
+
- - ">="
|
88
74
|
- !ruby/object:Gem::Version
|
89
75
|
version: '0'
|
90
76
|
type: :development
|
91
77
|
prerelease: false
|
92
78
|
version_requirements: !ruby/object:Gem::Requirement
|
93
79
|
requirements:
|
94
|
-
- -
|
80
|
+
- - ">="
|
95
81
|
- !ruby/object:Gem::Version
|
96
82
|
version: '0'
|
97
|
-
description: Simple name generator, which can generate
|
98
|
-
US Census Data
|
83
|
+
description: Simple name generator, which can generate names based on US Census Data
|
99
84
|
email:
|
100
85
|
- colin@muffinlabs.com
|
101
86
|
executables:
|
@@ -104,72 +89,12 @@ executables:
|
|
104
89
|
extensions: []
|
105
90
|
extra_rdoc_files: []
|
106
91
|
files:
|
107
|
-
- .gitignore
|
108
|
-
- .travis.yml
|
92
|
+
- ".gitignore"
|
93
|
+
- ".travis.yml"
|
109
94
|
- Gemfile
|
95
|
+
- LICENSE
|
110
96
|
- README.markdown
|
111
97
|
- Rakefile
|
112
|
-
- api/Gemfile
|
113
|
-
- api/config.ru.example
|
114
|
-
- api/namey_app.rb
|
115
|
-
- api/public/LICENSE
|
116
|
-
- api/public/Makefile
|
117
|
-
- api/public/README.md
|
118
|
-
- api/public/ajax-loader.gif
|
119
|
-
- api/public/api.js
|
120
|
-
- api/public/bootstrap.css
|
121
|
-
- api/public/bootstrap.min.css
|
122
|
-
- api/public/docs/assets/css/docs.css
|
123
|
-
- api/public/docs/assets/ico/bootstrap-apple-114x114.png
|
124
|
-
- api/public/docs/assets/ico/bootstrap-apple-57x57.png
|
125
|
-
- api/public/docs/assets/ico/bootstrap-apple-72x72.png
|
126
|
-
- api/public/docs/assets/ico/favicon.ico
|
127
|
-
- api/public/docs/assets/img/bird.png
|
128
|
-
- api/public/docs/assets/img/browsers.png
|
129
|
-
- api/public/docs/assets/img/example-diagram-01.png
|
130
|
-
- api/public/docs/assets/img/example-diagram-02.png
|
131
|
-
- api/public/docs/assets/img/example-diagram-03.png
|
132
|
-
- api/public/docs/assets/img/grid-18px.png
|
133
|
-
- api/public/docs/assets/img/twitter-logo-no-bird.png
|
134
|
-
- api/public/docs/assets/js/application.js
|
135
|
-
- api/public/docs/assets/js/google-code-prettify/prettify.css
|
136
|
-
- api/public/docs/assets/js/google-code-prettify/prettify.js
|
137
|
-
- api/public/docs/index.html
|
138
|
-
- api/public/docs/javascript.html
|
139
|
-
- api/public/examples/container-app.html
|
140
|
-
- api/public/examples/fluid.html
|
141
|
-
- api/public/examples/hero.html
|
142
|
-
- api/public/js/bootstrap-alerts.js
|
143
|
-
- api/public/js/bootstrap-buttons.js
|
144
|
-
- api/public/js/bootstrap-dropdown.js
|
145
|
-
- api/public/js/bootstrap-modal.js
|
146
|
-
- api/public/js/bootstrap-popover.js
|
147
|
-
- api/public/js/bootstrap-scrollspy.js
|
148
|
-
- api/public/js/bootstrap-tabs.js
|
149
|
-
- api/public/js/bootstrap-twipsy.js
|
150
|
-
- api/public/js/tests/index.html
|
151
|
-
- api/public/js/tests/unit/bootstrap-alerts.js
|
152
|
-
- api/public/js/tests/unit/bootstrap-buttons.js
|
153
|
-
- api/public/js/tests/unit/bootstrap-dropdown.js
|
154
|
-
- api/public/js/tests/unit/bootstrap-modal.js
|
155
|
-
- api/public/js/tests/unit/bootstrap-popover.js
|
156
|
-
- api/public/js/tests/unit/bootstrap-scrollspy.js
|
157
|
-
- api/public/js/tests/unit/bootstrap-tabs.js
|
158
|
-
- api/public/js/tests/unit/bootstrap-twipsy.js
|
159
|
-
- api/public/js/tests/vendor/qunit.css
|
160
|
-
- api/public/js/tests/vendor/qunit.js
|
161
|
-
- api/public/lib/bootstrap.less
|
162
|
-
- api/public/lib/forms.less
|
163
|
-
- api/public/lib/mixins.less
|
164
|
-
- api/public/lib/patterns.less
|
165
|
-
- api/public/lib/reset.less
|
166
|
-
- api/public/lib/scaffolding.less
|
167
|
-
- api/public/lib/tables.less
|
168
|
-
- api/public/lib/type.less
|
169
|
-
- api/public/lib/variables.less
|
170
|
-
- api/public/namey.css
|
171
|
-
- api/public/ui.js
|
172
|
-
- api/views/index.erb
|
173
98
|
- bin/namey-load-data
|
174
99
|
- bin/random-name
|
175
100
|
- data/names.db
|
@@ -180,28 +105,29 @@ files:
|
|
180
105
|
- namey.gemspec
|
181
106
|
- spec/generator_spec.rb
|
182
107
|
- spec/spec_helper.rb
|
108
|
+
- specs.watchr
|
183
109
|
homepage: https://github.com/muffinista/namey
|
184
110
|
licenses: []
|
185
111
|
metadata: {}
|
186
|
-
post_install_message:
|
112
|
+
post_install_message:
|
187
113
|
rdoc_options: []
|
188
114
|
require_paths:
|
189
115
|
- lib
|
190
116
|
required_ruby_version: !ruby/object:Gem::Requirement
|
191
117
|
requirements:
|
192
|
-
- -
|
118
|
+
- - ">="
|
193
119
|
- !ruby/object:Gem::Version
|
194
120
|
version: '0'
|
195
121
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
196
122
|
requirements:
|
197
|
-
- -
|
123
|
+
- - ">="
|
198
124
|
- !ruby/object:Gem::Version
|
199
125
|
version: '0'
|
200
126
|
requirements: []
|
201
|
-
|
202
|
-
|
203
|
-
signing_key:
|
127
|
+
rubygems_version: 3.3.7
|
128
|
+
signing_key:
|
204
129
|
specification_version: 4
|
205
130
|
summary: Simple name generator based on US Census Data
|
206
|
-
test_files:
|
207
|
-
|
131
|
+
test_files:
|
132
|
+
- spec/generator_spec.rb
|
133
|
+
- spec/spec_helper.rb
|
data/api/Gemfile
DELETED
data/api/config.ru.example
DELETED
data/api/namey_app.rb
DELETED
@@ -1,78 +0,0 @@
|
|
1
|
-
require 'sinatra'
|
2
|
-
require 'sinatra/sequel'
|
3
|
-
require 'namey'
|
4
|
-
require 'json'
|
5
|
-
|
6
|
-
class Hash
|
7
|
-
def symbolize_keys!
|
8
|
-
keys.each do |key|
|
9
|
-
self[(key.to_sym rescue key) || key] = delete(key)
|
10
|
-
end
|
11
|
-
self
|
12
|
-
end
|
13
|
-
end
|
14
|
-
|
15
|
-
|
16
|
-
# Establish the database connection; or, omit this and use the DATABASE_URL
|
17
|
-
# environment variable as the connection string:
|
18
|
-
#set :database, 'mysql://username@hostname/database'
|
19
|
-
|
20
|
-
|
21
|
-
#
|
22
|
-
# migration for logging names
|
23
|
-
#
|
24
|
-
migration "create the generated_names table" do
|
25
|
-
database.create_table :generated_names do
|
26
|
-
primary_key :id
|
27
|
-
String :name, :null => false
|
28
|
-
timestamp :created_at, :null => false
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
get '/' do
|
33
|
-
# use index.haml for readme
|
34
|
-
erb :index #, :layout => :index
|
35
|
-
end
|
36
|
-
|
37
|
-
get '/name.?:format?' do
|
38
|
-
@generator = Namey::Generator.new(database)
|
39
|
-
|
40
|
-
opts = {
|
41
|
-
:frequency => :common
|
42
|
-
}.merge(params.symbolize_keys!)
|
43
|
-
|
44
|
-
if params[:with_surname] == "true"
|
45
|
-
opts[:with_surname] = true
|
46
|
-
else
|
47
|
-
opts[:with_surname] = false
|
48
|
-
end
|
49
|
-
|
50
|
-
[:type, :frequency].each do |key|
|
51
|
-
opts[key] = opts[key].to_sym if opts.has_key?(key)
|
52
|
-
end
|
53
|
-
|
54
|
-
opts.delete(:type) if ! [:male, :female, :surname].include?(opts[:type])
|
55
|
-
|
56
|
-
count = (params.delete(:count) || 1).to_i
|
57
|
-
count = 10 if count > 10
|
58
|
-
|
59
|
-
names = 1.upto(count).collect do
|
60
|
-
@generator.generate(opts)
|
61
|
-
end.compact
|
62
|
-
|
63
|
-
names.each do |name|
|
64
|
-
database[:generated_names].insert(:name => name)
|
65
|
-
end
|
66
|
-
|
67
|
-
if params[:format] == "json"
|
68
|
-
content_type :json, 'charset' => 'utf-8'
|
69
|
-
tmp = JSON.generate names
|
70
|
-
if params[:callback]
|
71
|
-
"#{params[:callback]}(#{tmp});"
|
72
|
-
else
|
73
|
-
tmp
|
74
|
-
end
|
75
|
-
else
|
76
|
-
["<ul>", names.collect { |n| "<li>#{n}</li>" }.join(" "), "</ul>"].join("")
|
77
|
-
end
|
78
|
-
end
|