akaer 2.2.0 → 2.2.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.
@@ -8,7 +8,7 @@ source "http://rubygems.org"
8
8
 
9
9
  gemspec
10
10
 
11
- # Testing gems
11
+ # Testing
12
12
  gem "rspec", "~> 2.14.1"
13
13
  gem "rake", "~> 10.1.0"
14
14
  gem "simplecov", ">= 0.7.1"
data/Rakefile CHANGED
@@ -9,3 +9,21 @@ require "rspec/core/rake_task"
9
9
 
10
10
  RSpec::Core::RakeTask.new("spec")
11
11
  RSpec::Core::RakeTask.new("spec:coverage") { |t| t.ruby_opts = "-r./spec/coverage_helper" }
12
+
13
+ desc "Generate the documentation"
14
+ task :docs do
15
+ system("yardoc") || raise("Failed Execution of: yardoc")
16
+ end
17
+
18
+ desc "Get the current release version"
19
+ task :version, :with_name do |_, args|
20
+ gem = Bundler::GemHelper.instance.gemspec
21
+ puts [args[:with_name] == "true" ? gem.name : nil, gem.version].compact.join("-")
22
+ end
23
+
24
+ desc "Prepare the release"
25
+ task :prerelease => ["spec:coverage", "docs"] do
26
+ ["git add -A", "git commit -am \"Version #{Bundler::GemHelper.instance.gemspec.version}\""].each do |cmd|
27
+ system(cmd) || raise("Failed Execution of: #{cmd}")
28
+ end
29
+ end
@@ -23,6 +23,6 @@ Gem::Specification.new do |gem|
23
23
 
24
24
  gem.required_ruby_version = ">= 1.9.3"
25
25
 
26
- gem.add_dependency("mamertes", "~> 2.2.0")
26
+ gem.add_dependency("mamertes", "~> 2.2.1")
27
27
  gem.add_dependency("mustache", "~> 0.99.4")
28
28
  end
@@ -121,7 +121,7 @@ Licensed under the MIT license, which can be found at http://www.opensource.org/
121
121
  </div>
122
122
 
123
123
  <div id="footer">
124
- Generated on Sun Jul 14 17:46:44 2013 by
124
+ Generated on Sat Jul 20 11:33:59 2013 by
125
125
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
126
126
  0.8.6.2 (ruby-1.9.3).
127
127
  </div>
@@ -2452,7 +2452,7 @@
2452
2452
  </div>
2453
2453
 
2454
2454
  <div id="footer">
2455
- Generated on Sun Jul 14 17:46:45 2013 by
2455
+ Generated on Sat Jul 20 11:34:00 2013 by
2456
2456
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
2457
2457
  0.8.6.2 (ruby-1.9.3).
2458
2458
  </div>
@@ -116,7 +116,7 @@
116
116
  </div>
117
117
 
118
118
  <div id="footer">
119
- Generated on Sun Jul 14 17:46:44 2013 by
119
+ Generated on Sat Jul 20 11:33:59 2013 by
120
120
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
121
121
  0.8.6.2 (ruby-1.9.3).
122
122
  </div>
@@ -356,7 +356,7 @@
356
356
  </div>
357
357
 
358
358
  <div id="footer">
359
- Generated on Sun Jul 14 17:46:44 2013 by
359
+ Generated on Sat Jul 20 11:33:59 2013 by
360
360
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
361
361
  0.8.6.2 (ruby-1.9.3).
362
362
  </div>
@@ -447,7 +447,7 @@
447
447
  </div>
448
448
 
449
449
  <div id="footer">
450
- Generated on Sun Jul 14 17:46:44 2013 by
450
+ Generated on Sat Jul 20 11:33:59 2013 by
451
451
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
452
452
  0.8.6.2 (ruby-1.9.3).
453
453
  </div>
@@ -273,7 +273,7 @@
273
273
  </div>
274
274
 
275
275
  <div id="footer">
