sprewell 0.0.1 → 0.0.2

This diff has not been reviewed by any users.
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: 5c03329ce450a464f81d53b7ffad4a3b22ebaf11
4
- data.tar.gz: 6ab9080437024bacc0c586dd91ba57af6e001a3e
3
+ metadata.gz: 3f327f2d9d899ba9804cba7ae9f7bc5ad5102902
4
+ data.tar.gz: 274c5f3e54d1563d15ffc74a8bfc2639f0c65c83
5
5
  SHA512:
6
- metadata.gz: 05ffcb71edb0aeccac7fdf03b40683b203a26ac02f953165fb4c952f0bdef8b057a7ea36e5f9ac27c80c813214af310e4acadabfbf37318ebf0aa364da06e445
7
- data.tar.gz: f7ce27d9985befdcd85cd13fc1d0c873183cc0d4d71f6847ff5be0687a173ee9783d2ecfa56286491d7fa5f38700fcecf9e4344d7991dac39702c61531e5ae34
6
+ metadata.gz: 4bfe1f449d7a7ad761811e170adba0ea53aa3d150bc51948d9bb4f00165740e662d243b16e5bbcf143f483a1c6a5afdfcd22016a62541e8c18b7f456c1ea8b51
7
+ data.tar.gz: 313412e4c085a203a0bea5a7e766b5f56b1736d95bc07bfc2984a27761aeb22a32e056bbb49ebfa1ea556e3818033f47d9c5d98606635f08b270c15f4fd8947c
@@ -0,0 +1 @@
1
+ /*.gem
@@ -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
@@ -6,30 +6,47 @@ describe Sprewell do
6
6
  Dir.chdir 'spec/fixtures/test_project'
7
7
  end
8
8
 
9
- after(:each) do
10
- FileUtils.rm("sprewell.log")
11
- FileUtils.rm_rf(".test_project")
12
- end
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
- it 'creates a dot directory of the directory the command is run within' do
15
- Sprewell.spin_test "echo Hi"
16
- File.directory?('.test_project').should be_true
17
- end
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
- it 'runs the command passed to it' do
20
- Kernel.should_receive(:system).with('echo Hi')
21
- Sprewell.spin_test "echo Hi"
22
- end
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
- it 'creates a dot directory for the console output' do
25
- Sprewell.spin_test "echo Hi"
26
- File.exist?('sprewell.log').should be_true
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
- it 'prints the output of the command to a log file in the current directory' do
30
- Sprewell.spin_test "echo Hi"
31
- contents = File.read('sprewell.log')
32
- contents.should include "Hi"
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
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
 
5
5
  Gem::Specification.new do |spec|
6
6
  spec.name = "sprewell"
7
- spec.version = "0.0.1"
7
+ spec.version = "0.0.2"
8
8
  spec.authors = ["Dru Riley"]
9
9
  spec.email = ["dru@drurly.com"]
10
10
  spec.description = "Sprewell"
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.1
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-12 00:00:00.000000000 Z
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.0.3
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: