fedux_org-stdlib 0.0.25 → 0.0.26
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/fedux_org-stdlib.gemspec +7 -6
- data/lib/fedux_org/stdlib.rb +0 -1
- data/lib/fedux_org/stdlib/command.rb +2 -0
- data/lib/fedux_org/stdlib/version.rb +1 -1
- data/spec/command_spec.rb +37 -0
- data/spec/spec_helper.rb +1 -0
- metadata +5 -3
data/fedux_org-stdlib.gemspec
CHANGED
@@ -8,17 +8,18 @@ Gem::Specification.new do |spec|
|
|
8
8
|
spec.version = FeduxOrg::Stdlib::VERSION
|
9
9
|
spec.authors = ["Max Meyer"]
|
10
10
|
spec.email = ["dev@fedux.org"]
|
11
|
-
spec.description = %q{collection of
|
12
|
-
spec.summary = %q{collection of
|
11
|
+
spec.description = %q{collection of useful libraries}
|
12
|
+
spec.summary = %q{collection of useful libraries}
|
13
13
|
spec.homepage = ""
|
14
14
|
spec.license = "MIT"
|
15
15
|
|
16
16
|
spec.files = `git ls-files`.split($/)
|
17
17
|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
18
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
-
spec.require_paths = [
|
19
|
+
spec.require_paths = ['lib']
|
20
20
|
|
21
|
-
spec.add_development_dependency
|
22
|
-
spec.add_development_dependency
|
23
|
-
|
21
|
+
spec.add_development_dependency 'bundler', '~> 1.3'
|
22
|
+
spec.add_development_dependency 'rake'
|
23
|
+
|
24
|
+
spec.add_dependency 'activesupport'
|
24
25
|
end
|
data/lib/fedux_org/stdlib.rb
CHANGED
@@ -36,11 +36,13 @@ module FeduxOrg
|
|
36
36
|
env: nil,
|
37
37
|
stdin: nil,
|
38
38
|
binmode: false,
|
39
|
+
working_directory: Dir.getwd,
|
39
40
|
}.merge options
|
40
41
|
|
41
42
|
env = opts[:env] || ENV.to_hash
|
42
43
|
stdin = opts[:stdin]
|
43
44
|
binmode = opts[:binmode]
|
45
|
+
working_directory = opts[:working_directory]
|
44
46
|
|
45
47
|
result = CommandResult.new
|
46
48
|
result.stdout, result.stderr, result.status = Open3.capture3(env, cmd, stdin_data: stdin, chdir: working_directory, binmode: binmode)
|
@@ -0,0 +1,37 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Command do
|
4
|
+
context '#run_command' do
|
5
|
+
klass = Class.new do
|
6
|
+
include Command
|
7
|
+
end
|
8
|
+
|
9
|
+
it 'captures stdout' do
|
10
|
+
result = klass.new.run_command( 'echo hello_world' )
|
11
|
+
|
12
|
+
expect( result.stdout.chomp ).to eq( 'hello_world' )
|
13
|
+
end
|
14
|
+
|
15
|
+
it 'captures stderr' do
|
16
|
+
result = klass.new.run_command( 'echo hello_world >&2' )
|
17
|
+
|
18
|
+
expect( result.stderr.chomp ).to eq( 'hello_world' )
|
19
|
+
end
|
20
|
+
|
21
|
+
it 'captures exit status' do
|
22
|
+
result = klass.new.run_command( 'echo hello_world >&2' )
|
23
|
+
|
24
|
+
expect( result.status.exitstatus ).to eq( 0 )
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
context '#which' do
|
29
|
+
klass = Class.new do
|
30
|
+
include Command
|
31
|
+
end
|
32
|
+
|
33
|
+
it 'returns full path for a valid command' do
|
34
|
+
expect( klass.new.which( 'which' ) ).to eq( '/usr/bin/which' )
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fedux_org-stdlib
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.26
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -59,7 +59,7 @@ dependencies:
|
|
59
59
|
- - ! '>='
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '0'
|
62
|
-
description: collection of
|
62
|
+
description: collection of useful libraries
|
63
63
|
email:
|
64
64
|
- dev@fedux.org
|
65
65
|
executables: []
|
@@ -123,6 +123,7 @@ files:
|
|
123
123
|
- rakefiles/travis.rake
|
124
124
|
- script/console
|
125
125
|
- script/terminal
|
126
|
+
- spec/command_spec.rb
|
126
127
|
- spec/examples/models/class_based/forbidden_keyword.rb
|
127
128
|
- spec/examples/models/class_based/ignore/ignored.rb
|
128
129
|
- spec/examples/models/class_based/ignore/valid_1.rb
|
@@ -165,8 +166,9 @@ rubyforge_project:
|
|
165
166
|
rubygems_version: 1.8.23
|
166
167
|
signing_key:
|
167
168
|
specification_version: 3
|
168
|
-
summary: collection of
|
169
|
+
summary: collection of useful libraries
|
169
170
|
test_files:
|
171
|
+
- spec/command_spec.rb
|
170
172
|
- spec/examples/models/class_based/forbidden_keyword.rb
|
171
173
|
- spec/examples/models/class_based/ignore/ignored.rb
|
172
174
|
- spec/examples/models/class_based/ignore/valid_1.rb
|