276
- Generated on Sun Jul 14 17:46:45 2013 by
276
+ Generated on Sat Jul 20 11:34:00 2013 by
277
277
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
278
278
  0.8.6.2 (ruby-1.9.3).
279
279
  </div>
@@ -149,7 +149,7 @@
149
149
 
150
150
  </div>
151
151
  </dt>
152
- <dd><pre class="code"><span class='int'>0</span></pre></dd>
152
+ <dd><pre class="code"><span class='int'>1</span></pre></dd>
153
153
 
154
154
  <dt id="STRING-constant" class="">STRING =
155
155
  <div class="docstring">
@@ -180,7 +180,7 @@
180
180
  </div>
181
181
 
182
182
  <div id="footer">
183
- Generated on Sun Jul 14 17:46:44 2013 by
183
+ Generated on Sat Jul 20 11:33:59 2013 by
184
184
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
185
185
  0.8.6.2 (ruby-1.9.3).
186
186
  </div>
@@ -175,7 +175,7 @@
175
175
  </div>
176
176
 
177
177
  <div id="footer">
178
- Generated on Sun Jul 14 17:46:44 2013 by
178
+ Generated on Sat Jul 20 11:33:59 2013 by
179
179
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
180
180
  0.8.6.2 (ruby-1.9.3).
181
181
  </div>
@@ -145,7 +145,7 @@
145
145
  </div></div>
146
146
 
147
147
  <div id="footer">
148
- Generated on Sun Jul 14 17:46:44 2013 by
148
+ Generated on Sat Jul 20 11:33:59 2013 by
149
149
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
150
150
  0.8.6.2 (ruby-1.9.3).
151
151
  </div>
@@ -145,7 +145,7 @@
145
145
  </div></div>
146
146
 
147
147
  <div id="footer">
148
- Generated on Sun Jul 14 17:46:44 2013 by
148
+ Generated on Sat Jul 20 11:33:59 2013 by
149
149
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
150
150
  0.8.6.2 (ruby-1.9.3).
151
151
  </div>
@@ -103,7 +103,7 @@
103
103
  </div>
104
104
 
105
105
  <div id="footer">
106
- Generated on Sun Jul 14 17:46:44 2013 by
106
+ Generated on Sat Jul 20 11:33:59 2013 by
107
107
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
108
108
  0.8.6.2 (ruby-1.9.3).
109
109
  </div>
@@ -16,7 +16,7 @@ module Akaer
16
16
  MINOR = 2
17
17
 
18
18
  # The patch version.
19
- PATCH = 0
19
+ PATCH = 1
20
20
 
21
21
  # The current version of akaer.
22
22
  STRING = [MAJOR, MINOR, PATCH].compact.join(".")
@@ -26,41 +26,41 @@ describe Akaer::Application do
26
26
  end
27
27
 
28
28
  before(:each) do
29
- Bovem::Logger.stub(:default_file).and_return("/dev/null")
29
+ allow(Bovem::Logger).to receive(:default_file).and_return("/dev/null")
30
30
  end
31
31
  let(:log_file) { "/dev/null" }
32
32
  let(:application){ create_application({"log-file" => log_file}) }
33
33
  let(:launch_agent_path) { "/tmp/akaer-test-agent-#{Time.now.strftime("%Y%m%d-%H%M%S")}" }
34
34
 
35
35
  describe ".instance" do
36
- it("should call .new with the passed arguments") do
37
- ::Akaer::Application.should_receive(:new).with("FOO", :es)
36
+ it "should call .new with the passed arguments" do
37
+ expect(::Akaer::Application).to receive(:new).with("FOO", :es)
38
38
  ::Akaer::Application.instance("FOO", :es)
39
39
  end
40
40
 
41
- it("should return the same instance") do
42
- ::Akaer::Application.stub(:new) { Time.now }
41
+ it "should return the same instance" do
42
+ allow(::Akaer::Application).to receive(:new) { Time.now }
43
43
  instance = ::Akaer::Application.instance("start")
