chicken_little 0.1.0 → 0.2.0

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.
@@ -0,0 +1,20 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ chicken_little (0.2.0)
5
+ bundler
6
+ commandable
7
+ term-ansicolor-hi
8
+
9
+ GEM
10
+ remote: http://rubygems.org/
11
+ specs:
12
+ commandable (0.2.1)
13
+ term-ansicolor-hi (~> 1.0.7)
14
+ term-ansicolor-hi (1.0.7)
15
+
16
+ PLATFORMS
17
+ ruby
18
+
19
+ DEPENDENCIES
20
+ chicken_little!
@@ -6,16 +6,24 @@ A simple hack to disable the incredibly annoying deprecation warnings for `Gem::
6
6
 
7
7
  **Installing:**
8
8
 
9
- To install from a command line run:
9
+ To properly fix the deprecation warnings run:
10
10
 
11
11
  $ chicken_little
12
12
 
13
- If you like to being verbose you can run:
14
-
13
+ Which is short for:
14
+
15
15
  $ chicken_little install
16
+
17
+ If you're still getting errors you can use the old method:
18
+
19
+ $ chicken_little force_install
20
+
21
+ **Describes how to do it manually**
22
+
23
+ $ chicken_little describe_fix
16
24
 
17
25
  **Uninstalling:**
18
- When they come to their senses and realize the ridiculous deprecation warnings makes it virtually impossible to work you can uninstall Chicken Little by running:
26
+ To re-enable the deprecation warnings run:
19
27
 
20
28
  $ chicken_little uninstall
21
29
 
@@ -32,12 +40,25 @@ To see if it can be installed run:
32
40
 
33
41
  ### What's it do?
34
42
 
35
- Chicken Little hard patches the Rubygems library changing a single line of code so warning messages aren't printed for the `Gem::Specification#default_executable=` messsage.
43
+ Chicken Little hard patches the Rubygems library changing two lines of code commenting out the offending deprecations so warning messages aren't printed for the `Gem::Specification#default_executable=` messsage.
36
44
 
37
- It doesn't stop any other deprecation warnings, just the hostile, anti-user default\_executable one.
45
+ It doesn't stop any other deprecation warnings just the hostile, anti-user default\_executable one.
38
46
 
39
47
  ### Notes
40
48
 
41
49
  If you're using RVM you'll need to run this for each gemset.
42
50
 
43
51
  Also, as would be expected, you'll need to re-run Chicken Little every time you update the `gem` app.
52
+
53
+ ### Change List
54
+
55
+ Version 0.2.0
56
+ Changed to use the proper way to fix the deprecation error.
57
+
58
+ **Bug Fixes**
59
+ Now properly works in Linux (or at least in Ubuntu 10.10)
60
+
61
+ Version 0.1.0
62
+ Initial release
63
+
64
+
@@ -3,20 +3,22 @@ $:.push File.expand_path("../lib", __FILE__)
3
3
  require "chicken_little/version"
4
4
 
5
5
  Gem::Specification.new do |s|
6
- s.name = "chicken_little"
6
+ s.name = %q{chicken_little}
7
7
  s.version = ChickenLittle::VERSION
8
8
  s.platform = Gem::Platform::RUBY
9
9
  s.required_ruby_version = '>= 1.9.2'
