bait 0.5.4 → 0.5.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 58891295fc38209a37141334e62a3a03561bcffc
4
- data.tar.gz: 0aefe33c5cd7c7f2cbb9a3231a8258e196352f53
3
+ metadata.gz: cee1932d37be141c2cb617fa4ad5661a59495274
4
+ data.tar.gz: f1e5303b6be8f932951b8322c92603d284a7972e
5
5
  SHA512:
6
- metadata.gz: 1127e37a377f460b70fcdccec3a8b6491b6636b5cddfa6479475ea622ecda0f77623679572f23fc167927a90ab0841f040864106f37eb9a9409e62d73d3ef9ad
7
- data.tar.gz: 5b544f86eca0307b17b5fb6e9547eea4659c9fc5e57ec8f76e14867bbcf9f673dda983321bf6eb7bfad91b7aa8e9f0febe4d4ace33015132637a077d096ed764
6
+ metadata.gz: cb113c97d9f79a07f302fdb9170cdc7f1489bdf329e9e2dbc6f480adc7d6649206cfc08621ab1c98e6df703cb978231fefdbec9ab18caa05f1ee5a42bc98fea5
7
+ data.tar.gz: faeec3db06ee35a2347910ced47aaa5ea181385a15e02dcc8fee24d51ef0bee23828aa5fa1fe1988d7d463b7338164d3e2488a5442059566811c73f4ef8073cf
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- bait (0.5.4)
4
+ bait (0.5.5)
5
5
  git
6
6
  haml
7
7
  moneta
data/README.md CHANGED
@@ -59,6 +59,15 @@ bait provides a Sinatra endpoint for the github push event webhook.
59
59
  When the repo is cloned, an bait executes a file relative to your
60
60
  project. This file must exist in order to use bait: `.bait/test.sh`
61
61
 
62
+ ## SimpleCov Support
63
+
64
+ If your test suite builds the path `coverage/index.html` such as SimpleCov does
65
+ then bait will detect it and provide access to it from a link in the UI.
66
+
67
+ This feature was introduced in bait v0.5.4
68
+
69
+ # Extended Information
70
+
62
71
  ## .bait/test.sh
63
72
 
64
73
  In this file you will run your test suite. **Be sure to make it
data/Rakefile CHANGED
@@ -13,47 +13,40 @@ end
13
13
 
14
14
  namespace :assets do
15
15
  task :precompile do
16
- public = File.join File.dirname(__FILE__), %w(lib bait public)
17
- require 'bait/api'
18
- include Sinatra::AssetSnack::InstanceMethods
19
- Sinatra::AssetSnack.assets.each do |assets|
20
- compiled_path = File.join public, assets[:route]
21
- puts "compiling #{compiled_path}"
22
- File.open(compiled_path, 'w') do |file|
23
- response = compile assets[:paths]
24
- file.write response[:body]
25
- end
26
- end
16
+ require 'bait'
17
+ Bait.assets.compile!
27
18
  end
28
19
  end
29
20
 
30
-
31
21
  def git_master?
32
22
  `git branch | grep '* master'`
33
23
  $?.exitstatus == 0
34
24
  end
35
25
 
36
- def git_dirty?
37
- `git status --porcelain`.match(/^\sM/)
26
+ namespace :git do
27
+ task :dirty do
28
+ if `git status --porcelain`.match(/M /)
29
+ puts "Dirty working tree! Commit first before building!"
30
+ exit
31
+ end
32
+ end
38
33
  end
39
34
 
40
35
  namespace :gem do
41
36
  task :build do
42
37
  `bundle install`
38
+ Rake::Task['git:dirty'].invoke
43
39
  if !git_master?
44
40
  puts "I'll only build the gem on the master branch"
45
41
  else
46
- puts "On master branch"
42
+ puts "On master branch, running test suite; please wait."
47
43
  `rspec spec`
48
44
  if $?.exitstatus != 0
49
45
  puts "Uhh.. you have failing specs -- not building the gem"
50
46
  else
51
47
  puts "Specs pass. you're ready"
52
48
  Rake::Task['assets:precompile'].invoke
