turboname 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,5 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.0.0
4
+ - 1.9.3
5
+ - 1.8.7
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # Turboname
1
+ # Turboname [![Build Status](https://travis-ci.org/eljojo/turboname.png?branch=master)](https://travis-ci.org/eljojo/turboname)
2
2
 
3
3
  Do you have a project that needs a short domain name, while maintaining some sense of redability?
4
4
  This little tool will choose some random word in spanish or english, mix syllables, vocals until it finds a .com domain name available for that strange, made up-word.
@@ -8,7 +8,7 @@ While most of the results aren't that exiting you can find a gem watching the re
8
8
  Based on [Megoforce](https://github.com/megoforce/turboname)'s Turboname
9
9
 
10
10
 
11
- ## From the command line
11
+ ## Usage from the command line
12
12
  #### Installation
13
13
  fire up your terminal and run:
14
14
 
@@ -42,6 +42,26 @@ corcar.se IS available
42
42
  All the results are saved to a file called ```names.txt```.
43
43
  To close the app just press ```ctrl + c```
44
44
 
45
+ #### Domainify specific words
46
+
47
+ You can also give it some words to domainify. (Thanks [@jacobaweiss](https://github.com/eljojo/turboname/pull/1)!)
48
+
49
+ $ turboname peanutbutter andjelly
50
+
51
+ and get back
52
+
53
+ ```
54
+ ________ _____ ___ ____ _ _____ __ _______
55
+ /_ __/ / / / _ \/ _ )/ __ \/ |/ / _ | / |/ / __/
56
+ / / / /_/ / , _/ _ / /_/ / / __ |/ /|_/ / _/
57
+ /_/ \____/_/|_/____/\____/_/|_/_/ |_/_/ /_/___/
58
+ finding a domain name for you since 1825
59
+ peanutbutter.com is not available
60
+ peanutbutt.er is not available
61
+ andjelly.com is not available
62
+ andjel.ly IS available
63
+ ```
64
+
45
65
  #### You might also need
46
66
  - Precious time
47
67
  - Frustration tolerance.
data/Rakefile CHANGED
@@ -1 +1,5 @@
1
1
  require "bundler/gem_tasks"
2
+ require 'rspec/core/rake_task'
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+ task(:default => :spec)
@@ -11,11 +11,20 @@ puts ' / / / /_/ / , _/ _ / /_/ / / __ |/ /|_/ / _/ '
11
11
  puts '/_/ \____/_/|_/____/\____/_/|_/_/ |_/_/ /_/___/ '
12
12
  puts " finding a domain name for you since #{1800 + rand(100)}"
13
13
 
14
- dictionary = Turboname::Random.new
14
+ if ARGV.length > 0
15
+ ARGV.each do |arg|
16
+ name = Turboname::Domain.new(:from => arg.to_s)
17
+ name.save if name.available?
18
+ tld = name.tldize
19
+ name.save(tld) if tld and name.available?(tld)
20
+ end
21
+ else
22
+ dictionary = Turboname::Random.new
15
23
 
16
- 100999032982389.times do
17
- name = Turboname::Domain.new(:from => dictionary)
18
- name.save if name.length < 15 and name.available?
19
- tld = name.tldize
20
- name.save(tld) if tld and name.length < 15 and name.available?(tld)
24
+ 100999032982389.times do
25
+ name = Turboname::Domain.new(:from => dictionary)
26
+ name.save if name.length < 15 and name.available?
27
+ tld = name.tldize
28
+ name.save(tld) if tld and name.length < 15 and name.available?(tld)
29
+ end
21
30
  end
@@ -1,71 +1,14 @@
1
1
  require "turboname/version"
2
+ require "turboname/domain"
3
+ require "turboname/dictionary"
4
+ require "turboname/random_dictionary"
2
5
  require "whois"
3
6
 
4
7
  module Turboname
8
+ # all the logic is in the other files
5
9
 
10
+ # helper
6
11
  def self.path
7
12
  File.dirname(__FILE__)
8
13
  end
9
-
10
- class Domain
11
- CountryTLDs = %w{ac ad ae af ag ai al am an ao aq ar as at au aw ax az ba bb bd be bf bg bh bi bj bm bn bo br bs bt bu bv bw by bz ca cc cd cf cg ch ci ck cl cm cn co cr cs cu cv cx cy cz de dj dk dm do dz ec ee eg eh er es et eu fi fj fk fm fo fr ga gb gd ge gf gg gh gi gl gm gn gp gq gr gs gt gu gw gy hk hm hn hr ht hu id ie il im in io iq ir is it je jm jo jp ke kg kh ki km kn kp kr kw ky kz la lb lc li lk lr ls lt lu lv ly ma mc md me mg mh mk ml mm mn mo mp mq mr ms mt mu mv mw mx my mz na nc ne nf ng ni nl no np nr nu nz om pa pe pf pg ph pk pl pm pn pr ps pt pw py qa re ro rs ru rw sa sb sc sd se sg sh si sj sk sl sm sn so sr st su sv sy sz tc td tf tg tj tk tl tm tn to tp tr tt tv tw tz ua ug uk us uy uz va vc ve vg vi vn vu wf ws ye yt yu za zm zw}
12
-
13
- attr_accessor :name
14
-
15
- def initialize opts = {}
16
- self.name = opts[:from].is_a?(Dictionary) ? opts[:from].get : opts[:from] if opts[:from]
17
- end
18
-
19
- # let's remove the tld at the end of the domain. eljojo -> eljo.jo | asdfk -> asdfk.jo
20
- def with_tld tld
21
- @name[-tld.length..-1] == tld ? @name[0..-tld.length-1] + ".#{tld}" : "#{@name}.#{tld}"
22
- end
23
-
24
- def save tld = 'com'
25
- `echo "#{with_tld(tld)}" >> names.txt`
26
- end
27
-
28
- def available? tld = nil
29
- tld = 'com' if tld.nil?
30
- name_with_tld = with_tld(tld)
31
- print name_with_tld
32
- begin
33
- domain = Whois.whois(name_with_tld)
34
- available = domain.available?
35
- rescue
36
- available = false
37
- end
38
- puts "#{' '*(25 - name_with_tld.length)}#{available ? 'IS' : 'is not'} available"
39
- available
40
- end
41
-
42
- def tldize
43
- last_letters = self.name[-2..-1]
44
- last_letters if CountryTLDs.include?(last_letters)
45
- end
46
-
47
- # this will not include the tld
48
- def to_s
49
- @name
50
- end
51
-
52
- def length
53
- @name.length
54
- end
55
- end
56
-
57
- class Dictionary # maybe dictionary is not a good word
58
- def get; ''; end
59
- end
60
-
61
- class Random < Dictionary
62
- def get
63
- vowels = ["a","e","i","o","u"]
64
- line = File.readlines(File.join(Turboname::path, 'dictionary.txt'))[rand(435000)-1].gsub("\n","")
65
- rand(20).times do
66
- line = line.gsub(vowels.shuffle.first, vowels.shuffle.first)
67
- end
68
- line
69
- end
70
- end
71
14
  end
@@ -0,0 +1,7 @@
1
+ module Turboname
2
+ # a turboname dictionary is a class gets instantiated and is supposed to respond to the :get message with a domain name.
3
+
4
+ class Dictionary
5
+ def get; ''; end
6
+ end
7
+ end
@@ -0,0 +1,48 @@
1
+ module Turboname
2
+ class Domain
3
+ CountryTLDs = %w{ac ad ae af ag ai al am an ao aq ar as at au aw ax az ba bb bd be bf bg bh bi bj bm bn bo br bs bt bu bv bw by bz ca cc cd cf cg ch ci ck cl cm cn co cr cs cu cv cx cy cz de dj dk dm do dz ec ee eg eh er es et eu fi fj fk fm fo fr ga gb gd ge gf gg gh gi gl gm gn gp gq gr gs gt gu gw gy hk hm hn hr ht hu id ie il im in io iq ir is it je jm jo jp ke kg kh ki km kn kp kr kw ky kz la lb lc li lk lr ls lt lu lv ly ma mc md me mg mh mk ml mm mn mo mp mq mr ms mt mu mv mw mx my mz na nc ne nf ng ni nl no np nr nu nz om pa pe pf pg ph pk pl pm pn pr ps pt pw py qa re ro rs ru rw sa sb sc sd se sg sh si sj sk sl sm sn so sr st su sv sy sz tc td tf tg tj tk tl tm tn to tp tr tt tv tw tz ua ug uk us uy uz va vc ve vg vi vn vu wf ws ye yt yu za zm zw}
4
+
5
+ attr_accessor :name
6
+
7
+ def initialize opts = {}
8
+ self.name = opts[:from].respond_to?(:get) ? opts[:from].get : opts[:from] if opts[:from]
9
+ end
10
+
11
+ # let's remove the tld at the end of the domain. eljojo -> eljo.jo | asdfk -> asdfk.jo
12
+ def with_tld tld
13
+ @name[-tld.length..-1] == tld ? @name[0..-tld.length-1] + ".#{tld}" : "#{@name}.#{tld}"
14
+ end
15
+
16
+ def save tld = 'com'
17
+ `echo "#{with_tld(tld)}" >> names.txt`
18
+ end
19
+
20
+ def available? tld = nil
21
+ tld = 'com' if tld.nil?
22
+ name_with_tld = with_tld(tld)
23
+ print name_with_tld
24
+ begin
25
+ domain = Whois.whois(name_with_tld)
26
+ available = domain.available?
27
+ rescue
28
+ available = false
29
+ end
30
+ puts "#{' '*(25 - name_with_tld.length)}#{available ? 'IS' : 'is not'} available"
31
+ available
32
+ end
33
+
34
+ def tldize
35
+ last_letters = self.name[-2..-1]
36
+ last_letters if CountryTLDs.include?(last_letters)
37
+ end
38
+
39
+ # this will not include the tld
40
+ def to_s
41
+ @name
42
+ end
43
+
44
+ def length
45
+ @name.length
46
+ end
47
+ end
48
+ end
@@ -0,0 +1,13 @@
1
+ module Turboname
2
+ class Random < Dictionary
3
+ # let's get a random word out of the dictionary and modify it, also randomly
4
+ def get
5
+ vowels = ["a","e","i","o","u"]
6
+ line = File.readlines(File.join(Turboname::path, 'dictionary.txt'))[rand(435000)-1].gsub("\n","")
7
+ rand(20).times do
8
+ line = line.gsub(vowels.shuffle.first, vowels.shuffle.first)
9
+ end
10
+ line
11
+ end
12
+ end
13
+ end
@@ -1,3 +1,3 @@
1
1
  module Turboname
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
@@ -0,0 +1,13 @@
1
+ require 'turboname'
2
+
3
+ # http://stackoverflow.com/questions/1819614/how-do-i-globally-configure-rspec-to-keep-the-color-and-format-specdoc-o
4
+ RSpec.configure do |config|
5
+ # Use color in STDOUT
6
+ config.color_enabled = true
7
+
8
+ # Use color not only in STDOUT but also in pagers and files
9
+ config.tty = true
10
+
11
+ # Use the specified formatter
12
+ config.formatter = :documentation # :progress, :html, :textmate
13
+ end
@@ -0,0 +1,24 @@
1
+ require 'spec_helper'
2
+ describe Turboname::Dictionary do
3
+
4
+ # Base Dictionary. returns nothing.
5
+ context 'Base Dictionary' do
6
+ it "responds to get" do
7
+ @dictionary = Turboname::Dictionary.new
8
+ @dictionary.should respond_to :get
9
+ end
10
+ end
11
+
12
+ # random dictionary, based on /lib/dictionary.txt
13
+ context 'Random Dictionary' do
14
+ before do
15
+ @dictionary = Turboname::Random.new
16
+ end
17
+ it "responds to get" do
18
+ @dictionary.should respond_to :get
19
+ end
20
+ it "returns a word" do
21
+ @dictionary.get.should =~ /[\w]+/
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,45 @@
1
+ require 'spec_helper'
2
+ describe Turboname::Domain do
3
+ context 'basic functionality' do
4
+ it "gets the name out of regular strings" do
5
+ domain = Turboname::Domain.new(:from => 'pineapple')
6
+ domain.name.should == 'pineapple'
7
+ end
8
+ it "gets the name out of objects that respond to :get" do
9
+ dictionary = Turboname::Random.new
10
+ domain = Turboname::Domain.new(:from => dictionary)
11
+ domain.name.should =~ /[\w]+/
12
+ end
13
+ it "adds the tld at the end of a domain when it matches" do
14
+ domain = Turboname::Domain.new(:from => 'pineapple')
15
+ domain.with_tld('apple').should == 'pine.apple'
16
+ domain.with_tld('orange').should == 'pineapple.orange'
17
+ end
18
+ it "responds to :to_s" do
19
+ domain = Turboname::Domain.new(:from => 'pineapple')
20
+ domain.to_s.should == 'pineapple'
21
+ domain.to_s.length.should == 'pineapple'.length
22
+ end
23
+ end
24
+ context "TLDs" do
25
+ it "finds TLDs at the end of domains, when they exist" do
26
+ domain = Turboname::Domain.new(:from => 'turboname')
27
+ domain.tldize.should == 'me'
28
+ end
29
+ it "finds TLDs at the end of domains, when they don't exist" do
30
+ domain = Turboname::Domain.new(:from => 'turbona.xx')
31
+ domain.tldize.should be_nil
32
+ end
33
+ end
34
+ context "WHOIS" do
35
+ it "tells if a domain is available" do
36
+ # please don't break this test by buying this domain ;)
37
+ domain = Turboname::Domain.new(:from => 'eljojorsasdffasdasd')
38
+ domain.available?.should == true
39
+ end
40
+ it "tells if a domain is NOT available" do
41
+ domain = Turboname::Domain.new(:from => 'turbona')
42
+ domain.available?('me').should == false
43
+ end
44
+ end
45
+ end
@@ -20,6 +20,8 @@ Gem::Specification.new do |spec|
20
20
 
21
21
  spec.add_development_dependency "bundler", "~> 1.3"
22
22
  spec.add_development_dependency "rake"
23
+ spec.add_development_dependency "rspec"
24
+ spec.add_development_dependency "shoulda"
23
25
 
24
26
  spec.add_dependency('whois', '>= 2.0.0') # we should actually test with this version. i just picked a random one
25
27
  end
metadata CHANGED
@@ -1,18 +1,20 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: turboname
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
+ prerelease:
5
6
  platform: ruby
6
7
  authors:
7
8
  - José Tomás Albornoz
8
9
  autorequire:
9
10
  bindir: bin
10
11
  cert_chain: []
11
- date: 2013-03-16 00:00:00.000000000 Z
12
+ date: 2013-03-18 00:00:00.000000000 Z
12
13
  dependencies:
13
14
  - !ruby/object:Gem::Dependency
14
15
  name: bundler
15
16
  requirement: !ruby/object:Gem::Requirement
17
+ none: false
16
18
  requirements:
17
19
  - - ~>
18
20
  - !ruby/object:Gem::Version
@@ -20,6 +22,7 @@ dependencies:
20
22
  type: :development
21
23
  prerelease: false
22
24
  version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
23
26
  requirements:
24
27
  - - ~>
25
28
  - !ruby/object:Gem::Version
@@ -27,29 +30,65 @@ dependencies:
27
30
  - !ruby/object:Gem::Dependency
28
31
  name: rake
29
32
  requirement: !ruby/object:Gem::Requirement
33
+ none: false
30
34
  requirements:
31
- - - ! '>='
35
+ - - '>='
32
36
  - !ruby/object:Gem::Version
33
37
  version: '0'
34
38
  type: :development
35
39
  prerelease: false
36
40
  version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
37
42
  requirements:
38
- - - ! '>='
43
+ - - '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
46
+ - !ruby/object:Gem::Dependency
47
+ name: rspec
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - '>='
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
54
+ type: :development
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ - !ruby/object:Gem::Dependency
63
+ name: shoulda
64
+ requirement: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - '>='
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
70
+ type: :development
71
+ prerelease: false
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - '>='
39
76
  - !ruby/object:Gem::Version
40
77
  version: '0'
41
78
  - !ruby/object:Gem::Dependency
42
79
  name: whois
43
80
  requirement: !ruby/object:Gem::Requirement
81
+ none: false
44
82
  requirements:
45
- - - ! '>='
83
+ - - '>='
46
84
  - !ruby/object:Gem::Version
47
85
  version: 2.0.0
48
86
  type: :runtime
49
87
  prerelease: false
50
88
  version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
51
90
  requirements:
52
- - - ! '>='
91
+ - - '>='
53
92
  - !ruby/object:Gem::Version
54
93
  version: 2.0.0
55
94
  description: finding domain names at lightspeed
@@ -61,6 +100,7 @@ extensions: []
61
100
  extra_rdoc_files: []
62
101
  files:
63
102
  - .gitignore
103
+ - .travis.yml
64
104
  - Gemfile
65
105
  - Gemfile.lock
66
106
  - LICENSE.txt
@@ -69,31 +109,41 @@ files:
69
109
  - bin/turboname
70
110
  - lib/dictionary.txt
71
111
  - lib/turboname.rb
112
+ - lib/turboname/dictionary.rb
113
+ - lib/turboname/domain.rb
114
+ - lib/turboname/random_dictionary.rb
72
115
  - lib/turboname/version.rb
116
+ - spec/spec_helper.rb
117
+ - spec/turboname/dictionary_spec.rb
118
+ - spec/turboname/domain_spec.rb
73
119
  - turboname.gemspec
74
120
  homepage: https://github.com/eljojo/turboname
75
121
  licenses:
76
122
  - MIT
77
- metadata: {}
78
123
  post_install_message:
79
124
  rdoc_options: []
80
125
  require_paths:
81
126
  - lib
82
127
  required_ruby_version: !ruby/object:Gem::Requirement
128
+ none: false
83
129
  requirements:
84
- - - ! '>='
130
+ - - '>='
85
131
  - !ruby/object:Gem::Version
86
132
  version: '0'
87
133
  required_rubygems_version: !ruby/object:Gem::Requirement
134
+ none: false
88
135
  requirements:
89
- - - ! '>='
136
+ - - '>='
90
137
  - !ruby/object:Gem::Version
91
138
  version: '0'
92
139
  requirements: []
93
140
  rubyforge_project:
94
- rubygems_version: 2.0.3
141
+ rubygems_version: 1.8.25
95
142
  signing_key:
96
- specification_version: 4
143
+ specification_version: 3
97
144
  summary: Simple gem that searches for random domain names and tells you if they're
98
145
  available
99
- test_files: []
146
+ test_files:
147
+ - spec/spec_helper.rb
148
+ - spec/turboname/dictionary_spec.rb
149
+ - spec/turboname/domain_spec.rb
checksums.yaml DELETED
@@ -1,15 +0,0 @@
1
- ---
2
- !binary "U0hBMQ==":
3
- metadata.gz: !binary |-
4
- Y2JhYTM1MzA2MWM5Mjg3ZmZkMmY0ODdmNjliNjdlMzc5MDViNGM3Mw==
5
- data.tar.gz: !binary |-
6
- ZThlNDE0YWY2MmRkYmRjOWEwMDk3NWE2YjdkNTE1MTI1ZWE0NGM5ZA==
7
- !binary "U0hBNTEy":
8
- metadata.gz: !binary |-
9
- N2RjNjQwZGMzYmFiNWQxOGUyMTc2MzM0YzAzOWY4ZDc0MDI0Njc5OWFhOTFl
10
- ZGNmODc3YWQwZmNjMmQzNTU1YzdkYzE0MjNkNWUyZTFmYzhmZGIzMjJhYzRh
11
- ZTg2N2RjNWI5ZTY2MmZhNzY3ZGM0OWRjYWVlN2QwNjUyY2M4Njk=
12
- data.tar.gz: !binary |-
13
- YjIyYWU5YjFhYmUwYWVjNmRhNmVjZGFiYzIyMDQ0N2QzNGIwNTJmMTgzNjlj
14
- ODk0YmEwY2I0M2M2ZGZkOTI2ODViZjFlNTk0YWQ5ZjM0Mzk3NjIzYmU5MzFi
15
- Mjk5ODMzNWZiOWQ5ZDVmMDFkYWUyNWU2YTU0ZDk2YzUyODliMjc=