rubygems-isitjruby 1.1.2

Sign up to get free protection for your applications and to get access to all the features.
data/History.txt ADDED
@@ -0,0 +1,12 @@
1
+ * 1.1.2 / 2009-08-24
2
+ * If there is no comments about our version show up the first comments about the latest version
3
+ * Manage & develop
4
+ * Use Jeweler for create the gem
5
+ * Renamed to rubygems-isitjruby
6
+ * 1.1.1 / 2009-08-20
7
+ * Bug that always show up gems as maybe valid
8
+ * 1.1.0 / 2009-08-20
9
+ * Forked to work with isitjruby when platform is java
10
+ * 1.0.0 / 2009-08-19
11
+ * original rubygems-isit19
12
+
data/Manifest.txt ADDED
@@ -0,0 +1,8 @@
1
+ History.txt
2
+ Manifest.txt
3
+ README.txt
4
+ Rakefile
5
+ lib/isit19.rb
6
+ lib/rubygems/commands/isit19_command.rb
7
+ lib/rubygems/commands/isitjruby_command.rb
8
+ lib/rubygems_plugin.rb
data/README.rst ADDED
@@ -0,0 +1,74 @@
1
+ rubygems-isitjruby
2
+ ==================
3
+
4
+ * http://isitjruby.com
5
+ * http://github.com/blaxter/rubygem-isit19/tree/master
6
+
7
+ * This gem is a fork of http://seattlerb.rubyforge.org/rubygems-isit19
8
+
9
+ DESCRIPTION
10
+ ===========
11
+
12
+ Lets you figure out if your gems and gems you install might work on jruby. Uses http://isitjruby.com as its datastore. Be sure to update the website with
13
+ your experiences!
14
+
15
+
16
+ FEATURES/PROBLEMS
17
+ =================
18
+
19
+ * jruby
20
+ * gem isitjruby for checking your installed gems (when using jruby)
21
+ * gem install plugin that tells you if your installed gem works on jruby
22
+
23
+ USE
24
+ ===
25
+
26
+ $ jgem install daemons
27
+
28
+ daemons 1.0.10 probably might not work, blaxter says 1.0 fails
29
+ Update http://isitjruby.com/daemons with your experiences!
30
+
31
+ Successfully installed daemons-1.0.10
32
+ 1 gem installed
33
+ blaxter@helicon:~/devel/rubygems-isitjruby$ (master) $ jrake
34
+ blaxter@helicon:~/devel/rubygems-isitjruby$ (master) $ jgem isitjruby daemons
35
+ daemons 1.0.10: http://isitjruby.com/daemons
36
+ blaxter says 1.0 fails on GNU/Linux
37
+ Daemons use fork, jruby doesn't support fork, so it doesn't work and
38
+ never will
39
+
40
+ INSTALL
41
+ =======
42
+
43
+ * From github: `sudo gem install blaxter-rubygem-isitjruby`
44
+
45
+ * Or you could also install from gemcutter
46
+
47
+ sudo sources add http://gemcutter.com && sudo gem install rubygems-isitjruby
48
+
49
+
50
+ LICENSE
51
+ =======
52
+
53
+ (The MIT License)
54
+
55
+ Copyright (c) 2009 Eric Hodel, blaxter
56
+
57
+ Permission is hereby granted, free of charge, to any person obtaining
58
+ a copy of this software and associated documentation files (the
59
+ 'Software'), to deal in the Software without restriction, including
60
+ without limitation the rights to use, copy, modify, merge, publish,
61
+ distribute, sublicense, and/or sell copies of the Software, and to
62
+ permit persons to whom the Software is furnished to do so, subject to
63
+ the following conditions:
64
+
65
+ The above copyright notice and this permission notice shall be
66
+ included in all copies or substantial portions of the Software.
67
+
68
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
69
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
70
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
71
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
72
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
73
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
74
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/Rakefile ADDED
@@ -0,0 +1,17 @@
1
+ require 'rubygems'
2
+
3
+ begin
4
+ require 'jeweler'
5
+ Jeweler::Tasks.new do |gem|
6
+ gem.name = "rubygems-isitjruby"
7
+ gem.summary = "Check whether a gem is compatible with jruby on http://isitjruby.com"
8
+ gem.description = "Once the gem is installed, in every gem install command you'll get a message with info fetched from isitjruby.com website. Also you'll have a gem isitjruby command for getting those messages for the gem already installed in your system"
9
+ gem.email = "blaxter@gmail.com"
10
+ gem.homepage = "http://github.com/blaxter/rubygems-isitjruby"
11
+ gem.authors = ["blaxter", "Eric Hodel"]
12
+
13
+ gem.add_dependency 'json-jruby', '>= 1.1.7'
14
+ end
15
+ rescue LoadError
16
+ puts "Jeweler not available. Install it with: sudo gem install technicalpickles-jeweler -s http://gems.github.com"
17
+ end
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 1.1.2
data/lib/isit19.rb ADDED
@@ -0,0 +1,125 @@
1
+ require 'rubygems'
2
+ require 'rubygems/remote_fetcher'
3
+ require 'json'
4
+
5
+ ##
6
+ # Utilities for determining if a Gem::Specification is ruby 1.9 ready. Based
7
+ # on http://isitruby19.com
8
+
9
+ class IsIt19
10
+
11
+ ##
12
+ # This version of rubygems-isit19
13
+
14
+ VERSION = '1.1.1'
15
+
16
+ ##
17
+ # Comments for this gem
18
+
19
+ attr_reader :comments
20
+
21
+ ##
22
+ # The gemspec
23
+
24
+ attr_reader :spec
25
+
26
+ ##
27
+ # Downloads comments for +spec+ from http://isitruby19.com
28
+
29
+ def initialize(spec)
30
+ @spec = spec
31
+ end
32
+
33
+ def fetch!
34
+ comments_url = URI.parse "#{url}/comments.json"
35
+
36
+ json = Gem::RemoteFetcher.fetcher.fetch_path comments_url
37
+ comments = JSON.parse json
38
+
39
+ comments.map! do |comment|
40
+ begin
41
+ comment['comment']['version'] =
42
+ Gem::Version.new comment['comment']['version']
43
+ comment['comment']
44
+ rescue ArgumentError # bad data from isitruby19.com
45
+ next
46
+ end
47
+ end
48
+
49
+ comments.compact!
50
+
51
+ @comments = comments.sort_by do |comment|
52
+ works = comment['works_for_me'] ? 1 : 0
53
+ [comment['version'], works, comment['name']]
54
+ end.reverse
55
+ end
56
+
57
+ ##
58
+ # Strict check for this version
59
+
60
+ def is_it_for_sure?
61
+ @comments.any? do |comment|
62
+ comment['version'] == @spec.version and comment['works_for_me']
63
+ end
64
+ end
65
+
66
+ ##
67
+ # Returns a comment from the latest version that worked with 1.9
68
+
69
+ def maybe_is_it?
70
+ @comments.detect do |comment|
71
+ comment['works_for_me']
72
+ end
73
+ end
74
+
75
+ ##
76
+ # Returns the more recent comment about this gem
77
+
78
+ def more_recent
79
+ @comments.sort.last if are_there_comments?
80
+ end
81
+
82
+ ##
83
+ # Whether are the any comments
84
+ def are_there_comments?
85
+ @comments.size > 0
86
+ end
87
+
88
+ ##
89
+ # Returns a percentage of people saying +version+ worked for them
90
+
91
+ def percent(version = @spec.version)
92
+ matching = @comments.select do |comment|
93
+ comment['version'] == version
94
+ end
95
+
96
+ works = matching.select do |comment| comment['works_for_me'] end.length
97
+
98
+ percent = (matching.length.to_f / works * 100)
99
+ percent = 0 if percent.nan?
100
+ percent = 100 if percent > 100
101
+
102
+ "%2.0f%%" % percent
103
+ end
104
+
105
+ ##
106
+ # URL of this gem on http://isitruby19.com
107
+
108
+ def url
109
+ "http://isitruby19.com/#{spec.name}"
110
+ end
111
+
112
+ def platform
113
+ "1.9"
114
+ end
115
+ end
116
+
117
+ class IsItJruby < IsIt19
118
+ def url
119
+ "http://isitjruby.com/#{spec.name}"
120
+ end
121
+
122
+ def platform
123
+ "jruby"
124
+ end
125
+ end
@@ -0,0 +1,79 @@
1
+ require 'rubygems/command'
2
+ require 'rubygems/version_option'
3
+ require 'rubygems/text'
4
+ require 'isit19'
5
+
6
+ class Gem::Commands::Isit19Command < Gem::Command
7
+
8
+ include Gem::VersionOption
9
+ include Gem::Text
10
+
11
+ COMMAND = 'isit19'
12
+ DESCRIPTION = 'Check isitruby19.com for ruby 1.9 compatibility'
13
+
14
+ def initialize(command=COMMAND, description=DESCRIPTION)
15
+ super command, description, :version => Gem::Requirement.default
16
+
17
+ add_version_option
18
+ end
19
+
20
+ def arguments # :nodoc:
21
+ 'GEMNAME name of an installed gem to check for 1.9 compatibility'
22
+ end
23
+
24
+ def defaults_str # :nodoc:
25
+ "--version='>= 0'"
26
+ end
27
+
28
+ def usage # :nodoc:
29
+ "#{program_name} GEMNAME [options]"
30
+ end
31
+
32
+ def execute
33
+ name = get_one_gem_name
34
+
35
+ dep = Gem::Dependency.new name, options[:version]
36
+ specs = Gem.source_index.search dep
37
+
38
+ if specs.empty? then
39
+ alert_error "No installed gem #{dep}"
40
+ terminate_interaction 1
41
+ end
42
+
43
+ spec = specs.last
44
+
45
+ isit19 = new_instance_isit(spec)
46
+ isit19.fetch!
47
+
48
+ comments = isit19.comments
49
+
50
+ say "#{spec.name} #{spec.version}: #{isit19.url}"
51
+
52
+ say ' No reports!' if comments.empty?
53
+
54
+ last_seen_version = nil
55
+
56
+ comments.each_with_index do |comment, i|
57
+ break if i > 0 and comment['version'] != last_seen_version
58
+
59
+ works = comment['works_for_me'] ? 'works' : 'fails'
60
+ platform = comment['platform'].values.join ' ' if comment['platform']
61
+
62
+ msg = "#{comment['name']} says #{comment['version']} #{works}"
63
+ msg << " on #{platform}" if platform
64
+
65
+ say " #{msg}"
66
+ say format_text(comment['body'], 68, 8) unless comment['body'].empty?
67
+ say
68
+
69
+ last_seen_version = comment['version']
70
+ end
71
+ end
72
+
73
+ protected
74
+
75
+ def new_instance_isit(spec)
76
+ IsIt19.new spec
77
+ end
78
+ end
79
+
@@ -0,0 +1,21 @@
1
+ require 'rubygems/command'
2
+ require 'rubygems/version_option'
3
+ require 'rubygems/text'
4
+ require 'rubygems/commands/isit19_command.rb'
5
+
6
+ class Gem::Commands::IsitjrubyCommand < Gem::Commands::Isit19Command
7
+
8
+ COMMAND = 'isitjruby'
9
+ DESCRIPTION = 'Check isitjruby.com for jruby compatibility'
10
+
11
+ def initialize
12
+ super COMMAND, DESCRIPTION
13
+ end
14
+
15
+ protected
16
+
17
+ def new_instance_isit(spec)
18
+ IsItJruby.new spec
19
+ end
20
+ end
21
+
@@ -0,0 +1,52 @@
1
+ require 'rubygems/command_manager'
2
+
3
+ if PLATFORM =~ /java/
4
+ Gem::CommandManager.instance.register_command :isitjruby
5
+ else
6
+ Gem::CommandManager.instance.register_command :isit19
7
+ end
8
+
9
+ Gem.pre_install do |i| # installer
10
+ require 'isit19'
11
+
12
+ next if i.instance_variable_defined? :@isit19_ran
13
+
14
+ i.instance_variable_set :@isit19_ran, true
15
+
16
+ spec = i.spec
17
+ name = "#{spec.name} #{spec.version}"
18
+
19
+ isit19 = nil
20
+ begin
21
+ klass = PLATFORM =~ /java/ ? IsItJruby : IsIt19
22
+ isit19 = klass.new i.spec
23
+ isit19.fetch!
24
+ rescue Gem::RemoteFetcher::FetchError => e
25
+ i.say "uh-oh! unable to fetch data for #{name}, maybe it doesn't exist yet?"
26
+ i.say isit19.url
27
+ next
28
+ end
29
+
30
+ i.say
31
+
32
+ if isit19.are_there_comments?
33
+ if isit19.is_it_for_sure? then
34
+ i.say "#{name} is #{isit19.percent} verified #{isit19.platform}"
35
+ elsif ( comment = isit19.maybe_is_it? )
36
+ working = comment['version']
37
+ i.say "#{name} might work, #{isit19.percent working} say #{working} works on #{isit19.platform}"
38
+ else
39
+ comment = isit19.more_recent
40
+ works = comment['works_for_me'] ? 'works' : 'fails'
41
+ msg = "#{comment['name']} says #{comment['version']} #{works}"
42
+
43
+ i.say "#{name} probably might not work, #{msg}"
44
+ end
45
+ else
46
+ i.say "Nobody has verified #{name} works with #{isit19.platform}"
47
+ end
48
+
49
+ i.say "Update #{isit19.url} with your experiences!"
50
+ i.say
51
+ end
52
+
@@ -0,0 +1,48 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run `rake gemspec`
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = %q{rubygems-isitjruby}
8
+ s.version = "1.1.2"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["blaxter", "Eric Hodel"]
12
+ s.date = %q{2009-08-24}
13
+ s.description = %q{Once the gem is installed, in every gem install command you'll get a message with info fetched from isitjruby.com website. Also you'll have a gem isitjruby command for getting those messages for the gem already installed in your system}
14
+ s.email = %q{blaxter@gmail.com}
15
+ s.extra_rdoc_files = [
16
+ "README.rst"
17
+ ]
18
+ s.files = [
19
+ "History.txt",
20
+ "Manifest.txt",
21
+ "README.rst",
22
+ "Rakefile",
23
+ "VERSION",
24
+ "lib/isit19.rb",
25
+ "lib/rubygems/commands/isit19_command.rb",
26
+ "lib/rubygems/commands/isitjruby_command.rb",
27
+ "lib/rubygems_plugin.rb",
28
+ "rubygems-isitjruby.gemspec"
29
+ ]
30
+ s.homepage = %q{http://github.com/blaxter/rubygems-isitjruby}
31
+ s.rdoc_options = ["--charset=UTF-8"]
32
+ s.require_paths = ["lib"]
33
+ s.rubygems_version = %q{1.3.5}
34
+ s.summary = %q{Check whether a gem is compatible with jruby on http://isitjruby.com}
35
+
36
+ if s.respond_to? :specification_version then
37
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
38
+ s.specification_version = 3
39
+
40
+ if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
41
+ s.add_runtime_dependency(%q<json-jruby>, [">= 1.1.7"])
42
+ else
43
+ s.add_dependency(%q<json-jruby>, [">= 1.1.7"])
44
+ end
45
+ else
46
+ s.add_dependency(%q<json-jruby>, [">= 1.1.7"])
47
+ end
48
+ end
metadata ADDED
@@ -0,0 +1,74 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rubygems-isitjruby
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.1.2
5
+ platform: ruby
6
+ authors:
7
+ - blaxter
8
+ - Eric Hodel
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+
13
+ date: 2009-08-24 00:00:00 +02:00
14
+ default_executable:
15
+ dependencies:
16
+ - !ruby/object:Gem::Dependency
17
+ name: json-jruby
18
+ type: :runtime
19
+ version_requirement:
20
+ version_requirements: !ruby/object:Gem::Requirement
21
+ requirements:
22
+ - - ">="
23
+ - !ruby/object:Gem::Version
24
+ version: 1.1.7
25
+ version:
26
+ description: Once the gem is installed, in every gem install command you'll get a message with info fetched from isitjruby.com website. Also you'll have a gem isitjruby command for getting those messages for the gem already installed in your system
27
+ email: blaxter@gmail.com
28
+ executables: []
29
+
30
+ extensions: []
31
+
32
+ extra_rdoc_files:
33
+ - README.rst
34
+ files:
35
+ - History.txt
36
+ - Manifest.txt
37
+ - README.rst
38
+ - Rakefile
39
+ - VERSION
40
+ - lib/isit19.rb
41
+ - lib/rubygems/commands/isit19_command.rb
42
+ - lib/rubygems/commands/isitjruby_command.rb
43
+ - lib/rubygems_plugin.rb
44
+ - rubygems-isitjruby.gemspec
45
+ has_rdoc: true
46
+ homepage: http://github.com/blaxter/rubygems-isitjruby
47
+ licenses: []
48
+
49
+ post_install_message:
50
+ rdoc_options:
51
+ - --charset=UTF-8
52
+ require_paths:
53
+ - lib
54
+ required_ruby_version: !ruby/object:Gem::Requirement
55
+ requirements:
56
+ - - ">="
57
+ - !ruby/object:Gem::Version
58
+ version: "0"
59
+ version:
60
+ required_rubygems_version: !ruby/object:Gem::Requirement
61
+ requirements:
62
+ - - ">="
63
+ - !ruby/object:Gem::Version
64
+ version: "0"
65
+ version:
66
+ requirements: []
67
+
68
+ rubyforge_project:
69
+ rubygems_version: 1.3.5
70
+ signing_key:
71
+ specification_version: 3
72
+ summary: Check whether a gem is compatible with jruby on http://isitjruby.com
73
+ test_files: []
74
+