ghost 0.1.1-universal-darwin-9 → 0.1.2-universal-darwin-9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/README +21 -11
  2. data/bin/ghost +26 -4
  3. metadata +2 -2
data/README CHANGED
@@ -1,5 +1,5 @@
1
- Ghost 0.0.1
2
- ===========
1
+ Ghost
2
+ =====
3
3
 
4
4
  A gem that allows you to create, list, and modify local hostnames in 10.5 with ease...
5
5
 
@@ -19,17 +19,33 @@ Command
19
19
  -------
20
20
 
21
21
  $ ghost add mydevsite.local
22
+ [Adding] mydevsite.local -> 127.0.0.1
23
+
22
24
  $ ghost add staging-server.local 67.207.136.164
25
+ [Adding] staging-server.local -> 67.207.136.164
26
+
23
27
  $ ghost list
24
28
  Listing 2 host(s):
25
29
  mydevsite.local -> 127.0.0.1
26
30
  staging-server.local -> 67.207.136.164
27
- $ ghost delete mydevsite.local
31
+
32
+ $ ghost delete mydevsite.local
33
+ [Deleting] mydevsite.local
34
+
28
35
  $ ghost list
29
36
  Listing 1 host(s):
30
- staging-server -> 67.207.136.164
37
+ staging-server.local -> 67.207.136.164
38
+
39
+ $ ghost modify staging-server.local 64.233.167.99
40
+ [Modifying] staging-server.local -> 64.233.167.99
41
+
42
+ $ ghost list
43
+ Listing 1 host(s):
44
+ staging-server.local -> 64.233.167.99
45
+
31
46
  $ ghost empty
32
- Emptied host list.
47
+ [Emptying] Done.
48
+
33
49
  $ ghost list
34
50
  Listing 0 host(s):
35
51
 
@@ -48,12 +64,6 @@ Installation
48
64
  ============
49
65
 
50
66
  sudo gem install bjeanes-ghost --source http://gems.github.com/
51
-
52
- Notes
53
- =====
54
-
55
- This library is not fully implemented yet. I am just putting this README up so that you can
56
- see what the goals are.
57
67
 
58
68
  Legal Stuff
59
69
  ===========
data/bin/ghost CHANGED
@@ -13,6 +13,7 @@ end
13
13
  def help_text(exit_code = 0)
14
14
  script_name = File.basename $0
15
15
  puts """USAGE: #{script_name} add <hostname> [<ip=127.0.1.1>]
16
+ #{script_name} modify <hostname> <ip>
16
17
  #{script_name} delete <hostname>
17
18
  #{script_name} list
18
19
  #{script_name} empty
@@ -26,15 +27,35 @@ else
26
27
  case ARGV[0]
27
28
  when 'add':
28
29
  if [2,3].include?(ARGV.size)
29
- ARGV.shift
30
- Host.add(*ARGV)
30
+ begin
31
+ ARGV.shift
32
+ host = Host.add(*ARGV)
33
+ puts " [Adding] #{host.name} -> #{host.ip}"
34
+ exit 0
35
+ rescue
36
+ $stderr.puts "Cannot overwrite an existing entry. Use the modify subcommand"
37
+ exit 3
38
+ end
31
39
  else
32
40
  $stderr.puts "The add subcommand requires at least a hostname.\n\n"
33
41
  help_text 2
34
42
  end
43
+ when 'modify':
44
+ if ARGV.size == 3
45
+ ARGV.shift
46
+ ARGV << true
47
+ host = Host.add(*ARGV)
48
+ puts " [Modifying] #{host.name} -> #{host.ip}"
49
+ exit 0
50
+ else
51
+ $stderr.puts "The modify subcommand requires a hostname and an IP.\n\n"
52
+ help_text 4
53
+ end
35
54
  when 'delete':
36
55
  if ARGV.size == 2
37
56
  Host.delete(ARGV[1])
57
+ puts " [Deleting] #{ARGV[1]}"
58
+ exit 0
38
59
  else
39
60
  $stderr.puts "The delete subcommand requires a hostname.\n\n"
40
61
  help_text 2
@@ -49,9 +70,10 @@ else
49
70
  puts "#{host.name.rjust(pad+2)} -> #{host.ip}"
50
71
  end
51
72
  exit 0
52
- when 'empty':
73
+ when 'empty':
74
+ print " [Emptying] "
53
75
  Host.empty!
54
- puts "Emptied host list."
76
+ puts "Done."
55
77
  exit 0
56
78
  else
57
79
  $stderr.puts "Invalid option: #{ARGV[0]}"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ghost
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: universal-darwin-9
6
6
  authors:
7
7
  - Bodaniel Jeanes
@@ -56,7 +56,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
56
56
  version:
57
57
  requirements:
58
58
  - Mac OS X Leopard (10.5)
59
- rubyforge_project: ghost
59
+ rubyforge_project:
60
60
  rubygems_version: 1.2.0
61
61
  signing_key:
62
62
  specification_version: 2