gemcutter 0.2.0 → 0.2.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/lib/commands/migrate.rb +3 -95
- metadata +2 -13
data/lib/commands/migrate.rb
CHANGED
@@ -1,8 +1,6 @@
|
|
1
1
|
class Gem::Commands::MigrateCommand < Gem::AbstractCommand
|
2
|
-
attr_reader :rubygem
|
3
|
-
|
4
2
|
def description
|
5
|
-
'
|
3
|
+
'Deprecate method for migrating a gem you own from Rubyforge to Gemcutter.'
|
6
4
|
end
|
7
5
|
|
8
6
|
def initialize
|
@@ -10,97 +8,7 @@ class Gem::Commands::MigrateCommand < Gem::AbstractCommand
|
|
10
8
|
end
|
11
9
|
|
12
10
|
def execute
|
13
|
-
|
14
|
-
migrate
|
15
|
-
end
|
16
|
-
|
17
|
-
def migrate
|
18
|
-
find(get_one_gem_name)
|
19
|
-
token = get_token
|
20
|
-
upload_token(token)
|
21
|
-
check_for_approved
|
22
|
-
end
|
23
|
-
|
24
|
-
def project_name
|
25
|
-
rubygem['rubyforge_project'] || rubygem['name']
|
26
|
-
end
|
27
|
-
|
28
|
-
def find(name)
|
29
|
-
require 'json/pure'
|
30
|
-
|
31
|
-
response = make_request(:get, "gems/#{name}.json")
|
32
|
-
|
33
|
-
case response
|
34
|
-
when Net::HTTPSuccess
|
35
|
-
begin
|
36
|
-
@rubygem = JSON.parse(response.body)
|
37
|
-
rescue JSON::ParserError => json_error
|
38
|
-
say "There was a problem parsing the data: #{json_error}"
|
39
|
-
terminate_interaction
|
40
|
-
end
|
41
|
-
else
|
42
|
-
say "This gem is currently not hosted on Gemcutter."
|
43
|
-
terminate_interaction
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
47
|
-
def get_token
|
48
|
-
say "Starting migration of #{rubygem["name"]} from RubyForge..."
|
49
|
-
|
50
|
-
response = make_request(:post, "gems/#{rubygem["name"]}/migrate") do |request|
|
51
|
-
request.add_field("Content-Length", 0)
|
52
|
-
request.add_field("Authorization", api_key)
|
53
|
-
end
|
54
|
-
|
55
|
-
case response
|
56
|
-
when Net::HTTPSuccess
|
57
|
-
say "A migration token has been created."
|
58
|
-
response.body
|
59
|
-
else
|
60
|
-
say response.body
|
61
|
-
terminate_interaction
|
62
|
-
end
|
63
|
-
end
|
64
|
-
|
65
|
-
def upload_token(token)
|
66
|
-
require 'tempfile'
|
67
|
-
require 'net/scp'
|
68
|
-
|
69
|
-
url = "#{project_name}.rubyforge.org"
|
70
|
-
say "Uploading the migration token to #{url}."
|
71
|
-
|
72
|
-
rf_cfg_path = "#{Gem.user_home}/.rubyforge/user-config.yml"
|
73
|
-
|
74
|
-
login, password = if File.exists?(rf_cfg_path)
|
75
|
-
rcfg = YAML.load_file(rf_cfg_path)
|
76
|
-
rcfg.values_at('username', 'password')
|
77
|
-
else
|
78
|
-
say "Please enter your RubyForge login:"
|
79
|
-
[ask("Login: "), ask_for_password("Password: ")]
|
80
|
-
end
|
81
|
-
|
82
|
-
begin
|
83
|
-
Net::SCP.start(url, login, :password => password) do |scp|
|
84
|
-
temp_token = Tempfile.new("token")
|
85
|
-
temp_token.chmod 0644
|
86
|
-
temp_token.write(token)
|
87
|
-
temp_token.close
|
88
|
-
scp.upload! temp_token.path, "/var/www/gforge-projects/#{project_name}/migrate-#{rubygem['name']}.html"
|
89
|
-
end
|
90
|
-
say "Successfully uploaded your token."
|
91
|
-
rescue Exception => e
|
92
|
-
say "There was a problem uploading your token: #{e}"
|
93
|
-
end
|
94
|
-
end
|
95
|
-
|
96
|
-
def check_for_approved
|
97
|
-
say "Asking Gemcutter to verify the upload..."
|
98
|
-
|
99
|
-
response = make_request(:put, "gems/#{rubygem["name"]}/migrate") do |request|
|
100
|
-
request.add_field("Content-Length", 0)
|
101
|
-
request.add_field("Authorization", api_key)
|
102
|
-
end
|
103
|
-
|
104
|
-
say response.body
|
11
|
+
say "This command is deprecated, RubyForge accounts/ownerships have been transferred to Gemcutter."
|
12
|
+
say "Please see http://gemcutter.org/pages/migrate for more information"
|
105
13
|
end
|
106
14
|
end
|
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.2.
|
4
|
+
version: 0.2.1
|
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-12-
|
12
|
+
date: 2009-12-10 00:00:00 -05:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -22,16 +22,6 @@ dependencies:
|
|
22
22
|
- !ruby/object:Gem::Version
|
23
23
|
version: "0"
|
24
24
|
version:
|
25
|
-
- !ruby/object:Gem::Dependency
|
26
|
-
name: net-scp
|
27
|
-
type: :runtime
|
28
|
-
version_requirement:
|
29
|
-
version_requirements: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - ">="
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: "0"
|
34
|
-
version:
|
35
25
|
description: Adds several commands for using gemcutter.org, such as pushing new gems, migrating gems from RubyForge, and more.
|
36
26
|
email: nick@quaran.to
|
37
27
|
executables: []
|
@@ -58,7 +48,6 @@ post_install_message: |+
|
|
58
48
|
Thanks for installing Gemcutter! You can now run:
|
59
49
|
|
60
50
|
gem push publish your gems for the world to use and enjoy
|
61
|
-
gem migrate take over your gem from RubyForge on Gemcutter
|
62
51
|
gem owner allow/disallow others to push to your gems
|
63
52
|
|
64
53
|
========================================================================
|