subprocess 0.1.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (47) hide show
  1. data/History.txt +4 -0
  2. data/Manifest.txt +46 -0
  3. data/PostInstall.txt +7 -0
  4. data/README.rdoc +77 -0
  5. data/Rakefile +20 -0
  6. data/TODO.rdoc +1 -0
  7. data/examples/simple.irb +22 -0
  8. data/examples/simple_timeout.irb +22 -0
  9. data/features/multiple_popens_sequence.feature +23 -0
  10. data/features/popen.feature +45 -0
  11. data/features/popen_over_ssh.feature +44 -0
  12. data/features/popen_over_ssh_without_blocking.feature +16 -0
  13. data/features/popen_remote_fails_with_invalid_auth_data.feature +13 -0
  14. data/features/popen_reports_runtime.feature +11 -0
  15. data/features/popen_running.feature +11 -0
  16. data/features/popen_with_timeout.feature +19 -0
  17. data/features/popen_without_blocking.feature +16 -0
  18. data/features/step_definitions/common_steps.rb +168 -0
  19. data/features/step_definitions/multiple_popens_sequence_steps.rb +73 -0
  20. data/features/step_definitions/popen_over_ssh_steps.rb +29 -0
  21. data/features/step_definitions/popen_over_ssh_without_blocking_steps.rb +30 -0
  22. data/features/step_definitions/popen_remote_fails_with_invalid_auth_dat_steps.rb +19 -0
  23. data/features/step_definitions/popen_reports_runtime_steps.rb +13 -0
  24. data/features/step_definitions/popen_running_steps.rb +12 -0
  25. data/features/step_definitions/popen_steps.rb +34 -0
  26. data/features/step_definitions/popen_with_timeout_steps.rb +24 -0
  27. data/features/step_definitions/popen_without_blocking_steps.rb +33 -0
  28. data/features/support/common.rb +29 -0
  29. data/features/support/env.rb +15 -0
  30. data/features/support/matchers.rb +11 -0
  31. data/lib/core_ext/hash.rb +14 -0
  32. data/lib/core_ext/process_status.rb +14 -0
  33. data/lib/subprocess/popen.rb +188 -0
  34. data/lib/subprocess/popen_factory.rb +63 -0
  35. data/lib/subprocess/popen_remote.rb +64 -0
  36. data/lib/subprocess/popen_sequence.rb +57 -0
  37. data/lib/subprocess.rb +23 -0
  38. data/script/console +10 -0
  39. data/script/destroy +14 -0
  40. data/script/generate +14 -0
  41. data/spec/spec.opts +1 -0
  42. data/spec/spec_helper.rb +10 -0
  43. data/spec/subprocess/popen_spec.rb +32 -0
  44. data/spec/subprocess_spec.rb +2 -0
  45. data/subprocess.gemspec +36 -0
  46. data/tasks/rspec.rake +21 -0
  47. metadata +138 -0
