gemline 0.1.4 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/gemline.gemspec +2 -2
  2. data/lib/gemline.rb +12 -9
  3. metadata +9 -9
@@ -13,9 +13,9 @@ Gem::Specification.new do |gem|
13
13
  gem.name = "gemline"
14
14
  gem.require_paths = ["lib"]
15
15
 
16
- gem.version = '0.1.4'
16
+ gem.version = '0.2.0'
17
17
 
18
- gem.add_dependency('crack')
18
+ gem.add_dependency('json_pure', ["~> 1.7.6"])
19
19
  gem.add_development_dependency('rake') # For Travis CI
20
20
  gem.add_development_dependency(%q<rspec>, [">= 2.11.0"])
21
21
  end
@@ -1,8 +1,5 @@
1
- require 'crack/json'
2
- require 'net/http'
3
-
4
- require 'yaml'
5
- YAML::ENGINE.yamler = 'syck' if RUBY_VERSION[0,3] == "1.9"
1
+ require 'json/pure'
2
+ require 'net/https'
6
3
 
7
4
 
8
5
  class Gemline
@@ -13,7 +10,7 @@ class Gemline
13
10
  check_input(gem_name)
14
11
 
15
12
  g = Gemline.new(gem_name)
16
-
13
+
17
14
  if g.gem_not_found?
18
15
  $stderr.puts "Ruby gem #{gem_name} was not found on rubygems.org"
19
16
  Kernel.exit 1
@@ -32,7 +29,7 @@ class Gemline
32
29
  @gem = gem_name.to_s.gsub(/[^\w\-]+/,'') # Yeah, a little over-defensive.
33
30
  @json = Gemline.get_rubygem_json(@gem)
34
31
  unless gem_not_found?
35
- @response = Crack::JSON.parse(@json)
32
+ @response = JSON.parse(@json)
36
33
  @gemline = Gemline.create_gemline(@gem, response['version'], options)
37
34
  end
38
35
  end
@@ -45,8 +42,14 @@ class Gemline
45
42
  private
46
43
 
47
44
  def self.get_rubygem_json(gem_name)
48
- Net::HTTP.get(URI.parse("http://rubygems.org/api/v1/gems/#{gem_name}.json"))
49
- end
45
+ uri = URI.parse("https://rubygems.org/api/v1/gems/#{gem_name}.json")
46
+ http = Net::HTTP.new(uri.host, uri.port)
47
+ http.use_ssl = true
48
+ http.verify_mode = OpenSSL::SSL::VERIFY_NONE
49
+ request = Net::HTTP::Get.new(uri.request_uri)
50
+ response = http.request(request)
51
+ response.body
52
+ end
50
53
 
51
54
  def self.create_gemline(gem_name, version, options = {})
52
55
  if options[:gemspec]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gemline
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.2.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,24 +9,24 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-12-06 00:00:00.000000000 Z
12
+ date: 2013-02-04 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
- name: crack
15
+ name: json_pure
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
- - - ! '>='
19
+ - - ~>
20
20
  - !ruby/object:Gem::Version
21
- version: '0'
21
+ version: 1.7.6
22
22
  type: :runtime
23
23
  prerelease: false
24
24
  version_requirements: !ruby/object:Gem::Requirement
25
25
  none: false
26
26
  requirements:
27
- - - ! '>='
27
+ - - ~>
28
28
  - !ruby/object:Gem::Version
29
- version: '0'
29
+ version: 1.7.6
30
30
  - !ruby/object:Gem::Dependency
31
31
  name: rake
32
32
  requirement: !ruby/object:Gem::Requirement
@@ -96,7 +96,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
96
96
  version: '0'
97
97
  segments:
98
98
  - 0
99
- hash: 824165569411568049
99
+ hash: -1367495166113172796
100
100
  required_rubygems_version: !ruby/object:Gem::Requirement
101
101
  none: false
102
102
  requirements:
@@ -105,7 +105,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
105
105
  version: '0'
106
106
  segments:
107
107
  - 0
108
- hash: 824165569411568049
108
+ hash: -1367495166113172796
109
109
  requirements: []
110
110
  rubyforge_project:
111
111
  rubygems_version: 1.8.24