rake-gemcutter 0.0.2 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,7 +1,10 @@
1
1
 
2
2
  Rake::Gemcutter::Tasks
3
3
  - should define gem:push
4
+ - should successfully push the gem
5
+ - should check for gem requirements
6
+ - should fail if gem requirements are missing
4
7
 
5
- Finished in 0.003935 seconds
8
+ Finished in 73.925493 seconds
6
9
 
7
- 1 example, 0 failures
10
+ 4 examples, 0 failures
@@ -1,26 +1,12 @@
1
1
  require 'rake'
2
2
  require 'rake/tasklib'
3
- require 'commands/abstract_command'
4
3
 
5
- module Rake::Gemcutter
6
- class GemcutterCommands < ::Gem::AbstractCommand
7
- def initialize
8
- end
9
4
 
10
- def send_gem(gem_path)
11
- puts "Pushing gem to Gemcutter..."
12
-
13
- response = make_request(:post, "gems") do |request|
14
- request.body = File.open(gem_path){|io| io.read }
15
- request.add_field("Content-Length", request.body.size)
16
- request.add_field("Content-Type", "application/octet-stream")
17
- request.add_field("Authorization", api_key)
18
- end
19
-
20
- puts response.body
21
- end
22
- end
5
+ module Gem::Commands
6
+ autoload("PushCommand", "rubygems/commands/push_command")
7
+ end
23
8
 
9
+ module Rake::Gemcutter
24
10
  class Tasks < ::Rake::TaskLib
25
11
  def initialize(gem_spec)
26
12
  @gem_spec = gem_spec
@@ -46,6 +32,20 @@ module Rake::Gemcutter
46
32
  end
47
33
  end
48
34
 
35
+ module CommandTweaks
36
+ def setup_args(args = nil)
37
+ args ||= []
38
+ handle_options(args)
39
+ end
40
+ end
41
+
42
+ def get_command(klass, args=nil)
43
+ cmd = klass.new
44
+ cmd.extend(CommandTweaks)
45
+ cmd.setup_args(args)
46
+ cmd
47
+ end
48
+
49
49
  def define
50
50
  namespace :gem do
51
51
  desc "Uninstall the gem"
@@ -63,7 +63,8 @@ module Rake::Gemcutter
63
63
  task :install => [@gem_path] do |t|
64
64
  when_writing("Installing #{@gem_path}") do
65
65
  puts "Installing #{@gem_path}"
66
- system(*%w{sudo gem install} + [@gem_path] )
66
+ system(*%w{sudo gem install} + [@gem_path] ) #Wish I could do this without
67
+ #resorting to the command line
67
68
  end
68
69
  end
69
70
 
@@ -84,8 +85,9 @@ module Rake::Gemcutter
84
85
 
85
86
  desc 'Push a gem up to Gemcutter'
86
87
  task :push => [:dependencies_available] do
87
- cmd = GemcutterCommands::new
88
- cmd.send_gem(@gem_path)
88
+ push = get_command(Gem::Commands::PushCommand)
89
+ push.options[:args] = [@gem_path]
90
+ push.execute
89
91
  end
90
92
  end
91
93
  end
