update 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -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 ADDED
@@ -0,0 +1,7 @@
1
+ # Update
2
+
3
+ Update is a script for running command line updates.
4
+
5
+ RedGreen is just a light module for pretty red and green in your console.
6
+
7
+ Add commands to commands.rb and run your script with './update'.
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,50 @@
1
+ require "update/version"
2
+ require "update/red-green"
3
+ require "update/commands"
4
+ require "slop"
5
+
6
+ opts = Slop.parse(:help => true, :banner => "Update script for running commands.rb.") do
7
+ on :v, :version, 'Print version information'
8
+ end
9
+
10
+ module Update
11
+ extend RedGreen
12
+
13
+ class << self
14
+ def run
15
+ run_each_command
16
+ report_final_status
17
+ end
18
+
19
+ private
20
+
21
+ def run_each_command
22
+ COMMANDS.each do |command, task|
23
+ green task
24
+ puts `#{command}`
25
+ check_for_failures
26
+ end
27
+ end
28
+
29
+ def check_for_failures
30
+ unless $?.success?
31
+ @failed = true
32
+ red "Command failed."
33
+ end
34
+ end
35
+
36
+ def report_final_status
37
+ unless @failed
38
+ green "Update process completed successfully."
39
+ else
40
+ red "Update process completed with failures.\a"
41
+ end
42
+ end
43
+ end
44
+ end
45
+
46
+ unless opts.version?
47
+ Update.run
48
+ else
49
+ puts VERSION
50
+ end
@@ -0,0 +1,10 @@
1
+ COMMANDS = { "brew update" => "Checking for updated Brew packages...",
2
+ "brew upgrade" => "Installing updated Brew packages...",
3
+ "brew cleanup --force" => "Cleaning up outdated packages...",
4
+ "rvm get head --auto" => "Get the latest RVM...",
5
+ "rvm 1.9.3-head do gem update --system" => "Update 1.9.3's RubyGems version...",
6
+ "rvm 1.9.3-head do gem update" => "Update 1.9.3 gems...",
7
+ "rvm 1.9.3-head do gem cleanup -d" => "Show 1.9.3 gem cleanup dry-run...",
8
+ "rvm rbx-head do gem update --system" => "Update Rubinius' RubyGems version...",
9
+ "rvm rbx-head do gem update" => "Update Rubinius gems...",
10
+ "rvm rbx-head do gem cleanup -d" => "Show Rubinius gem cleanup dry-run..." }
@@ -0,0 +1,13 @@
1
+ module RedGreen
2
+ def green message
3
+ system "tput setaf 2" #color green
4
+ puts message
5
+ system "tput sgr0" #color reset
6
+ end
7
+
8
+ def red message
9
+ system "tput setaf 1" #color red
10
+ puts message
11
+ system "tput sgr0" #color reset
12
+ end
13
+ end
@@ -0,0 +1,3 @@
1
+ module Update
2
+ VERSION = "0.0.1"
3
+ end
@@ -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 = ""
11
+ s.summary = %q{simple command line updater script in Ruby}
12
+ s.description = %q{update script for updating yer things}
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 ADDED
@@ -0,0 +1,77 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: update
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - shan
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-01-22 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: slop
16
+ requirement: &70320929471200 !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :development
23
+ prerelease: false
24
+ version_requirements: *70320929471200
25
+ - !ruby/object:Gem::Dependency
26
+ name: slop
27
+ requirement: &70320929470720 !ruby/object:Gem::Requirement
28
+ none: false
29
+ requirements:
30
+ - - ! '>='
31
+ - !ruby/object:Gem::Version
32
+ version: '0'
33
+ type: :runtime
34
+ prerelease: false
35
+ version_requirements: *70320929470720
36
+ description: update script for updating yer things
37
+ email:
38
+ - shannonskipper@gmail.com
39
+ executables: []
40
+ extensions: []
41
+ extra_rdoc_files: []
42
+ files:
43
+ - .gitignore
44
+ - Gemfile
45
+ - README
46
+ - Rakefile
47
+ - lib/update.rb
48
+ - lib/update/commands.rb
49
+ - lib/update/red-green.rb
50
+ - lib/update/version.rb
51
+ - update.gemspec
52
+ homepage: ''
53
+ licenses: []
54
+ post_install_message:
55
+ rdoc_options: []
56
+ require_paths:
57
+ - lib
58
+ required_ruby_version: !ruby/object:Gem::Requirement
59
+ none: false
60
+ requirements:
61
+ - - ! '>='
62
+ - !ruby/object:Gem::Version
63
+ version: '0'
64
+ required_rubygems_version: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - ! '>='
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
70
+ requirements: []
71
+ rubyforge_project: update
72
+ rubygems_version: 1.8.15
73
+ signing_key:
74
+ specification_version: 3
75
+ summary: simple command line updater script in Ruby
76
+ test_files: []
77
+ has_rdoc: