spitball 0.3.0 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -24,9 +24,7 @@ begin
24
24
  gem.homepage = "http://github.com/freels/spitball"
25
25
  gem.authors = ["Matt Freels", "Brandon Mitchell", "Joshua Hull"]
26
26
 
27
- gem.add_dependency 'bundler', '~> 1.0.0'
28
- gem.add_dependency 'sinatra', '~> 1.0'
29
-
27
+ gem.add_dependency 'sinatra', '>= 1.0'
30
28
  gem.add_development_dependency 'rspec'
31
29
  gem.add_development_dependency 'rr'
32
30
  end
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.0
1
+ 0.3.1
@@ -25,18 +25,26 @@ module Bundler
25
25
  private
26
26
 
27
27
  TYPES = {
28
- "GIT" => Bundler::Source::Git,
29
- "GEM" => Bundler::Source::Rubygems,
30
- "PATH" => Bundler::Source::Path
28
+ "GIT" => 'git',
29
+ "GEM" => 'gem',
30
+ "PATH" => 'path'
31
31
  }
32
32
 
33
+ GemSource = Struct.new(:remotes)
34
+
33
35
  def parse_source(line)
34
36
  case line
35
37
  when "GIT", "GEM", "PATH"
36
38
  @current_source = nil
37
39
  @opts, @type = {}, line
38
40
  when " specs:"
39
- @current_source = TYPES[@type].from_lock(@opts)
41
+ case @type
42
+ when 'GEM'
43
+ @current_source = GemSource.new([])
44
+ @current_source.remotes << @opts['remote']
45
+ else
46
+ raise
47
+ end
40
48
  @sources << @current_source
41
49
  when /^ ([a-z]+): (.*)$/i
42
50
  value = $2
@@ -63,20 +71,11 @@ module Bundler
63
71
  name, version, pinned = $1, $2, $4
64
72
  version = version.split(",").map { |d| d.strip } if version
65
73
 
66
- dep = Bundler::Dependency.new(name, version)
74
+ dep = Gem::Dependency.new(name, version)
67
75
 
68
76
  if pinned && dep.name != 'bundler'
69
77
  spec = @specs.find { |s| s.name == dep.name }
70
78
  dep.source = spec.source if spec
71
-
72
- # Path sources need to know what the default name / version
73
- # to use in the case that there are no gemspecs present. A fake
74
- # gemspec is created based on the version set on the dependency
75
- # TODO: Use the version from the spec instead of from the dependency
76
- if version && version.size == 1 && version.first =~ /^\s*= (.+)\s*$/ && dep.source.is_a?(Bundler::Source::Path)
77
- dep.source.name = name
78
- dep.source.version = $1
79
- end
80
79
  end
81
80
 
82
81
  @dependencies << dep
