ditchdaddy 0.0.1
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.
- data/.gemtest +0 -0
- data/History.txt +4 -0
- data/Manifest.txt +13 -0
- data/PostInstall.txt +8 -0
- data/README.rdoc +42 -0
- data/Rakefile +21 -0
- data/bin/ditchdaddy +183 -0
- data/lib/ditchdaddy.rb +6 -0
- data/script/console +10 -0
- data/script/destroy +14 -0
- data/script/generate +14 -0
- data/test/test_ditchdaddy.rb +11 -0
- data/test/test_ditchdaddy_cli.rb +14 -0
- data/test/test_helper.rb +3 -0
- metadata +134 -0
data/.gemtest
ADDED
File without changes
|
data/History.txt
ADDED
data/Manifest.txt
ADDED
data/PostInstall.txt
ADDED
data/README.rdoc
ADDED
@@ -0,0 +1,42 @@
|
|
1
|
+
= ditchdaddy
|
2
|
+
|
3
|
+
* http://github.com/jm/ditchdaddy
|
4
|
+
|
5
|
+
== DESCRIPTION:
|
6
|
+
|
7
|
+
Bye GoDaddy, hello DNSimple.
|
8
|
+
|
9
|
+
== SYNOPSIS:
|
10
|
+
|
11
|
+
ditchdaddy # follow the prompts
|
12
|
+
|
13
|
+
== REQUIREMENTS:
|
14
|
+
|
15
|
+
* rainbow
|
16
|
+
* dnsimple
|
17
|
+
* highline
|
18
|
+
|
19
|
+
== LICENSE:
|
20
|
+
|
21
|
+
(The MIT License)
|
22
|
+
|
23
|
+
Copyright (c) 2011 FIXME full name
|
24
|
+
|
25
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
26
|
+
a copy of this software and associated documentation files (the
|
27
|
+
'Software'), to deal in the Software without restriction, including
|
28
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
29
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
30
|
+
permit persons to whom the Software is furnished to do so, subject to
|
31
|
+
the following conditions:
|
32
|
+
|
33
|
+
The above copyright notice and this permission notice shall be
|
34
|
+
included in all copies or substantial portions of the Software.
|
35
|
+
|
36
|
+
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
37
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
38
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
39
|
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
40
|
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
41
|
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
42
|
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/Rakefile
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
gem 'hoe', '>= 2.1.0'
|
3
|
+
require 'hoe'
|
4
|
+
require 'fileutils'
|
5
|
+
require './lib/ditchdaddy'
|
6
|
+
|
7
|
+
Hoe.plugin :newgem
|
8
|
+
|
9
|
+
$hoe = Hoe.spec 'ditchdaddy' do
|
10
|
+
self.developer 'Jeremy McAnally', 'jeremy@arcturo.com'
|
11
|
+
self.post_install_message = 'PostInstall.txt' # TODO remove if post-install message not required
|
12
|
+
self.rubyforge_name = self.name # TODO this is default value
|
13
|
+
self.extra_deps = [['dnsimple-ruby','> 0.0.0'], ['highline','> 0.0.0'], ['rainbow','> 0.0.0']]
|
14
|
+
end
|
15
|
+
|
16
|
+
require 'newgem/tasks'
|
17
|
+
Dir['tasks/**/*.rake'].each { |t| load t }
|
18
|
+
|
19
|
+
# TODO - want other tests/tasks run by default? Add them to the list
|
20
|
+
# remove_task :default
|
21
|
+
# task :default => [:spec, :features]
|
data/bin/ditchdaddy
ADDED
@@ -0,0 +1,183 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
|
5
|
+
require 'rainbow'
|
6
|
+
require 'net/http'
|
7
|
+
require 'highline/import'
|
8
|
+
require 'dnsimple'
|
9
|
+
|
10
|
+
# We can't transfer these via the API for
|
11
|
+
# one reason or another
|
12
|
+
BAD_TLDS = [".us", ".aero", ".ca"]
|
13
|
+
|
14
|
+
if RUBY_VERSION < "1.9"
|
15
|
+
puts
|
16
|
+
puts "--- ATTENTION ---".color(:red).bright.blink
|
17
|
+
puts "You appear to be on Ruby 1.8. Highline acts weird on 1.8 when retrying after an exception."
|
18
|
+
puts "I recommend you hop up to 1.9.2. But it's OK. Whatever. It's not like I know"
|
19
|
+
puts "anything about how I run or anything. NO NO. DONT LISTEN TO ME."
|
20
|
+
puts "--- ATTENTION ---".color(:red).bright.blink
|
21
|
+
puts
|
22
|
+
require 'fastercsv'
|
23
|
+
CSVModule = FasterCSV
|
24
|
+
else
|
25
|
+
require 'csv'
|
26
|
+
CSVModule = CSV
|
27
|
+
end
|
28
|
+
|
29
|
+
puts "Ready to ditch GoDaddy?" + " LET'S DO THIS THING.".color(:red).bright
|
30
|
+
puts
|
31
|
+
|
32
|
+
puts "First, I need your DNSimple details.".color(:magenta)
|
33
|
+
user = nil
|
34
|
+
begin
|
35
|
+
DNSimple::Client.username = ask("What's your username?".bright)
|
36
|
+
DNSimple::Client.password = ask("What's your password?".bright) { |q| q.echo = "*" }
|
37
|
+
|
38
|
+
user = DNSimple::User.me
|
39
|
+
rescue DNSimple::AuthenticationFailed
|
40
|
+
puts
|
41
|
+
puts "ZOMG WTF AUTHENTICATION FAILED!!!".color(:red).bright.blink
|
42
|
+
puts
|
43
|
+
|
44
|
+
retry
|
45
|
+
end
|
46
|
+
|
47
|
+
puts "\nOK, you're logged in now.".color(:yellow) + " Amazing, I know, right?\n".bright.color(:yellow)
|
48
|
+
|
49
|
+
contact = nil
|
50
|
+
if DNSimple::Contact.all.empty?
|
51
|
+
puts "Hm, well it turns out you don't have contacts setup in DNSimple."
|
52
|
+
puts "You can either setup one up on dnsimple.com or we can do it here."
|
53
|
+
puts
|
54
|
+
puts "What say ye? Do it here or the web?".color(:magenta)
|
55
|
+
choice = ask("Say 'here' or 'web': ") {|q| q.validate = /(^here$)|(^web$)/ }
|
56
|
+
|
57
|
+
if choice == 'web'
|
58
|
+
puts
|
59
|
+
puts "PEACE OUT FOR NOW!".bright.color(:blue).blink.italic.background(:yellow)
|
60
|
+
puts "You come back now, ya here?"
|
61
|
+
puts
|
62
|
+
|
63
|
+
exit
|
64
|
+
end
|
65
|
+
|
66
|
+
puts
|
67
|
+
puts "OK, let's get the data we need...".bright.color(:cyan)
|
68
|
+
|
69
|
+
begin
|
70
|
+
fn = ask("First name: ") {|q| q.validate = /.+/ }
|
71
|
+
ln = ask("Last name: ") {|q| q.validate = /.+/ }
|
72
|
+
address = ask("Address: ") {|q| q.validate = /.+/ }
|
73
|
+
city = ask("City: ") {|q| q.validate = /.+/ }
|
74
|
+
state = ask("State: ") {|q| q.validate = /.+/ }
|
75
|
+
postal_code = ask("Postal code: ") {|q| q.validate = /.+/ }
|
76
|
+
country = ask("Country: ") {|q| q.validate = /.+/ }
|
77
|
+
email_address = ask("E-mail: ") {|q| q.validate = /.+/ }
|
78
|
+
phone = ask("Phone: ") {|q| q.validate = /.+/ }
|
79
|
+
|
80
|
+
begin
|
81
|
+
contact = DNSimple::Contact.create({
|
82
|
+
:first_name => fn,
|
83
|
+
:last_name => ln,
|
84
|
+
:address1 => address,
|
85
|
+
:city => city,
|
86
|
+
:state_province => state,
|
87
|
+
:country => country,
|
88
|
+
:postal_code => postal_code,
|
89
|
+
:email_address => email_address,
|
90
|
+
:phone => phone
|
91
|
+
})
|
92
|
+
rescue DNSimple::Error
|
93
|
+
puts "WHAT DID YOU DO?".bright.color(:red) + " Something broke.".color(:red)
|
94
|
+
puts "Maybe you put in some bad data. Let's try this again."
|
95
|
+
puts
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
99
|
+
puts
|
100
|
+
puts "Yay!".color(:yellow).bright + " Contact created."
|
101
|
+
puts
|
102
|
+
end
|
103
|
+
|
104
|
+
unless contact
|
105
|
+
contacts = DNSimple::Contact.all
|
106
|
+
|
107
|
+
puts "You have to pick a registrant for your domains."
|
108
|
+
puts
|
109
|
+
choose do |menu|
|
110
|
+
menu.prompt = "CHOOSE ONE. QUICKLY.".bright.color(:magenta)
|
111
|
+
|
112
|
+
contacts.each do |possible_contact|
|
113
|
+
menu.choice("#{possible_contact.first_name} #{possible_contact.last_name}") { contact = possible_contact }
|
114
|
+
end
|
115
|
+
end
|
116
|
+
end
|
117
|
+
|
118
|
+
puts
|
119
|
+
|
120
|
+
file_path = nil
|
121
|
+
begin
|
122
|
+
puts "Next, tell me where your data export from GoDaddy is at.\n(Follow instructions here: http://is.gd/2vI0aV)\n".color(:magenta)
|
123
|
+
|
124
|
+
file_path = ask("Where is the data file at?".bright)
|
125
|
+
puts File.join(Dir.pwd, file_path)
|
126
|
+
unless File.exists?(file_path)
|
127
|
+
raise "File fail."
|
128
|
+
end
|
129
|
+
rescue
|
130
|
+
puts
|
131
|
+
puts "ZOMG WTF FILE NOT FOUND!!!".color(:red).bright.blink
|
132
|
+
puts
|
133
|
+
|
134
|
+
retry
|
135
|
+
end
|
136
|
+
|
137
|
+
puts "\nFile found, now slurpinating it.".bright.color(:yellow)
|
138
|
+
|
139
|
+
csv = CSVModule.new(File.open(file_path), :headers => true, :skip_blanks => true)
|
140
|
+
|
141
|
+
puts
|
142
|
+
puts "OK, this is getting serious now."
|
143
|
+
puts "Should I just transfer every domain I can or ask you about each one?".color(:cyan).bright
|
144
|
+
|
145
|
+
ask = ask("Say 'ask' or 'transfer': ") {|q| q.validate = /(^ask$)|(^transfer$)/ }
|
146
|
+
ask = (ask == "ask")
|
147
|
+
|
148
|
+
puts
|
149
|
+
|
150
|
+
csv.each do |row|
|
151
|
+
if ask
|
152
|
+
response = ask("Transfer " + row['DomainName'].bright.color(:yellow) + " to DNSimple? (yes/no)") {|q| q.validate = /(^yes$)|(^no$)/ }
|
153
|
+
if response == 'no'
|
154
|
+
puts "\tOK, cow(boy|girl). Skipping that guy..."
|
155
|
+
puts
|
156
|
+
|
157
|
+
next
|
158
|
+
end
|
159
|
+
end
|
160
|
+
|
161
|
+
puts "Transferring #{row['DomainName'].bright.color(:yellow)}..."
|
162
|
+
if row['Locked'] != 'Unlocked'
|
163
|
+
puts "\t!".color(:red).bright + " Oops. You didn't unlock that domain according to this export. Skipping..."
|
164
|
+
next
|
165
|
+
end
|
166
|
+
|
167
|
+
begin
|
168
|
+
DNSimple::TransferOrder.create(row['DomainName'], row['AuthorizationCode'], {:id => contact.id})
|
169
|
+
puts "\t*".color(:cyan).bright + " That worked!"
|
170
|
+
rescue StandardError
|
171
|
+
# There's a bug in the DNSimple gem...
|
172
|
+
puts "\t! Well, poop. There seems to be an error.".color(:red)
|
173
|
+
rescue DNSimple::Error => e
|
174
|
+
puts "\tWell, poop. There seems to be an error.".color(:red)
|
175
|
+
puts "\t#{e.message}"
|
176
|
+
end
|
177
|
+
end
|
178
|
+
|
179
|
+
puts
|
180
|
+
puts "Well, we're all done. Our time together was magical.".color(:cyan)
|
181
|
+
puts "I hope it was as good for you as it was for me. ktnxbai"
|
182
|
+
puts "Visit me at http://arcturo.com sometime."
|
183
|
+
puts
|
data/lib/ditchdaddy.rb
ADDED
data/script/console
ADDED
@@ -0,0 +1,10 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# File: script/console
|
3
|
+
irb = RUBY_PLATFORM =~ /(:?mswin|mingw)/ ? 'irb.bat' : 'irb'
|
4
|
+
|
5
|
+
libs = " -r irb/completion"
|
6
|
+
# Perhaps use a console_lib to store any extra methods I may want available in the cosole
|
7
|
+
# libs << " -r #{File.dirname(__FILE__) + '/../lib/console_lib/console_logger.rb'}"
|
8
|
+
libs << " -r #{File.dirname(__FILE__) + '/../lib/ditchdaddy.rb'}"
|
9
|
+
puts "Loading ditchdaddy gem"
|
10
|
+
exec "#{irb} #{libs} --simple-prompt"
|
data/script/destroy
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
APP_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..'))
|
3
|
+
|
4
|
+
begin
|
5
|
+
require 'rubigen'
|
6
|
+
rescue LoadError
|
7
|
+
require 'rubygems'
|
8
|
+
require 'rubigen'
|
9
|
+
end
|
10
|
+
require 'rubigen/scripts/destroy'
|
11
|
+
|
12
|
+
ARGV.shift if ['--help', '-h'].include?(ARGV[0])
|
13
|
+
RubiGen::Base.use_component_sources! [:rubygems, :newgem, :newgem_theme, :test_unit]
|
14
|
+
RubiGen::Scripts::Destroy.new.run(ARGV)
|
data/script/generate
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
APP_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..'))
|
3
|
+
|
4
|
+
begin
|
5
|
+
require 'rubigen'
|
6
|
+
rescue LoadError
|
7
|
+
require 'rubygems'
|
8
|
+
require 'rubigen'
|
9
|
+
end
|
10
|
+
require 'rubigen/scripts/generate'
|
11
|
+
|
12
|
+
ARGV.shift if ['--help', '-h'].include?(ARGV[0])
|
13
|
+
RubiGen::Base.use_component_sources! [:rubygems, :newgem, :newgem_theme, :test_unit]
|
14
|
+
RubiGen::Scripts::Generate.new.run(ARGV)
|
@@ -0,0 +1,14 @@
|
|
1
|
+
require File.join(File.dirname(__FILE__), "test_helper.rb")
|
2
|
+
require 'ditchdaddy/cli'
|
3
|
+
|
4
|
+
class TestDitchdaddyCli < Test::Unit::TestCase
|
5
|
+
def setup
|
6
|
+
Ditchdaddy::CLI.execute(@stdout_io = StringIO.new, [])
|
7
|
+
@stdout_io.rewind
|
8
|
+
@stdout = @stdout_io.read
|
9
|
+
end
|
10
|
+
|
11
|
+
def test_print_default_output
|
12
|
+
assert_match(/To update this executable/, @stdout)
|
13
|
+
end
|
14
|
+
end
|
data/test/test_helper.rb
ADDED
metadata
ADDED
@@ -0,0 +1,134 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: ditchdaddy
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Jeremy McAnally
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2011-12-23 00:00:00.000000000Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: dnsimple-ruby
|
16
|
+
requirement: &2157097240 !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>'
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: 0.0.0
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: *2157097240
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: highline
|
27
|
+
requirement: &2157096780 !ruby/object:Gem::Requirement
|
28
|
+
none: false
|
29
|
+
requirements:
|
30
|
+
- - ! '>'
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: 0.0.0
|
33
|
+
type: :runtime
|
34
|
+
prerelease: false
|
35
|
+
version_requirements: *2157096780
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: rainbow
|
38
|
+
requirement: &2157096340 !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
40
|
+
requirements:
|
41
|
+
- - ! '>'
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: 0.0.0
|
44
|
+
type: :runtime
|
45
|
+
prerelease: false
|
46
|
+
version_requirements: *2157096340
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: rdoc
|
49
|
+
requirement: &2157095920 !ruby/object:Gem::Requirement
|
50
|
+
none: false
|
51
|
+
requirements:
|
52
|
+
- - ~>
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '3.10'
|
55
|
+
type: :development
|
56
|
+
prerelease: false
|
57
|
+
version_requirements: *2157095920
|
58
|
+
- !ruby/object:Gem::Dependency
|
59
|
+
name: newgem
|
60
|
+
requirement: &2157095500 !ruby/object:Gem::Requirement
|
61
|
+
none: false
|
62
|
+
requirements:
|
63
|
+
- - ! '>='
|
64
|
+
- !ruby/object:Gem::Version
|
65
|
+
version: 1.5.3
|
66
|
+
type: :development
|
67
|
+
prerelease: false
|
68
|
+
version_requirements: *2157095500
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: hoe
|
71
|
+
requirement: &2157095080 !ruby/object:Gem::Requirement
|
72
|
+
none: false
|
73
|
+
requirements:
|
74
|
+
- - ~>
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: '2.12'
|
77
|
+
type: :development
|
78
|
+
prerelease: false
|
79
|
+
version_requirements: *2157095080
|
80
|
+
description: Bye GoDaddy, hello DNSimple.
|
81
|
+
email:
|
82
|
+
- jeremy@arcturo.com
|
83
|
+
executables:
|
84
|
+
- ditchdaddy
|
85
|
+
extensions: []
|
86
|
+
extra_rdoc_files:
|
87
|
+
- History.txt
|
88
|
+
- Manifest.txt
|
89
|
+
- PostInstall.txt
|
90
|
+
files:
|
91
|
+
- History.txt
|
92
|
+
- Manifest.txt
|
93
|
+
- PostInstall.txt
|
94
|
+
- README.rdoc
|
95
|
+
- Rakefile
|
96
|
+
- bin/ditchdaddy
|
97
|
+
- lib/ditchdaddy.rb
|
98
|
+
- script/console
|
99
|
+
- script/destroy
|
100
|
+
- script/generate
|
101
|
+
- test/test_ditchdaddy.rb
|
102
|
+
- test/test_ditchdaddy_cli.rb
|
103
|
+
- test/test_helper.rb
|
104
|
+
- .gemtest
|
105
|
+
homepage: http://github.com/jm/ditchdaddy
|
106
|
+
licenses: []
|
107
|
+
post_install_message: PostInstall.txt
|
108
|
+
rdoc_options:
|
109
|
+
- --main
|
110
|
+
- README.rdoc
|
111
|
+
require_paths:
|
112
|
+
- lib
|
113
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
114
|
+
none: false
|
115
|
+
requirements:
|
116
|
+
- - ! '>='
|
117
|
+
- !ruby/object:Gem::Version
|
118
|
+
version: '0'
|
119
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
120
|
+
none: false
|
121
|
+
requirements:
|
122
|
+
- - ! '>='
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
125
|
+
requirements: []
|
126
|
+
rubyforge_project: ditchdaddy
|
127
|
+
rubygems_version: 1.8.10
|
128
|
+
signing_key:
|
129
|
+
specification_version: 3
|
130
|
+
summary: Bye GoDaddy, hello DNSimple.
|
131
|
+
test_files:
|
132
|
+
- test/test_ditchdaddy.rb
|
133
|
+
- test/test_ditchdaddy_cli.rb
|
134
|
+
- test/test_helper.rb
|