53
- if git_dirty?
54
- puts "Dirty working tree! Commit first before building!"
55
- exit
56
- end
49
+ Rake::Task['git:dirty'].invoke
57
50
  puts `gem build bait.gemspec`
58
51
  puts "Done! You can gem push that now"
59
52
  end
@@ -64,8 +57,14 @@ namespace :gem do
64
57
  require "bait/version"
65
58
  gem = "bait-#{Bait::VERSION}.gem"
66
59
  if File.exists?(gem)
67
- puts "Pushing gem to rubygems"
68
- puts `gem push #{gem}`
60
+ begin
61
+ puts "Press any key to push to Rubygems"
62
+ STDIN.gets
63
+ puts "Pushing gem to rubygems"
64
+ puts `gem push #{gem}`
65
+ rescue Interrupt
66
+ puts "ancelled"
67
+ end
69
68
  else
70
69
  puts "File not found #{gem}"
71
70
  end
data/VERSION CHANGED
@@ -1,3 +1,3 @@
1
- 0.5.4
1
+ 0.5.5
2
2
 
3
3
 
@@ -1,38 +1,47 @@
1
1
  require "bait/version"
2
2
  require 'moneta'
3
3
  require 'fileutils'
4
+ require 'bait/assets'
4
5
 
5
6
  module Bait
6
- def self.storage_dir
7
- path = File.join("#{self.home}", "#{self.env}")
8
- FileUtils.mkdir_p path
9
- path
10
- end
7
+ class << self
8
+ include Bait::Assets
11
9
 
12
- def self.db_dir
13
- db_dir = File.join self.storage_dir, "databases"
14
- FileUtils.mkdir_p db_dir
15
- db_dir
16
- end
10
+ def storage_dir
11
+ path = File.join("#{home}", "#{env}")
12
+ FileUtils.mkdir_p path
13
+ path
14
+ end
17
15
 
18
- def self.db_file name
19
- yaml_file = File.join self.db_dir, "#{name}.yaml"
20
- FileUtils.touch yaml_file
21
- yaml_file
22
- end
16
+ def db_dir
17
+ db_dir = File.join storage_dir, "databases"
18
+ FileUtils.mkdir_p db_dir
19
+ db_dir
20
+ end
23
21
 
24
- def self.store
25
- @store ||= begin
26
- Moneta.new :YAML, :file => db_file("main")
22
+ def db_file name
23
+ yaml_file = File.join db_dir, "#{name}.yaml"
24
+ FileUtils.touch yaml_file
25
+ yaml_file
27
26
  end
28
- end
29
27
 
30
- def self.env
31
- ENV['RACK_ENV'] ||= 'production'
32
- end
28
+ def store
29
+ @store ||= begin
30
+ Moneta.new :YAML, :file => db_file("main")
31
+ end
32
+ end
33
+
34
+ def env
35
+ ENV['RACK_ENV'] ||= 'production'
36
+ end
33
37
 
34
- def self.home
35
- File.join Etc.getpwuid.dir, '.bait'
38
+ def home
39
+ File.join Etc.getpwuid.dir, '.bait'
40
+ end
41
+
42
+ def public
43
+ Pathname.new(File.join(File.dirname(__FILE__), 'bait', 'public'))
44
+ end
36
45
  end
37
46
  end
38
47
 
@@ -6,23 +6,14 @@ require 'json'
6
6
  require 'bait/pubsub'
7
7
  require 'bait/build'
8
8
 
9
- if Bait.env != "production"
10
- require 'sinatra/asset_snack'
11
- DYNAMIC_ASSETS = true
12
- require 'fileutils'
13
- public = File.join File.dirname(__FILE__), %w(public)
14
- [%w(js application.js), %w(css application.css)].each do |i|
15
- path = File.join(public, i)
16
- FileUtils.rm(path) if File.exists?(path)
17
- end
18
- end
19
-
20
9
  module Bait
21
10
  class Api < Sinatra::Base
22
11
  set :port, 8417
23
12
  set server: 'thin'
24
13
 
25
- if defined? DYNAMIC_ASSETS
14
+ if Bait.assets.dynamic?
15
+ Bait.assets.remove!
16
+ require 'sinatra/asset_snack'
26
17
  register Sinatra::AssetSnack
