patir 0.7.0 → 0.7.2
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +4 -0
- data/Rakefile +1 -1
- data/lib/patir/base.rb +1 -1
- data/lib/patir/configuration.rb +9 -10
- data/test/test_patir_configuration.rb +9 -0
- metadata +56 -73
data/History.txt
CHANGED
@@ -1,3 +1,7 @@
|
|
1
|
+
==0.7.2 / 2011-11-29
|
2
|
+
* you can now use require in configuration files
|
3
|
+
* better handling of paths in configuration files. Relative paths in chained configuration files are now correct
|
4
|
+
* more unit tests
|
1
5
|
==0.7.0 / 2011-08-11
|
2
6
|
* Ruby 1.9 compatibility
|
3
7
|
* updated systemu dependency
|
data/Rakefile
CHANGED
@@ -15,7 +15,7 @@ Hoe.spec('patir') do
|
|
15
15
|
self.description = paragraphs_of('README.md', 1..4).join("\n\n")
|
16
16
|
self.url = "http://patir.rubyforge.org"
|
17
17
|
self.changes = paragraphs_of('History.txt', 0..1).join("\n\n")
|
18
|
-
extra_deps<<['systemu',"~>2.
|
18
|
+
extra_deps<<['systemu',"~>2.3"]
|
19
19
|
end
|
20
20
|
|
21
21
|
# vim: syntax=Ruby
|
data/lib/patir/base.rb
CHANGED
data/lib/patir/configuration.rb
CHANGED
@@ -37,7 +37,7 @@ module Patir
|
|
37
37
|
#To use it you would do
|
38
38
|
# cfg=SimpleConfigurator.new("config.cfg").configuration
|
39
39
|
class Configurator
|
40
|
-
attr_reader :logger,:config_file
|
40
|
+
attr_reader :logger,:config_file,:wd
|
41
41
|
def initialize config_file,logger=nil
|
42
42
|
@logger=logger
|
43
43
|
@logger||=Patir.setup_logger
|
@@ -59,17 +59,19 @@ module Patir
|
|
59
59
|
#You can 'include' the first.cfg file in the other configurations with
|
60
60
|
# configuration.load_from_file("first.cfg")
|
61
61
|
def load_from_file filename
|
62
|
-
|
62
|
+
fnm = File.exists?(filename) ? filename : File.join(@wd,filename)
|
63
|
+
load_configuration(fnm)
|
63
64
|
end
|
64
65
|
private
|
65
66
|
def load_configuration filename
|
66
67
|
begin
|
67
|
-
|
68
|
-
|
69
|
-
Dir.chdir(File.dirname(filename))
|
70
|
-
cfg_txt=File.readlines(File.basename(filename))
|
68
|
+
cfg_txt=File.read(filename)
|
69
|
+
@wd=File.expand_path(File.dirname(filename))
|
71
70
|
configuration=self
|
72
|
-
|
71
|
+
#add the path to the require lookup path to allow require statements in the configuration files
|
72
|
+
$:.unshift File.join(@wd)
|
73
|
+
#evaluate in the working directory to enable relative paths in configuration
|
74
|
+
Dir.chdir(@wd){eval(cfg_txt,binding())}
|
73
75
|
@logger.info("Configuration loaded from #{filename}") if @logger
|
74
76
|
rescue ConfigurationException
|
75
77
|
#pass it on, do not wrap again
|
@@ -85,9 +87,6 @@ module Patir
|
|
85
87
|
@logger.debug($!)
|
86
88
|
#Just wrap the exception so we can differentiate
|
87
89
|
raise ConfigurationException.new,"#{$!.message}"
|
88
|
-
ensure
|
89
|
-
#ensure we go back to our previous dir
|
90
|
-
Dir.chdir(prev_dir)
|
91
90
|
end
|
92
91
|
end
|
93
92
|
end
|
@@ -14,6 +14,15 @@ module Patir
|
|
14
14
|
def test_configuration
|
15
15
|
c=Patir::Configurator.new("samples/empty.cfg")
|
16
16
|
assert_equal(c.configuration,c)
|
17
|
+
|
18
|
+
c=Patir::Configurator.new("samples/chain.cfg")
|
19
|
+
assert_equal(c.configuration,c)
|
20
|
+
end
|
21
|
+
def test_raise_configuration
|
22
|
+
assert_raise(Patir::ConfigurationException) { Patir::Configurator.new("samples/failed.cfg")}
|
23
|
+
assert_raise(Patir::ConfigurationException) { Patir::Configurator.new("samples/failed_unknown.cfg")}
|
24
|
+
assert_raise(Patir::ConfigurationException) { Patir::Configurator.new("samples/syntax.cfg")}
|
25
|
+
assert_raise(Patir::ConfigurationException) { Patir::Configurator.new("samples/config_fail.cfg")}
|
17
26
|
end
|
18
27
|
end
|
19
28
|
end
|
metadata
CHANGED
@@ -1,77 +1,64 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: patir
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.7.2
|
5
5
|
prerelease:
|
6
|
-
segments:
|
7
|
-
- 0
|
8
|
-
- 7
|
9
|
-
- 0
|
10
|
-
version: 0.7.0
|
11
6
|
platform: ruby
|
12
|
-
authors:
|
7
|
+
authors:
|
13
8
|
- Vassilis Rizopoulos
|
14
9
|
autorequire:
|
15
10
|
bindir: bin
|
16
11
|
cert_chain: []
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
- !ruby/object:Gem::Dependency
|
12
|
+
date: 2011-11-29 00:00:00.000000000Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
21
15
|
name: systemu
|
22
|
-
|
23
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
16
|
+
requirement: &2161475600 !ruby/object:Gem::Requirement
|
24
17
|
none: false
|
25
|
-
requirements:
|
18
|
+
requirements:
|
26
19
|
- - ~>
|
27
|
-
- !ruby/object:Gem::Version
|
28
|
-
|
29
|
-
segments:
|
30
|
-
- 2
|
31
|
-
- 2
|
32
|
-
- 0
|
33
|
-
version: 2.2.0
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '2.3'
|
34
22
|
type: :runtime
|
35
|
-
|
36
|
-
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: *2161475600
|
25
|
+
- !ruby/object:Gem::Dependency
|
37
26
|
name: hoe
|
27
|
+
requirement: &2161471140 !ruby/object:Gem::Requirement
|
28
|
+
none: false
|
29
|
+
requirements:
|
30
|
+
- - ~>
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '2.12'
|
33
|
+
type: :development
|
38
34
|
prerelease: false
|
39
|
-
|
35
|
+
version_requirements: *2161471140
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: rdoc
|
38
|
+
requirement: &2161360540 !ruby/object:Gem::Requirement
|
40
39
|
none: false
|
41
|
-
requirements:
|
40
|
+
requirements:
|
42
41
|
- - ~>
|
43
|
-
- !ruby/object:Gem::Version
|
44
|
-
|
45
|
-
segments:
|
46
|
-
- 2
|
47
|
-
- 11
|
48
|
-
version: "2.11"
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '3.10'
|
49
44
|
type: :development
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
* Command sequences using the same command abstraction as single commands.
|
59
|
-
* Code that allows the use of configuration files written in ruby.
|
60
|
-
|
61
|
-
##INSTALL:
|
62
|
-
|
63
|
-
gem install patir
|
45
|
+
prerelease: false
|
46
|
+
version_requirements: *2161360540
|
47
|
+
description: ! "##DESCRIPTION:\n \npatir provides code to enable project automation
|
48
|
+
tasks:\n\n * A default logging format for ruby's built-in Logger\n * A command abstraction
|
49
|
+
with a platform independent implementation for running shell commands and ruby code\n
|
50
|
+
* Command sequences using the same command abstraction as single commands.\n * Code
|
51
|
+
that allows the use of configuration files written in ruby.\n\n##INSTALL:\n\n gem
|
52
|
+
install patir"
|
64
53
|
email: vassilisrizopoulos@gmail.com
|
65
54
|
executables: []
|
66
|
-
|
67
55
|
extensions: []
|
68
|
-
|
69
|
-
extra_rdoc_files:
|
56
|
+
extra_rdoc_files:
|
70
57
|
- COPYING.txt
|
71
58
|
- History.txt
|
72
59
|
- Manifest.txt
|
73
60
|
- README.txt
|
74
|
-
files:
|
61
|
+
files:
|
75
62
|
- COPYING.txt
|
76
63
|
- History.txt
|
77
64
|
- Manifest.txt
|
@@ -87,39 +74,35 @@ files:
|
|
87
74
|
- .gemtest
|
88
75
|
homepage: http://patir.rubyforge.org
|
89
76
|
licenses: []
|
90
|
-
|
91
77
|
post_install_message:
|
92
|
-
rdoc_options:
|
78
|
+
rdoc_options:
|
93
79
|
- --main
|
94
80
|
- README.txt
|
95
|
-
require_paths:
|
81
|
+
require_paths:
|
96
82
|
- lib
|
97
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
83
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
98
84
|
none: false
|
99
|
-
requirements:
|
100
|
-
- -
|
101
|
-
- !ruby/object:Gem::Version
|
102
|
-
|
103
|
-
segments:
|
85
|
+
requirements:
|
86
|
+
- - ! '>='
|
87
|
+
- !ruby/object:Gem::Version
|
88
|
+
version: '0'
|
89
|
+
segments:
|
104
90
|
- 0
|
105
|
-
|
106
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
91
|
+
hash: 813397894778583248
|
92
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
107
93
|
none: false
|
108
|
-
requirements:
|
109
|
-
- -
|
110
|
-
- !ruby/object:Gem::Version
|
111
|
-
|
112
|
-
segments:
|
113
|
-
- 0
|
114
|
-
version: "0"
|
94
|
+
requirements:
|
95
|
+
- - ! '>='
|
96
|
+
- !ruby/object:Gem::Version
|
97
|
+
version: '0'
|
115
98
|
requirements: []
|
116
|
-
|
117
99
|
rubyforge_project: patir
|
118
|
-
rubygems_version: 1.8.
|
100
|
+
rubygems_version: 1.8.8
|
119
101
|
signing_key:
|
120
102
|
specification_version: 3
|
121
|
-
summary: patir (Project Automation Tools in Ruby) provides libraries for use in project
|
122
|
-
|
103
|
+
summary: patir (Project Automation Tools in Ruby) provides libraries for use in project
|
104
|
+
automation tools
|
105
|
+
test_files:
|
123
106
|
- test/test_patir_base.rb
|
124
107
|
- test/test_patir_command.rb
|
125
108
|
- test/test_patir_configuration.rb
|