spitball 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.sample +0 -1
- data/VERSION +1 -1
- data/bin/spitball-server +15 -0
- data/spec/spec.opts +7 -0
- data/spec/spec_helper.rb +29 -0
- data/spec/spitball_spec.rb +52 -0
- data/spitball.gemspec +10 -3
- metadata +10 -6
data/Gemfile.sample
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.4
|
data/bin/spitball-server
CHANGED
@@ -1,9 +1,24 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
3
|
require 'spitball'
|
4
|
+
require 'optparse'
|
4
5
|
require 'sinatra'
|
5
6
|
require 'json'
|
6
7
|
|
8
|
+
# cargo culting sinatra's option parser, since it has trouble
|
9
|
+
# with rubygem stub files
|
10
|
+
|
11
|
+
OptionParser.new { |op|
|
12
|
+
op.on('-x') { set :lock, true }
|
13
|
+
op.on('-e env') { |val| set :environment, val.to_sym }
|
14
|
+
op.on('-s server') { |val| set :server, val }
|
15
|
+
op.on('-p port') { |val| set :port, val.to_i }
|
16
|
+
op.on('-o addr') { |val| set :bind, val }
|
17
|
+
}.parse!(ARGV.dup)
|
18
|
+
|
19
|
+
# always run
|
20
|
+
set :run, true
|
21
|
+
|
7
22
|
mime_type :gemfile, 'text/plain'
|
8
23
|
mime_type :tgz, 'application/x-compressed'
|
9
24
|
|
data/spec/spec.opts
ADDED
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
SPEC_DIR = File.dirname(__FILE__)
|
2
|
+
|
3
|
+
SPITBALL_CACHE = ENV['SPITBALL_CACHE'] = File.expand_path('cache', SPEC_DIR)
|
4
|
+
|
5
|
+
$: << File.expand_path("../lib", SPEC_DIR)
|
6
|
+
|
7
|
+
require 'rubygems'
|
8
|
+
require 'fileutils'
|
9
|
+
require 'spec'
|
10
|
+
require 'spitball'
|
11
|
+
|
12
|
+
|
13
|
+
Spec::Runner.configure do |config|
|
14
|
+
config.mock_with :rr
|
15
|
+
config.before do
|
16
|
+
purge_test_cache
|
17
|
+
end
|
18
|
+
|
19
|
+
config.after :all do
|
20
|
+
purge_test_cache
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
|
25
|
+
# helper methods
|
26
|
+
|
27
|
+
def purge_test_cache
|
28
|
+
FileUtils.rm_rf SPITBALL_CACHE
|
29
|
+
end
|
@@ -0,0 +1,52 @@
|
|
1
|
+
require 'spec/spec_helper'
|
2
|
+
|
3
|
+
describe Spitball do
|
4
|
+
it "works" do
|
5
|
+
end
|
6
|
+
end
|
7
|
+
|
8
|
+
describe Spitball::FileLock do
|
9
|
+
include Spitball::FileLock
|
10
|
+
|
11
|
+
describe "acquire_lock" do
|
12
|
+
before do
|
13
|
+
Spitball::Repo.make_cache_dir
|
14
|
+
@lock_path = File.expand_path('test.lock', SPITBALL_CACHE)
|
15
|
+
end
|
16
|
+
|
17
|
+
it "returns true if the lock is acquired" do
|
18
|
+
acquire_lock(@lock_path).should == true
|
19
|
+
end
|
20
|
+
|
21
|
+
it "returns false if the lock is not acquired" do
|
22
|
+
fork { acquire_lock(@lock_path); exit! }
|
23
|
+
Process.wait
|
24
|
+
|
25
|
+
acquire_lock(@lock_path).should == false
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
describe Spitball::Repo do
|
31
|
+
describe "make_cache_dir" do
|
32
|
+
it "creates the correct cache dir" do
|
33
|
+
File.exist?(SPITBALL_CACHE).should_not == true
|
34
|
+
Spitball::Repo.make_cache_dir
|
35
|
+
File.exist?(SPITBALL_CACHE).should == true
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
describe "path" do
|
40
|
+
it "generates paths with the correct cache" do
|
41
|
+
Spitball::Repo.path('digest').should =~ %r[^#{SPITBALL_CACHE}]
|
42
|
+
end
|
43
|
+
|
44
|
+
it "generates paths with extensions" do
|
45
|
+
Spitball::Repo.path('digest', 'tgz').should =~ %r[\.tgz$]
|
46
|
+
end
|
47
|
+
|
48
|
+
it "generates paths prefixed with bundle_" do
|
49
|
+
Spitball::Repo.path('digest', 'tgz').should =~ %r[bundle_digest\.tgz$]
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
data/spitball.gemspec
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
# Generated by jeweler
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
-
# Instead, edit Jeweler::Tasks in
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{spitball}
|
8
|
-
s.version = "0.1.
|
8
|
+
s.version = "0.1.4"
|
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"]
|
12
|
-
s.date = %q{2010-07-
|
12
|
+
s.date = %q{2010-07-21}
|
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-server"]
|
@@ -29,6 +29,9 @@ Gem::Specification.new do |s|
|
|
29
29
|
"lib/spitball/file_lock.rb",
|
30
30
|
"lib/spitball/remote.rb",
|
31
31
|
"lib/spitball/repo.rb",
|
32
|
+
"spec/spec.opts",
|
33
|
+
"spec/spec_helper.rb",
|
34
|
+
"spec/spitball_spec.rb",
|
32
35
|
"spitball.gemspec"
|
33
36
|
]
|
34
37
|
s.homepage = %q{http://twitter.com}
|
@@ -36,6 +39,10 @@ Gem::Specification.new do |s|
|
|
36
39
|
s.require_paths = ["lib"]
|
37
40
|
s.rubygems_version = %q{1.3.7}
|
38
41
|
s.summary = %q{get a bundle}
|
42
|
+
s.test_files = [
|
43
|
+
"spec/spec_helper.rb",
|
44
|
+
"spec/spitball_spec.rb"
|
45
|
+
]
|
39
46
|
|
40
47
|
if s.respond_to? :specification_version then
|
41
48
|
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
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:
|
4
|
+
hash: 19
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 4
|
10
|
+
version: 0.1.4
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Matt Freels
|
@@ -16,7 +16,7 @@ autorequire:
|
|
16
16
|
bindir: bin
|
17
17
|
cert_chain: []
|
18
18
|
|
19
|
-
date: 2010-07-
|
19
|
+
date: 2010-07-21 00:00:00 -07:00
|
20
20
|
default_executable:
|
21
21
|
dependencies:
|
22
22
|
- !ruby/object:Gem::Dependency
|
@@ -100,6 +100,9 @@ files:
|
|
100
100
|
- lib/spitball/file_lock.rb
|
101
101
|
- lib/spitball/remote.rb
|
102
102
|
- lib/spitball/repo.rb
|
103
|
+
- spec/spec.opts
|
104
|
+
- spec/spec_helper.rb
|
105
|
+
- spec/spitball_spec.rb
|
103
106
|
- spitball.gemspec
|
104
107
|
has_rdoc: true
|
105
108
|
homepage: http://twitter.com
|
@@ -135,5 +138,6 @@ rubygems_version: 1.3.7
|
|
135
138
|
signing_key:
|
136
139
|
specification_version: 3
|
137
140
|
summary: get a bundle
|
138
|
-
test_files:
|
139
|
-
|
141
|
+
test_files:
|
142
|
+
- spec/spec_helper.rb
|
143
|
+
- spec/spitball_spec.rb
|