10
- s.authors = ["Mike Bethany"]
11
- s.email = ["mikbe.tk@gmail.com"]
12
- s.homepage = "http://mikbe.tk"
13
- s.summary = %q{Disables the annoying Gem::Specification#default_executable= warnings when running `gem`.}
14
- s.description = %q{A simple hack to disable the incredibly annoying deprecation warnings for Gem::Specification#default_executable= when using the `gem` command.}
10
+ s.summary = %q{Now uses the officially sanctioned method to disable the annoying Gem::Specification#default_executable= warnings when running gem.}
11
+ s.description = %q{Uses the officially sanctioned method fix the incredibly annoying deprecation warnings for Gem::Specification#default_executable= when using the gem command.}
15
12
 
16
- s.license = 'MIT'
13
+ s.authors = [%q{Mike Bethany}]
14
+ s.date = %q{2011-05-12}
15
+ s.email = [%q{mikbe.tk@gmail.com}]
16
+ s.homepage = %q{http://mikbe.tk}
17
+ s.licenses = [%q{MIT}]
17
18
 
18
19
  s.add_dependency("bundler")
19
20
  s.add_dependency("commandable")
21
+ s.add_dependency("term-ansicolor-hi")
20
22
 
21
23
  s.files = `git ls-files`.split("\n")
22
24
  s.test_files = `git ls-files -- {spec}/*`.split("\n")
@@ -1,3 +1,3 @@
1
1
  require 'chicken_little/commandable_settings'
2
- require 'chicken_little/patch'
3
2
  require 'chicken_little/exceptions'
3
+ require 'chicken_little/patch'
@@ -1,3 +1,7 @@
1
+ require 'rubygems'
2
+ require 'rubygems/gem_runner'
3
+ require 'rubygems/exceptions'
4
+
1
5
  module ChickenLittle
2
6
 
3
7
  Uncommented_Line = "deprecate :default_executable"
@@ -5,8 +9,64 @@ module ChickenLittle
5
9
  class Patch
6
10
  extend Commandable
7
11
 
8
- command "Disables the annoying deprication warnings from the gem command", :default, :xor
12
+ command "Tries to fix your gems so they stop giving the deprication warning.", :default
9
13
  def install
14
+ describe_fix false
15
+ puts %{
16
+ Chicken Little is attempting to fix the errors for you properly. This may take a while.
17
+ The fix will be run repeatedly until the errors go away or it's tried too many times.
18
+ }
19
+
20
+ # Test for RVM
21
+ begin
22
+ puts "Fixing the global RVM gemset first"
23
+ #ruby_ver, gemset = `rvm-prompt`.strip.split("@")
24
+
25
+ rvm_path = File.expand_path(ENV['rvm_path'] || '~/.rvm')
26
+ $LOAD_PATH.unshift File.join(rvm_path, 'lib')
27
+ require 'rvm'
28
+
29
+ current_env = RVM.current.environment_name
30
+ #puts "Current: #{current_env.inspect}"
31
+ # puts `rvm-prompt`
32
+ rvm = RVM.environment current_env
33
+
34
+ rvm.gemset_use! 'global'
35
+ # puts `rvm-prompt`
36
+ fix_gems
37
+ rvm.use! "#{current_env}"
38
+ # puts `rvm-prompt`
39
+ puts "RVM global gemset done"
40
+ rescue Exception
41
+ #skipping error
42
+ puts "RVM not found"
43
+ end
44
+
45
+ puts "\nFixing your default gemset now"
46
+ fix_gems
47
+ puts "All done. Enjoy"
48
+ end
49
+
50
+ def fix_gems
51
+ (1..5).each do |i|
52
+ puts "Run ##{i}: Cleaning up gems, this may take a while."
53
+ output = capture_output{ Gem::GemRunner.new.run %w{list} }
54
+ break if output[:stderr].empty?
55
+
56
+ output = capture_output{
57
+ case i
58
+ when 1,4
59
+ Gem::GemRunner.new.run %w{pristine --all --no-extensions}
60
+ else
61
+ Gem::GemRunner.new.run %w{pristine --all}
62
+ end
63
+ }
64
+ end
65
+ end
66
+
67
+ command "Forces the old method for disabling the annoying deprication warnings", :xor
68
+ def force_install
69
+ describe_fix
10
70
  supported?
11
71
  return "Chicken Little is already installed" if installed?
12
72
  new_spec_file = spec_file_contents.collect { |line| line.index(Uncommented_Line) ? "##{line.strip}\n" : line}
@@ -18,7 +78,7 @@ module ChickenLittle
18
78
  end
19
79
  end
20
80
 
21
- command "Removes the Chicken Little patch", :xor
81
+ command "Removes the old Chicken Little patch.\nThe new fix does not need to be uninstalled\nas it doesn't really install anything.", :xor
22
82
  def uninstall
23
83
  supported?
24
84
  return "Chicken Little isn't installed" unless installed?
@@ -33,7 +93,7 @@ module ChickenLittle
33
93
 
34
94
  command "Checks to see if Chicken Little is already installed", :xor
35
95
  def installed?
36
- spec_file_contents.select { |line| line.strip.start_with?(Uncommented_Line) }.empty?
96
+ !spec_file_contents.select { |line| line.strip.start_with?("##{Uncommented_Line}") }.empty?
37
97
  end
38
98
 
39
99
  command "Lets you know if it can be installed"
@@ -44,7 +104,41 @@ module ChickenLittle
44
104
  "Looks good. Chicken Little can find and modify the necessary files."
45
105
  end
46
106
 
107
+ command "Describe a better way to fix the problem"
108
+ def describe_fix(force_description=true)
109
+ flag_file = "#{File.expand_path(File.dirname(__FILE__))}/better_fix_described"
110
+ unless File.exist?(flag_file) && !force_description
111
+ FileUtils.touch flag_file
112
+ puts %{
113
+ Important! The old install method should not be necessary.
114
+
115
+ A better fix is to run:
116
+ $ gem pristine --all --no-extensions
117
+
118
+ Then run this:
119
+ $ gem pristine --all
120
+
121
+ You may need to run those commands several times.
122
+
123
+ If you still have problems you can then force the old install method with:
124
+ $ chicken_little force_install}
125
+ end
126
+
127
+ end
128
+
47
129
  private
130
+
131
+ def capture_output
132
+ begin
133
+ require 'stringio'
134
+ $o_stdout, $o_stderr = $stdout, $stderr
135
+ $stdout, $stderr = StringIO.new, StringIO.new
136
+ yield
137
+ {:stdout => $stdout.string, :stderr => $stderr.string}
138
+ ensure
139
+ $stdout, $stderr = $o_stdout, $o_stderr
140
+ end
141
+ end
48
142
 
49
143
  def gem_file_path
50
144
  @gem_file ||= `which gem`.chomp
@@ -79,4 +173,4 @@ module ChickenLittle
79
173
 
80
174
  end
81
175
 
82
- end
176
+ end
@@ -1,3 +1,3 @@
1
1
  module ChickenLittle
2
- VERSION = "0.1.0"
2
+ VERSION = "0.2.0"
3
3
  end
@@ -0,0 +1,12 @@
1
+ rvm_path = File.expand_path(ENV['rvm_path'] || '~/.rvm')
2
+ $LOAD_PATH.unshift File.join(rvm_path, 'lib')
3
+ require 'rvm'
4
+
5
+ rvm = RVM.environment '1.9.2@global'
6
+ puts rvm.gemset_list
7
+
8
+ rvm.gemset_use! 'global'
9
+
10
+ puts "rvm: #{`rvm-prompt`}"
11
+
12
+
metadata CHANGED
@@ -1,53 +1,65 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: chicken_little
3
- version: !ruby/object:Gem::Version
4
- version: 0.1.0
3
+ version: !ruby/object:Gem::Version
5
4
  prerelease:
5
+ version: 0.2.0
6
6
  platform: ruby
7
- authors:
7
+ authors:
8
8
  - Mike Bethany
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-05-12 00:00:00.000000000Z
13
- dependencies:
14
- - !ruby/object:Gem::Dependency
12
+
13
+ date: 2011-05-12 00:00:00 Z
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
15
16
  name: bundler
16
- requirement: &2153965620 !ruby/object:Gem::Requirement
17
+ prerelease: false
18
+ requirement: &id001 !ruby/object:Gem::Requirement
17
19
  none: false
18
- requirements:
19
- - - ! '>='
20
- - !ruby/object:Gem::Version
21
- version: '0'
20
+ requirements:
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: "0"
22
24
  type: :runtime
23
- prerelease: false
24
- version_requirements: *2153965620
25
- - !ruby/object:Gem::Dependency
25
+ version_requirements: *id001
26
+ - !ruby/object:Gem::Dependency
26
27
  name: commandable
27
- requirement: &2153965160 !ruby/object:Gem::Requirement
28
+ prerelease: false
29
+ requirement: &id002 !ruby/object:Gem::Requirement
28
30
  none: false
29
- requirements:
30
- - - ! '>='
31
- - !ruby/object:Gem::Version
32
- version: '0'
31
+ requirements:
32
+ - - ">="
33
+ - !ruby/object:Gem::Version
34
+ version: "0"
33
35
  type: :runtime
36
+ version_requirements: *id002
37
+ - !ruby/object:Gem::Dependency
38
+ name: term-ansicolor-hi
34
39
  prerelease: false
35
- version_requirements: *2153965160
36
- description: A simple hack to disable the incredibly annoying deprecation warnings
37
- for Gem::Specification#default_executable= when using the `gem` command.
38
- email:
40
+ requirement: &id003 !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ">="
44
+ - !ruby/object:Gem::Version
45
+ version: "0"
46
+ type: :runtime
47
+ version_requirements: *id003
48
+ description: Uses the officially sanctioned method fix the incredibly annoying deprecation warnings for Gem::Specification#default_executable= when using the gem command.
49
+ email:
39
50
  - mikbe.tk@gmail.com
40
- executables:
51
+ executables:
41
52
  - chicken_little
42
53
  extensions: []
54
+
43
55
  extra_rdoc_files: []
44
- files:
45
- - .gitignore
56
+
57
+ files:
46
58
  - Gemfile
59
+ - Gemfile.lock
47
60
  - LICENSE
48
61
  - README.markdown
49
62
  - Rakefile
50
- - autotest/discover.rb
51
63
  - bin/chicken_little
52
64
  - chicken_little.gemspec
53
65
  - lib/chicken_little.rb
@@ -55,30 +67,33 @@ files:
55
67
  - lib/chicken_little/exceptions.rb
56
68
  - lib/chicken_little/patch.rb
57
69
  - lib/chicken_little/version.rb
70
+ - rvm_test.rb
58
71
  homepage: http://mikbe.tk
59
- licenses:
72
+ licenses:
60
73
  - MIT
61
74
  post_install_message:
62
75
  rdoc_options: []
63
- require_paths:
76
+
77
+ require_paths:
64
78
  - lib
65
- required_ruby_version: !ruby/object:Gem::Requirement
79
+ required_ruby_version: !ruby/object:Gem::Requirement
66
80
  none: false
67
- requirements:
68
- - - ! '>='
69
- - !ruby/object:Gem::Version
81
+ requirements:
82
+ - - ">="
83
+ - !ruby/object:Gem::Version
70
84
  version: 1.9.2
71
- required_rubygems_version: !ruby/object:Gem::Requirement
85
+ required_rubygems_version: !ruby/object:Gem::Requirement
72
86
  none: false
73
- requirements:
74
- - - ! '>='
75
- - !ruby/object:Gem::Version
76
- version: '0'
87
+ requirements:
88
+ - - ">="
89
+ - !ruby/object:Gem::Version
90
+ version: "0"
77
91
  requirements: []
92
+
78
93
  rubyforge_project:
79
- rubygems_version: 1.8.1
94
+ rubygems_version: 1.8.2
80
95
  signing_key:
81
96
  specification_version: 3
82
- summary: Disables the annoying Gem::Specification#default_executable= warnings when
83
- running `gem`.
97
+ summary: Now uses the officially sanctioned method to disable the annoying Gem::Specification#default_executable= warnings when running gem.
84
98
  test_files: []
99
+
data/.gitignore DELETED
@@ -1,5 +0,0 @@
1
- *.gem
2
- .bundle
3
- Gemfile.lock
4
- pkg/*
5
- .DS_Store
@@ -1 +0,0 @@
1
- Autotest.add_discovery {"rspec2"}