update 0.9.2 → 0.9.3

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.
@@ -1,13 +1,21 @@
1
1
  module Update
2
2
  COMMAND_GROUPS = [
3
- {"brew update" => "Checking for updated Brew packages...",
4
- "brew upgrade" => "Installing updated Brew packages...",
5
- "brew cleanup --force" => "Cleaning up outdated packages..."},
3
+ {
4
+ "brew update" => "Checking for updated Brew packages...",
5
+ "brew upgrade" => "Installing updated Brew packages...",
6
+ "brew cleanup --force" => "Cleaning up outdated packages..."
7
+ },
6
8
 
7
- {"rvm get head --auto" => "Get the latest RVM..."},
9
+ ### Add new command groups by uncommenting a hash such as below:
10
+ # {
11
+ # "rvm get head --auto" => "Getting the latest RVM...",
12
+ # "rvm cleanup all" => "Cleaning up everything RVM..."
13
+ # },
8
14
 
9
- {"gem update --system" => "Get the latest RubyGems...",
10
- "gem update" => "Update gems...",
11
- "gem cleanup --dryrun" => "Show gem cleanup dry-run..."}
15
+ {
16
+ "gem update --system" => "Getting the latest RubyGems...",
17
+ "gem update" => "Updating gems...",
18
+ "gem cleanup --dryrun" => "Showing gem cleanup dry-run..."
19
+ }
12
20
  ]
13
21
  end
@@ -4,13 +4,39 @@ module Update
4
4
  class << self
5
5
  def run
6
6
  EM.synchrony do
7
+ <<<<<<< HEAD
8
+ asynchronously_iterate_over_command_groups
9
+ end
10
+
11
+ report_final_status
12
+ end
13
+
14
+ private
15
+
16
+ def asynchronously_iterate_over_command_groups
17
+ EM::Synchrony::FiberIterator.new(Update::COMMAND_GROUPS).each do |commands|
18
+ @commands = commands
19
+
20
+ synchronously_run_commands_within_each_command_group
21
+ end
22
+ =======
7
23
  EM::Synchrony::FiberIterator.new(Update::COMMAND_GROUPS).each do |commands|
8
24
  commands.each do |command, description|
9
25
  @command = command
26
+ >>>>>>> decd17cc3beee1747212fae05bdde97b94263337
27
+
28
+ EventMachine.stop
29
+ end
30
+
31
+ <<<<<<< HEAD
32
+ def synchronously_run_commands_within_each_command_group
33
+ @commands.each do |command, description|
34
+ @command, @description = command, description
10
35
 
11
- @results ||= {}
12
- @results["#{description}"] = `#@command`
36
+ run_commands_in_each_command_group
13
37
 
38
+ take_note_if_command_fails
39
+ =======
14
40
  take_note_if_command_fails
15
41
  end
16
42
 
@@ -21,12 +47,16 @@ module Update
21
47
  end
22
48
 
23
49
  EventMachine.stop
50
+ >>>>>>> decd17cc3beee1747212fae05bdde97b94263337
24
51
  end
25
-
26
- report_final_status
52
+
53
+ display_results_of_command_group
27
54
  end
28
55
 
29
- private
56
+ def run_commands_in_each_command_group
57
+ @results ||= {}
58
+ @results["#{@description}"] = `#@command`
59
+ end
30
60
 
31
61
  def take_note_if_command_fails
32
62
  unless $?.success?
@@ -34,6 +64,13 @@ module Update
34
64
  @failed << @command
35
65
  end
36
66
  end
67
+
68
+ def display_results_of_command_group
69
+ @results.each do |description, result|
70
+ green @description
71
+ puts result
72
+ end
73
+ end
37
74
 
38
75
  def report_final_status
39
76
  if @failed
@@ -1,3 +1,3 @@
1
1
  module Update
2
- VERSION = "0.9.2"
2
+ VERSION = "0.9.3"
3
3
  end
