gemcutter 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
data/README.textile CHANGED
@@ -1,6 +1,6 @@
1
1
  h1. gemcutter
2
2
 
3
- Kickass and simple RubyGem hosting.
3
+ Awesome RubyGem hosting.
4
4
 
5
5
  h2. Purpose
6
6
 
@@ -43,3 +43,7 @@ What's coming:
43
43
  * RubyForge migration for gem projects
44
44
  * Fully fledged API documentation
45
45
  * Search via the API and site
46
+
47
+ h2. Testing
48
+
49
+ Make sure you run `rake gemcutter:index:create` before running the test suite, otherwise it might complain. Better solutions to this are more than welcome.
data/lib/commands/push.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  require 'net/http'
2
+ require 'net/https'
2
3
 
3
4
  class Gem::Commands::PushCommand < Gem::Command
4
5
  def description
@@ -32,19 +33,30 @@ class Gem::Commands::PushCommand < Gem::Command
32
33
  Gem.configuration[:gemcutter_key]
33
34
  end
34
35
 
36
+ def push_url
37
+ if ENV['test']
38
+ "http://gemcutter.local"
39
+ else
40
+ "https://gemcutter.heroku.com"
41
+ end
42
+ end
43
+
35
44
  def send_gem
36
45
  say "Pushing gem to Gemcutter..."
37
46
 
38
47
  name = get_one_gem_name
39
- site = ENV['TEST'] ? "local" : "org"
40
- url = URI.parse("http://gemcutter.#{site}/gems")
48
+ url = URI.parse("#{push_url}/gems")
41
49
 
50
+ http = Net::HTTP.new(url.host, url.port)
51
+ http.verify_mode = OpenSSL::SSL::VERIFY_NONE
52
+ http.use_ssl = (url.scheme == 'https')
42
53
  request = Net::HTTP::Post.new(url.path)
43
54
  request.body = File.open(name).read
44
- request.content_length = request.body.size
45
- request.initialize_http_header("HTTP_AUTHORIZATION" => api_key)
55
+ request.add_field("Content-Length", request.body.size)
56
+ request.add_field("Authorization", api_key)
57
+
58
+ response = http.request(request)
46
59
 
47
- response = Net::HTTP.new(url.host, url.port).start { |http| http.request(request) }
48
60
  say response.body
49
61
  end
50
62
 
@@ -54,12 +66,14 @@ class Gem::Commands::PushCommand < Gem::Command
54
66
  email = ask("Email: ")
55
67
  password = ask_for_password("Password: ")
56
68
 
57
- site = ENV['TEST'] ? "local" : "org"
58
- url = URI.parse("http://gemcutter.#{site}/api_key")
69
+ url = URI.parse("#{push_url}/api_key")
59
70
 
71
+ http = Net::HTTP.new(url.host, url.port)
72
+ http.verify_mode = OpenSSL::SSL::VERIFY_NONE
73
+ http.use_ssl = (url.scheme == 'https')
60
74
  request = Net::HTTP::Get.new(url.path)
61
75
  request.basic_auth email, password
62
- response = Net::HTTP.new(url.host, url.port).start { |http| http.request(request) }
76
+ response = http.request(request)
63
77
 
64
78
  case response
65
79
  when Net::HTTPSuccess
@@ -1,3 +1,5 @@
1
+ $:.unshift File.dirname(__FILE__) # For use/testing when no gem is installed
2
+
1
3
  require 'rubygems/command_manager'
2
4
 
3
5
  require 'commands/downgrade'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gemcutter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nick Quaranto
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-06-15 00:00:00 -04:00
12
+ date: 2009-07-25 00:00:00 -04:00
13
13
  default_executable:
14
14
  dependencies: []
15
15