@@ -87,8 +86,10 @@ module Bundler
87
86
  if line =~ %r{^ {4}#{NAME_VERSION}$}
88
87
  name, version = $1, Gem::Version.new($2)
89
88
  platform = $3 ? Gem::Platform.new($3) : Gem::Platform::RUBY
90
- @current_spec = LazySpecification.new(name, version, platform)
91
- @current_spec.source = @current_source
89
+ @current_spec = Gem::Specification.new
90
+ @current_spec.name = name
91
+ @current_spec.version = version
92
+ #@current_spec.source = @current_source
92
93
  @specs << @current_spec
93
94
  elsif line =~ %r{^ {6}#{NAME_VERSION}$}
94
95
  name, version = $1, $2
@@ -11,8 +11,19 @@ class Spitball::Remote
11
11
  end
12
12
 
13
13
  def copy_to(path)
14
- data = generate_remote_tarball
15
- File.open(path, 'w') { |f| f.write data }
14
+ case path
15
+ when /\.tar\.gz$/, /\.tgz$/
16
+ data = generate_remote_tarball
17
+ File.open(path, 'w') { |f| f.write data }
18
+ else
19
+ begin
20
+ File.open('tmp.tgz', 'w') { |f| f.write data }
21
+ FileUtils.mkdir_p path
22
+ `tar xvf tmp.tgz -C #{path}`
23
+ ensure
24
+ FileUtils.rm_rf('tmp.tgz')
25
+ end
26
+ end
16
27
  end
17
28
 
18
29
  private
data/lib/spitball.rb CHANGED
@@ -1,6 +1,5 @@
1
1
  require 'fileutils'
2
2
  require 'digest/md5'
3
- require 'bundler'
4
3
  require 'ext/bundler_lockfile_parser'
5
4
  require 'ext/bundler_fake_dsl'
6
5
 
@@ -29,7 +29,7 @@ describe Spitball do
29
29
  it "returns true if the tarball has already been cached" do
30
30
  @spitball.should_not be_cached
31
31
  mock(@spitball).install_gem(anything, anything).times(any_times)
32
- capture_stdout { @spitball.cache! }
32
+ @spitball.cache!
33
33
  @spitball.should be_cached
34
34
  end
35
35
  end
@@ -97,7 +97,7 @@ describe Spitball do
97
97
  end
98
98
  end_gemfile
99
99
 
100
- @lockfile = <<-end_lockfile.strip.gsub(/\n[ ]{6}/m, "\n")
100
+ @lockfile = <<-end_lockfile.strip.gsub(/\n[ ]{8}/m, "\n")
101
101
  GEM
102
102
  remote: http://rubygems.org/
103
103
  specs:
@@ -127,10 +127,10 @@ describe Spitball do
127
127
 
128
128
  it "should use without" do
129
129
  @spitball = Spitball.new(@gemfile, @lockfile)
130
- mock(@spitball).install_gem(anything, anything).times(3)
130
+ mock(@spitball).install_gem(anything, anything).times(7)
131
131
  @spitball.create_bundle
132
132
  @spitball = Spitball.new(@gemfile, @lockfile, :without => 'development')
133
- mock(@spitball).install_gem(anything, anything).times(1)
133
+ mock(@spitball).install_gem(anything, anything).times(6)
134
134
  @spitball.create_bundle
135
135
  end
136
136
  end
data/spitball.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{spitball}
8
- s.version = "0.3.0"
8
+ s.version = "0.3.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Matt Freels", "Brandon Mitchell", "Joshua Hull"]
12
- s.date = %q{2010-10-27}
12
+ s.date = %q{2010-10-28}
13
13
  s.description = %q{Use bundler to generate gem tarball packages.}
14
14
  s.email = %q{freels@twitter.com}
15
15
  s.executables = ["spitball", "spitball-cache-cleanup", "spitball-server"]
@@ -51,19 +51,16 @@ Gem::Specification.new do |s|
51
51
  s.specification_version = 3
52
52
 
53
53
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
54
- s.add_runtime_dependency(%q<bundler>, ["~> 1.0.0"])
55
- s.add_runtime_dependency(%q<sinatra>, ["~> 1.0"])
54
+ s.add_runtime_dependency(%q<sinatra>, [">= 1.0"])
56
55
  s.add_development_dependency(%q<rspec>, [">= 0"])
57
56
  s.add_development_dependency(%q<rr>, [">= 0"])
58
57
  else
59
- s.add_dependency(%q<bundler>, ["~> 1.0.0"])
60
- s.add_dependency(%q<sinatra>, ["~> 1.0"])
58
+ s.add_dependency(%q<sinatra>, [">= 1.0"])
61
59
  s.add_dependency(%q<rspec>, [">= 0"])
62
60
  s.add_dependency(%q<rr>, [">= 0"])
63
61
  end
64
62
  else
65
- s.add_dependency(%q<bundler>, ["~> 1.0.0"])
66
- s.add_dependency(%q<sinatra>, ["~> 1.0"])
63
+ s.add_dependency(%q<sinatra>, [">= 1.0"])
67
64
  s.add_dependency(%q<rspec>, [">= 0"])
68
65
  s.add_dependency(%q<rr>, [">= 0"])
69
66
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spitball
3
3
  version: !ruby/object:Gem::Version
4
- hash: 19
4
+ hash: 17
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 3
9
- - 0
10
- version: 0.3.0
9
+ - 1
10
+ version: 0.3.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - Matt Freels
@@ -17,32 +17,16 @@ autorequire:
17
17
  bindir: bin
18
18
  cert_chain: []
19
19
 
20
- date: 2010-10-27 00:00:00 -07:00
20
+ date: 2010-10-28 00:00:00 -07:00
21
21
  default_executable:
22
22
  dependencies:
23
- - !ruby/object:Gem::Dependency
24
- name: bundler
25
- prerelease: false
26
- requirement: &id001 !ruby/object:Gem::Requirement
27
- none: false
28
- requirements:
29
- - - ~>
30
- - !ruby/object:Gem::Version
31
- hash: 23
32
- segments:
33
- - 1
34
- - 0
35
- - 0
36
- version: 1.0.0
37
- type: :runtime
38
- version_requirements: *id001
39
23
  - !ruby/object:Gem::Dependency
40
24
  name: sinatra
41
25
  prerelease: false
42
- requirement: &id002 !ruby/object:Gem::Requirement
26
+ requirement: &id001 !ruby/object:Gem::Requirement
43
27
  none: false
44
28
  requirements:
45
- - - ~>
29
+ - - ">="
46
30
  - !ruby/object:Gem::Version
47
31
  hash: 15
48
32
  segments:
@@ -50,11 +34,11 @@ dependencies:
50
34
  - 0
51
35
  version: "1.0"
52
36
  type: :runtime
53
- version_requirements: *id002
37
+ version_requirements: *id001
54
38
  - !ruby/object:Gem::Dependency
55
39
  name: rspec
56
40
  prerelease: false
57
- requirement: &id003 !ruby/object:Gem::Requirement
41
+ requirement: &id002 !ruby/object:Gem::Requirement
58
42
  none: false
59
43
  requirements:
60
44
  - - ">="
@@ -64,11 +48,11 @@ dependencies:
64
48
  - 0
65
49
  version: "0"
66
50
  type: :development
67
- version_requirements: *id003
51
+ version_requirements: *id002
68
52
  - !ruby/object:Gem::Dependency
69
53
  name: rr
70
54
  prerelease: false
71
- requirement: &id004 !ruby/object:Gem::Requirement
55
+ requirement: &id003 !ruby/object:Gem::Requirement
72
56
  none: false
73
57
  requirements:
74
58
  - - ">="
@@ -78,7 +62,7 @@ dependencies:
78
62
  - 0
79
63
  version: "0"
80
64
  type: :development
81
- version_requirements: *id004
65
+ version_requirements: *id003
82
66
  description: Use bundler to generate gem tarball packages.
83
67
  email: freels@twitter.com
84
68
  executables: