akaer 1.0.0 → 1.5.0

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore CHANGED
@@ -1,21 +1,6 @@
1
- *.gem
2
- *.rbc
3
- .bundle
4
- .config
5
- coverage
6
- InstalledFiles
7
- lib/bundler/man
8
- pkg
9
- rdoc
10
- spec/reports
11
- test/tmp
12
- test/version_tmp
13
- tmp
14
-
15
- # YARD artifacts
16
- .yardoc
17
- _yardoc
18
- doc/
19
-
20
- # RubyMine
21
- .idea/
1
+ Gemfile.lock
2
+ tester.rb
3
+ coverage/
4
+ pkg/
5
+ .idea/
6
+ .yardoc/
data/.yardopts CHANGED
@@ -1 +1 @@
1
- --exclude lib/devdnsd/patches/.+ --exclude utils/ -m markdown
1
+ -m markdown
data/Gemfile.lock CHANGED
@@ -1,16 +1,15 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- akaer (1.0.0)
5
- bovem (>= 0.5.0)
6
- gli (~> 1.6.0)
4
+ akaer (1.5.0)
5
+ mamertes (>= 1.1.0)
7
6
 
8
7
  GEM
9
8
  remote: http://rubygems.org/
10
9
  specs:
11
- actionpack (3.2.7)
12
- activemodel (= 3.2.7)
13
- activesupport (= 3.2.7)
10
+ actionpack (3.2.8)
11
+ activemodel (= 3.2.8)
12
+ activesupport (= 3.2.8)
14
13
  builder (~> 3.0.0)
15
14
  erubis (~> 2.7.0)
16
15
  journey (~> 1.0.4)
@@ -18,31 +17,33 @@ GEM
18
17
  rack-cache (~> 1.2)
19
18
  rack-test (~> 0.6.1)
20
19
  sprockets (~> 2.1.3)
21
- activemodel (3.2.7)
22
- activesupport (= 3.2.7)
20
+ activemodel (3.2.8)
21
+ activesupport (= 3.2.8)
23
22
  builder (~> 3.0.0)
24
- activesupport (3.2.7)
23
+ activesupport (3.2.8)
25
24
  i18n (~> 0.6)
26
25
  multi_json (~> 1.0)
27
- bovem (0.6.0)
26
+ bovem (1.1.0)
28
27
  lazier (~> 1.0)
29
- rainbow (~> 1.1.0)
28
+ open4 (~> 1.3.0)
30
29
  builder (3.0.0)
31
30
  coderay (1.0.7)
32
31
  diff-lcs (1.1.3)
33
32
  erubis (2.7.0)
34
- github-markup (0.7.2)
35
- gli (1.6.0)
33
+ github-markup (0.7.4)
36
34
  hike (1.2.1)
37
35
  i18n (0.6.0)
38
36
  journey (1.0.4)
39
- json (1.7.4)
40
- lazier (1.0.1)
37
+ json (1.7.5)
38
+ lazier (1.0.3)
41
39
  actionpack (~> 3.0)
42
40
  json (~> 1.7.0)
43
41
  tzinfo (~> 0.3.0)
42
+ mamertes (1.1.0)
43
+ bovem (~> 1.1.0)
44
44
  method_source (0.8)
45
45
  multi_json (1.3.6)
46
+ open4 (1.3.0)
46
47
  pry (0.9.10)
47
48
  coderay (~> 1.0.5)
48
49
  method_source (~> 0.8)
@@ -52,17 +53,16 @@ GEM
52
53
  rack (>= 0.4)
53
54
  rack-test (0.6.1)
54
55
  rack (>= 1.0)
55
- rainbow (1.1.4)
56
56
  rake (0.9.2.2)
57
57
  redcarpet (2.1.1)
58
58
  rspec (2.11.0)
59
59
  rspec-core (~> 2.11.0)
60
60
  rspec-expectations (~> 2.11.0)
61
61
  rspec-mocks (~> 2.11.0)
62
- rspec-core (2.11.0)
63
- rspec-expectations (2.11.1)
62
+ rspec-core (2.11.1)
63
+ rspec-expectations (2.11.2)
64
64
  diff-lcs (~> 1.1.3)
65
- rspec-mocks (2.11.0)
65
+ rspec-mocks (2.11.2)
66
66
  simplecov (0.6.4)
67
67
  multi_json (~> 1.0)
68
68
  simplecov-html (~> 0.5.3)
data/akaer.gemspec CHANGED
@@ -21,8 +21,7 @@ Gem::Specification.new do |gem|
21
21
  gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
22
22
  gem.require_paths = ["lib"]
23
23
 
24
- gem.add_dependency("bovem", ">= 0.5.0")
25
- gem.add_dependency("gli", "~> 1.6.0")
24
+ gem.add_dependency("mamertes", ">= 1.1.0")
26
25
 
27
26
  gem.add_development_dependency("rspec", "~> 2.11.0")
28
27
  gem.add_development_dependency("rake", "~> 0.9.0")
@@ -31,6 +30,4 @@ Gem::Specification.new do |gem|
31
30
  gem.add_development_dependency("yard", "~> 0.8.0")
32
31
  gem.add_development_dependency("redcarpet", "~> 2.1.0")
33
32
  gem.add_development_dependency("github-markup", "~> 0.7.0")
34
- end
35
-
36
-
33
+ end
data/bin/akaer CHANGED
@@ -6,86 +6,45 @@
6
6
 
7
7
  require "rubygems"
