fox-domain-fu 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,3 @@
1
+ /pkg
2
+ /doc
3
+ *.gem
data/LICENCE ADDED
@@ -0,0 +1,21 @@
1
+ Copyright (c) 2009 Sasa Brankovic
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21
+
@@ -0,0 +1,25 @@
1
+ = domain-fu
2
+
3
+ Console app and a library for checking domain availability.
4
+
5
+ You may use it to find wheter a particular name of interest is available or taken by those !$##!! domain squatters. Domain-fu will attempt to combine the name you're looking for with the most common TLDs, as well as attempt to {domain hack}[http://en.wikipedia.org/wiki/Domain_hack].
6
+
7
+ == Install
8
+
9
+ sudo gem install fox-domain-fu -s http://gems.github.com
10
+
11
+ == Usage
12
+
13
+ domain-fu [DOMAINS...]
14
+
15
+ for usage in your own apps do something like this:
16
+
17
+ require 'domain-fu'
18
+ include DomainFu
19
+
20
+ # Check wheter a domain exists
21
+ Domain.new("piratespeopleparty.com").exists? => false
22
+
23
+ # Try forming a domain hacked name
24
+ hacked_domains 'linkedin', %w(me ja in) => [#<DomainFu::Domain:0x7f036ca78368 @name="linked.in">]
25
+
@@ -0,0 +1,16 @@
1
+ require 'rubygems'
2
+ require 'rake'
3
+
4
+ begin
5
+ require 'jeweler'
6
+ Jeweler::Tasks.new do |gemspec|
7
+ gemspec.name = 'domain-fu'
8
+ gemspec.summary = 'Console app and a library for checking domain availability.'
9
+ gemspec.email = 'sasa.brankovic@inet.hr'
10
+ gemspec.homepage = 'http://github.com/fox/domain-fu'
11
+ gemspec.authors = ['Sasa Brankovic']
12
+ gemspec.rdoc_options = ['--main', 'README.rdoc']
13
+ end
14
+ rescue LoadError
15
+ puts "Jeweler not available. Install it with: sudo gem install technicalpickles-jeweler -s http://gems.github.com"
16
+ end
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.1.0
@@ -0,0 +1,35 @@
1
+ #!/usr/bin/ruby
2
+ require 'rubygems'
3
+ require 'domain-fu'
4
+
5
+ $:.unshift File.dirname(__FILE__) + '/../lib'
6
+
7
+
8
+ unless ARGV[0]
9
+ puts "usage: #{File.basename($0)} [DOMAINS...]"
10
+ exit
11
+ end
12
+
13
+ include DomainFu
14
+
15
+ TLDS = %w(biz com info name net org)
16
+ HACK_TLDS = TLDS + %w(hr me it us cc de us)
17
+
18
+ ARGV.each do
19
+ |name|
20
+
21
+ domains = Array.new
22
+ if name.include?'.'
23
+ domains << Domain.new(name)
24
+ else
25
+ domains += TLDS.map { |tld| Domain.new("#{name}.#{tld}") }
26
+ domains += hacked_domains(name, HACK_TLDS)
27
+ end
28
+
29
+ domains.each do
30
+ |domain|
31
+ print "#{domain.name}\t\t"
32
+ print domain.exists? ? 'NOT AVAILABLE' : 'AVAILABLE'
33
+ print "\n"
34
+ end
35
+ end
@@ -0,0 +1,2 @@
1
+ require 'domain-fu/domain'
2
+ require 'domain-fu/hacks'
@@ -0,0 +1,22 @@
1
+ require 'resolv'
2
+
3
+ module DomainFu
4
+
5
+ class Domain
6
+ attr_reader :name
7
+
8
+ def initialize(name)
9
+ @name = name
10
+ end
11
+
12
+ def exists?
13
+ begin
14
+ Resolv.getaddress @name
15
+ true
16
+ rescue Resolv::ResolvError
17
+ false
18
+ end
19
+ end
20
+ end
21
+
22
+ end
@@ -0,0 +1,12 @@
1
+ module DomainFu
2
+
3
+ def hacked_domains(name, tlds)
4
+ tlds.collect do
5
+ |tld|
6
+ if name[-tld.length..-1] == tld
7
+ Domain.new(name[0..-tld.length-1] + '.' + tld)
8
+ end
9
+ end.compact
10
+ end
11
+
12
+ end
metadata ADDED
@@ -0,0 +1,62 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: fox-domain-fu
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Sasa Brankovic
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2009-07-01 00:00:00 -07:00
13
+ default_executable: domain-fu
14
+ dependencies: []
15
+
16
+ description:
17
+ email: sasa.brankovic@inet.hr
18
+ executables:
19
+ - domain-fu
20
+ extensions: []
21
+
22
+ extra_rdoc_files:
23
+ - README.rdoc
24
+ files:
25
+ - .gitignore
26
+ - LICENCE
27
+ - README.rdoc
28
+ - Rakefile
29
+ - VERSION
30
+ - bin/domain-fu
31
+ - lib/domain-fu.rb
32
+ - lib/domain-fu/domain.rb
33
+ - lib/domain-fu/hacks.rb
34
+ has_rdoc: true
35
+ homepage: http://github.com/fox/domain-fu
36
+ post_install_message:
37
+ rdoc_options:
38
+ - --main
39
+ - README.rdoc
40
+ require_paths:
41
+ - lib
42
+ required_ruby_version: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - ">="
45
+ - !ruby/object:Gem::Version
46
+ version: "0"
47
+ version:
48
+ required_rubygems_version: !ruby/object:Gem::Requirement
49
+ requirements:
50
+ - - ">="
51
+ - !ruby/object:Gem::Version
52
+ version: "0"
53
+ version:
54
+ requirements: []
55
+
56
+ rubyforge_project:
57
+ rubygems_version: 1.2.0
58
+ signing_key:
59
+ specification_version: 2
60
+ summary: Console app and a library for checking domain availability.
61
+ test_files: []
62
+