gemfury 0.4.2 → 0.4.3.rc

Sign up to get free protection for your applications and to get access to all the features.
@@ -128,6 +128,7 @@ module Gemfury
128
128
  case error['type']
129
129
  when 'Forbidden' then Gemfury::Forbidden
130
130
  when 'GemVersionError' then Gemfury::InvalidGemVersion
131
+ when 'InvalidGemFile' then Gemfury::CorruptGemFile
131
132
  else Gemfury::Error
132
133
  end
133
134
  else
@@ -25,21 +25,7 @@ class Gemfury::Command::App < Thor
25
25
  desc "push GEM", "Upload a new version of a gem"
26
26
  def push(*gems)
27
27
  with_checks_and_rescues do
28
- gem_files = gems.map do |g|
29
- File.exists?(g) ? File.new(g) : nil
30
- end.compact
31
-
32
- if gem_files.empty?
33
- shell.say "Problem: No valid gems specified", :red
34
- help(:push)
35
- return
36
- end
37
-
38
- # Let's get uploading
39
- gem_files.each do |gem_file|
40
- shell.say "Uploading #{File.basename(gem_file)}"
41
- client.push_gem(gem_file)
42
- end
28
+ push_files(:push, gems)
43
29
  end
44
30
  end
45
31
 
@@ -123,6 +109,33 @@ class Gemfury::Command::App < Thor
123
109
  end
124
110
  end
125
111
 
112
+ ### MIGRATION (Pushing directories) ###
113
+ desc "migrate DIR", "Upload all gems within a directory"
114
+ def migrate(*paths)
115
+ with_checks_and_rescues do
116
+ gem_paths = Dir[*(paths.map do |p|
117
+ if File.directory?(p)
118
+ "#{p}/**/*.gem"
119
+ elsif File.file?(p)
120
+ p
121
+ else
122
+ nil
123
+ end
124
+ end.compact)]
125
+
126
+ if gem_paths.empty?
127
+ shell.say "Problem: No valid gems found", :red
128
+ help(:migrate)
129
+ else
130
+ shell.say "Found the following RubyGems:"
131
+ gem_paths.each { |p| shell.say " #{File.basename(p)}" }
132
+ if shell.yes? "Upload these files to Gemfury? [yN]", :green
133
+ push_files(:migrate, gem_paths)
134
+ end
135
+ end
136
+ end
137
+ end
138
+
126
139
  private
127
140
  def client
128
141
  opts = {}
@@ -148,4 +161,30 @@ private
148
161
  shell.say "Oops! Something went wrong. Looking into it ASAP!", :red