27
18
  asset_map '/js/application.js', ['app/js/**/*.js', 'app/js/**/*.coffee']
28
19
  asset_map '/css/application.css', ['app/css/**/*.css', 'app/css/**/*.scss']
@@ -0,0 +1,35 @@
1
+ module Bait
2
+ module Assets
3
+ def assets
4
+ Class.new do
5
+ def missing?
6
+ !Bait.public.join('js', 'application.js').exist? &&
7
+ !Bait.public.join('css', 'application.css').exist?
8
+ end
9
+
10
+ def remove!
11
+ FileUtils.rm(Bait.public.join('js', 'application.js')) rescue nil
12
+ FileUtils.rm(Bait.public.join('css', 'application.css')) rescue nil
13
+ end
14
+
15
+ def dynamic?
16
+ Bait.env != "production"
17
+ end
18
+
19
+ def compile!
20
+ Module.new do
21
+ require 'bait/api'
22
+ require 'sinatra/asset_snack'
23
+ extend Sinatra::AssetSnack::InstanceMethods
24
+ Sinatra::AssetSnack.assets.each do |assets|
25
+ path = File.join(Bait.public, assets[:route])
26
+ File.open(path, 'w') do |file|
27
+ file.write compile(assets[:paths])[:body]
28
+ end
29
+ end
30
+ end
31
+ end
32
+ end.new
33
+ end
34
+ end
35
+ end
@@ -12,6 +12,9 @@ module Bait
12
12
  # Start the server
13
13
  def self.server
14
14
  puts "** Bait/#{Bait::VERSION} booting up in #{Bait.env} environment"
15
+ if Bait.env == "production" && Bait.assets.missing?
16
+ Bait.assets.precompile
17
+ end
15
18
  require 'bait/api'
16
19
  Bait::Api.run!
17
20
  end
@@ -8,8 +8,9 @@
8
8
  %script{src:'/js/ansi2html.js'}
9
9
  %script{src:'/js/application.js'}
10
10
  %body
11
- #nav
12
- %a{href:'/'}Home
13
11
  #content
14
12
  = yield
13
+ %hr
14
+ #footer
15
+ %center Bait/#{Bait::VERSION} #{Bait.env}
15
16
 
@@ -1,7 +1,39 @@
1
1
  require 'spec_helper'
2
+ require 'bait'
2
3
 
3
4
  describe Bait do
4
5
  it 'should have a version number' do
5
6
  Bait::VERSION.should_not be_nil
6
7
  end
8
+
9
+ describe "#public" do
10
+ it "returns a Pathname" do
11
+ Bait.public.should be_a Pathname
12
+ end
13
+ it "returns the app public path" do
14
+ Bait.public.to_s.split('/').last.should eq "public"
15
+ end
16
+ it "returns a real path" do
17
+ Bait.public.should exist
18
+ end
19
+ end
20
+
21
+ describe "#assets" do
22
+ describe "#missing?" do
23
+ subject { Bait.assets }
24
+ context "when assets are missing" do
25
+ before do
26
+ Bait.assets.remove!
27
+ end
28
+ it { should be_missing }
29
+ end
30
+ context "when assets are compiled" do
31
+ before do
32
+ Bait.assets.remove!
33
+ Bait.assets.compile!
34
+ end
35
+ it { should_not be_missing }
36
+ end
37
+ end
38
+ end
7
39
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bait
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.4
4
+ version: 0.5.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Keyvan Fatehi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-08-05 00:00:00.000000000 Z
11
+ date: 2013-08-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -261,6 +261,7 @@ files:
261
261
  - bin/bait
262
262
  - lib/bait.rb
263
263
  - lib/bait/api.rb
264
+ - lib/bait/assets.rb
264
265
  - lib/bait/build.rb
265
266
  - lib/bait/build_helper.rb
266
267
  - lib/bait/cli.rb
@@ -307,7 +308,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
307
308
  version: '0'
308
309
  requirements: []
309
310
  rubyforge_project:
310
- rubygems_version: 2.0.5
311
+ rubygems_version: 2.0.3
311
312
  signing_key:
312
313
  specification_version: 4
313
314
  summary: build and integration test service