44
44
  expect(::Akaer::Application.instance("stop")).to be(instance)
45
45
  end
46
46
 
47
- it("should return a new instance if requested to") do
48
- ::Akaer::Application.stub(:new) { Time.now }
47
+ it "should return a new instance if requested to" do
48
+ allow(::Akaer::Application).to receive(:new) { Time.now }
49
49
  instance = ::Akaer::Application.instance("")
50
50
  expect(::Akaer::Application.instance({"log-file" => "/dev/null"}, nil, true)).not_to be(instance)
51
51
  end
52
52
  end
53
53
 
54
54
  describe "#initialize" do
55
- it("should setup the logger") do
55
+ it "should setup the logger" do
56
56
  expect(application.logger).not_to be_nil
57
57
  end
58
58
 
59
- it("should setup the configuration") do
59
+ it "should setup the configuration" do
60
60
  expect(application.config).not_to be_nil
61
61
  end
62
62
 
63
- it("should abort with an invalid configuration") do
63
+ it "should abort with an invalid configuration" do
64
64
  path = "/tmp/akaer-test-#{Time.now.strftime("%Y%m%d-%H:%M:%S")}"
65
65
  file = ::File.new(path, "w")
66
66
  file.write("config.aliases = ")
@@ -166,7 +166,7 @@ describe Akaer::Application do
166
166
 
167
167
  describe "#execute_command" do
168
168
  it "should forward to system" do
169
- Kernel.should_receive("system")
169
+ expect(Kernel).to receive("system")
170
170
  application.execute_command("echo OK")
171
171
  end
172
172
  end
@@ -182,18 +182,18 @@ describe Akaer::Application do
182
182
 
183
183
  describe "#manage" do
184
184
  it "should show a right message to the user" do
185
- application.logger.should_receive(:info).with(/.+.*03.*\/.*05.*.+ *Adding.* address .*10.0.0.3.* to interface .*lo0.*/)
185
+ expect(application.logger).to receive(:info).with(/.+.*03.*\/.*05.*.+ *Adding.* address .*10.0.0.3.* to interface .*lo0.*/)
186
186
  application.manage(:add, "10.0.0.3")
187
187
 
188
- application.logger.should_receive(:info).with(/.+.*03.*\/.*05.*.+ *Removing.* address .*10.0.0.3.* from interface .*lo0.*/)
188
+ expect(application.logger).to receive(:info).with(/.+.*03.*\/.*05.*.+ *Removing.* address .*10.0.0.3.* from interface .*lo0.*/)
189
189
  application.manage(:remove, "10.0.0.3")
190
190
  end
191
191
 
192
192
  it "should call the right system command" do
193
- application.should_receive(:execute_command).with("sudo ifconfig lo0 alias 10.0.0.3 > /dev/null 2>&1")
193
+ expect(application).to receive(:execute_command).with("sudo ifconfig lo0 alias 10.0.0.3 > /dev/null 2>&1")
194
194
  application.manage(:add, "10.0.0.3")
195
195
 
196
- application.should_receive(:execute_command).with("sudo ifconfig lo0 -alias 10.0.0.3 > /dev/null 2>&1")
196
+ expect(application).to receive(:execute_command).with("sudo ifconfig lo0 -alias 10.0.0.3 > /dev/null 2>&1")
197
197
  application.manage(:remove, "10.0.0.3")
198
198
  end
199
199
 
@@ -209,78 +209,78 @@ describe Akaer::Application do
209
209
  it "should respect dry-run mode" do
210
210
  other_application = create_application({"log-file" => log_file, "dry-run" => true})
211
211
 
