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.
@@ -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 use full libraries}
12
- spec.summary = %q{collection of use full libraries}
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 = ["lib"]
19
+ spec.require_paths = ['lib']
20
20
 
21
- spec.add_development_dependency "bundler", "~> 1.3"
22
- spec.add_development_dependency "rake"
23
- spec.add_dependency "activesupport"
21
+ spec.add_development_dependency 'bundler', '~> 1.3'
22
+ spec.add_development_dependency 'rake'
23
+
24
+ spec.add_dependency 'activesupport'
24
25
  end
@@ -4,7 +4,6 @@ require 'fedux_org/stdlib/filesystem'
4
4
  require 'fedux_org/stdlib/logging'
5
5
  require 'fedux_org/stdlib/logic_converters'
6
6
  require 'fedux_org/stdlib/models'
7
- require 'fedux_org/stdlib/rake'
8
7
  require 'fedux_org/stdlib/version'
9
8
 
10
9
  module FeduxOrg
@@ -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)
@@ -1,6 +1,6 @@
1
1
  #main FeduxOrg
2
2
  module FeduxOrg
3
3
  module Stdlib
4
- VERSION = '0.0.25'
4
+ VERSION = '0.0.26'
5
5
  end
6
6
  end
@@ -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
@@ -27,3 +27,4 @@ def examples_dir
27
27
  File.expand_path( '../examples', __FILE__ )
28
28
  end
29
29
 
30
+ require 'active_support/core_ext/kernel/reporting'
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.25
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 use full libraries
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 use full libraries
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