domain_finder 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: ca7e5e41e81bd2b52c90a4ffd0ad9cf020985f42
4
+ data.tar.gz: 5c9f4da34ba19fcf83cd9a8c5ca4161dc3fb3f77
5
+ SHA512:
6
+ metadata.gz: c15995b123ea841df90582976e3b97b8abbd83fdfd9a5721d6d83520a8170e3387692dbefbb0c846e3ff02b4f6e262496fb0b510225617649c77ea18e68dbf5c
7
+ data.tar.gz: 941c3f2b21b4695eee95b5abda6b97f75f850dc25089b8ee18f20f3f58636e60d1b7f7048ffd0e09fbd2469affa0b03a88d32f3a191123718764c4d05bf41f59
data/.gitignore ADDED
@@ -0,0 +1,18 @@
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
+ *.idea
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --require spec_helper
2
+ --color
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in domain_finder.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 Jade McGough
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,15 @@
1
+ # Domain Finder
2
+
3
+ Say you're working on a new web project and suddenly think of a good name for it. "Well, this is sort of like Facebook, and also like Twitter," you muse. "I've got it - facetweet!"
4
+
5
+ You _could_ open up a browser tab and check domains on a registrar. Or, you could search _right in your terminal_ with Domain Finder.
6
+
7
+ ## Installation
8
+
9
+ Easy peasy lemon squeezy:
10
+
11
+ $ gem install domain_finder
12
+
13
+ ## Usage
14
+
15
+ TODO: Write usage instructions here
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
data/bin/domain ADDED
@@ -0,0 +1,9 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require_relative '../lib/domain_finder'
4
+
5
+ unless ARGV.empty?
6
+ puts DomainFinder::search(ARGV)
7
+ else
8
+ puts 'Give me a domain name plskthx'
9
+ end
@@ -0,0 +1,23 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'domain_finder/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "domain_finder"
8
+ spec.version = DomainFinder::VERSION
9
+ spec.authors = ["Jade McGough"]
10
+ spec.email = ["jade@thezets.com"]
11
+ spec.summary = %q{Domain availability checker}
12
+ spec.description = %q{Check website domain availability from the command line}
13
+ spec.homepage = "https://github.com/zetsubo/domain_finder"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files -z`.split("\x0")
17
+ spec.executables = ["domain"]
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_development_dependency "vcr", "~> 2.8"
22
+
23
+ end
@@ -0,0 +1,51 @@
1
+ require "domain_finder/version"
2
+ require 'json'
3
+ require 'net/http'
4
+
5
+ module DomainFinder
6
+
7
+ URL = 'https://domai.nr/api/json/search'
8
+
9
+ class << self
10
+ def search(domains)
11
+
12
+ results = []
13
+
14
+ domains.each do |domain|
15
+ uri = URI(URL)
16
+ params = { q: domain }
17
+ uri.query = URI.encode_www_form(params)
18
+ res = Net::HTTP.get_response(uri)
19
+
20
+ results << "** #{domain} **" if domains.size > 1
21
+
22
+ if res.is_a?(Net::HTTPSuccess)
23
+ results << parse_results(res.body)
24
+ elsif res.is_a?(Net::HTTPBadRequest)
25
+ results << "Registrar doesn't like your request. Try a different one."
26
+ else
27
+ raise "Error #{res.code} while accessing domain registrar"
28
+ end
29
+
30
+ end
31
+
32
+ results
33
+ end
34
+
35
+ private
36
+
37
+ def parse_results(results)
38
+ json = JSON.parse(results)
39
+ json['results'].map do |result|
40
+ case result['availability']
41
+ when 'available'
42
+ "○ #{result['domain']}"
43
+ when 'maybe'
44
+ "? #{result['domain']}"
45
+ else
46
+ "✘ #{result['domain']}"
47
+ end
48
+ end
49
+ end
50
+ end
51
+ end
@@ -0,0 +1,3 @@
1
+ module DomainFinder
2
+ VERSION = "0.0.1"
3
+ end
Binary file
Binary file
@@ -0,0 +1,7 @@
1
+ describe DomainFinder do
2
+
3
+ class DomainFinder
4
+
5
+ end
6
+
7
+ end
@@ -0,0 +1,17 @@
1
+ require 'domain_finder'
2
+ require 'vcr'
3
+
4
+ VCR.configure do |c|
5
+ c.cassette_library_dir = 'spec/cassettes'
6
+ c.hook_into :webmock
7
+ c.configure_rspec_metadata!
8
+ c.default_cassette_options[:record] = :new_episodes
9
+ end
10
+
11
+ RSpec.configure do |c|
12
+ config.treat_symbols_as_metadata_keys_with_true_values = true
13
+
14
+ config.expect_with :rspec do |c|
15
+ c.syntax = :expect
16
+ end
17
+ end
metadata ADDED
@@ -0,0 +1,75 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: domain_finder
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Jade McGough
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-02-10 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: vcr
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '2.8'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '2.8'
27
+ description: Check website domain availability from the command line
28
+ email:
29
+ - jade@thezets.com
30
+ executables:
31
+ - domain
32
+ extensions: []
33
+ extra_rdoc_files: []
34
+ files:
35
+ - ".gitignore"
36
+ - ".rspec"
37
+ - Gemfile
38
+ - LICENSE.txt
39
+ - README.md
40
+ - Rakefile
41
+ - bin/domain
42
+ - domain_finder.gemspec
43
+ - lib/domain_finder.rb
44
+ - lib/domain_finder/version.rb
45
+ - screenshots/domainfinder.png
46
+ - screenshots/domainfinder2.png
47
+ - spec/domain_finder_spec.rb
48
+ - spec/spec_helper.rb
49
+ homepage: https://github.com/zetsubo/domain_finder
50
+ licenses:
51
+ - MIT
52
+ metadata: {}
53
+ post_install_message:
54
+ rdoc_options: []
55
+ require_paths:
56
+ - lib
57
+ required_ruby_version: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ required_rubygems_version: !ruby/object:Gem::Requirement
63
+ requirements:
64
+ - - ">="
65
+ - !ruby/object:Gem::Version
66
+ version: '0'
67
+ requirements: []
68
+ rubyforge_project:
69
+ rubygems_version: 2.2.1
70
+ signing_key:
71
+ specification_version: 4
72
+ summary: Domain availability checker
73
+ test_files:
74
+ - spec/domain_finder_spec.rb
75
+ - spec/spec_helper.rb