212
- other_application.logger.should_receive(:info).with(/.+.*03.*\/.*05.*.+ I will .*add.* address .*10.0.0.3.* to interface .*lo0.*/)
213
- other_application.should_not_receive(:execute_command)
212
+ expect(other_application.logger).to receive(:info).with(/.+.*03.*\/.*05.*.+ I will .*add.* address .*10.0.0.3.* to interface .*lo0.*/)
213
+ expect(other_application).not_to receive(:execute_command)
214
214
  other_application.manage(:add, "10.0.0.3")
215
215
 
216
- other_application.logger.should_receive(:info).with(/.+.*03.*\/.*05.*.+ I will .*remove.* address .*10.0.0.3.* from interface .*lo0.*/)
217
- other_application.should_not_receive(:execute_command)
216
+ expect(other_application.logger).to receive(:info).with(/.+.*03.*\/.*05.*.+ I will .*remove.* address .*10.0.0.3.* from interface .*lo0.*/)
217
+ expect(other_application).not_to receive(:execute_command)
218
218
  other_application.manage(:remove, "10.0.0.3")
219
219
  end
220
220
  end
221
221
 
222
222
  describe "#action_add" do
223
- it("should compute addresses to manage") do
224
- application.should_receive(:compute_addresses)
223
+ it "should compute addresses to manage" do
224
+ expect(application).to receive(:compute_addresses)
225
225
  application.action_add
226
226
  end
227
227
 
228
- it("should call #manage for every command") do
229
- application.stub(:manage) do |operation, address|
228
+ it "should call #manage for every command" do
229
+ allow(application).to receive(:manage) do |operation, address|
230
230
  address !~ /3$/
231
231
  end
232
232
 
233
- application.should_receive(:manage).at_most(application.compute_addresses.length).with(:add, /.+/)
233
+ expect(application).to receive(:manage).at_most(application.compute_addresses.length).with(:add, /.+/)
234
234
  application.action_add
235
235
  end
236
236
 
237
- it("should show an error there's no address to manage") do
238
- application.stub(:compute_addresses).and_return([])
237
+ it "should show an error there's no address to manage" do
238
+ allow(application).to receive(:compute_addresses).and_return([])
239
239
  other_application = create_application({"log-file" => log_file, "quiet" => true})
240
- other_application.stub(:compute_addresses).and_return([])
240
+ allow(other_application).to receive(:compute_addresses).and_return([])
241
241
 
242
- application.logger.should_receive(:error).with("No valid addresses to add to the interface found.")
242
+ expect(application.logger).to receive(:error).with("No valid addresses to add to the interface found.")
243
243
  application.action_add
244
- other_application.logger.should_not_receive(:error)
244
+ expect(other_application.logger).not_to receive(:error)
245
245
  other_application.action_add
246
246
  end
247
247
  end
248
248
 
249
249
  describe "#action_remove" do
250
- it("should compute addresses to manage") do
251
- application.should_receive(:compute_addresses)
250
+ it "should compute addresses to manage" do
251
+ expect(application).to receive(:compute_addresses)
252
252
  application.action_remove
253
253
  end
254
254
 
255
- it("should call #manage for every command") do
256
- application.stub(:manage) do |operation, address|
255
+ it "should call #manage for every command" do
256
+ allow(application).to receive(:manage) do |operation, address|
257
257
  address !~ /3$/
258
258
  end
259
259
 
260
- application.should_receive(:manage).at_most(application.compute_addresses.length).with(:remove, /.+/)
260
+ expect(application).to receive(:manage).at_most(application.compute_addresses.length).with(:remove, /.+/)
261
261
  application.action_remove
262
262
  end
263
263
 
264
- it("should show an error there's no address to manage") do
265
- application.stub(:compute_addresses).and_return([])
264
+ it "should show an error there's no address to manage" do
265
+ allow(application).to receive(:compute_addresses).and_return([])
266
266
  other_application = create_application({"log-file" => log_file, "quiet" => true})
267
- other_application.stub(:compute_addresses).and_return([])
267
+ allow(other_application).to receive(:compute_addresses).and_return([])
268
268
 