@@ -0,0 +1,48 @@
1
+ require 'rake/gemcutter'
2
+ require 'rubygems/gemcutter_utilities'
3
+ require 'rubygems/user_interaction'
4
+
5
+ $said = []
6
+
7
+ module Gem::UserInteraction
8
+ def say(string)
9
+ $said << string
10
+ end
11
+ end
12
+
13
+ module Gem::GemcutterUtilities
14
+ FakeRequest = Struct.new(:body)
15
+
16
+ def rubygems_api_request(*args)
17
+ return FakeRequest.new("Fake Request! Ha!")
18
+ end
19
+
20
+ def with_response(resp)
21
+ end
22
+ end
23
+
24
+ describe Rake::Gemcutter::Tasks do
25
+ before do
26
+ @spec = Gem::Specification.new
27
+ @tasks = Rake::Gemcutter::Tasks.new(@spec)
28
+ end
29
+ it "should define gem:push" do
30
+ Rake::Task['gem:push'].should_not be_nil
31
+ end
32
+
33
+ it "should successfully push the gem" do
34
+ Rake::Task['gem:push'].execute.should be_true
35
+ end
36
+
37
+ it "should check for gem requirements" do
38
+ @spec.add_dependency("rspec")
39
+ Rake::Task['gem:dependencies_available'].execute.should be_true
40
+ end
41
+
42
+ it "should fail if gem requirements are missing" do
43
+ @spec.add_dependency("True Love")
44
+ expect do
45
+ Rake::Task['gem:dependencies_available'].execute
46
+ end.to raise_error
47
+ end
48
+ end
@@ -0,0 +1,17 @@
1
+ puts Dir::pwd
2
+ require 'test/unit'
3
+ begin
4
+ require 'spec'
5
+ rescue LoadError
6
+ false
7
+ end
8
+
9
+ class RSpecTest < Test::Unit::TestCase
10
+ def test_that_rspec_is_available
11
+ assert_nothing_raised("\n\n * RSpec isn't available - please run: gem install rspec *\n\n"){ ::Spec }
12
+ end
13
+
14
+ def test_that_specs_pass
15
+ assert(system(*%w{spec -f e -p **/*.rb spec}),"\n\n * Specs failed *\n\n")
16
+ end
17
+ end
metadata CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
4
4
  prerelease: false
5
5
  segments:
6
6
  - 0
7
+ - 1
7
8
  - 0
8
- - 2
9
- version: 0.0.2
9
+ version: 0.1.0
10
10
  platform: ruby
11
11
  authors:
12
12
  - Judson Lester
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-03-20 00:00:00 -07:00
17
+ date: 2010-03-24 00:00:00 -07:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -36,14 +36,7 @@ dependencies:
36
36
  prerelease: false
37
37
  requirement: &id002 !ruby/object:Gem::Requirement
38
38
  requirements:
39
- - - ">="
40
- - !ruby/object:Gem::Version
41
- segments:
42
- - 0
43
- - 2
44
- - 1
45
- version: 0.2.1
46
- - - <
39
+ - - "="
47
40
  - !ruby/object:Gem::Version
48
41
  segments:
49
42
  - 0
@@ -53,7 +46,7 @@ dependencies:
53
46
  type: :runtime
54
47
  version_requirements: *id002
55
48
  description: " Tasks for gemcutter, including gemcutter-push\n"
56
- email: judson@jacked.com
49
+ email: nyarly@gmail.com
57
50
  executables: []
58
51
 
59
52
  extensions: []
@@ -65,6 +58,7 @@ files:
65
58
  - lib/rake/gemcutter.rb
66
59
  - doc/README
67
60
  - doc/Specifications
61
+ - spec/gemcutter.rb
68
62
  has_rdoc: true
69
63
  homepage: http://rake-gemcutter.rubyforge.org/
70
64
  licenses: []
@@ -75,7 +69,7 @@ rdoc_options:
75
69
  - --main
76
70
  - doc/README
77
71
  - --title
78
- - rake-gemcutter-0.0.2 RDoc
72
+ - rake-gemcutter-0.1.0 RDoc
79
73
  require_paths:
80
74
  - lib
81
75
  required_ruby_version: !ruby/object:Gem::Requirement
@@ -87,7 +81,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
87
81
  version: "0"
88
82
  required_rubygems_version: !ruby/object:Gem::Requirement
89
83
  requirements:
90
- - - <
84
+ - - "="
91
85
  - !ruby/object:Gem::Version
92
86
  segments:
93
87
  - 1
@@ -101,5 +95,5 @@ rubygems_version: 1.3.6
101
95
  signing_key:
102
96
  specification_version: 3
103
97
  summary: Rake tasks for gemcutter
104
- test_files: []
105
-
98
+ test_files:
99
+ - spec_help/gem_test_suite.rb