149
162
  shell.say %Q(#{e.class.name}: #{e}\n#{e.backtrace.join("\n")}) if ENV['DEBUG']
150
163
  end
164
+
165
+ def push_files(command, gem_paths)
166
+ files = gem_paths.map do |g|
167
+ g.is_a?(String) ? File.new(g) : g rescue nil
168
+ end.compact
169
+
170
+ if files.empty?
171
+ shell.say "Problem: No valid gems found", :red
172
+ help(command)
173
+ return
174
+ end
175
+
176
+ # Let's get uploading
177
+ files.each do |file|
178
+ begin
179
+ shell.say "Uploading #{File.basename(file.path)} "
180
+ client.push_gem(file)
181
+ shell.say "- done"
182
+ rescue Gemfury::CorruptGemFile
183
+ shell.say "- problem processing this gem", :red
184
+ rescue => e
185
+ shell.say "- oops", :red
186
+ throw e
187
+ end
188
+ end
189
+ end
151
190
  end
@@ -13,4 +13,7 @@ module Gemfury
13
13
 
14
14
  # Returned if something is not found
15
15
  NotFound = Class.new(Error)
16
+
17
+ # Corrupt Gem File
18
+ CorruptGemFile = Class.new(Error)
16
19
  end
@@ -0,0 +1,2 @@
1
+ # Load Gemfury rakefile extensions
2
+ load "gemfury/tasks/release.rake"
@@ -0,0 +1,25 @@
1
+ require 'rubygems/builder'
2
+ require 'gemfury'
3
+ require 'gemfury/command'
4
+
5
+ namespace 'fury' do
6
+ desc "Build gem and push it to Gemfury"
7
+ task :release, :gemspec do |t, args|
8
+ gemspec = args[:gemspec] ||
9
+ FileList["#{Dir.pwd}/*.gemspec"][0]
10
+
11
+ if gemspec.nil? || !File.exist?(gemspec)
12
+ puts "No gemspec found"
13
+ else
14
+ puts "Building #{File.basename(gemspec)}"
15
+ spec = Gem::Specification.load(gemspec)
16
+ Gem::Builder.new(spec).build
17
+ gemfile = File.basename(spec.cache_file)
18
+ Gemfury::Command::App.start(['push', gemfile])
19
+ end
20
+ end
21
+ end
22
+
23
+ namespace 'gemfury' do
24
+ task :release => 'fury:release'
25
+ end
@@ -1,3 +1,3 @@
1
1
  module Gemfury
2
- VERSION = '0.4.2'
2
+ VERSION = '0.4.3.rc'
3
3
  end
metadata CHANGED
@@ -1,19 +1,19 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gemfury
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.2
5
- prerelease:
4
+ version: 0.4.3.rc
5
+ prerelease: 6
6
6
  platform: ruby
7
7
  authors:
8
8
  - Michael Rykov
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-01-04 00:00:00.000000000 Z
12
+ date: 2012-01-09 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: highline
16
- requirement: &70191611798440 !ruby/object:Gem::Requirement
16
+ requirement: &70317209295620 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 1.6.0
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70191611798440
24
+ version_requirements: *70317209295620
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: thor
27
- requirement: &70191611797940 !ruby/object:Gem::Requirement
27
+ requirement: &70317209293340 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ~>
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: 0.14.0
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *70191611797940
35
+ version_requirements: *70317209293340
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: multi_json
38
- requirement: &70191611797460 !ruby/object:Gem::Requirement
38
+ requirement: &70317209291140 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ~>
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: 1.0.2
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *70191611797460
46
+ version_requirements: *70317209291140
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: faraday
49
- requirement: &70191611797000 !ruby/object:Gem::Requirement
49
+ requirement: &70317209289400 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ~>
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: 0.7.4
55
55
  type: :runtime
56
56
  prerelease: false
57
- version_requirements: *70191611797000
57
+ version_requirements: *70317209289400
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: faraday_middleware
60
- requirement: &70191611796500 !ruby/object:Gem::Requirement
60
+ requirement: &70317209287280 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ~>
@@ -65,7 +65,7 @@ dependencies:
65
65
  version: 0.7.0
66
66
  type: :runtime
67
67
  prerelease: false
68
- version_requirements: *70191611796500
68
+ version_requirements: *70317209287280
69
69
  description: ! 'Client library and command-line tool to manage your gems on http://gemfury.com
70
70
 
71
71
  '
@@ -89,12 +89,15 @@ files:
89
89
  - lib/gemfury/const.rb
90
90
  - lib/gemfury/error.rb
91
91
  - lib/gemfury/platform.rb
92
+ - lib/gemfury/tasks/release.rake
93
+ - lib/gemfury/tasks.rb
92
94
  - lib/gemfury/version.rb
93
95
  - lib/gemfury.rb
94
96
  homepage: http://gemfury.com
95
97
  licenses: []
96
98
  post_install_message: ! "************************************************************************\n\n
97
99
  \ Upload your first gem to start using Gemfury:\n fury push my-gem-1.0.gem\n\n
100
+ \ If you have a directory with gems, you can use:\n fury migrate ./path/to/gems\n\n
98
101
  \ Find out what else you can do:\n fury help\n\n Follow @gemfury on Twitter for
99
102
  announcements, updates, and news.\n https://twitter.com/gemfury\n\n************************************************************************\n"
100
103
  rdoc_options: []
@@ -109,9 +112,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
109
112
  required_rubygems_version: !ruby/object:Gem::Requirement
110
113
  none: false
111
114
  requirements:
112
- - - ! '>='
115
+ - - ! '>'
113
116
  - !ruby/object:Gem::Version
114
- version: '0'
117
+ version: 1.3.1
115
118
  requirements: []
116
119
  rubyforge_project:
117
120
  rubygems_version: 1.8.11