8
8
  require "akaer"
9
- require "gli"
10
9
 
11
- include GLI
12
-
13
- program_desc("A small utility to add aliases to network interfaces.")
14
- version(Akaer::Version::STRING)
15
-
16
- desc("The default interface to manage.")
17
- default_value("lo0")
18
- arg_name("INTERFACE")
19
- flag(:i, :interface)
20
-
21
- desc("The default list of aliases to add.")
22
- default_value([])
23
- arg_name("ADDRESSES")
24
- flag(:A, :addresses)
25
-
26
- desc("The starting address for sequential aliases.")
27
- default_value("10.0.0.1")
28
- arg_name("ADDRESS")
29
- flag(:s, :"start-address")
30
-
31
- desc("The number of aliases to add.")
32
- default_value(5)
33
- arg_name("ALIASES")
34
- flag(:S, :aliases)
35
-
36
- desc("The command to run for adding an alias.")
37
- default_value("sudo ifconfig @INTERFACE@ alias @ALIAS@")
38
- arg_name("COMMAND")
39
- flag(:c, :"add-command")
40
-
41
- desc("The command to run for adding an alias.")
42
- default_value("sudo ifconfig @INTERFACE@ -alias @ALIAS@")
43
- arg_name("COMMAND")
44
- flag(:C, :"remove-command")
45
-
46
- desc("The default log file.")
47
- default_value("STDOUT")
48
- arg_name("LOG")
49
- flag([:l, :log])
50
-
51
- desc("The default log level. Valid values are from 0 to 5 where 0 means \"all messages\".")
52
- default_value(1)
53
- arg_name("LEVEL")
54
- flag([:L, :"log-level"])
55
-
56
- desc("Only show which modifications will be done")
57
- switch([:n, :"dry-run"])
58
-
59
- desc("Do not show any message.")
60
- switch([:q, :quiet])
61
-
62
- desc("Add aliases.")
63
- command [:a, :add] do |c|
64
- c.action do |globals, locals, args|
65
- Akaer::Application.instance(globals, locals, args).action_add()
10
+ Mamertes.App do
11
+ name "Akaer"
12
+ description "A small utility to add aliases to network interfaces."
13
+ version Akaer::Version::STRING
14
+
15
+ option "configuration", [], {:help => "The configuration file to use. Default is \"~/.akaer_config\".", :default => "~/.akaer_config"}
16
+ option "interface", [], {:help => "The default interface to manage. Default is \"lo0\".", :default => "lo0"}
17
+ option "addresses", [], {:type => Array, :help => "The default list of aliases to add. Overrides sequential list"}
18
+ option "start-address", [], {:help => "The starting address for sequential aliases. Default is \"10.0.0.1\".", :default => "10.0.0.1", :meta => "ADDRESS"}
19
+ option "aliases", [:S], {:type => Integer, :help => "The number of aliases to add. Default is 5.", :default => 5}
20
+ option "add-command", [:A], {:help => "The command to run for adding an alias. Default is \"sudo ifconfig @INTERFACE@ alias @ALIAS@\".", :default => "sudo ifconfig @INTERFACE@ alias @ALIAS@", :meta => "COMMAND"}
21
+ option "remove-command", [:R], {:help => "The command to run for removing an alias. Default is \"sudo ifconfig @INTERFACE@ -alias @ALIAS@\".", :default => "sudo ifconfig @INTERFACE@ -alias @ALIAS@", :meta => "COMMAND"}
22
+ option "log-file", [], {:help => "The default log file. Default is standard output.", :default => "STDOUT", :meta => "FILE"}
23
+ option "log-level", [:L], {:type => Integer, :help => "The default log level. Valid values are from 0 to 5 where 0 means \"all messages\". Default is 1.", :default => 1, :meta => "LEVEL"}
24
+ option "dry-run", [:n], {:help => "Only show which modifications will be done."}
25
+ option "quiet", [], {:help => "Do not show any message."}
26
+
27
+ command :add do
28
+ description "Adds aliases."
29
+ action { |command| Akaer::Application.instance(command).action_add() }
66
30
  end
67
- end
68
31
 
69
- desc("Remove aliases.")
70
- command [:r, :remove] do |c|
71
- c.action do |globals, locals, args|
72
- Akaer::Application.instance(globals, locals, args).action_remove()
32
+ command :remove do
33
+ description "Removes aliases."
34
+ action { |command| Akaer::Application.instance(command).action_remove() }
73
35
  end
74
- end
75
36
 
76
- desc("Install the application for autolaunch.")
77
- command [:i, :install] do |c|
78
- c.action do |globals, locals, args|
79
- Akaer::Application.instance(globals, locals, args).action_install()
37
+ command :install do
38
+ description "Installs the application to autolaunch."
39
+ action { |command| Akaer::Application.instance(command).action_install() }
80
40
  end
81
- end
82
41
 
83
- desc("Uninstall the application from autolaunch.")
84
- command [:u, :uninstall] do |c|
85
- c.action do |globals, locals, args|
86
- Akaer::Application.instance(globals, locals, args).action_uninstall()
42
+ command :uninstall do
43
+ description "Uninstalls the application from autolaunch."
44
+ action { |command| Akaer::Application.instance(command).action_uninstall() }
87
45
  end
88
- end
89
46
 
90
- ARGV << "help" if ARGV.length == 0
91
- exit(GLI.run(ARGV))
47
+ action do |command|
48
+ self.commands["add"].execute(ARGV)
49
+ end
50
+ end