269
- application.logger.should_receive(:error).with("No valid addresses to remove from the interface found.")
269
+ expect(application.logger).to receive(:error).with("No valid addresses to remove from the interface found.")
270
270
  application.action_remove
271
- other_application.logger.should_not_receive(:error)
271
+ expect(other_application.logger).not_to receive(:error)
272
272
  other_application.action_remove
273
273
  end
274
274
  end
275
275
 
276
276
  describe "#action_install" do
277
277
  before(:each) do
278
- application.stub(:is_osx?).and_return(true)
279
- application.stub(:execute_command)
278
+ allow(application).to receive(:is_osx?).and_return(true)
279
+ allow(application).to receive(:execute_command)
280
280
  end
281
281
 
282
282
  it "should create the agent" do
283
- application.stub(:launch_agent_path).and_return(launch_agent_path)
283
+ allow(application).to receive(:launch_agent_path).and_return(launch_agent_path)
284
284
  ::File.unlink(application.launch_agent_path) if ::File.exists?(application.launch_agent_path)
285
285
 
286
286
  application.action_install
@@ -289,46 +289,46 @@ describe Akaer::Application do
289
289
  end
290
290
 
291
291
  it "should not create and invalid agent" do
292
- application.stub(:launch_agent_path).and_return("/invalid/agent")
292
+ allow(application).to receive(:launch_agent_path).and_return("/invalid/agent")
293
293
 
294
294
  ::File.unlink(application.launch_agent_path) if ::File.exists?(application.launch_agent_path)
295
295
 
296
- application.logger.should_receive(:error).with("Cannot create the launch agent.")
296
+ expect(application.logger).to receive(:error).with("Cannot create the launch agent.")
297
297
  application.action_install
298
298
  ::File.unlink(application.launch_agent_path) if ::File.exists?(application.launch_agent_path)
299
299
  end
300
300
 
301
301
  it "should not load an invalid agent" do
302
- application.stub(:execute_command) do |command|
302
+ allow(application).to receive(:execute_command) do |command|
303
303
  command =~ /^launchctl/ ? raise(StandardError) : true
304
304
  end
305
305
 
306
- application.stub(:launch_agent_path).and_return(launch_agent_path)
306
+ allow(application).to receive(:launch_agent_path).and_return(launch_agent_path)
307
307
  ::File.unlink(application.launch_agent_path) if ::File.exists?(application.launch_agent_path)
308
308
 
309
- application.logger.should_receive(:error).with("Cannot load the launch agent.")
309
+ expect(application.logger).to receive(:error).with("Cannot load the launch agent.")
310
310
  application.action_install
311
311
  ::File.unlink(application.launch_agent_path) if ::File.exists?(application.launch_agent_path)
312
312
  end
313
313
 
314
314
  it "should raise an exception if not running on OSX" do
315
- application.stub(:is_osx?).and_return(false)
316
- application.logger.should_receive(:fatal).with("Installing akaer on autolaunch is only available on MacOSX.")
315
+ allow(application).to receive(:is_osx?).and_return(false)
316
+ expect(application.logger).to receive(:fatal).with("Installing akaer on autolaunch is only available on MacOSX.")
317
317
  expect(application.action_install).to be_false
318
318
  end
319
319
  end
320
320
 
321
321
  describe "#action_uninstall" do
322
322
  before(:each) do
323
- application.stub(:is_osx?).and_return(true)
324
- application.stub(:execute_command)
323
+ allow(application).to receive(:is_osx?).and_return(true)
324
+ allow(application).to receive(:execute_command)
325
325
  end
326
326
 
327
327
  it "should remove the agent" do
328
- application.stub(:launch_agent_path).and_return(launch_agent_path)
328
+ allow(application).to receive(:launch_agent_path).and_return(launch_agent_path)
329
329
  ::File.unlink(application.launch_agent_path) if ::File.exists?(application.launch_agent_path)
330
330
 
