n3bulous-amiruby19 1.0.1
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.
- data/README.textile +101 -0
- data/Rakefile +40 -0
- data/bin/amiruby19 +8 -0
- data/lib/amiruby19.rb +3 -0
- data/lib/amiruby19/amiruby19.rb +66 -0
- data/lib/amiruby19/version.rb +13 -0
- data/test/test_helper.rb +10 -0
- data/test/unit/amiruby19_test.rb +13 -0
- metadata +63 -0
data/README.textile
ADDED
@@ -0,0 +1,101 @@
|
|
1
|
+
h1. Am I Ruby 1.9?
|
2
|
+
|
3
|
+
h2. Description
|
4
|
+
|
5
|
+
So you want to move to Ruby 1.9 but you _need_ your gems? Thanks to the folks at "Brightbox":http://www.brightbox.co.uk/ we have "Is it Ruby 1.9":isitruby19.com and an "API":http://forum.brightbox.co.uk/forums/isitruby19-com/topics/api-is-added.
|
6
|
+
|
7
|
+
Building off the API announcement, conveniently released a few days before I needed it, I created *Am I Ruby 1.9* to quickly determine how close your installed gems are to being ready.
|
8
|
+
|
9
|
+
The highly classified algorithm is listed below. The _sum_ is merely the number of works_for_me true responses for the gem. Only the five most recent responses are considered.
|
10
|
+
|
11
|
+
<pre>
|
12
|
+
rate = sum / recent.size.to_f
|
13
|
+
ratio = "#{sum} / #{recent.size}"
|
14
|
+
|
15
|
+
if rate >= 0.80
|
16
|
+
works[gem_name] = ratio
|
17
|
+
elsif rate >= 0.40
|
18
|
+
may_work[gem_name] = ratio
|
19
|
+
else
|
20
|
+
fails[gem_name] = ratio
|
21
|
+
end
|
22
|
+
</pre>
|
23
|
+
|
24
|
+
Please note that this doesn't guarantee any gem will or will not work. It merely tries to guesstimate based on what other people have reported. Better ideas will be merged!
|
25
|
+
|
26
|
+
Another fine gem created with the help of "simple-gem":http://github.com/reagent/simple-gem. Your definition of fine may differ, but simple-gem is pretty good and simple.
|
27
|
+
|
28
|
+
h2. Requirements
|
29
|
+
|
30
|
+
*Am I Ruby 1.9* is "tested" with Ruby 1.8.[67], and requires the following gem:
|
31
|
+
|
32
|
+
* json
|
33
|
+
|
34
|
+
h2. Installation
|
35
|
+
|
36
|
+
<pre>
|
37
|
+
gem install n3bulous-amiruby19
|
38
|
+
</pre>
|
39
|
+
|
40
|
+
h2. Usage
|
41
|
+
|
42
|
+
Right now, you just run *amiruby19* with no arguments. After some amount of time directly proportional to the number of gems installed, you will see five different sections of output:
|
43
|
+
|
44
|
+
* WORKS - 80% or more responses are positive.
|
45
|
+
* MAY WORK - 40% or more of responses are positive
|
46
|
+
* FAILS - Less than 40% of responses are positive.
|
47
|
+
* UNTESTED - No responses are recorded for these gems.
|
48
|
+
* MISSING - The gem is not known on Is It Ruby 1.9.
|
49
|
+
|
50
|
+
h2. Example Output
|
51
|
+
|
52
|
+
Your output will look different, and this lists only the first 11 gems I have installed. This output will allow you "gem19 install" with some cut and paste to test the results.
|
53
|
+
|
54
|
+
<pre>
|
55
|
+
WORKS
|
56
|
+
-----
|
57
|
+
activeresource acts_as_versioned activerecord addressable actionpack actionmailer
|
58
|
+
|
59
|
+
MAY WORK
|
60
|
+
--------
|
61
|
+
activesupport
|
62
|
+
|
63
|
+
FAILS
|
64
|
+
-----
|
65
|
+
|
66
|
+
UNTESTED
|
67
|
+
--------
|
68
|
+
abstract acts_as_cached AdoccaMemcache archive-tar-minitar
|
69
|
+
|
70
|
+
MISSING
|
71
|
+
-------
|
72
|
+
</pre>
|
73
|
+
|
74
|
+
h2. TODO
|
75
|
+
|
76
|
+
* Maintain a blacklist of working gems.
|
77
|
+
* Ignore already installed Ruby 1.9 gems.
|
78
|
+
|
79
|
+
h2. LICENSE
|
80
|
+
|
81
|
+
Copyright (c) 2009 Kevin McFadden<br />
|
82
|
+
Copyright (c) 2009 Concepts Ahead
|
83
|
+
|
84
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
85
|
+
a copy of this software and associated documentation files (the
|
86
|
+
"Software"), to deal in the Software without restriction, including
|
87
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
88
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
89
|
+
permit persons to whom the Software is furnished to do so, subject to
|
90
|
+
the following conditions:
|
91
|
+
|
92
|
+
The above copyright notice and this permission notice shall be
|
93
|
+
included in all copies or substantial portions of the Software.
|
94
|
+
|
95
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
96
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
97
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
98
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
99
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
100
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
101
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/Rakefile
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'rake/gempackagetask'
|
3
|
+
require 'rake/testtask'
|
4
|
+
|
5
|
+
require 'lib/amiruby19/version'
|
6
|
+
|
7
|
+
task :default => :test
|
8
|
+
|
9
|
+
spec = Gem::Specification.new do |s|
|
10
|
+
s.name = 'amiruby19'
|
11
|
+
s.version = Amiruby19::Version.to_s
|
12
|
+
s.has_rdoc = true
|
13
|
+
s.extra_rdoc_files = %w(README.textile)
|
14
|
+
s.rdoc_options = %w(--main README.textile)
|
15
|
+
s.summary = "Verifies whether your Ruby 1.8 gems are compatible with Ruby 1.9 based on entries from http://isitruby19.com"
|
16
|
+
s.author = 'Kevin McFadden'
|
17
|
+
s.email = 'kevin+github@conceptsahead.com'
|
18
|
+
s.homepage = 'http://conceptsahead.com'
|
19
|
+
s.files = %w(README.textile Rakefile) + Dir.glob("{lib,test}/**/*")
|
20
|
+
s.executables = ['amiruby19']
|
21
|
+
|
22
|
+
# s.add_dependency('gem_name', '~> 0.0.1')
|
23
|
+
end
|
24
|
+
|
25
|
+
Rake::GemPackageTask.new(spec) do |pkg|
|
26
|
+
pkg.gem_spec = spec
|
27
|
+
end
|
28
|
+
|
29
|
+
Rake::TestTask.new do |t|
|
30
|
+
t.libs << 'test'
|
31
|
+
t.test_files = FileList["test/**/*_test.rb"]
|
32
|
+
t.verbose = true
|
33
|
+
end
|
34
|
+
|
35
|
+
desc 'Generate the gemspec to serve this Gem from Github'
|
36
|
+
task :github do
|
37
|
+
file = File.dirname(__FILE__) + "/#{spec.name}.gemspec"
|
38
|
+
File.open(file, 'w') {|f| f << spec.to_ruby }
|
39
|
+
puts "Created gemspec: #{file}"
|
40
|
+
end
|
data/bin/amiruby19
ADDED
data/lib/amiruby19.rb
ADDED
@@ -0,0 +1,66 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'json'
|
3
|
+
require 'open-uri'
|
4
|
+
|
5
|
+
works = {}
|
6
|
+
may_work = {}
|
7
|
+
fails = {}
|
8
|
+
untested = []
|
9
|
+
missing = []
|
10
|
+
|
11
|
+
isit19_url = "http://isitruby19.com"
|
12
|
+
isit19_file = "comments.json"
|
13
|
+
|
14
|
+
installed_gems = %x[gem list].split("\n")
|
15
|
+
installed_gems.each do |g|
|
16
|
+
gem_name = g.split(" ")[0]
|
17
|
+
url = isit19_url + "/" + gem_name + "/" + isit19_file
|
18
|
+
|
19
|
+
begin
|
20
|
+
doc = open(url).read
|
21
|
+
rescue
|
22
|
+
missing << gem_name
|
23
|
+
next
|
24
|
+
end
|
25
|
+
|
26
|
+
json = JSON.parse(doc)
|
27
|
+
|
28
|
+
if json.size == 0
|
29
|
+
untested << gem_name
|
30
|
+
else
|
31
|
+
sum = 0
|
32
|
+
recent = json[0..4]
|
33
|
+
|
34
|
+
recent.each do |r|
|
35
|
+
if r["comment"]["works_for_me"]
|
36
|
+
sum += 1
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
rate = sum / recent.size.to_f
|
41
|
+
ratio = "#{sum} / #{recent.size}"
|
42
|
+
|
43
|
+
if rate > 0.80
|
44
|
+
works[gem_name] = ratio
|
45
|
+
elsif rate >= 0.40
|
46
|
+
may_work[gem_name] = ratio
|
47
|
+
else
|
48
|
+
fails[gem_name] = ratio
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
puts "WORKS\n-----"
|
54
|
+
puts works.keys.join(" ")
|
55
|
+
|
56
|
+
puts "\nMAY WORK\n--------"
|
57
|
+
puts may_work.keys.join(" ")
|
58
|
+
|
59
|
+
puts "\nFAILS\n-----"
|
60
|
+
puts fails.keys.join(" ")
|
61
|
+
|
62
|
+
puts "\nUNTESTED\n--------"
|
63
|
+
puts untested.join(" ")
|
64
|
+
|
65
|
+
puts "\nMISSING\n-------"
|
66
|
+
puts missing.join(" ")
|
data/test/test_helper.rb
ADDED
metadata
ADDED
@@ -0,0 +1,63 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: n3bulous-amiruby19
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Kevin McFadden
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2009-03-30 00:00:00 -07:00
|
13
|
+
default_executable: amiruby19
|
14
|
+
dependencies: []
|
15
|
+
|
16
|
+
description:
|
17
|
+
email: kevin+github@conceptsahead.com
|
18
|
+
executables:
|
19
|
+
- amiruby19
|
20
|
+
extensions: []
|
21
|
+
|
22
|
+
extra_rdoc_files:
|
23
|
+
- README.textile
|
24
|
+
files:
|
25
|
+
- README.textile
|
26
|
+
- Rakefile
|
27
|
+
- lib/amiruby19
|
28
|
+
- lib/amiruby19/amiruby19.rb
|
29
|
+
- lib/amiruby19/version.rb
|
30
|
+
- lib/amiruby19.rb
|
31
|
+
- test/test_helper.rb
|
32
|
+
- test/unit
|
33
|
+
- test/unit/amiruby19_test.rb
|
34
|
+
- bin/amiruby19
|
35
|
+
has_rdoc: true
|
36
|
+
homepage: http://conceptsahead.com
|
37
|
+
post_install_message:
|
38
|
+
rdoc_options:
|
39
|
+
- --main
|
40
|
+
- README.textile
|
41
|
+
require_paths:
|
42
|
+
- lib
|
43
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: "0"
|
48
|
+
version:
|
49
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
50
|
+
requirements:
|
51
|
+
- - ">="
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: "0"
|
54
|
+
version:
|
55
|
+
requirements: []
|
56
|
+
|
57
|
+
rubyforge_project:
|
58
|
+
rubygems_version: 1.2.0
|
59
|
+
signing_key:
|
60
|
+
specification_version: 2
|
61
|
+
summary: Verifies whether your Ruby 1.8 gems are compatible with Ruby 1.9 based on entries from http://isitruby19.com
|
62
|
+
test_files: []
|
63
|
+
|