spitball 0.4.5 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -0
- data/Gemfile +3 -0
- data/bin/spitball-cache-cleanup +0 -0
- data/bin/spitball-server +5 -0
- data/lib/ext/bundler_fake_dsl.rb +7 -3
- data/lib/spitball/remote.rb +1 -1
- data/lib/spitball/version.rb +1 -1
- data/lib/spitball.rb +34 -15
- data/spec/spitball_spec.rb +1 -1
- data/spitball.gemspec +2 -2
- metadata +18 -18
data/.gitignore
CHANGED
data/Gemfile
ADDED
data/bin/spitball-cache-cleanup
CHANGED
File without changes
|
data/bin/spitball-server
CHANGED
@@ -29,6 +29,11 @@ get '/list' do
|
|
29
29
|
JSON.dump Spitball::Repo.cached_digests
|
30
30
|
end
|
31
31
|
|
32
|
+
get '/env' do
|
33
|
+
content_type :text
|
34
|
+
`#{$:.inspect}\n#{Spitball.gem_cmd} env`
|
35
|
+
end
|
36
|
+
|
32
37
|
# return tgz or gemfile of cached SHA or 404
|
33
38
|
get '/:digest.:format' do |digest, format|
|
34
39
|
error 400 unless ['tgz', 'gemfile'].include? format
|
data/lib/ext/bundler_fake_dsl.rb
CHANGED
@@ -3,7 +3,7 @@ module Bundler
|
|
3
3
|
|
4
4
|
def initialize(file)
|
5
5
|
@groups = Hash.new{|h, k| h[k] = []}
|
6
|
-
@
|
6
|
+
@gems = []
|
7
7
|
instance_eval(file)
|
8
8
|
end
|
9
9
|
|
@@ -11,8 +11,12 @@ module Bundler
|
|
11
11
|
@groups
|
12
12
|
end
|
13
13
|
|
14
|
+
def __gems
|
15
|
+
@gems
|
16
|
+
end
|
17
|
+
|
14
18
|
def __gem_names
|
15
|
-
|
19
|
+
__gems.map(&:first)
|
16
20
|
end
|
17
21
|
|
18
22
|
def group(name, &blk)
|
@@ -23,7 +27,7 @@ module Bundler
|
|
23
27
|
alias_method :groups, :group
|
24
28
|
|
25
29
|
def gem(*args)
|
26
|
-
@
|
30
|
+
@gems << args
|
27
31
|
@groups[@current_group] << args.first
|
28
32
|
end
|
29
33
|
|
data/lib/spitball/remote.rb
CHANGED
@@ -11,7 +11,7 @@ class Spitball::Remote
|
|
11
11
|
@host = opts[:host]
|
12
12
|
@port = opts[:port]
|
13
13
|
@without = (opts[:without] || []).map{|w| w.to_sym}
|
14
|
-
@cache_dir = File.join(ENV['SPITBALL_CACHE'] || '
|
14
|
+
@cache_dir = File.join(ENV['SPITBALL_CACHE'] || File.join(ENV['HOME'], '.spitball'), 'client')
|
15
15
|
FileUtils.mkdir_p(@cache_dir)
|
16
16
|
use_cache_file
|
17
17
|
end
|
data/lib/spitball/version.rb
CHANGED
data/lib/spitball.rb
CHANGED
@@ -15,6 +15,10 @@ class Spitball
|
|
15
15
|
class ClientError < StandardError; end
|
16
16
|
class BundleCreationFailure < StandardError; end
|
17
17
|
|
18
|
+
def self.gem_cmd
|
19
|
+
ENV['GEM_CMD'] || 'gem'
|
20
|
+
end
|
21
|
+
|
18
22
|
PROTOCOL_VERSION = '1'
|
19
23
|
PROTOCOL_HEADER = "X-Spitball-Protocol"
|
20
24
|
WITHOUT_HEADER = "X-Spitball-Without"
|
@@ -69,9 +73,16 @@ class Spitball
|
|
69
73
|
File.open(gemfile_lock_path, 'w') {|f| f.write gemfile_lock }
|
70
74
|
|
71
75
|
Dir.chdir(Repo.gemcache_path) do
|
72
|
-
@dsl.__gem_names.each do |
|
76
|
+
@dsl.__gem_names.each do |spec|
|
77
|
+
spec_name = spec.first
|
73
78
|
if @groups_to_install.any?{|group| @dsl.__groups[group].include?(spec_name)}
|
74
|
-
|
79
|
+
if found_spec = @parsed_lockfile.specs.find {|spec| spec.name == spec_name}
|
80
|
+
install_gem(found_spec)
|
81
|
+
elsif spec_name == 'bundler'
|
82
|
+
install_and_copy_spec(spec_name, '>= 0')
|
83
|
+
else
|
84
|
+
raise "Cannot install #{spec * ' '}"
|
85
|
+
end
|
75
86
|
end
|
76
87
|
end
|
77
88
|
end
|
@@ -91,17 +102,24 @@ class Spitball
|
|
91
102
|
end
|
92
103
|
|
93
104
|
def install_gem(spec)
|
94
|
-
install_and_copy_spec(spec)
|
105
|
+
install_and_copy_spec(spec.name, spec.version)
|
95
106
|
spec.dependencies.each do |dep|
|
96
|
-
|
107
|
+
spec_name = dep.name
|
108
|
+
if found_spec = @parsed_lockfile.specs.find {|spec| spec.name == spec_name}
|
109
|
+
install_gem(found_spec)
|
110
|
+
elsif spec_name == 'bundler'
|
111
|
+
install_and_copy_spec(dep.name, dep.requirements_list.first || '> 0')
|
112
|
+
else
|
113
|
+
raise "Cannot install #{dep.inspect}"
|
114
|
+
end
|
97
115
|
end
|
98
116
|
end
|
99
117
|
|
100
|
-
def install_and_copy_spec(
|
101
|
-
cache_dir = File.join(Repo.gemcache_path, "#{
|
118
|
+
def install_and_copy_spec(name, version)
|
119
|
+
cache_dir = File.join(Repo.gemcache_path, "#{name}-#{::Digest::MD5.hexdigest([name, version, sources_opt(@parsed_lockfile.sources)].join('/'))}")
|
102
120
|
unless File.exist?(cache_dir)
|
103
121
|
FileUtils.mkdir_p(cache_dir)
|
104
|
-
out =
|
122
|
+
out = `#{Spitball.gem_cmd} install #{name} -v'#{version}' --no-rdoc --no-ri --ignore-dependencies -i#{cache_dir} #{sources_opt(@parsed_lockfile.sources)} 2>&1`
|
105
123
|
if $? == 0
|
106
124
|
puts out
|
107
125
|
else
|
@@ -109,19 +127,20 @@ class Spitball
|
|
109
127
|
raise BundleCreationFailure, out
|
110
128
|
end
|
111
129
|
else
|
112
|
-
puts "Using cached version of #{
|
130
|
+
puts "Using cached version of #{name} (#{version})"
|
113
131
|
end
|
114
132
|
`cp -R #{cache_dir}/* #{bundle_path}`
|
115
133
|
end
|
116
134
|
|
117
135
|
def sources_opt(sources)
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
136
|
+
Array(ENV['SOURCE_OVERRIDE'] ||
|
137
|
+
sources.
|
138
|
+
map{|s| s.remotes}.flatten.
|
139
|
+
map{|s| s.to_s}.
|
140
|
+
sort.
|
141
|
+
map{|s| %w{gemcutter rubygems rubyforge}.include?(s) ? "http://rubygems.org" : s}).
|
142
|
+
map{|s| "--source #{s}"}.
|
143
|
+
join(' ')
|
125
144
|
end
|
126
145
|
|
127
146
|
# Paths
|
data/spec/spitball_spec.rb
CHANGED
@@ -127,7 +127,7 @@ describe Spitball do
|
|
127
127
|
|
128
128
|
it "should use without" do
|
129
129
|
@spitball = Spitball.new(@gemfile, @lockfile)
|
130
|
-
mock(@spitball).install_and_copy_spec(anything).times(9)
|
130
|
+
mock(@spitball).install_and_copy_spec(anything, anything).times(9)
|
131
131
|
@spitball.send :create_bundle
|
132
132
|
@spitball = Spitball.new(@gemfile, @lockfile, :without => 'development')
|
133
133
|
mock(@spitball).install_and_copy_spec(anything).times(0)
|
data/spitball.gemspec
CHANGED
@@ -9,13 +9,13 @@ Gem::Specification.new do |s|
|
|
9
9
|
s.authors = ["Matt Freels", "Brandon Mitchell", "Joshua Hull"]
|
10
10
|
s.email = "freels@twitter.com"
|
11
11
|
s.homepage = "http://rubygems.org/gems/spitball"
|
12
|
-
s.summary = %q{Use bundler to generate gem tarball packages
|
12
|
+
s.summary = %q{Use bundler to generate gem tarball packages}
|
13
13
|
s.description = %q{Use bundler to generate gem tarball packages.}
|
14
14
|
|
15
15
|
s.rubyforge_project = "spitball"
|
16
16
|
|
17
|
-
s.add_dependency 'sinatra', '>= 1.0'
|
18
17
|
s.add_development_dependency 'rspec', "~> 1.3.0"
|
18
|
+
s.add_development_dependency 'diff-lcs'
|
19
19
|
s.add_development_dependency 'rr'
|
20
20
|
s.add_development_dependency 'rake'
|
21
21
|
s.add_development_dependency 'phocus'
|
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:
|
5
|
-
prerelease:
|
4
|
+
hash: 11
|
5
|
+
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
- 4
|
9
8
|
- 5
|
10
|
-
|
9
|
+
- 0
|
10
|
+
version: 0.5.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Matt Freels
|
@@ -17,38 +17,37 @@ autorequire:
|
|
17
17
|
bindir: bin
|
18
18
|
cert_chain: []
|
19
19
|
|
20
|
-
date: 2011-
|
20
|
+
date: 2011-04-25 00:00:00 -07:00
|
21
21
|
default_executable:
|
22
22
|
dependencies:
|
23
23
|
- !ruby/object:Gem::Dependency
|
24
|
-
name:
|
24
|
+
name: rspec
|
25
25
|
prerelease: false
|
26
26
|
requirement: &id001 !ruby/object:Gem::Requirement
|
27
27
|
none: false
|
28
28
|
requirements:
|
29
|
-
- -
|
29
|
+
- - ~>
|
30
30
|
- !ruby/object:Gem::Version
|
31
|
-
hash:
|
31
|
+
hash: 27
|
32
32
|
segments:
|
33
33
|
- 1
|
34
|
+
- 3
|
34
35
|
- 0
|
35
|
-
version:
|
36
|
-
type: :
|
36
|
+
version: 1.3.0
|
37
|
+
type: :development
|
37
38
|
version_requirements: *id001
|
38
39
|
- !ruby/object:Gem::Dependency
|
39
|
-
name:
|
40
|
+
name: diff-lcs
|
40
41
|
prerelease: false
|
41
42
|
requirement: &id002 !ruby/object:Gem::Requirement
|
42
43
|
none: false
|
43
44
|
requirements:
|
44
|
-
- -
|
45
|
+
- - ">="
|
45
46
|
- !ruby/object:Gem::Version
|
46
|
-
hash:
|
47
|
+
hash: 3
|
47
48
|
segments:
|
48
|
-
- 1
|
49
|
-
- 3
|
50
49
|
- 0
|
51
|
-
version:
|
50
|
+
version: "0"
|
52
51
|
type: :development
|
53
52
|
version_requirements: *id002
|
54
53
|
- !ruby/object:Gem::Dependency
|
@@ -105,6 +104,7 @@ extra_rdoc_files:
|
|
105
104
|
- README.md
|
106
105
|
files:
|
107
106
|
- .gitignore
|
107
|
+
- Gemfile
|
108
108
|
- README.md
|
109
109
|
- Rakefile
|
110
110
|
- bin/spitball
|
@@ -153,10 +153,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
153
153
|
requirements: []
|
154
154
|
|
155
155
|
rubyforge_project: spitball
|
156
|
-
rubygems_version: 1.
|
156
|
+
rubygems_version: 1.6.2
|
157
157
|
signing_key:
|
158
158
|
specification_version: 3
|
159
|
-
summary: Use bundler to generate gem tarball packages
|
159
|
+
summary: Use bundler to generate gem tarball packages
|
160
160
|
test_files:
|
161
161
|
- spec/spec.opts
|
162
162
|
- spec/spec_helper.rb
|