bahia 0.3.0 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
data/.gemspec CHANGED
@@ -13,6 +13,7 @@ Gem::Specification.new do |s|
13
13
  s.required_rubygems_version = ">= 1.3.6"
14
14
  s.add_development_dependency 'rspec', '~> 2.7.0'
15
15
  s.files = Dir.glob(%w[{lib,spec}/**/*.rb bin/* [A-Z]*.{md,txt,rdoc} ext/**/*.{rb,c} **/deps.rip]) + %w{Rakefile .gemspec}
16
+ s.files += %w{.travis.yml}
16
17
  s.extra_rdoc_files = ["README.md", "LICENSE.txt"]
17
18
  s.license = 'MIT'
18
19
  end
data/.travis.yml ADDED
@@ -0,0 +1,8 @@
1
+ before_install: bundle init --gemspec=.gemspec
2
+ script: bundle exec rspec spec
3
+ rvm:
4
+ - 1.8.7
5
+ - 1.9.2
6
+ - 1.9.3
7
+ - jruby
8
+ - rbx
data/CHANGELOG.rdoc CHANGED
@@ -1,3 +1,7 @@
1
+ == 0.4
2
+ * Add support for 1.8.7
3
+ * Fix handling of nil and blank $RUBYLIB
4
+
1
5
  == 0.3
2
6
  * Add support for quoted args
3
7
  * Allow no arguments
data/README.md CHANGED
@@ -60,7 +60,6 @@ including it:
60
60
 
61
61
  About
62
62
  =====
63
-
64
63
  Bahia uses open3 and is dead simple - so simple that you probably should've read
65
64
  the source instead of this readme. Ha!
66
65
 
data/lib/bahia.rb CHANGED
@@ -2,7 +2,7 @@ require 'open3'
2
2
  require 'shellwords'
3
3
 
4
4
  module Bahia
5
- VERSION = '0.3.0'
5
+ VERSION = '0.4.0'
6
6
 
7
7
  class DetectionError < StandardError
8
8
  def initialize(name)
@@ -19,15 +19,20 @@ module Bahia
19
19
  raise DetectionError.new(:command)
20
20
  self.command_method ||= File.basename(command)
21
21
 
22
- define_method(command_method) do |cmd = ''|
23
- args = Shellwords.split(cmd)
24
- args.unshift Bahia.command
25
- args.unshift({'RUBYLIB' => "#{Bahia.project_directory}/lib:" +
26
- ENV['RUBYLIB']})
27
- @stdout, @stderr, @process = Open3.capture3(*args)
22
+ # We want only want ane optional arg, thank 1.8.7 for the splat
23
+ define_method(command_method) do |*cmd|
24
+ @stdout, @stderr, @process = Bahia.run_command(cmd.shift || '')
28
25
  end
29
26
  end
30
27
 
28
+ def self.run_command(cmd)
29
+ args = Shellwords.split(cmd)
30
+ args.unshift Bahia.command
31
+ args.unshift('RUBYLIB' =>
32
+ "#{Bahia.project_directory}/lib:#{ENV['RUBYLIB']}".sub(/:\s*$/, ''))
33
+ Open3.capture3(*args)
34
+ end
35
+
31
36
  def self.set_project_directory(arr)
32
37
  arr[0][/^([^:]+):\d+/] or raise DetectionError.new(:project_directory)
33
38
  file = $1
data/spec/bahia_spec.rb CHANGED
@@ -70,7 +70,8 @@ describe Bahia do
70
70
  context "helper method blarg correctly calls Open3.capture" do
71
71
  def open3_receives(*args)
72
72
  Open3.should_receive(:capture3).with(
73
- {'RUBYLIB' => "/dir/lib:#{ENV['RUBYLIB']}"}, executable, *args)
73
+ {'RUBYLIB' => "/dir/lib:#{ENV['RUBYLIB']}".sub(/:\s*$/, '')},
74
+ executable, *args)
74
75
  end
75
76
 
76
77
  it "with no arguments" do
