sprewell 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/lib/sprewell.rb +10 -3
- data/spec/sprewell_spec.rb +36 -19
- data/sprewell.gemspec +1 -1
- metadata +5 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3f327f2d9d899ba9804cba7ae9f7bc5ad5102902
|
4
|
+
data.tar.gz: 274c5f3e54d1563d15ffc74a8bfc2639f0c65c83
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4bfe1f449d7a7ad761811e170adba0ea53aa3d150bc51948d9bb4f00165740e662d243b16e5bbcf143f483a1c6a5afdfcd22016a62541e8c18b7f456c1ea8b51
|
7
|
+
data.tar.gz: 313412e4c085a203a0bea5a7e766b5f56b1736d95bc07bfc2984a27761aeb22a32e056bbb49ebfa1ea556e3818033f47d9c5d98606635f08b270c15f4fd8947c
|
data/.gitignore
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
/*.gem
|
data/lib/sprewell.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
class Sprewell
|
2
|
-
def self.spin_test command
|
2
|
+
def self.spin_test command=nil
|
3
|
+
if command
|
3
4
|
path = Dir.pwd
|
4
5
|
parent_directory = path.split("/").last
|
5
6
|
|
@@ -8,10 +9,16 @@ class Sprewell
|
|
8
9
|
FileUtils.cp_r Dir["#{path}/*"], dot_directory
|
9
10
|
FileUtils.chdir dot_directory
|
10
11
|
orig_std_out = STDOUT.clone
|
11
|
-
STDOUT.reopen(File.open('sprewell.log', 'w'))
|
12
|
+
STDOUT.reopen(File.open(path + '/sprewell.log', 'w'))
|
12
13
|
Kernel.system command
|
13
14
|
STDOUT.reopen(orig_std_out)
|
14
|
-
FileUtils.mv('sprewell.log', path)
|
15
15
|
FileUtils.chdir ".."
|
16
|
+
else
|
17
|
+
STDOUT.puts <<-EOF
|
18
|
+
Please provide a command
|
19
|
+
|
20
|
+
Exmaple: sprewell "rspec spec"
|
21
|
+
EOF
|
22
|
+
end
|
16
23
|
end
|
17
24
|
end
|
data/spec/sprewell_spec.rb
CHANGED
@@ -6,30 +6,47 @@ describe Sprewell do
|
|
6
6
|
Dir.chdir 'spec/fixtures/test_project'
|
7
7
|
end
|
8
8
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
9
|
+
context 'with an argument' do
|
10
|
+
after(:each) do
|
11
|
+
FileUtils.rm("sprewell.log")
|
12
|
+
FileUtils.rm_rf(".test_project")
|
13
|
+
end
|
13
14
|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
15
|
+
it 'copies the current directory to a dot directory' do
|
16
|
+
Sprewell.spin_test "echo Hi"
|
17
|
+
File.directory?('.test_project').should be_true
|
18
|
+
end
|
18
19
|
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
20
|
+
it 'runs the command passed' do
|
21
|
+
Kernel.should_receive(:system).with('echo Hi')
|
22
|
+
Sprewell.spin_test "echo Hi"
|
23
|
+
end
|
23
24
|
|
24
|
-
|
25
|
-
|
26
|
-
|
25
|
+
it 'prints the output of the command to a log file in the current directory' do
|
26
|
+
Sprewell.spin_test "echo Hi"
|
27
|
+
contents = File.read('sprewell.log')
|
28
|
+
contents.should include "Hi"
|
29
|
+
end
|
30
|
+
|
31
|
+
it 'creates sprewell.log for console output' do
|
32
|
+
Sprewell.spin_test "echo Hi"
|
33
|
+
File.exist?('sprewell.log').should be_true
|
34
|
+
end
|
27
35
|
end
|
28
36
|
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
37
|
+
context 'without an argument' do
|
38
|
+
let(:usage) {
|
39
|
+
<<-EOF
|
40
|
+
Please provide a command
|
41
|
+
|
42
|
+
Exmaple: sprewell "rspec spec"
|
43
|
+
EOF
|
44
|
+
}
|
45
|
+
|
46
|
+
it 'prints usage' do
|
47
|
+
STDOUT.should_receive(:puts).with(usage)
|
48
|
+
Sprewell.spin_test
|
49
|
+
end
|
33
50
|
end
|
34
51
|
end
|
35
52
|
end
|
data/sprewell.gemspec
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sprewell
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dru Riley
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-02-
|
11
|
+
date: 2014-02-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -74,6 +74,7 @@ executables:
|
|
74
74
|
extensions: []
|
75
75
|
extra_rdoc_files: []
|
76
76
|
files:
|
77
|
+
- .gitignore
|
77
78
|
- .rspec
|
78
79
|
- .rvmrc
|
79
80
|
- Gemfile
|
@@ -105,7 +106,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
105
106
|
version: '0'
|
106
107
|
requirements: []
|
107
108
|
rubyforge_project:
|
108
|
-
rubygems_version: 2.
|
109
|
+
rubygems_version: 2.1.11
|
109
110
|
signing_key:
|
110
111
|
specification_version: 4
|
111
112
|
summary: Run tests without fear of touching your code.
|
@@ -113,3 +114,4 @@ test_files:
|
|
113
114
|
- spec/fixtures/test_project/Gemfile
|
114
115
|
- spec/spec_helper.rb
|
115
116
|
- spec/sprewell_spec.rb
|
117
|
+
has_rdoc:
|