@@ -0,0 +1,7 @@
1
+ unless Object.const_defined? 'Update'
2
+ $:.unshift File.expand_path '../../lib', __FILE__
3
+ require 'update'
4
+ end
5
+
6
+ require 'minitest/autorun'
7
+ require 'minitest/pride'
@@ -0,0 +1,23 @@
1
+ require_relative 'helper'
2
+
3
+ class TestUpdate < MiniTest::Unit::TestCase
4
+ def test_version
5
+ version = `update -v`
6
+ assert_match version, /Version \d.\d.\d on/
7
+ end
8
+
9
+ def test_list
10
+ list = `update -l`
11
+ assert_match list, /[0]/
12
+ end
13
+
14
+ def test_edit
15
+ edit = `update -e`
16
+ assert_equal edit, "Something sane, which this is not..."
17
+ end
18
+
19
+ def test_help
20
+ help = `update -h`
21
+ assert help.empty?, "Slop -h returns an empty string, not sure why. TODO: find out why. >.>"
22
+ end
23
+ end
@@ -0,0 +1,7 @@
1
+ require_relative 'helper'
2
+
3
+ class TestUpdate < MiniTest::Unit::TestCase
4
+ def test_async
5
+ assert "I know not how to test this, which makes me sad.", "Must seek enlightenment elsewhere, for there is none here."
6
+ end
7
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: update
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.2
4
+ version: 0.9.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2012-02-28 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: slop
16
- requirement: &70116696575560 !ruby/object:Gem::Requirement
16
+ requirement: &70324888715920 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '2.4'
22
22
  type: :development
23
23
  prerelease: false
24
- version_requirements: *70116696575560
24
+ version_requirements: *70324888715920
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: awesome_print
27
- requirement: &70116696574880 !ruby/object:Gem::Requirement
27
+ requirement: &70324888714340 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ~>
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '1.0'
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *70116696574880
35
+ version_requirements: *70324888714340
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: em-synchrony
38
- requirement: &70116696574060 !ruby/object:Gem::Requirement
38
+ requirement: &70324888713200 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ~>
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '1.0'
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *70116696574060
46
+ version_requirements: *70324888713200
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: slop
49
- requirement: &70116696573280 !ruby/object:Gem::Requirement
49
+ requirement: &70324888712400 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ~>
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: '2.4'
55
55
  type: :runtime
56
56
  prerelease: false
57
- version_requirements: *70116696573280
57
+ version_requirements: *70324888712400
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: awesome_print
60
- requirement: &70116696572520 !ruby/object:Gem::Requirement
60
+ requirement: &70324888711800 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ~>
@@ -65,10 +65,10 @@ dependencies:
65
65
  version: '1.0'
66
66
  type: :runtime
67
67
  prerelease: false
68
- version_requirements: *70116696572520
68
+ version_requirements: *70324888711800
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: em-synchrony
71
- requirement: &70116696571820 !ruby/object:Gem::Requirement
71
+ requirement: &70324888710940 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ~>
@@ -76,7 +76,7 @@ dependencies:
76
76
  version: '1.0'
77
77
  type: :runtime
78
78
  prerelease: false
79
- version_requirements: *70116696571820
79
+ version_requirements: *70324888710940
80
80
  description: A Ruby Gem for running a list of update commands from command line.
81
81
  email:
82
82
  - shannonskipper@gmail.com
@@ -95,6 +95,9 @@ files:
95
95
  - lib/update/red-green.rb
96
96
  - lib/update/run-updates.rb
97
97
  - lib/update/version.rb
98
+ - test/helper.rb
99
+ - test/test_option_flags.rb
100
+ - test/test_update_runs_asynchronously.rb
98
101
  - update.gemspec
99
102
  homepage: https://github.com/havenwood/update
100
103
  licenses: []
@@ -120,5 +123,8 @@ rubygems_version: 1.8.17
120
123
  signing_key:
121
124
  specification_version: 3
122
125
  summary: a gem to run a list of updates
123
- test_files: []
126
+ test_files:
127
+ - test/helper.rb
128
+ - test/test_option_flags.rb
129
+ - test/test_update_runs_asynchronously.rb
124
130
  has_rdoc: