bait 0.5.12 → 0.5.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 492066aede4bd771d097e7e7ce1b79d39fa984f5
4
- data.tar.gz: f65eeda693dba6014995642e487b13916e94d2b9
3
+ metadata.gz: a24157c8fb0d4ac6c4a50da7cdb1ef2313e419f3
4
+ data.tar.gz: 2969c4f70dd268662a9e5df2e2f51576af67dbd0
5
5
  SHA512:
6
- metadata.gz: 337809e4233657b7aa490f1bf7097e993d886f8fd692b1c7e826c8f335d5a94c4808a7e1461861e8f0c4165ecd95ee1a52876d9fb6bdaa34761a2735e3caa9f5
7
- data.tar.gz: d6ec7ba50ca490f5f93f5fdd887915eea4bbcd3719d910bfe2c77cb4ec70f9bed7b4a64cd0e8e3e0b56c5019bc25c90a0e5b0541492ceec6913c2637e42b1651
6
+ metadata.gz: 373ad361ccb95aba49abbef635485b4086f5aad9e435ac6bdfe12e04d347e14570a26b96336b2460e1977d0610e895707063f68c457986786fe4ee4727db8b62
7
+ data.tar.gz: 7d8622aad172e9d261cee74822a727df08689c548649bc2f364d68981f996961c67d910dd4a898ae4af1ceaf11a5c3536ba4ac88e6605ce519c77b8237fa2d23
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- bait (0.5.12)
4
+ bait (0.5.13)
5
5
  git
6
6
  haml
7
7
  moneta
data/Rakefile CHANGED
@@ -35,6 +35,7 @@ end
35
35
  namespace :gem do
36
36
  task :build do
37
37
  `bundle install`
38
+ Rake::Task['assets:precompile'].invoke
38
39
  Rake::Task['git:dirty'].invoke
39
40
  if !git_master?
40
41
  puts "I'll only build the gem on the master branch"
@@ -45,7 +46,6 @@ namespace :gem do
45
46
  puts "Uhh.. you have failing specs -- not building the gem"
46
47
  else
47
48
  puts "Specs pass. you're ready"
48
- Rake::Task['assets:precompile'].invoke
49
49
  Rake::Task['git:dirty'].invoke
50
50
  puts `gem build bait.gemspec`
51
51
  puts "Done! You can gem push that now"
@@ -53,7 +53,7 @@ namespace :gem do
53
53
  end
54
54
  end
55
55
 
56
- task :push => :build do
56
+ task :publish => :build do
57
57
  require "bait/version"
58
58
  gem = "bait-#{Bait::VERSION}.gem"
59
59
  if File.exists?(gem)
data/VERSION CHANGED
@@ -1,3 +1,3 @@
1
- 0.5.12
1
+ 0.5.13
2
2
 
3
3
 
@@ -16,7 +16,7 @@ module Bait
16
16
  Moneta.new(:YAML, :file => Bait.db_file('builds'))
17
17
 
18
18
  attribute :simplecov, Boolean, default: false
19
- attribute :ref, String, default: "master"
19
+ attribute :ref, String, default: "refs/heads/master"
20
20
  attribute :owner_name, String
21
21
  attribute :owner_email, String
22
22
  attribute :name, String
@@ -36,9 +36,12 @@ module Bait
36
36
  self.cleanup!
37
37
  end
38
38
 
39
+ def branch
40
+ self.ref.gsub('refs/heads/', '')
41
+ end
42
+
39
43
  def summary
40
- branch = self.ref ? self.ref.split('/').last : "n/a"
41
- output = %{#{self.name} (#{branch}) #{self.status}}
44
+ output = %{#{self.name} (#{self.branch}) #{self.status}}
42
45
  case self.status
43
46
  when "passed"
44
47
  output.green
@@ -91,7 +94,10 @@ module Bait
91
94
  FileUtils.mkdir_p sandbox_directory
92
95
  end
93
96
  begin
94
- Git.clone(clone_url, name, :path => sandbox_directory)
97
+ g = Git.clone(clone_url, name, :path => sandbox_directory)
98
+ if g.branch.name != self.branch
99
+ g.checkout("origin/#{self.branch}")
100
+ end
95
101
  rescue => ex
96
102
  msg = "Failed to clone #{clone_url}"
97
103
  self.output << "#{msg}\n\n#{ex.message}\n\n#{ex.backtrace.join("\n")}"
@@ -82,9 +82,17 @@ describe Bait::Build do
82
82
 
83
83
  describe "#clone!" do
84
84
  context 'valid clone url' do
85
- before { build.clone_url = repo_path ; build.clone! }
85
+ before do
86
+ build.clone_url = repo_path
87
+ build.clone!
88
+ end
86
89
  specify { build.output.should_not match /Failed to clone/ }
87
90
  specify { build.should be_cloned }
91
+ it "should be on the correct branch" do
92
+ g = Git.open File.join(build.sandbox_directory, build.name)
93
+ g.branch.name.should eq build.branch
94
+ build.ref.should include build.branch
95
+ end
88
96
  end
89
97
  context "invalid clone url" do
90
98
  before { build.clone_url = "invalid" ; build.clone! }
@@ -156,4 +164,11 @@ describe Bait::Build do
156
164
  build.summary.should match /.+ \(.+\) .+/
157
165
  end
158
166
  end
167
+
168
+ describe "#branch" do
169
+ it "removes the refs/heads portion and returns only the branch name" do
170
+ build.ref = "refs/heads/foo/bar/baz"
171
+ build.branch.should eq "foo/bar/baz"
172
+ end
173
+ end
159
174
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bait
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.12
4
+ version: 0.5.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - Keyvan Fatehi
@@ -329,7 +329,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
329
329
  version: '0'
330
330
  requirements: []
331
331
  rubyforge_project:
332
- rubygems_version: 2.0.3
332
+ rubygems_version: 2.0.5
333
333
  signing_key:
334
334
  specification_version: 4
335
335
  summary: build and integration test service