update 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore ADDED
@@ -0,0 +1,4 @@
1
+ *.gem
2
+ .bundle
3
+ Gemfile.lock
4
+ pkg/*
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in update.gemspec
4
+ gemspec
data/README.md ADDED
@@ -0,0 +1,13 @@
1
+ # Update: a gem to run a list of updates
2
+ Update is a simple Ruby script for running sets of updates from your command line.
3
+ ##Installation and usage
4
+ ```ruby
5
+ gem install update
6
+ update
7
+ ```
8
+ Running `update` processes the list of updates found in the commands.rb file and then reports back whether the updates were run sucessfully.
9
+ ##Edit list of updates
10
+ Modify the Hash of update commands in commands.rb to customize update scripts. TODO: Sane and usable way to do this. >.>
11
+ ##License
12
+ Copyright (c) Shannon Skipper.
13
+ MIT License.
data/bin/update ADDED
@@ -0,0 +1,13 @@
1
+ #!/usr/bin/env ruby
2
+ require "update"
3
+ require "slop"
4
+
5
+ opts = Slop.parse(:help => true, :banner => "Usage: update [options]") do
6
+ on :v, :version, "Print version information" do
7
+ puts "Update Gem version #{Update::VERSION} on Ruby #{RUBY_VERSION}"
8
+ puts "Shannon Skipper <shannonskipper@gmail.com>"
9
+ exit
10
+ end
11
+ end
12
+
13
+ Update.run
@@ -0,0 +1,35 @@
1
+ module Update
2
+ extend RedGreen
3
+
4
+ class << self
5
+ def run
6
+ run_each_command
7
+ report_final_status
8
+ end
9
+
10
+ private
11
+
12
+ def run_each_command
13
+ COMMANDS.each do |command, description|
14
+ green description
15
+ puts `#{command}`
16
+ check_for_failures
17
+ end
18
+ end
19
+
20
+ def check_for_failures
21
+ unless $?.success?
22
+ @failed = true
23
+ red "Command failed."
24
+ end
25
+ end
26
+
27
+ def report_final_status
28
+ unless @failed
29
+ green "Update process completed successfully."
30
+ else
31
+ red "Update process completed with failures.\a" #chirp
32
+ end
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,17 @@
1
+ module RedGreen
2
+ GREEN = "tput setaf 2"
3
+ RED = "tput setaf 1"
4
+ RESET = "tput sgr0"
5
+
6
+ def green message
7
+ system GREEN
8
+ puts message
9
+ system RESET
10
+ end
11
+
12
+ def red message
13
+ system RED
14
+ puts message
15
+ system RESET
16
+ end
17
+ end
@@ -0,0 +1,3 @@
1
+ module Update
2
+ VERSION = "0.1.2"
3
+ end
data/lib/update.rb ADDED
@@ -0,0 +1,14 @@
1
+ require "update/version"
2
+ require "update/red-green"
3
+ require "update/base"
4
+
5
+ COMMANDS = { "brew update" => "Checking for updated Brew packages...",
6
+ "brew upgrade" => "Installing updated Brew packages...",
7
+ "brew cleanup --force" => "Cleaning up outdated packages...",
8
+ "rvm get head --auto" => "Get the latest RVM...",
9
+ "rvm 1.9.3-head do gem update --system" => "Update 1.9.3's RubyGems version...",
10
+ "rvm 1.9.3-head do gem update" => "Update 1.9.3 gems...",
11
+ "rvm 1.9.3-head do gem cleanup -d" => "Show 1.9.3 gem cleanup dry-run...",
12
+ "rvm rbx-head do gem update --system" => "Update Rubinius' RubyGems version...",
13
+ "rvm rbx-head do gem update" => "Update Rubinius gems...",
14
+ "rvm rbx-head do gem cleanup -d" => "Show Rubinius gem cleanup dry-run..." }
data/update.gemspec ADDED
@@ -0,0 +1,23 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "update/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "update"
7
+ s.version = Update::VERSION
8
+ s.authors = ["shan"]
9
+ s.email = ["shannonskipper@gmail.com"]
10
+ s.homepage = "https://github.com/havenwood/update"
11
+ s.summary = %q{a gem to run a list of updates}
12
+ s.description = %q{A Ruby Gem for running a list of update commands from command line.}
13
+
14
+ s.rubyforge_project = "update"
15
+
16
+ s.files = `git ls-files`.split("\n")
17
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
18
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
19
+ s.require_paths = ["lib"]
20
+
21
+ s.add_development_dependency "slop"
22
+ s.add_runtime_dependency "slop"
23
+ 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.1.1
4
+ version: 0.1.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2012-01-23 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: slop
16
- requirement: &70176284947000 !ruby/object:Gem::Requirement
16
+ requirement: &70305289142200 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :development
23
23
  prerelease: false
24
- version_requirements: *70176284947000
24
+ version_requirements: *70305289142200
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: slop
27
- requirement: &70176284946500 !ruby/object:Gem::Requirement
27
+ requirement: &70305289141660 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,14 +32,24 @@ dependencies:
32
32
  version: '0'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *70176284946500
35
+ version_requirements: *70305289141660
36
36
  description: A Ruby Gem for running a list of update commands from command line.
37
37
  email:
38
38
  - shannonskipper@gmail.com
39
- executables: []
39
+ executables:
40
+ - update
40
41
  extensions: []
41
42
  extra_rdoc_files: []
42
- files: []
43
+ files:
44
+ - .gitignore
45
+ - Gemfile
46
+ - README.md
47
+ - bin/update
48
+ - lib/update.rb
49
+ - lib/update/base.rb
50
+ - lib/update/red-green.rb
51
+ - lib/update/version.rb
52
+ - update.gemspec
43
53
  homepage: https://github.com/havenwood/update
44
54
  licenses: []
45
55
  post_install_message: