buzzcore 0.6.3 → 0.6.4
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +16 -3
- data/Rakefile +2 -65
- data/buzzcore.gemspec +14 -9
- data/lib/buzzcore/config.rb +3 -2
- data/lib/buzzcore/extend_base_classes.rb +31 -3
- data/lib/buzzcore/misc_utils.rb +8 -0
- data/lib/buzzcore/xml_utils.rb +12 -3
- data/lib/buzzcore.rb +2 -0
- metadata +6 -12
- data/.document +0 -5
- data/VERSION +0 -2
- data/buzzcore.vpj +0 -93
- data/buzzcore.vpw +0 -93
data/.gitignore
CHANGED
data/Rakefile
CHANGED
@@ -1,65 +1,2 @@
|
|
1
|
-
|
2
|
-
require
|
3
|
-
|
4
|
-
begin
|
5
|
-
require 'jeweler'
|
6
|
-
Jeweler::Tasks.new do |gem|
|
7
|
-
gem.name = "buzzcore"
|
8
|
-
gem.summary = %Q{buzzcore is the ruby core library developed and used by Buzzware Solutions.}
|
9
|
-
gem.description = %Q{buzzcore is the ruby core library developed and used by Buzzware Solutions.}
|
10
|
-
gem.email = "contact@buzzware.com.au"
|
11
|
-
gem.homepage = "http://github.com/buzzware/buzzcore"
|
12
|
-
gem.authors = ["buzzware"]
|
13
|
-
#gem.rubyforge_project = "buzzware"
|
14
|
-
gem.add_dependency "POpen4"
|
15
|
-
gem.add_development_dependency "shoulda"
|
16
|
-
gem.files.include %w(
|
17
|
-
lib/buzzcore.rb
|
18
|
-
)
|
19
|
-
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
20
|
-
end
|
21
|
-
Jeweler::GemcutterTasks.new
|
22
|
-
Jeweler::RubyforgeTasks.new do |rubyforge|
|
23
|
-
rubyforge.doc_task = "rdoc"
|
24
|
-
end
|
25
|
-
rescue LoadError
|
26
|
-
puts "Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler"
|
27
|
-
end
|
28
|
-
|
29
|
-
require 'rake/testtask'
|
30
|
-
Rake::TestTask.new(:test) do |test|
|
31
|
-
test.libs << 'lib' << 'test'
|
32
|
-
test.pattern = 'test/**/*_test.rb'
|
33
|
-
test.verbose = true
|
34
|
-
end
|
35
|
-
|
36
|
-
begin
|
37
|
-
require 'rcov/rcovtask'
|
38
|
-
Rcov::RcovTask.new do |test|
|
39
|
-
test.libs << 'test'
|
40
|
-
test.pattern = 'test/**/*_test.rb'
|
41
|
-
test.verbose = true
|
42
|
-
end
|
43
|
-
rescue LoadError
|
44
|
-
task :rcov do
|
45
|
-
abort "RCov is not available. In order to run rcov, you must: sudo gem install spicycode-rcov"
|
46
|
-
end
|
47
|
-
end
|
48
|
-
|
49
|
-
task :test => :check_dependencies
|
50
|
-
|
51
|
-
task :default => :test
|
52
|
-
|
53
|
-
require 'rake/rdoctask'
|
54
|
-
Rake::RDocTask.new do |rdoc|
|
55
|
-
if File.exist?('VERSION')
|
56
|
-
version = File.read('VERSION')
|
57
|
-
else
|
58
|
-
version = ""
|
59
|
-
end
|
60
|
-
|
61
|
-
rdoc.rdoc_dir = 'rdoc'
|
62
|
-
rdoc.title = "buzzcore #{version}"
|
63
|
-
rdoc.rdoc_files.include('README*')
|
64
|
-
rdoc.rdoc_files.include('lib/**/*.rb')
|
65
|
-
end
|
1
|
+
#!/usr/bin/env rake
|
2
|
+
require "bundler/gem_tasks"
|
data/buzzcore.gemspec
CHANGED
@@ -1,31 +1,37 @@
|
|
1
|
-
# Generated by jeweler
|
2
|
-
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
-
# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
|
4
1
|
# -*- encoding: utf-8 -*-
|
2
|
+
require File.expand_path('../lib/buzzcore/version', __FILE__)
|
5
3
|
|
6
4
|
Gem::Specification.new do |s|
|
7
5
|
s.name = %q{buzzcore}
|
8
|
-
s.version =
|
6
|
+
s.version = Buzzcore::VERSION
|
9
7
|
|
10
8
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
9
|
s.authors = ["buzzware"]
|
12
10
|
s.date = %q{2011-07-07}
|
13
11
|
s.description = %q{buzzcore is the ruby core library developed and used by Buzzware Solutions.}
|
14
12
|
s.email = %q{contact@buzzware.com.au}
|
13
|
+
|
14
|
+
|
15
|
+
|
16
|
+
# gem.files.include %w(
|
17
|
+
# lib/buzzcore.rb
|
18
|
+
# )
|
19
|
+
|
20
|
+
# gem.files = `git ls-files`.split($\)
|
21
|
+
# gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
22
|
+
# gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
23
|
+
# gem.version = Buzzcore::VERSION
|
24
|
+
|
15
25
|
s.extra_rdoc_files = [
|
16
26
|
"LICENSE",
|
17
27
|
"README.rdoc"
|
18
28
|
]
|
19
29
|
s.files = [
|
20
|
-
".document",
|
21
30
|
".gitignore",
|
22
31
|
"LICENSE",
|
23
32
|
"README.rdoc",
|
24
33
|
"Rakefile",
|
25
|
-
"VERSION",
|
26
34
|
"buzzcore.gemspec",
|
27
|
-
"buzzcore.vpj",
|
28
|
-
"buzzcore.vpw",
|
29
35
|
"lib/buzzcore.rb",
|
30
36
|
"lib/buzzcore/config.rb",
|
31
37
|
"lib/buzzcore/database_utils.rb",
|
@@ -54,7 +60,6 @@ Gem::Specification.new do |s|
|
|
54
60
|
s.homepage = %q{http://github.com/buzzware/buzzcore}
|
55
61
|
s.rdoc_options = ["--charset=UTF-8"]
|
56
62
|
s.require_paths = ["lib"]
|
57
|
-
s.rubygems_version = %q{1.3.7}
|
58
63
|
s.summary = %q{buzzcore is the ruby core library developed and used by Buzzware Solutions.}
|
59
64
|
s.test_files = [
|
60
65
|
"test/buzzcore_test.rb",
|
data/lib/buzzcore/config.rb
CHANGED
@@ -201,8 +201,9 @@ class Credentials < Hash
|
|
201
201
|
def get_all_credentials(aXmlRoot)
|
202
202
|
return nil unless aXmlRoot
|
203
203
|
result = {}
|
204
|
-
|
205
|
-
|
204
|
+
simpleItemses = aXmlRoot.get_elements('SimpleItems') + aXmlRoot.get_elements('simpleItems')
|
205
|
+
simpleItemses.each do |si|
|
206
|
+
ns = si.attributes['namespace'] || si.attributes['Namespace']
|
206
207
|
values = XmlUtils.read_simple_items(si)
|
207
208
|
result[ns.to_sym] = values.symbolize_keys if ns && values
|
208
209
|
end
|
@@ -19,12 +19,40 @@ String.class_eval do
|
|
19
19
|
end
|
20
20
|
end
|
21
21
|
|
22
|
+
# Like bite, but returns the first match instead of the subject
|
23
|
+
def extract!(aValue=$/,aString=self)
|
24
|
+
if aValue.is_a? String
|
25
|
+
if aString[0,aValue.length] == aValue
|
26
|
+
aString[0,aValue.length] = ''
|
27
|
+
return aValue
|
28
|
+
else
|
29
|
+
return nil
|
30
|
+
end
|
31
|
+
elsif aValue.is_a? Regexp
|
32
|
+
if md = aValue.match(aString)
|
33
|
+
aString[md.begin(0),md.end(0)-md.begin(0)] = ''
|
34
|
+
return md.to_s
|
35
|
+
else
|
36
|
+
return nil
|
37
|
+
end
|
38
|
+
else
|
39
|
+
return aString
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
|
22
44
|
# Like chomp! but operates on the leading characters instead.
|
23
45
|
# The aString parameter would not normally be used.
|
24
46
|
def bite!(aValue=$/,aString=self)
|
25
|
-
if
|
26
|
-
aString[0,aValue.length]
|
27
|
-
|
47
|
+
if aValue.is_a? String
|
48
|
+
if aString[0,aValue.length] == aValue
|
49
|
+
aString[0,aValue.length] = ''
|
50
|
+
return aString
|
51
|
+
else
|
52
|
+
return aString
|
53
|
+
end
|
54
|
+
elsif aValue.is_a? Regexp
|
55
|
+
return aString.sub!(aValue,'') if aString.index(aValue)==0
|
28
56
|
else
|
29
57
|
return aString
|
30
58
|
end
|
data/lib/buzzcore/misc_utils.rb
CHANGED
@@ -140,6 +140,14 @@ module MiscUtils
|
|
140
140
|
return aPath
|
141
141
|
end
|
142
142
|
|
143
|
+
def self.ensure_prefix(aString,aPrefix)
|
144
|
+
aString.begins_with?(aPrefix) ? aString : aPrefix+aString
|
145
|
+
end
|
146
|
+
|
147
|
+
def self.ensure_suffix(aString,aSuffix)
|
148
|
+
aString.ends_with?(aSuffix) ? aString : aString+aSuffix
|
149
|
+
end
|
150
|
+
|
143
151
|
# Remove base dir from given path. Result will be relative to base dir and not have a leading or trailing slash
|
144
152
|
#'/a/b/c','/a' = 'b/c'
|
145
153
|
#'/a/b/c','/' = 'a/b/c'
|
data/lib/buzzcore/xml_utils.rb
CHANGED
@@ -38,6 +38,12 @@ module XmlUtils
|
|
38
38
|
return val.nil? ? default : val.to_s
|
39
39
|
end
|
40
40
|
|
41
|
+
def self.attr(aNode,aName,aDefault=nil)
|
42
|
+
return aDefault unless aNode && aName
|
43
|
+
a = aNode.attribute(aName.to_s)
|
44
|
+
a ? a.to_s : aDefault
|
45
|
+
end
|
46
|
+
|
41
47
|
def self.peek_node_value(aNode,aXPath,aDefault=nil)
|
42
48
|
node = single_node(aNode,aXPath)
|
43
49
|
return node.to_s if node.is_a?(REXML::Attribute)
|
@@ -96,9 +102,12 @@ module XmlUtils
|
|
96
102
|
|
97
103
|
def self.read_simple_items(aRoot,aParentXPath=nil)
|
98
104
|
result = {}
|
99
|
-
xp = aParentXPath ? File.join(aParentXPath,'Item') : 'Item'
|
100
|
-
|
101
|
-
|
105
|
+
#xp = aParentXPath ? File.join(aParentXPath,'Item') : 'Item'
|
106
|
+
items = aParentXPath ? aRoot.get_elements(aParentXPath) : aRoot.elements.to_a
|
107
|
+
items.each do |item|
|
108
|
+
next unless item.name=='Item' || item.name=='item'
|
109
|
+
name = (item.attribute('name')||item.attribute('Name')).to_s
|
110
|
+
result[name] = item.text
|
102
111
|
end
|
103
112
|
return result
|
104
113
|
end
|
data/lib/buzzcore.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: buzzcore
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
5
|
-
prerelease:
|
4
|
+
hash: 15
|
5
|
+
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 6
|
9
|
-
-
|
10
|
-
version: 0.6.
|
9
|
+
- 4
|
10
|
+
version: 0.6.4
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- buzzware
|
@@ -15,8 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-07-07 00:00:00
|
19
|
-
default_executable:
|
18
|
+
date: 2011-07-07 00:00:00 Z
|
20
19
|
dependencies:
|
21
20
|
- !ruby/object:Gem::Dependency
|
22
21
|
name: POpen4
|
@@ -56,15 +55,11 @@ extra_rdoc_files:
|
|
56
55
|
- LICENSE
|
57
56
|
- README.rdoc
|
58
57
|
files:
|
59
|
-
- .document
|
60
58
|
- .gitignore
|
61
59
|
- LICENSE
|
62
60
|
- README.rdoc
|
63
61
|
- Rakefile
|
64
|
-
- VERSION
|
65
62
|
- buzzcore.gemspec
|
66
|
-
- buzzcore.vpj
|
67
|
-
- buzzcore.vpw
|
68
63
|
- lib/buzzcore.rb
|
69
64
|
- lib/buzzcore/config.rb
|
70
65
|
- lib/buzzcore/database_utils.rb
|
@@ -89,7 +84,6 @@ files:
|
|
89
84
|
- test/misc_test.rb
|
90
85
|
- test/shell_test.rb
|
91
86
|
- test/test_helper.rb
|
92
|
-
has_rdoc: true
|
93
87
|
homepage: http://github.com/buzzware/buzzcore
|
94
88
|
licenses: []
|
95
89
|
|
@@ -119,7 +113,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
119
113
|
requirements: []
|
120
114
|
|
121
115
|
rubyforge_project:
|
122
|
-
rubygems_version: 1.
|
116
|
+
rubygems_version: 1.8.23
|
123
117
|
signing_key:
|
124
118
|
specification_version: 3
|
125
119
|
summary: buzzcore is the ruby core library developed and used by Buzzware Solutions.
|
data/.document
DELETED
data/VERSION
DELETED
data/buzzcore.vpj
DELETED
@@ -1,93 +0,0 @@
|
|
1
|
-
<!DOCTYPE Project SYSTEM "http://www.slickedit.com/dtd/vse/10.0/vpj.dtd">
|
2
|
-
<Project
|
3
|
-
Version="10.0"
|
4
|
-
VendorName="SlickEdit"
|
5
|
-
WorkingDir=".">
|
6
|
-
<Config
|
7
|
-
Name="Release"
|
8
|
-
OutputFile=""
|
9
|
-
CompilerConfigName="Latest Version">
|
10
|
-
<Menu>
|
11
|
-
<Target
|
12
|
-
Name="Compile"
|
13
|
-
MenuCaption="&Compile"
|
14
|
-
CaptureOutputWith="ProcessBuffer"
|
15
|
-
SaveOption="SaveCurrent"
|
16
|
-
RunFromDir="%rw">
|
17
|
-
<Exec/>
|
18
|
-
</Target>
|
19
|
-
<Target
|
20
|
-
Name="Build"
|
21
|
-
MenuCaption="&Build"
|
22
|
-
CaptureOutputWith="ProcessBuffer"
|
23
|
-
SaveOption="SaveWorkspaceFiles"
|
24
|
-
RunFromDir="%rw">
|
25
|
-
<Exec/>
|
26
|
-
</Target>
|
27
|
-
<Target
|
28
|
-
Name="Rebuild"
|
29
|
-
MenuCaption="&Rebuild"
|
30
|
-
CaptureOutputWith="ProcessBuffer"
|
31
|
-
SaveOption="SaveWorkspaceFiles"
|
32
|
-
RunFromDir="%rw">
|
33
|
-
<Exec/>
|
34
|
-
</Target>
|
35
|
-
<Target
|
36
|
-
Name="Debug"
|
37
|
-
MenuCaption="&Debug"
|
38
|
-
SaveOption="SaveNone"
|
39
|
-
RunFromDir="%rw">
|
40
|
-
<Exec/>
|
41
|
-
</Target>
|
42
|
-
<Target
|
43
|
-
Name="Execute"
|
44
|
-
MenuCaption="E&xecute"
|
45
|
-
SaveOption="SaveNone"
|
46
|
-
RunFromDir="%rw"
|
47
|
-
CaptureOutputWith="ProcessBuffer"
|
48
|
-
ClearProcessBuffer="1">
|
49
|
-
<Exec CmdLine="source actions.sh execute"/>
|
50
|
-
</Target>
|
51
|
-
</Menu>
|
52
|
-
</Config>
|
53
|
-
<CustomFolders>
|
54
|
-
<Folder
|
55
|
-
Name="Source Files"
|
56
|
-
Filters="*.c;*.C;*.cc;*.cpp;*.cp;*.cxx;*.c++;*.prg;*.pas;*.dpr;*.asm;*.s;*.bas;*.java;*.cs;*.sc;*.e;*.cob;*.html;*.rc;*.tcl;*.py;*.pl"/>
|
57
|
-
<Folder
|
58
|
-
Name="Header Files"
|
59
|
-
Filters="*.h;*.H;*.hh;*.hpp;*.hxx;*.inc;*.sh;*.cpy;*.if"/>
|
60
|
-
<Folder
|
61
|
-
Name="Resource Files"
|
62
|
-
Filters="*.ico;*.cur;*.dlg"/>
|
63
|
-
<Folder
|
64
|
-
Name="Bitmaps"
|
65
|
-
Filters="*.bmp"/>
|
66
|
-
<Folder
|
67
|
-
Name="Other Files"
|
68
|
-
Filters="">
|
69
|
-
</Folder>
|
70
|
-
</CustomFolders>
|
71
|
-
<Files AutoFolders="DirectoryView">
|
72
|
-
<Folder Name="lib">
|
73
|
-
<F
|
74
|
-
N="lib/*"
|
75
|
-
Recurse="1"
|
76
|
-
Refilter="0"
|
77
|
-
Excludes=""/>
|
78
|
-
</Folder>
|
79
|
-
<Folder Name="test">
|
80
|
-
<F
|
81
|
-
N="test/*"
|
82
|
-
Recurse="0"
|
83
|
-
Refilter="0"
|
84
|
-
Excludes=".svn/"/>
|
85
|
-
</Folder>
|
86
|
-
<F N="buzzcore.gemspec"/>
|
87
|
-
<F N="History.txt"/>
|
88
|
-
<F N="Manifest.txt"/>
|
89
|
-
<F N="PostInstall.txt"/>
|
90
|
-
<F N="Rakefile"/>
|
91
|
-
<F N="README.rdoc"/>
|
92
|
-
</Files>
|
93
|
-
</Project>
|
data/buzzcore.vpw
DELETED
@@ -1,93 +0,0 @@
|
|
1
|
-
<!DOCTYPE Project SYSTEM "http://www.slickedit.com/dtd/vse/10.0/vpj.dtd">
|
2
|
-
<Project
|
3
|
-
Version="10.0"
|
4
|
-
VendorName="SlickEdit"
|
5
|
-
WorkingDir=".">
|
6
|
-
<Config
|
7
|
-
Name="Release"
|
8
|
-
OutputFile=""
|
9
|
-
CompilerConfigName="Latest Version">
|
10
|
-
<Menu>
|
11
|
-
<Target
|
12
|
-
Name="Compile"
|
13
|
-
MenuCaption="&Compile"
|
14
|
-
CaptureOutputWith="ProcessBuffer"
|
15
|
-
SaveOption="SaveCurrent"
|
16
|
-
RunFromDir="%rw">
|
17
|
-
<Exec/>
|
18
|
-
</Target>
|
19
|
-
<Target
|
20
|
-
Name="Build"
|
21
|
-
MenuCaption="&Build"
|
22
|
-
CaptureOutputWith="ProcessBuffer"
|
23
|
-
SaveOption="SaveWorkspaceFiles"
|
24
|
-
RunFromDir="%rw">
|
25
|
-
<Exec/>
|
26
|
-
</Target>
|
27
|
-
<Target
|
28
|
-
Name="Rebuild"
|
29
|
-
MenuCaption="&Rebuild"
|
30
|
-
CaptureOutputWith="ProcessBuffer"
|
31
|
-
SaveOption="SaveWorkspaceFiles"
|
32
|
-
RunFromDir="%rw">
|
33
|
-
<Exec/>
|
34
|
-
</Target>
|
35
|
-
<Target
|
36
|
-
Name="Debug"
|
37
|
-
MenuCaption="&Debug"
|
38
|
-
SaveOption="SaveNone"
|
39
|
-
RunFromDir="%rw">
|
40
|
-
<Exec/>
|
41
|
-
</Target>
|
42
|
-
<Target
|
43
|
-
Name="Execute"
|
44
|
-
MenuCaption="E&xecute"
|
45
|
-
SaveOption="SaveNone"
|
46
|
-
RunFromDir="%rw"
|
47
|
-
CaptureOutputWith="ProcessBuffer"
|
48
|
-
ClearProcessBuffer="1">
|
49
|
-
<Exec CmdLine="source actions.sh execute"/>
|
50
|
-
</Target>
|
51
|
-
</Menu>
|
52
|
-
</Config>
|
53
|
-
<CustomFolders>
|
54
|
-
<Folder
|
55
|
-
Name="Source Files"
|
56
|
-
Filters="*.c;*.C;*.cc;*.cpp;*.cp;*.cxx;*.c++;*.prg;*.pas;*.dpr;*.asm;*.s;*.bas;*.java;*.cs;*.sc;*.e;*.cob;*.html;*.rc;*.tcl;*.py;*.pl"/>
|
57
|
-
<Folder
|
58
|
-
Name="Header Files"
|
59
|
-
Filters="*.h;*.H;*.hh;*.hpp;*.hxx;*.inc;*.sh;*.cpy;*.if"/>
|
60
|
-
<Folder
|
61
|
-
Name="Resource Files"
|
62
|
-
Filters="*.ico;*.cur;*.dlg"/>
|
63
|
-
<Folder
|
64
|
-
Name="Bitmaps"
|
65
|
-
Filters="*.bmp"/>
|
66
|
-
<Folder
|
67
|
-
Name="Other Files"
|
68
|
-
Filters="">
|
69
|
-
</Folder>
|
70
|
-
</CustomFolders>
|
71
|
-
<Files AutoFolders="DirectoryView">
|
72
|
-
<Folder Name="lib">
|
73
|
-
<F
|
74
|
-
N="lib/*"
|
75
|
-
Recurse="1"
|
76
|
-
Refilter="0"
|
77
|
-
Excludes=""/>
|
78
|
-
</Folder>
|
79
|
-
<Folder Name="test">
|
80
|
-
<F
|
81
|
-
N="test/*"
|
82
|
-
Recurse="0"
|
83
|
-
Refilter="0"
|
84
|
-
Excludes=".svn/"/>
|
85
|
-
</Folder>
|
86
|
-
<F N="buzzcore.gemspec"/>
|
87
|
-
<F N="History.txt"/>
|
88
|
-
<F N="Manifest.txt"/>
|
89
|
-
<F N="PostInstall.txt"/>
|
90
|
-
<F N="Rakefile"/>
|
91
|
-
<F N="README.rdoc"/>
|
92
|
-
</Files>
|
93
|
-
</Project>
|