chicken_little 0.1.0.beta1

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore ADDED
@@ -0,0 +1,5 @@
1
+ *.gem
2
+ .bundle
3
+ Gemfile.lock
4
+ pkg/*
5
+ .DS_Store
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in chicken_little.gemspec
4
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,19 @@
1
+ Copyright (c) 2011 Mike Bethany
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ of this software and associated documentation files (the "Software"), to deal
5
+ in the Software without restriction, including without limitation the rights
6
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ copies of the Software, and to permit persons to whom the Software is
8
+ furnished to do so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in
11
+ all copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ THE SOFTWARE.
data/README.markdown ADDED
@@ -0,0 +1,38 @@
1
+ # Chicken Little
2
+
3
+ A simple hack to disable the incredibly annoying deprecation warnings for `Gem::Specification#default_executable=` when using the `gem` command.
4
+
5
+ ### Usage
6
+
7
+ **Installing:**
8
+
9
+ To install from a command line run:
10
+
11
+ $ chicken_little
12
+
13
+ If you like to being verbose you can run:
14
+
15
+ $ chicken_little install
16
+
17
+ **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:
19
+
20
+ $ chicken_little uninstall
21
+
22
+ **Checking Install Status:**
23
+ To check if it's already installed run:
24
+
25
+ $ chicken_little installed?
26
+
27
+
28
+ ### What's it do?
29
+
30
+ 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.
31
+
32
+ It doesn't stop any other deprecation warnings, just the hostile, anti-user default\_executable one.
33
+
34
+ ### Notes
35
+
36
+ If you're using RVM you'll need to run this for each gemset.
37
+
38
+ Also, as would be expected, you'll need to re-run Chicken Little every time you update the `gem` app.
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ require 'bundler'
2
+ Bundler::GemHelper.install_tasks
@@ -0,0 +1 @@
1
+ Autotest.add_discovery {"rspec2"}
@@ -0,0 +1,6 @@
1
+ #! /usr/bin/env ruby
2
+ $LOAD_PATH.unshift File.expand_path(File.join(File.dirname(__FILE__), '/../lib'))
3
+ require 'chicken_little'
4
+
5
+ # Make it so!
6
+ Commandable.execute(ARGV)
@@ -0,0 +1,25 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "chicken_little/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "chicken_little"
7
+ s.version = ChickenLittle::VERSION
8
+ s.platform = Gem::Platform::RUBY
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.}
15
+
16
+ s.license = 'MIT'
17
+
18
+ s.add_dependency("bundler")
19
+ s.add_dependency("commandable")
20
+
21
+ s.files = `git ls-files`.split("\n")
22
+ s.test_files = `git ls-files -- {spec}/*`.split("\n")
23
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
24
+ s.require_paths = ["lib"]
25
+ end
@@ -0,0 +1,11 @@
1
+ # Configure Commandable
2
+ require 'commandable'
3
+ Commandable.color_output = true
4
+ Commandable.verbose_parameters = false
5
+ Commandable.app_exe = "chicken_little"
6
+ Commandable.app_info =
7
+ """
8
+ \e[92mChicken Little\e[0m - Disables the annoying deprication warnings from the gem command.
9
+ It's only been tested on OS X and Linux but I know it won't work on Windows.
10
+ Copyright (c) 2011 Mike Bethany
11
+ """
@@ -0,0 +1,21 @@
1
+ module ChickenLittle
2
+
3
+ class GemFileNotFound < StandardError
4
+ def initialize(msg = "I couldn't figure out where to start looking for the RubyGems install.")
5
+ super(msg)
6
+ end
7
+ end
8
+
9
+ class SpecFileNotFound < StandardError
10
+ def initialize(msg = "Could not find specification.rb file")
11
+ super(msg)
12
+ end
13
+ end
14
+
15
+ class SpecFileNotWritable < StandardError
16
+ def initialize(msg = "You do not have permission to write to the specification.rb file.\nTry running using the sudo command: sudo chiken_little [option]")
17
+ super(msg)
18
+ end
19
+ end
20
+
21
+ end
@@ -0,0 +1,82 @@
1
+ module ChickenLittle
2
+
3
+ Uncommented_Line = "deprecate :default_executable"
4
+
5
+ class Patch
6
+ extend Commandable
7
+
8
+ command "Disables the annoying deprication warnings from the gem command", :default, :xor
9
+ def install
10
+ supported?
11
+ return "Chicken Little is already installed" if installed?
12
+ new_spec_file = spec_file_contents.collect { |line| line.index(Uncommented_Line) ? "##{line.strip}\n" : line}
13
+ save_spec_file(new_spec_file)
14
+ if installed?
15
+ "Chicken Little installed successfully."
16
+ else
17
+ "Install failed. No idea why."
18
+ end
19
+ end
20
+
21
+ command "Removes the Chicken Little patch", :xor
22
+ def uninstall
23
+ supported?
24
+ return "Chicken Little isn't installed" unless installed?
25
+ new_spec_file = spec_file_contents.collect { |line| line.index(Uncommented_Line) ? line.delete("#") : line}
26
+ save_spec_file(new_spec_file)
27
+ unless installed?
28
+ "Chicken Little uninstalled successfully."
29
+ else
30
+ "Uninstall failed. No idea why."
31
+ end
32
+ end
33
+
34
+ command "Checks to see if Chicken Little is already installed", :xor
35
+ def installed?
36
+ spec_file_contents.select { |line| line.strip.start_with?(Uncommented_Line) }.empty?
37
+ end
38
+
39
+ command "Lets you know if it can be installed"
40
+ def supported?
41
+ raise ChickenLittle::GemFileNotFound unless gem_file_found?
42
+ raise ChickenLittle::SpecFileNotFound unless spec_file_found?
43
+ raise ChickenLittle::SpecFileNotWritable unless spec_file_writable?
44
+ "Looks good. Chicken Little can find and modify the necessary files."
45
+ end
46
+
47
+ private
48
+
49
+ def gem_file_path
50
+ @gem_file ||= `which gem`.chomp
51
+ @gem_file_path ||= File.symlink?(@gem_file) ? File.readlink(@gem_file) : @gem_file
52
+ end
53
+
54
+ def spec_file_path
55
+ @spec_file_path ||= File.expand_path(gem_file_path + "/../../lib/ruby/site_ruby/1.9.1/rubygems/specification.rb")
56
+ end
57
+
58
+ def spec_file_contents
59
+ File.readlines(spec_file_path)
60
+ end
61
+
62
+ def gem_file_found?
63
+ File.exist?(gem_file_path)
64
+ end
65
+
66
+ def spec_file_found?
67
+ File.exist?(spec_file_path)
68
+ end
69
+
70
+ def spec_file_writable?
71
+ File.writable?(spec_file_path)
72
+ end
73
+
74
+ def save_spec_file(spec_file_lines)
75
+ File.open(spec_file_path, "w") do |file|
76
+ spec_file_lines.each {|line| file.write(line)}
77
+ end
78
+ end
79
+
80
+ end
81
+
82
+ end
@@ -0,0 +1,3 @@
1
+ module ChickenLittle
2
+ VERSION = "0.1.0.beta1"
3
+ end
@@ -0,0 +1,3 @@
1
+ require 'chicken_little/commandable_settings'
2
+ require 'chicken_little/patch'
3
+ require 'chicken_little/exceptions'
metadata ADDED
@@ -0,0 +1,84 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: chicken_little
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0.beta1
5
+ prerelease: 6
6
+ platform: ruby
7
+ authors:
8
+ - Mike Bethany
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2011-05-12 00:00:00.000000000Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: bundler
16
+ requirement: &2157694020 !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: *2157694020
25
+ - !ruby/object:Gem::Dependency
26
+ name: commandable
27
+ requirement: &2157693560 !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: *2157693560
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:
39
+ - mikbe.tk@gmail.com
40
+ executables:
41
+ - chicken_little
42
+ extensions: []
43
+ extra_rdoc_files: []
44
+ files:
45
+ - .gitignore
46
+ - Gemfile
47
+ - LICENSE
48
+ - README.markdown
49
+ - Rakefile
50
+ - autotest/discover.rb
51
+ - bin/chicken_little
52
+ - chicken_little.gemspec
53
+ - lib/chicken_little.rb
54
+ - lib/chicken_little/commandable_settings.rb
55
+ - lib/chicken_little/exceptions.rb
56
+ - lib/chicken_little/patch.rb
57
+ - lib/chicken_little/version.rb
58
+ homepage: http://mikbe.tk
59
+ licenses:
60
+ - MIT
61
+ post_install_message:
62
+ rdoc_options: []
63
+ require_paths:
64
+ - lib
65
+ required_ruby_version: !ruby/object:Gem::Requirement
66
+ none: false
67
+ requirements:
68
+ - - ! '>='
69
+ - !ruby/object:Gem::Version
70
+ version: 1.9.2
71
+ required_rubygems_version: !ruby/object:Gem::Requirement
72
+ none: false
73
+ requirements:
74
+ - - ! '>'
75
+ - !ruby/object:Gem::Version
76
+ version: 1.3.1
77
+ requirements: []
78
+ rubyforge_project:
79
+ rubygems_version: 1.8.1
80
+ signing_key:
81
+ specification_version: 3
82
+ summary: Disables the annoying Gem::Specification#default_executable= warnings when
83
+ running `gem`.
84
+ test_files: []