@@ -97,6 +98,22 @@ describe Bahia do
97
98
  open3_receives "can't", 'be', 'stopped'
98
99
  test_class.new.blarg("can\\'t be stopped")
99
100
  end
101
+
102
+ context "when $RUBYLIB" do
103
+ before { @rubylib = ENV.delete('RUBYLIB') }
104
+ after { ENV['RUBYLIB'] = @rubylib }
105
+
106
+ it "is nil" do
107
+ open3_receives
108
+ test_class.new.blarg
109
+ end
110
+
111
+ it "is blank" do
112
+ ENV['RUBYLIB'] = ''
113
+ open3_receives
114
+ test_class.new.blarg
115
+ end
116
+ end
100
117
  end
101
118
  end
102
119
  end
metadata CHANGED
@@ -1,39 +1,36 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: bahia
3
- version: !ruby/object:Gem::Version
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.4.0
4
5
  prerelease:
5
- version: 0.3.0
6
6
  platform: ruby
7
- authors:
7
+ authors:
8
8
  - Gabriel Horner
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
-
13
- date: 2011-12-17 00:00:00 -05:00
14
- default_executable:
15
- dependencies:
16
- - !ruby/object:Gem::Dependency
12
+ date: 2012-02-16 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
17
15
  name: rspec
18
- prerelease: false
19
- requirement: &id001 !ruby/object:Gem::Requirement
16
+ requirement: &70169129224660 !ruby/object:Gem::Requirement
20
17
  none: false
21
- requirements:
18
+ requirements:
22
19
  - - ~>
23
- - !ruby/object:Gem::Version
20
+ - !ruby/object:Gem::Version
24
21
  version: 2.7.0
25
22
  type: :development
26
- version_requirements: *id001
27
- description: Bahia - where commandline acceptance tests are easy, the people are festive and onde nasceu capoeira. In other words, aruba for any non-cucumber test framework.
23
+ prerelease: false
24
+ version_requirements: *70169129224660
25
+ description: Bahia - where commandline acceptance tests are easy, the people are festive
26
+ and onde nasceu capoeira. In other words, aruba for any non-cucumber test framework.
28
27
  email: gabriel.horner@gmail.com
29
28
  executables: []
30
-
31
29
  extensions: []
32
-
33
- extra_rdoc_files:
30
+ extra_rdoc_files:
34
31
  - README.md
35
32
  - LICENSE.txt
36
- files:
33
+ files:
37
34
  - lib/bahia.rb
38
35
  - spec/bahia_spec.rb
39
36
  - README.md
@@ -42,33 +39,30 @@ files:
42
39
  - spec/deps.rip
43
40
  - Rakefile
44
41
  - .gemspec
45
- has_rdoc: true
42
+ - .travis.yml
46
43
  homepage: http://github.com/cldwalker/bahia
47
- licenses:
44
+ licenses:
48
45
  - MIT
49
46
  post_install_message:
50
47
  rdoc_options: []
51
-
52
- require_paths:
48
+ require_paths:
53
49
  - lib
54
- required_ruby_version: !ruby/object:Gem::Requirement
50
+ required_ruby_version: !ruby/object:Gem::Requirement
55
51
  none: false
56
- requirements:
57
- - - ">="
58
- - !ruby/object:Gem::Version
59
- version: "0"
60
- required_rubygems_version: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - ! '>='
54
+ - !ruby/object:Gem::Version
55
+ version: '0'
56
+ required_rubygems_version: !ruby/object:Gem::Requirement
61
57
  none: false
62
- requirements:
63
- - - ">="
64
- - !ruby/object:Gem::Version
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
65
61
  version: 1.3.6
66
62
  requirements: []
67
-
68
63
  rubyforge_project:
69
- rubygems_version: 1.6.2
64
+ rubygems_version: 1.8.11
70
65
  signing_key:
71
66
  specification_version: 3
72
67
  summary: aruba for non-cucumber test frameworks
73
68
  test_files: []
74
-