ubuntu_update 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f59e4d4351972df1f32366e0f1c181704a921ff2
4
- data.tar.gz: e4f97553b7cc49dab98cb72e08de67795677afa7
3
+ metadata.gz: b3e58e73976842e49aade235f59c2806740cc4d7
4
+ data.tar.gz: 6872c4cdd815fc0989791d522d6c19e7a3d298db
5
5
  SHA512:
6
- metadata.gz: a776c72bb27be43da939e23093f0002b02c432d483563b848a4e51c54674f141ce82060add0de55aa2bb40328c9202e9fd56bb11b879a765e023a0abcce11cd1
7
- data.tar.gz: 276bb7c10c0fd6ea2aec41d234e27f9ab54ab69c592acf53b3edd8c96f759e23251368bb1c828ba3da0f380216297a61fd2759e4d202b087a67473a157ab20d9
6
+ metadata.gz: 8977e49f9e7eb20b6cb611b899cab02e0b19851dccc3218955674b282db43fd137645373f466a06aa97f1bf31a19743bbe5d2fc95482ac4dca47a5ed4533b4b9
7
+ data.tar.gz: 9c745712097813a3756c28cf1246c32504338d8480804711e966086d5a4a37db251bcacbd641b8017b991e81db247cdf3228d856652df6a793444b632c1d0f62
@@ -27,6 +27,10 @@ module UbuntuUpdate
27
27
  @options[:upgrade] = g
28
28
  end
29
29
 
30
+ opts.on("-y", "--yes", "Silent confirmation") do |y|
31
+ @options[:yes] = y
32
+ end
33
+
30
34
  opts.on("-h", "--help", "Show usage summary") do |h|
31
35
  @options[:help] = h
32
36
  @summary = opts.help
@@ -1,3 +1,3 @@
1
1
  module UbuntuUpdate
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
@@ -10,20 +10,19 @@ describe UbuntuUpdate::OptionsParser, "#get_summary" do
10
10
  # expect(options_parser.get_options).not_to include(:verbose)
11
11
  # end
12
12
 
13
+ subject(:options_parser) { options_parser = UbuntuUpdate::OptionsParser.new }
14
+
13
15
  it "it should contains :verbose when passed -v in the argument" do
14
- options_parser = UbuntuUpdate::OptionsParser.new
15
16
  options_parser.parse(["-v"])
16
17
  expect(options_parser.get_options).to include({:verbose=>true})
17
18
  end
18
19
 
19
20
  it "it should contains :update when passed -p in the argument" do
20
- options_parser = UbuntuUpdate::OptionsParser.new
21
21
  options_parser.parse(["-p"])
22
22
  expect(options_parser.get_options).to include({:update=>true})
23
23
  end
24
24
 
25
25
  it "it should contains :upgrade when passed -g in the argument" do
26
- options_parser = UbuntuUpdate::OptionsParser.new
27
26
  options_parser.parse(["-g"])
28
27
  expect(options_parser.get_options).to include({:upgrade=>true})
29
28
  end
@@ -6,70 +6,64 @@ require 'ubuntu_update/command_executor'
6
6
 
7
7
  describe UbuntuUpdate::Updater, "#execute_command" do
8
8
 
9
- it "it should show summary when --help is passed in" do
10
- options_parser = UbuntuUpdate::OptionsParser.new
11
- options_parser.expects(:get_options).at_least(1).returns({:help => true})
12
- options_parser.expects(:get_summary).at_least(1).returns("My script summary")
9
+ subject(:updater) do
10
+ updater = UbuntuUpdate::Updater.new options_parser, command_executor
11
+ end
12
+
13
+ let(:command_executor) do
14
+ command_executor = UbuntuUpdate::CommandExecutor.new
15
+ end
16
+
17
+ let(:options_parser) do
18
+ options_parser = UbuntuUpdate::OptionsParser.new
19
+ end
13
20
 
14
- command_executor = UbuntuUpdate::CommandExecutor.new
21
+ it "it should show summary when --help is passed in" do
15
22
  command_executor.expects(:execute).with(includes("My script summary"))
16
23
 
17
- updater = UbuntuUpdate::Updater.new options_parser, command_executor
24
+ options_parser.expects(:get_options).at_least(1).returns({:help => true})
25
+ options_parser.expects(:get_summary).at_least(1).returns("My script summary")
26
+
18
27
  updater.execute_command
19
28
  end
20
29
 
21
30
  it "it should run apt-get update when no argument passed in" do
22
- options_parser = UbuntuUpdate::OptionsParser.new
23
31
  options_parser.expects(:get_options).at_least(1).returns({})
24
32
 
25
- command_executor = UbuntuUpdate::CommandExecutor.new
26
33
  command_executor.expects(:execute).with("sudo apt-get update")
27
34
 
28
- updater = UbuntuUpdate::Updater.new options_parser, command_executor
29
35
  updater.execute_command
30
36
  end
31
37
 
32
38
  it "it should run apt-get update when passed in {:update=>true}" do
33
- options_parser = UbuntuUpdate::OptionsParser.new
34
39
  options_parser.expects(:get_options).at_least(1).returns({:update=>true})
35
40
 
36
- command_executor = UbuntuUpdate::CommandExecutor.new
37
41
  command_executor.expects(:execute).with("sudo apt-get update")
38
42
 
39
- updater = UbuntuUpdate::Updater.new options_parser, command_executor
40
43
  updater.execute_command
41
44
  end
42
45
 
43
46
  it "it should run apt-get update when passed in {:upgrade=>true}" do
44
- options_parser = UbuntuUpdate::OptionsParser.new
45
47
  options_parser.expects(:get_options).at_least(1).returns({:upgrade=>true})
46
48
 
47
- command_executor = UbuntuUpdate::CommandExecutor.new
48
49
  command_executor.expects(:execute).with("sudo apt-get upgrade")
49
50
 
50
- updater = UbuntuUpdate::Updater.new options_parser, command_executor
51
51
  updater.execute_command
52
52
  end
53
53
 
54
54
  it "it should run apt-get upgrade with -y when passed in {:yes=>true}" do
55
- options_parser = UbuntuUpdate::OptionsParser.new
56
55
  options_parser.expects(:get_options).at_least(1).returns({:yes=>true, :upgrade=>true})
57
56
 
58
- command_executor = UbuntuUpdate::CommandExecutor.new
59
57
  command_executor.expects(:execute).with("sudo apt-get upgrade -y")
60
58
 
61
- updater = UbuntuUpdate::Updater.new options_parser, command_executor
62
59
  updater.execute_command
63
60
  end
64
61
 
65
62
  it "it should run apt-get upgrade and upgrade when passed in {:update=>true, :upgrade=>true}" do
66
- options_parser = UbuntuUpdate::OptionsParser.new
67
63
  options_parser.expects(:get_options).at_least(1).returns({:update=>true, :upgrade=>true})
68
64
 
69
- command_executor = UbuntuUpdate::CommandExecutor.new
70
65
  command_executor.expects(:execute).with("sudo apt-get update && sudo apt-get upgrade")
71
66
 
72
- updater = UbuntuUpdate::Updater.new options_parser, command_executor
73
67
  updater.execute_command
74
68
  end
75
69
  end
Binary file
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ubuntu_update
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - taufekj
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-11-28 00:00:00.000000000 Z
11
+ date: 2014-12-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler