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 +4 -4
- data/lib/ubuntu_update/options_parser.rb +4 -0
- data/lib/ubuntu_update/version.rb +1 -1
- data/spec/options_parser_spec.rb +2 -3
- data/spec/ubuntu_update_spec.rb +15 -21
- data/ubuntu_update-0.0.1.gem +0 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b3e58e73976842e49aade235f59c2806740cc4d7
|
4
|
+
data.tar.gz: 6872c4cdd815fc0989791d522d6c19e7a3d298db
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8977e49f9e7eb20b6cb611b899cab02e0b19851dccc3218955674b282db43fd137645373f466a06aa97f1bf31a19743bbe5d2fc95482ac4dca47a5ed4533b4b9
|
7
|
+
data.tar.gz: 9c745712097813a3756c28cf1246c32504338d8480804711e966086d5a4a37db251bcacbd641b8017b991e81db247cdf3228d856652df6a793444b632c1d0f62
|
data/spec/options_parser_spec.rb
CHANGED
@@ -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
|
data/spec/ubuntu_update_spec.rb
CHANGED
@@ -6,70 +6,64 @@ require 'ubuntu_update/command_executor'
|
|
6
6
|
|
7
7
|
describe UbuntuUpdate::Updater, "#execute_command" do
|
8
8
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
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
|
-
|
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
|
-
|
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
|
data/ubuntu_update-0.0.1.gem
CHANGED
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.
|
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
|
+
date: 2014-12-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|