enom 0.9.4 → 0.9.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/bin/enom.rb +77 -0
  2. metadata +3 -2
data/bin/enom.rb ADDED
@@ -0,0 +1,77 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ $:.unshift(File.dirname(__FILE__) + '/../lib')
4
+ require 'enom'
5
+ require 'enom/cli'
6
+
7
+ require 'optparse'
8
+
9
+ def usage
10
+ $stderr.puts <<-EOF
11
+
12
+ This is a command line tool for Enom.
13
+
14
+ Before using this tool you should create a file called .enomconfig in your home
15
+ directory and add the following to that file:
16
+
17
+ username: YOUR_USERNAME
18
+ password: YOUR_PASSWORD
19
+
20
+ Alternatively you can pass the credentials via command-line arguments, as in:
21
+
22
+ enom -u username -p password command
23
+
24
+ You can run commands from the test interface with the -t flag:
25
+ enom -u username -p password -t command
26
+
27
+ == Commands
28
+
29
+ All commands are executed as enom [options] command [command-options] args
30
+
31
+
32
+ The following commands are available:
33
+
34
+ help # Show this usage
35
+ info # Show your account information
36
+
37
+ list # List all domains
38
+ check domain.com # Check if a domain is available (for registration)
39
+ describe domain.com # Describe the given domain
40
+ register domain.com # Register the given domain with Enom
41
+ renew domain.com # Renew the given domain with Enom
42
+ transfer domain.com [authcode] # Transfer the given domain into Enom
43
+
44
+ EOF
45
+ end
46
+
47
+ options = {}
48
+
49
+ global = OptionParser.new do |opts|
50
+ opts.on("-u", "--username [ARG]") do |username|
51
+ Enom::Client.username = username
52
+ end
53
+ opts.on("-p", "--password [ARG]") do |password|
54
+ Enom::Client.password = password
55
+ end
56
+ opts.on("-t") do
57
+ Enom::Client.test = true
58
+ end
59
+ end
60
+
61
+ global.order!
62
+ command = ARGV.shift
63
+
64
+ if command.nil? || command == 'help'
65
+ usage
66
+ else
67
+ begin
68
+ cli = Enom::CLI.new
69
+ cli.execute(command, ARGV, options)
70
+ rescue Enom::CommandNotFound => e
71
+ puts e.message
72
+ rescue Enom::InvalidCredentials => e
73
+ puts e.message
74
+ rescue Enom::InterfaceError => e
75
+ puts e.message
76
+ end
77
+ end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 9
8
- - 4
9
- version: 0.9.4
8
+ - 5
9
+ version: 0.9.5
10
10
  platform: ruby
11
11
  authors:
12
12
  - James Miller
@@ -70,6 +70,7 @@ files:
70
70
  - test/enom_test.rb
71
71
  - test/test_helper.rb
72
72
  - bin/enom
73
+ - bin/enom.rb
73
74
  has_rdoc: true
74
75
  homepage: http://github.com/bensie/enom
75
76
  licenses: []