buildem 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/buildem/base.rb +11 -1
- data/lib/buildem/version.rb +1 -1
- data/spec/helper.rb +11 -0
- data/spec/unit/base_spec.rb +30 -0
- data/spec/unit/version_spec.rb +8 -0
- metadata +9 -5
data/lib/buildem/base.rb
CHANGED
@@ -1,7 +1,17 @@
|
|
1
1
|
require 'rubygems'
|
2
|
-
require
|
2
|
+
require 'buildem'
|
3
|
+
require 'fileutils'
|
4
|
+
include FileUtils
|
3
5
|
|
4
6
|
def windows?
|
5
7
|
return java.lang.System.get_property("os.name")[/windows/i] if RUBY_PLATFORM == "java"
|
6
8
|
return RUBY_PLATFORM[/mswin/]
|
7
9
|
end
|
10
|
+
|
11
|
+
def inside path
|
12
|
+
cd path do
|
13
|
+
yield
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
alias :within :inside
|
data/lib/buildem/version.rb
CHANGED
data/spec/helper.rb
CHANGED
@@ -19,6 +19,17 @@ def within path
|
|
19
19
|
end
|
20
20
|
|
21
21
|
RSpec.configure do |config|
|
22
|
+
|
23
|
+
def expecting_exception(clazz)
|
24
|
+
begin
|
25
|
+
yield
|
26
|
+
rescue Exception => e
|
27
|
+
e.class.should == clazz
|
28
|
+
return
|
29
|
+
end
|
30
|
+
fail "Did not throw an exception like intended"
|
31
|
+
end
|
32
|
+
|
22
33
|
def capture(stream)
|
23
34
|
begin
|
24
35
|
stream = stream.to_s
|
@@ -0,0 +1,30 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__)+"/../helper.rb")
|
2
|
+
require_files "base"
|
3
|
+
|
4
|
+
describe "base" do
|
5
|
+
|
6
|
+
describe "inside" do
|
7
|
+
it "can execute a command inside a directory" do
|
8
|
+
inside "./spec/unit" do
|
9
|
+
Dir.pwd.should =~ /spec\/unit$/i
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
it "throws an exception when you go to an improper directory" do
|
14
|
+
expecting_exception(Errno::ENOENT){inside("./spec/unitz"){ Dir.pwd }}
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
describe "within" do
|
19
|
+
it "can execute a command inside a directory" do
|
20
|
+
within "./spec/unit" do
|
21
|
+
Dir.pwd.should =~ /spec\/unit$/i
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
it "throws an exception when you go to an improper directory" do
|
26
|
+
expecting_exception(Errno::ENOENT){within("./spec/unitz"){ Dir.pwd }}
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: buildem
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 25
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 3
|
10
|
+
version: 0.0.3
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Jeremy W. Rowe
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-03-
|
18
|
+
date: 2011-03-27 00:00:00 -04:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -73,6 +73,7 @@ files:
|
|
73
73
|
- lib/buildem/validator.rb
|
74
74
|
- lib/buildem/version.rb
|
75
75
|
- spec/helper.rb
|
76
|
+
- spec/unit/base_spec.rb
|
76
77
|
- spec/unit/configuration_spec.rb
|
77
78
|
- spec/unit/helper/examples/blank_file.buildem
|
78
79
|
- spec/unit/helper/examples/everything.buildem
|
@@ -82,6 +83,7 @@ files:
|
|
82
83
|
- spec/unit/helper/examples/sequential_with_comments.buildem
|
83
84
|
- spec/unit/helper/examples/sequential_with_config.buildem
|
84
85
|
- spec/unit/runner_spec.rb
|
86
|
+
- spec/unit/version_spec.rb
|
85
87
|
has_rdoc: true
|
86
88
|
homepage: http://github.com/jeremywrowe/buildem
|
87
89
|
licenses: []
|
@@ -112,12 +114,13 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
112
114
|
requirements: []
|
113
115
|
|
114
116
|
rubyforge_project: buildem
|
115
|
-
rubygems_version: 1.6.
|
117
|
+
rubygems_version: 1.6.2
|
116
118
|
signing_key:
|
117
119
|
specification_version: 3
|
118
120
|
summary: A simple build script wrapper that allows for concurent tasks
|
119
121
|
test_files:
|
120
122
|
- spec/helper.rb
|
123
|
+
- spec/unit/base_spec.rb
|
121
124
|
- spec/unit/configuration_spec.rb
|
122
125
|
- spec/unit/helper/examples/blank_file.buildem
|
123
126
|
- spec/unit/helper/examples/everything.buildem
|
@@ -127,3 +130,4 @@ test_files:
|
|
127
130
|
- spec/unit/helper/examples/sequential_with_comments.buildem
|
128
131
|
- spec/unit/helper/examples/sequential_with_config.buildem
|
129
132
|
- spec/unit/runner_spec.rb
|
133
|
+
- spec/unit/version_spec.rb
|