buzzware-buzzcore 0.2.2
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/.document +5 -0
- data/.gitignore +5 -0
- data/LICENSE +23 -0
- data/README.rdoc +46 -0
- data/Rakefile +63 -0
- data/VERSION +1 -0
- data/buzzcore.gemspec +77 -0
- data/buzzcore.vpj +93 -0
- data/buzzcore.vpw +6 -0
- data/lib/buzzcore.rb +2 -0
- data/lib/buzzcore/cap_utils.rb +181 -0
- data/lib/buzzcore/config.rb +210 -0
- data/lib/buzzcore/database_utils.rb +86 -0
- data/lib/buzzcore/enum.rb +50 -0
- data/lib/buzzcore/extend_base_classes.rb +320 -0
- data/lib/buzzcore/ftp_extra.rb +188 -0
- data/lib/buzzcore/logging.rb +159 -0
- data/lib/buzzcore/misc_utils.rb +382 -0
- data/lib/buzzcore/require_paths.rb +28 -0
- data/lib/buzzcore/shell_extras.rb +80 -0
- data/lib/buzzcore/string_utils.rb +53 -0
- data/lib/buzzcore/text_doc.rb +70 -0
- data/lib/buzzcore/thread_utils.rb +709 -0
- data/lib/buzzcore/xml_utils.rb +184 -0
- data/test/buzzcore_test.rb +7 -0
- data/test/config_test.rb +201 -0
- data/test/credentials_test.rb +71 -0
- data/test/shell_test.rb +54 -0
- data/test/test_helper.rb +10 -0
- metadata +95 -0
data/test/shell_test.rb
ADDED
@@ -0,0 +1,54 @@
|
|
1
|
+
# To change this template, choose Tools | Templates
|
2
|
+
# and open the template in the editor.
|
3
|
+
|
4
|
+
$:.unshift File.join(File.dirname(__FILE__),'..','lib')
|
5
|
+
|
6
|
+
require 'rubygems'
|
7
|
+
|
8
|
+
require 'test/unit'
|
9
|
+
gem 'Shoulda'; require 'shoulda'
|
10
|
+
|
11
|
+
require 'buzzcore/shell_extras'
|
12
|
+
require 'yore/yore_core'
|
13
|
+
|
14
|
+
class ShellTest < Test::Unit::TestCase
|
15
|
+
should "raise exception on timeout"
|
16
|
+
|
17
|
+
should "not raise exception on non-zero return code, fixed in block. Check result contents"
|
18
|
+
|
19
|
+
should "return values from succesfult system call" do
|
20
|
+
result = POpen4::shell('ls .')
|
21
|
+
assert_instance_of Hash, result
|
22
|
+
assert_instance_of String, result[:stdout]
|
23
|
+
assert_instance_of String, result[:stderr]
|
24
|
+
assert result[:stdout].length > 0
|
25
|
+
assert_equal(0, result[:exitcode])
|
26
|
+
end
|
27
|
+
|
28
|
+
context "fail correctly" do
|
29
|
+
|
30
|
+
should "raise exception on invalid ls" do
|
31
|
+
begin
|
32
|
+
result = POpen4::shell('ls asdsadasdasdasdasd')
|
33
|
+
rescue ::StandardError => e
|
34
|
+
assert_instance_of(POpen4::ExecuteError, e)
|
35
|
+
assert_equal 1, e.result[:exitcode]
|
36
|
+
assert_instance_of String,e.result[:stdout]
|
37
|
+
assert_instance_of String,e.result[:stderr]
|
38
|
+
return
|
39
|
+
end
|
40
|
+
flunk 'should have raised an exception'
|
41
|
+
end
|
42
|
+
|
43
|
+
should "not raise exception when fixed in block" do
|
44
|
+
result = POpen4::shell('ls asdsadasdasdasdasd') do |r|
|
45
|
+
r[:exitcode] = 0
|
46
|
+
end
|
47
|
+
assert_instance_of Hash, result
|
48
|
+
assert_instance_of String, result[:stdout]
|
49
|
+
assert_instance_of String, result[:stderr]
|
50
|
+
assert_equal(0, result[:exitcode])
|
51
|
+
end
|
52
|
+
|
53
|
+
end
|
54
|
+
end
|
data/test/test_helper.rb
ADDED
metadata
ADDED
@@ -0,0 +1,95 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: buzzware-buzzcore
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.2.2
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- buzzware
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2009-09-10 00:00:00 -07:00
|
13
|
+
default_executable:
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: thoughtbot-shoulda
|
17
|
+
type: :development
|
18
|
+
version_requirement:
|
19
|
+
version_requirements: !ruby/object:Gem::Requirement
|
20
|
+
requirements:
|
21
|
+
- - ">="
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: "0"
|
24
|
+
version:
|
25
|
+
description: buzzcore is the ruby core library developed and used by Buzzware Solutions.
|
26
|
+
email: contact@buzzware.com.au
|
27
|
+
executables: []
|
28
|
+
|
29
|
+
extensions: []
|
30
|
+
|
31
|
+
extra_rdoc_files:
|
32
|
+
- LICENSE
|
33
|
+
- README.rdoc
|
34
|
+
files:
|
35
|
+
- .document
|
36
|
+
- .gitignore
|
37
|
+
- LICENSE
|
38
|
+
- README.rdoc
|
39
|
+
- Rakefile
|
40
|
+
- VERSION
|
41
|
+
- buzzcore.gemspec
|
42
|
+
- buzzcore.vpj
|
43
|
+
- buzzcore.vpw
|
44
|
+
- lib/buzzcore.rb
|
45
|
+
- lib/buzzcore/cap_utils.rb
|
46
|
+
- lib/buzzcore/config.rb
|
47
|
+
- lib/buzzcore/database_utils.rb
|
48
|
+
- lib/buzzcore/enum.rb
|
49
|
+
- lib/buzzcore/extend_base_classes.rb
|
50
|
+
- lib/buzzcore/ftp_extra.rb
|
51
|
+
- lib/buzzcore/logging.rb
|
52
|
+
- lib/buzzcore/misc_utils.rb
|
53
|
+
- lib/buzzcore/require_paths.rb
|
54
|
+
- lib/buzzcore/shell_extras.rb
|
55
|
+
- lib/buzzcore/string_utils.rb
|
56
|
+
- lib/buzzcore/text_doc.rb
|
57
|
+
- lib/buzzcore/thread_utils.rb
|
58
|
+
- lib/buzzcore/xml_utils.rb
|
59
|
+
- test/buzzcore_test.rb
|
60
|
+
- test/config_test.rb
|
61
|
+
- test/credentials_test.rb
|
62
|
+
- test/shell_test.rb
|
63
|
+
- test/test_helper.rb
|
64
|
+
has_rdoc: true
|
65
|
+
homepage: http://github.com/buzzware/buzzcore
|
66
|
+
post_install_message:
|
67
|
+
rdoc_options:
|
68
|
+
- --charset=UTF-8
|
69
|
+
require_paths:
|
70
|
+
- lib
|
71
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: "0"
|
76
|
+
version:
|
77
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
78
|
+
requirements:
|
79
|
+
- - ">="
|
80
|
+
- !ruby/object:Gem::Version
|
81
|
+
version: "0"
|
82
|
+
version:
|
83
|
+
requirements: []
|
84
|
+
|
85
|
+
rubyforge_project:
|
86
|
+
rubygems_version: 1.2.0
|
87
|
+
signing_key:
|
88
|
+
specification_version: 2
|
89
|
+
summary: buzzcore is the ruby core library developed and used by Buzzware Solutions.
|
90
|
+
test_files:
|
91
|
+
- test/buzzcore_test.rb
|
92
|
+
- test/config_test.rb
|
93
|
+
- test/credentials_test.rb
|
94
|
+
- test/shell_test.rb
|
95
|
+
- test/test_helper.rb
|