data/script/console ADDED
@@ -0,0 +1,10 @@
1
+ #!/usr/bin/env ruby
2
+ # File: script/console
3
+ irb = RUBY_PLATFORM =~ /(:?mswin|mingw)/ ? 'irb.bat' : 'irb'
4
+
5
+ libs = " -r irb/completion"
6
+ # Perhaps use a console_lib to store any extra methods I may want available in the cosole
7
+ # libs << " -r #{File.dirname(__FILE__) + '/../lib/console_lib/console_logger.rb'}"
8
+ libs << " -r #{File.dirname(__FILE__) + '/../lib/subprocess.rb'}"
9
+ puts "Loading subprocess gem"
10
+ exec "#{irb} #{libs} --simple-prompt"
data/script/destroy ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+ APP_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..'))
3
+
4
+ begin
5
+ require 'rubigen'
6
+ rescue LoadError
7
+ require 'rubygems'
8
+ require 'rubigen'
9
+ end
10
+ require 'rubigen/scripts/destroy'
11
+
12
+ ARGV.shift if ['--help', '-h'].include?(ARGV[0])
13
+ RubiGen::Base.use_component_sources! [:rubygems, :newgem, :newgem_theme, :test_unit]
14
+ RubiGen::Scripts::Destroy.new.run(ARGV)
data/script/generate ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+ APP_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..'))
3
+
4
+ begin
5
+ require 'rubigen'
6
+ rescue LoadError
7
+ require 'rubygems'
8
+ require 'rubigen'
9
+ end
10
+ require 'rubigen/scripts/generate'
11
+
12
+ ARGV.shift if ['--help', '-h'].include?(ARGV[0])
13
+ RubiGen::Base.use_component_sources! [:rubygems, :newgem, :newgem_theme, :test_unit]
14
+ RubiGen::Scripts::Generate.new.run(ARGV)
data/spec/spec.opts ADDED
@@ -0,0 +1 @@
1
+ --colour --format nested
@@ -0,0 +1,10 @@
1
+ begin
2
+ require 'spec'
3
+ rescue LoadError
4
+ require 'rubygems' unless ENV['NO_RUBYGEMS']
5
+ gem 'rspec'
6
+ require 'spec'
7
+ end
8
+
9
+ $:.unshift(File.dirname(__FILE__) + '/../lib')
10
+ require 'subprocess'
@@ -0,0 +1,32 @@
1
+ require File.dirname(__FILE__) + '/../spec_helper.rb'
2
+
3
+ module Subprocess
4
+ #describe Popen do
5
+
6
+ describe "zero exit code subprocess with stdout" do
7
+ before(:each) do
8
+ @subprocess = Popen.new('echo 1')
9
+ @subprocess.run
10
+ @subprocess.wait
11
+ end
12
+ it "has an exitcode of 0" do
13
+ @subprocess.status[:exitstatus].should == 0
14
+ end
15
+ it "has a runtime in seconds" do
16
+ @subprocess.status[:run_time].should be_kind_of Numeric
17
+ end
18
+ # TODO: trackdown/report rspec bug with stdout
19
+ #it "has a stdout of 1" do
20
+ # puts @subprocess.stdout
21
+ # @subprocess.stdout.should == '1'
22
+ #end
23
+ it "has an stderr of " do
24
+ @subprocess.stderr.should == ''
25
+ end
26
+ it "has a numerical pid" do
27
+ @subprocess.pid.should be_a_kind_of Numeric
28
+ end
29
+ end
30
+
31
+ #end
32
+ end
@@ -0,0 +1,2 @@
1
+ require File.dirname(__FILE__) + '/spec_helper.rb'
2
+
@@ -0,0 +1,36 @@
1
+ # -*- encoding: utf-8 -*-
2
+
3
+ Gem::Specification.new do |s|
4
+ s.name = %q{subprocess}
5
+ s.version = "0.1.6"
6
+
7
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
+ s.authors = ["Bram Swenson"]
9
+ s.date = %q{2010-05-22}
10
+ s.description = %q{* Subprocess provides a clean wrapper class around the Kernel.exec method.}
11
+ s.email = ["bram@craniumisajar.com"]
12
+ s.extra_rdoc_files = ["History.txt", "Manifest.txt", "PostInstall.txt"]
13
+ s.files = ["History.txt", "Manifest.txt", "PostInstall.txt", "README.rdoc", "Rakefile", "TODO.rdoc", "examples/simple.irb", "examples/simple_timeout.irb", "features/multiple_popens_sequence.feature", "features/popen.feature", "features/popen_over_ssh.feature", "features/popen_over_ssh_without_blocking.feature", "features/popen_remote_fails_with_invalid_auth_data.feature", "features/popen_reports_runtime.feature", "features/popen_running.feature", "features/popen_with_timeout.feature", "features/popen_without_blocking.feature", "features/step_definitions/common_steps.rb", "features/step_definitions/multiple_popens_sequence_steps.rb", "features/step_definitions/popen_over_ssh_steps.rb", "features/step_definitions/popen_over_ssh_without_blocking_steps.rb", "features/step_definitions/popen_remote_fails_with_invalid_auth_dat_steps.rb", "features/step_definitions/popen_reports_runtime_steps.rb", "features/step_definitions/popen_running_steps.rb", "features/step_definitions/popen_steps.rb", "features/step_definitions/popen_with_timeout_steps.rb", "features/step_definitions/popen_without_blocking_steps.rb", "features/support/common.rb", "features/support/env.rb", "features/support/matchers.rb", "git_user_switcher", "lib/core_ext/hash.rb", "lib/core_ext/process_status.rb", "lib/subprocess.rb", "lib/subprocess/popen.rb", "lib/subprocess/popen_factory.rb", "lib/subprocess/popen_remote.rb", "lib/subprocess/popen_sequence.rb", "script/console", "script/destroy", "script/generate", "spec/spec.opts", "spec/spec_helper.rb", "spec/subprocess/popen_spec.rb", "spec/subprocess_spec.rb", "subprocess.gemspec", "tasks/rspec.rake"]
14
+ s.homepage = %q{http://github.com/bramswenson/subprocess}
15
+ s.rdoc_options = ["--main", "README.rdoc"]
16
+ s.require_paths = ["lib"]
17
+ s.rubyforge_project = %q{subprocess}
18
+ s.rubygems_version = %q{1.3.6}
19
+ s.summary = %q{* Subprocess provides a clean wrapper class around the Kernel.exec method.}
20
+
21
+ if s.respond_to? :specification_version then
22
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
23
+ s.specification_version = 3
24
+
25
+ if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
26
+ s.add_development_dependency(%q<rubyforge>, [">= 2.0.4"])
27
+ s.add_development_dependency(%q<hoe>, [">= 2.6.0"])
28
+ else
29
+ s.add_dependency(%q<rubyforge>, [">= 2.0.4"])
30
+ s.add_dependency(%q<hoe>, [">= 2.6.0"])
31
+ end
32
+ else
33
+ s.add_dependency(%q<rubyforge>, [">= 2.0.4"])
34
+ s.add_dependency(%q<hoe>, [">= 2.6.0"])
35
+ end
36
+ end
data/tasks/rspec.rake ADDED
@@ -0,0 +1,21 @@
1
+ begin
2
+ require 'spec'
3
+ rescue LoadError
4
+ require 'rubygems' unless ENV['NO_RUBYGEMS']
5
+ require 'spec'
6
+ end
7
+ begin
8
+ require 'spec/rake/spectask'
9
+ rescue LoadError
10
+ puts <<-EOS
11
+ To use rspec for testing you must install rspec gem:
12
+ gem install rspec
13
+ EOS
14
+ exit(0)
15
+ end
16
+
17
+ desc "Run the specs under spec/models"
18
+ Spec::Rake::SpecTask.new do |t|
19
+ t.spec_opts = ['--options', "spec/spec.opts"]
20
+ t.spec_files = FileList['spec/**/*_spec.rb']
21
+ end
metadata ADDED
@@ -0,0 +1,138 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: subprocess
3
+ version: !ruby/object:Gem::Version
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 1
8
+ - 6
9
+ version: 0.1.6
10
+ platform: ruby
11
+ authors:
12
+ - Bram Swenson
13
+ autorequire:
14
+ bindir: bin
15
+ cert_chain: []
16
+
17
+ date: 2010-05-22 00:00:00 -04:00
18
+ default_executable:
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
21
+ name: rubyforge
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - ">="
26
+ - !ruby/object:Gem::Version
27
+ segments:
28
+ - 2
29
+ - 0
30
+ - 4
31
+ version: 2.0.4
32
+ type: :development
33
+ version_requirements: *id001
34
+ - !ruby/object:Gem::Dependency
35
+ name: hoe
36
+ prerelease: false
37
+ requirement: &id002 !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - ">="
40
+ - !ruby/object:Gem::Version
41
+ segments:
42
+ - 2
43
+ - 6
44
+ - 0
45
+ version: 2.6.0
46
+ type: :development
47
+ version_requirements: *id002
48
+ description: "* Subprocess provides a clean wrapper class around the Kernel.exec method."
49
+ email:
50
+ - bram@craniumisajar.com
51
+ executables: []
52
+
53
+ extensions: []
54
+
55
+ extra_rdoc_files:
56
+ - History.txt
57
+ - Manifest.txt
58
+ - PostInstall.txt
59
+ files:
60
+ - History.txt
61
+ - Manifest.txt
62
+ - PostInstall.txt
63
+ - README.rdoc
64
+ - Rakefile
65
+ - TODO.rdoc
66
+ - examples/simple.irb
67
+ - examples/simple_timeout.irb
68
+ - features/multiple_popens_sequence.feature
69
+ - features/popen.feature
70
+ - features/popen_over_ssh.feature
71
+ - features/popen_over_ssh_without_blocking.feature
72
+ - features/popen_remote_fails_with_invalid_auth_data.feature
73
+ - features/popen_reports_runtime.feature
74
+ - features/popen_running.feature
75
+ - features/popen_with_timeout.feature
76
+ - features/popen_without_blocking.feature
77
+ - features/step_definitions/common_steps.rb
78
+ - features/step_definitions/multiple_popens_sequence_steps.rb
79
+ - features/step_definitions/popen_over_ssh_steps.rb
80
+ - features/step_definitions/popen_over_ssh_without_blocking_steps.rb
81
+ - features/step_definitions/popen_remote_fails_with_invalid_auth_dat_steps.rb
82
+ - features/step_definitions/popen_reports_runtime_steps.rb
83
+ - features/step_definitions/popen_running_steps.rb
84
+ - features/step_definitions/popen_steps.rb
85
+ - features/step_definitions/popen_with_timeout_steps.rb
86
+ - features/step_definitions/popen_without_blocking_steps.rb
87
+ - features/support/common.rb
88
+ - features/support/env.rb
89
+ - features/support/matchers.rb
90
+ - lib/core_ext/hash.rb
91
+ - lib/core_ext/process_status.rb
92
+ - lib/subprocess.rb
93
+ - lib/subprocess/popen.rb
94
+ - lib/subprocess/popen_factory.rb
95
+ - lib/subprocess/popen_remote.rb
96
+ - lib/subprocess/popen_sequence.rb
97
+ - script/console
98
+ - script/destroy
99
+ - script/generate
100
+ - spec/spec.opts
101
+ - spec/spec_helper.rb
102
+ - spec/subprocess/popen_spec.rb
103
+ - spec/subprocess_spec.rb
104
+ - subprocess.gemspec
105
+ - tasks/rspec.rake
106
+ has_rdoc: true
107
+ homepage: http://github.com/bramswenson/subprocess
108
+ licenses: []
109
+
110
+ post_install_message:
111
+ rdoc_options:
112
+ - --main
113
+ - README.rdoc
114
+ require_paths:
115
+ - lib
116
+ required_ruby_version: !ruby/object:Gem::Requirement
117
+ requirements:
118
+ - - ">="
119
+ - !ruby/object:Gem::Version
120
+ segments:
121
+ - 0
122
+ version: "0"
123
+ required_rubygems_version: !ruby/object:Gem::Requirement
124
+ requirements:
125
+ - - ">="
126
+ - !ruby/object:Gem::Version
127
+ segments:
128
+ - 0
129
+ version: "0"
130
+ requirements: []
131
+
132
+ rubyforge_project: subprocess
133
+ rubygems_version: 1.3.6
134
+ signing_key:
135
+ specification_version: 3
136
+ summary: "* Subprocess provides a clean wrapper class around the Kernel.exec method."
137
+ test_files: []
138
+