namesies 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/bin/namesies +5 -0
- data/lib/namesies.rb +10 -0
- data/lib/namesies/cli.rb +22 -0
- data/lib/namesies/domain.rb +28 -0
- data/lib/namesies/reporter.rb +20 -0
- data/lib/namesies/rubygems.rb +19 -0
- data/lib/namesies/trademark.rb +34 -0
- data/lib/namesies/twitter.rb +21 -0
- data/lib/namesies/version.rb +3 -0
- metadata +138 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 249cc65c37f64700d2934e4e60d3674354d55aab
|
4
|
+
data.tar.gz: bd7d1c2571ffe6ed417674c06810852a90675d00
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: dddefc750c2ae935b46dae9777a0f189fee22ae2555d49a3fab0203bc1d5cc39d57058850333bcbb844736738c7f70c707eec36921262d47f700cb69ab546888
|
7
|
+
data.tar.gz: e898abfdc915e3b347baa9042aba3ff8886937ab16b5b08a8b6cd51254f62d860675c4924d3aef63e47dc34be77bce4f1944cc1599f5835dbde8fe1a613c9e9c
|
data/bin/namesies
ADDED
data/lib/namesies.rb
ADDED
data/lib/namesies/cli.rb
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'thor'
|
2
|
+
|
3
|
+
module Namesies
|
4
|
+
class CLI < Thor
|
5
|
+
|
6
|
+
desc "search QUERY", "search all services for QUERY"
|
7
|
+
def search(q)
|
8
|
+
puts "Searching for #{q}..."
|
9
|
+
puts "\n"
|
10
|
+
Namesies::Domain.search(q)
|
11
|
+
Namesies::Twitter.search(q)
|
12
|
+
Namesies::Trademark.search(q)
|
13
|
+
Namesies::RubyGems.search(q)
|
14
|
+
puts "\n"
|
15
|
+
end
|
16
|
+
|
17
|
+
desc "s QUERY", "alias for search QUERY"
|
18
|
+
def s(q)
|
19
|
+
search(q)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
require 'json'
|
2
|
+
require 'net/http'
|
3
|
+
|
4
|
+
module Namesies
|
5
|
+
class Domain
|
6
|
+
|
7
|
+
def self.search(query)
|
8
|
+
reporter = Namesies::Reporter.new('Domains')
|
9
|
+
|
10
|
+
response = Net::HTTP.get(URI("https://domai.nr/api/json/search?q=#{query}"))
|
11
|
+
results = JSON.parse(response)['results']
|
12
|
+
available = results.map{|d| d if d['availability'] == "available" }.compact
|
13
|
+
|
14
|
+
if available.any?
|
15
|
+
reporter.result "#{available.length} related domains available", 'green'
|
16
|
+
|
17
|
+
available.each do |domain|
|
18
|
+
reporter.recommendation domain["domain"]
|
19
|
+
end
|
20
|
+
|
21
|
+
else
|
22
|
+
reporter.result "0 related domains available", 'red'
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
require 'colorize'
|
2
|
+
|
3
|
+
module Namesies
|
4
|
+
class Reporter
|
5
|
+
attr_accessor :title
|
6
|
+
|
7
|
+
def initialize(title)
|
8
|
+
@title = title
|
9
|
+
end
|
10
|
+
|
11
|
+
def result(result, color)
|
12
|
+
color ||= 'white'
|
13
|
+
puts " #{@title}: " + result.send(color)
|
14
|
+
end
|
15
|
+
|
16
|
+
def recommendation(rec)
|
17
|
+
puts " " + rec
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
require 'gems'
|
2
|
+
|
3
|
+
module Namesies
|
4
|
+
class RubyGems
|
5
|
+
|
6
|
+
def self.search(query)
|
7
|
+
reporter = Namesies::Reporter.new('RubyGems')
|
8
|
+
gem_info = Gems.info query
|
9
|
+
|
10
|
+
if gem_info.is_a? String
|
11
|
+
reporter.result "No gem named #{query}", 'green'
|
12
|
+
else
|
13
|
+
reporter.result "gem named #{query} exists: - #{gem_info['homepage_uri']} (#{gem_info['downloads']} downloads)", 'red'
|
14
|
+
end
|
15
|
+
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
require 'mechanize'
|
2
|
+
|
3
|
+
module Namesies
|
4
|
+
class Trademark
|
5
|
+
|
6
|
+
def self.search(query)
|
7
|
+
reporter = Namesies::Reporter.new('Trademark')
|
8
|
+
agent = Mechanize.new
|
9
|
+
agent.user_agent_alias = 'Mac Safari'
|
10
|
+
|
11
|
+
page = agent.get('http://www.uspto.gov/trademarks/')
|
12
|
+
page = agent.page.links.find{ |l| l.text.match /TESS/ }.click
|
13
|
+
page = agent.page.link_with(:text => 'Basic Word Mark Search (New User)').click
|
14
|
+
|
15
|
+
form = page.form('search_text')
|
16
|
+
form.p_s_PARA2 = query
|
17
|
+
form.radiobutton_with(:value => /live/).check
|
18
|
+
form.fields.delete_at(10)
|
19
|
+
|
20
|
+
page = form.submit
|
21
|
+
|
22
|
+
if page.body.include? 'No TESS records were found'
|
23
|
+
reporter.result "No trademarks match #{query}", "green"
|
24
|
+
elsif page.body.include? 'Record 1 out of 1'
|
25
|
+
reporter.result "1 related live trademark found", "red"
|
26
|
+
else
|
27
|
+
result_count = page.body.match(/docs: (\d+) occ: (\d+)/)[1]
|
28
|
+
reporter.result "#{result_count} related live trademarks found", "red"
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'net/http'
|
2
|
+
|
3
|
+
module Namesies
|
4
|
+
class Twitter
|
5
|
+
|
6
|
+
def self.search(query)
|
7
|
+
reporter = Namesies::Reporter.new('Twitter')
|
8
|
+
response = Net::HTTP.get_response(URI("https://twitter.com/#{query}"))
|
9
|
+
|
10
|
+
case response.code
|
11
|
+
when "404"
|
12
|
+
reporter.result "@#{query} available", 'green'
|
13
|
+
when "200"
|
14
|
+
reporter.result "@#{query} unavailable", 'red'
|
15
|
+
else
|
16
|
+
reporter.result "something's wrong with twitter :("
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
21
|
+
end
|
metadata
ADDED
@@ -0,0 +1,138 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: namesies
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Tony Dewan
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2013-08-29 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: thor
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - '>='
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - '>='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: colorize
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: gems
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - '>='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: mechanize
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - '>='
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: bundler
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ~>
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '1.3'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ~>
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '1.3'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: rake
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - '>='
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - '>='
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
description: Naming things is hard. Namesies make's it a little easier.
|
98
|
+
email:
|
99
|
+
- tony.dewan@gmail.com
|
100
|
+
executables:
|
101
|
+
- namesies
|
102
|
+
extensions: []
|
103
|
+
extra_rdoc_files: []
|
104
|
+
files:
|
105
|
+
- lib/namesies.rb
|
106
|
+
- lib/namesies/version.rb
|
107
|
+
- lib/namesies/reporter.rb
|
108
|
+
- lib/namesies/cli.rb
|
109
|
+
- lib/namesies/domain.rb
|
110
|
+
- lib/namesies/twitter.rb
|
111
|
+
- lib/namesies/trademark.rb
|
112
|
+
- lib/namesies/rubygems.rb
|
113
|
+
- bin/namesies
|
114
|
+
homepage: https://github.com/tonydewan/namesies
|
115
|
+
licenses:
|
116
|
+
- MIT
|
117
|
+
metadata: {}
|
118
|
+
post_install_message:
|
119
|
+
rdoc_options: []
|
120
|
+
require_paths:
|
121
|
+
- lib
|
122
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
123
|
+
requirements:
|
124
|
+
- - '>='
|
125
|
+
- !ruby/object:Gem::Version
|
126
|
+
version: '0'
|
127
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - '>='
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0'
|
132
|
+
requirements: []
|
133
|
+
rubyforge_project:
|
134
|
+
rubygems_version: 2.0.3
|
135
|
+
signing_key:
|
136
|
+
specification_version: 4
|
137
|
+
summary: Search ALL THE THINGS when trying to name things.
|
138
|
+
test_files: []
|