331
- Bovem::Logger.stub(:default_file).and_return($stdout)
331
+ allow(Bovem::Logger).to receive(:default_file).and_return($stdout)
332
332
  application.action_install
333
333
  application.action_uninstall
334
334
  expect(::File.exists?(application.launch_agent_path)).to be_false
@@ -336,36 +336,36 @@ describe Akaer::Application do
336
336
  end
337
337
 
338
338
  it "should not load delete an invalid resolver" do
339
- application.stub(:launch_agent_path).and_return("/invalid/agent")
339
+ allow(application).to receive(:launch_agent_path).and_return("/invalid/agent")
340
340
 
341
341
  application.action_install
342
- application.logger.should_receive(:warn).at_least(1)
342
+ expect(application.logger).to receive(:warn).at_least(1)
343
343
  application.action_uninstall
344
344
  ::File.unlink(application.launch_agent_path) if ::File.exists?(application.launch_agent_path)
345
345
  end
346
346
 
347
347
  it "should not delete an invalid agent" do
348
- application.stub(:launch_agent_path).and_return("/invalid/agent")
348
+ allow(application).to receive(:launch_agent_path).and_return("/invalid/agent")
349
349
 
350
350
  application.action_install
351
- application.logger.should_receive(:warn).at_least(1)
351
+ expect(application.logger).to receive(:warn).at_least(1)
352
352
  application.action_uninstall
353
353
  ::File.unlink(application.launch_agent_path) if ::File.exists?(application.launch_agent_path)
354
354
  end
355
355
 
356
356
  it "should not load delete invalid agent" do
357
- application.stub(:launch_agent_path).and_return("/invalid/agent")
357
+ allow(application).to receive(:launch_agent_path).and_return("/invalid/agent")
358
358
 
359
359
  application.action_install
360
- application.stub(:execute_command).and_raise(StandardError)
361
- application.logger.should_receive(:warn).at_least(1)
360
+ allow(application).to receive(:execute_command).and_raise(StandardError)
361
+ expect(application.logger).to receive(:warn).at_least(1)
362
362
  application.action_uninstall
363
363
  ::File.unlink(application.launch_agent_path) if ::File.exists?(application.launch_agent_path)
364
364
  end
365
365
 
366
366
  it "should raise an exception if not running on OSX" do
367
- application.stub(:is_osx?).and_return(false)
368
- application.logger.should_receive(:fatal).with("Installing akaer on autolaunch is only available on MacOSX.")
367
+ allow(application).to receive(:is_osx?).and_return(false)
368
+ expect(application.logger).to receive(:fatal).with("Installing akaer on autolaunch is only available on MacOSX.")
369
369
  expect(application.action_uninstall).to be_false
370
370
  end
371
371
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: akaer
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.0
4
+ version: 2.2.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-07-15 00:00:00.000000000 Z
12
+ date: 2013-07-20 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: mamertes
@@ -18,7 +18,7 @@ dependencies:
18
18
  requirements:
19
19
  - - ~>
20
20
  - !ruby/object:Gem::Version
21
- version: 2.2.0
21
+ version: 2.2.1
22
22
  type: :runtime
23
23
  prerelease: false
24
24
  version_requirements: !ruby/object:Gem::Requirement
@@ -26,7 +26,7 @@ dependencies:
26
26
  requirements:
27
27
  - - ~>
28
28
  - !ruby/object:Gem::Version
29
- version: 2.2.0
29
+ version: 2.2.1
30
30
  - !ruby/object:Gem::Dependency
31
31
  name: mustache
32
32
  requirement: !ruby/object:Gem::Requirement
@@ -111,7 +111,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
111
111
  version: '0'
112
112
  segments:
113
113
  - 0
114
- hash: -3163015799533818897
114
+ hash: -2682300453030102654
115
115
  requirements: []
116
116
  rubyforge_project: akaer
117
117
  rubygems_version: 1.8.25