rc 0.1.1 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- metadata +22 -73
- data/.ruby +0 -51
- data/.yardopts +0 -8
- data/Config.rb +0 -68
- data/HISTORY.md +0 -10
- data/LICENSE.txt +0 -27
- data/NOTES.md +0 -38
- data/README.md +0 -182
- data/lib/c.rb +0 -1
- data/lib/rc.rb +0 -10
- data/lib/rc/config.rb +0 -142
- data/lib/rc/configuration.rb +0 -192
- data/lib/rc/core_ext.rb +0 -49
- data/lib/rc/interface.rb +0 -163
- data/lib/rc/properties.rb +0 -44
- data/lib/rc/tool_configuration.rb +0 -54
- data/lib/rc/tweaks/rake.rb +0 -28
- data/spec/00_concept.md +0 -22
- data/spec/01_config.md +0 -14
- data/spec/02_configuration.md +0 -65
- data/spec/03_import.md +0 -48
- data/spec/06_interface.md +0 -36
- data/spec/applique/ae.rb +0 -1
- data/spec/applique/file.rb +0 -8
- data/spec/applique/fixture.rb +0 -10
- data/spec/applique/fixture/config.rb +0 -16
metadata
CHANGED
@@ -1,101 +1,49 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
|
+
- Rubyworks
|
8
9
|
- Trans
|
9
10
|
autorequire:
|
10
11
|
bindir: bin
|
11
12
|
cert_chain: []
|
12
|
-
date: 2012-04-
|
13
|
+
date: 2012-04-30 00:00:00.000000000 Z
|
13
14
|
dependencies:
|
14
15
|
- !ruby/object:Gem::Dependency
|
15
|
-
name:
|
16
|
-
requirement: &
|
16
|
+
name: courtier
|
17
|
+
requirement: &20862920 !ruby/object:Gem::Requirement
|
17
18
|
none: false
|
18
19
|
requirements:
|
19
|
-
- -
|
20
|
+
- - =
|
20
21
|
- !ruby/object:Gem::Version
|
21
|
-
version:
|
22
|
+
version: 0.2.0
|
22
23
|
type: :runtime
|
23
24
|
prerelease: false
|
24
|
-
version_requirements: *
|
25
|
+
version_requirements: *20862920
|
25
26
|
- !ruby/object:Gem::Dependency
|
26
|
-
name:
|
27
|
-
requirement: &
|
27
|
+
name: courtier
|
28
|
+
requirement: &20862420 !ruby/object:Gem::Requirement
|
28
29
|
none: false
|
29
30
|
requirements:
|
30
|
-
- -
|
31
|
+
- - =
|
31
32
|
- !ruby/object:Gem::Version
|
32
|
-
version:
|
33
|
+
version: 0.2.0
|
33
34
|
type: :development
|
34
35
|
prerelease: false
|
35
|
-
version_requirements: *
|
36
|
-
-
|
37
|
-
|
38
|
-
requirement: &6999260 !ruby/object:Gem::Requirement
|
39
|
-
none: false
|
40
|
-
requirements:
|
41
|
-
- - ! '>='
|
42
|
-
- !ruby/object:Gem::Version
|
43
|
-
version: '0'
|
44
|
-
type: :development
|
45
|
-
prerelease: false
|
46
|
-
version_requirements: *6999260
|
47
|
-
- !ruby/object:Gem::Dependency
|
48
|
-
name: ae
|
49
|
-
requirement: &6997500 !ruby/object:Gem::Requirement
|
50
|
-
none: false
|
51
|
-
requirements:
|
52
|
-
- - ! '>='
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: '0'
|
55
|
-
type: :development
|
56
|
-
prerelease: false
|
57
|
-
version_requirements: *6997500
|
58
|
-
description: ! "RC is a multi-tenant configuration system for Ruby projects.\nIt is
|
59
|
-
a spin-off of the original Confection project with\na simplifed overall design and
|
60
|
-
the ability to work with \nalmost any Ruby-based command line tool."
|
36
|
+
version_requirements: *20862420
|
37
|
+
description: Courtier manages an application's configuration via a single multi-tenant
|
38
|
+
project file.
|
61
39
|
email:
|
62
40
|
- transfire@gmail.com
|
63
41
|
executables: []
|
64
42
|
extensions: []
|
65
|
-
extra_rdoc_files:
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
- README.md
|
70
|
-
files:
|
71
|
-
- .ruby
|
72
|
-
- .yardopts
|
73
|
-
- lib/c.rb
|
74
|
-
- lib/rc/config.rb
|
75
|
-
- lib/rc/configuration.rb
|
76
|
-
- lib/rc/core_ext.rb
|
77
|
-
- lib/rc/interface.rb
|
78
|
-
- lib/rc/properties.rb
|
79
|
-
- lib/rc/tool_configuration.rb
|
80
|
-
- lib/rc/tweaks/rake.rb
|
81
|
-
- lib/rc.rb
|
82
|
-
- spec/00_concept.md
|
83
|
-
- spec/01_config.md
|
84
|
-
- spec/02_configuration.md
|
85
|
-
- spec/03_import.md
|
86
|
-
- spec/06_interface.md
|
87
|
-
- spec/applique/ae.rb
|
88
|
-
- spec/applique/file.rb
|
89
|
-
- spec/applique/fixture/config.rb
|
90
|
-
- spec/applique/fixture.rb
|
91
|
-
- NOTES.md
|
92
|
-
- LICENSE.txt
|
93
|
-
- HISTORY.md
|
94
|
-
- README.md
|
95
|
-
- Config.rb
|
96
|
-
homepage: http://rubyworks.github.com/rc
|
97
|
-
licenses:
|
98
|
-
- BSD-2-Clause
|
43
|
+
extra_rdoc_files: []
|
44
|
+
files: []
|
45
|
+
homepage: http://github.com/rubyworks/courtier
|
46
|
+
licenses: []
|
99
47
|
post_install_message:
|
100
48
|
rdoc_options: []
|
101
49
|
require_paths:
|
@@ -113,9 +61,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
113
61
|
- !ruby/object:Gem::Version
|
114
62
|
version: '0'
|
115
63
|
requirements: []
|
116
|
-
rubyforge_project:
|
64
|
+
rubyforge_project: courtier
|
117
65
|
rubygems_version: 1.8.11
|
118
66
|
signing_key:
|
119
67
|
specification_version: 3
|
120
|
-
summary:
|
68
|
+
summary: The best way to manage your application's configuration.
|
121
69
|
test_files: []
|
70
|
+
has_rdoc:
|
data/.ruby
DELETED
@@ -1,51 +0,0 @@
|
|
1
|
-
---
|
2
|
-
source:
|
3
|
-
- var
|
4
|
-
authors:
|
5
|
-
- name: Trans
|
6
|
-
email: transfire@gmail.com
|
7
|
-
copyrights:
|
8
|
-
- holder: Rubyworks
|
9
|
-
year: '2011'
|
10
|
-
license: BSD-2-Clause
|
11
|
-
requirements:
|
12
|
-
- name: finder
|
13
|
-
- name: detroit
|
14
|
-
groups:
|
15
|
-
- build
|
16
|
-
development: true
|
17
|
-
- name: qed
|
18
|
-
groups:
|
19
|
-
- test
|
20
|
-
development: true
|
21
|
-
- name: ae
|
22
|
-
groups:
|
23
|
-
- test
|
24
|
-
development: true
|
25
|
-
dependencies: []
|
26
|
-
alternatives: []
|
27
|
-
conflicts: []
|
28
|
-
repositories:
|
29
|
-
- uri: git://github.com/rubyworks/rc.git
|
30
|
-
scm: git
|
31
|
-
name: upstream
|
32
|
-
resources:
|
33
|
-
home: http://rubyworks.github.com/rc
|
34
|
-
docs: http://rubydoc.info/gems/rc/frames
|
35
|
-
code: http://github.com/rubyworks/rc
|
36
|
-
mail: http://groups.google.com/group/rubyworks-mailinglist
|
37
|
-
chat: http://chat.us.freenode.net/rubyworks
|
38
|
-
extra: {}
|
39
|
-
load_path:
|
40
|
-
- lib
|
41
|
-
name: rc
|
42
|
-
title: RC
|
43
|
-
revision: 0
|
44
|
-
created: '2011-11-06'
|
45
|
-
summary: Multi-tenant configuration for Ruby.
|
46
|
-
version: 0.1.1
|
47
|
-
description: ! "RC is a multi-tenant configuration system for Ruby projects.\nIt is
|
48
|
-
a spin-off of the original Confection project with\na simplifed overall design and
|
49
|
-
the ability to work with \nalmost any Ruby-based command line tool."
|
50
|
-
organization: Rubyworks
|
51
|
-
date: '2012-04-09'
|
data/.yardopts
DELETED
data/Config.rb
DELETED
@@ -1,68 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
#
|
4
|
-
# Detroit assembly.
|
5
|
-
#
|
6
|
-
config :detroit do
|
7
|
-
service :email do |s|
|
8
|
-
s.mailto = ['ruby-talk@ruby-lang.org',
|
9
|
-
'rubyworks-mailinglist@googlegroups.com']
|
10
|
-
end
|
11
|
-
|
12
|
-
service :gem do |s|
|
13
|
-
s.gemspec = 'pkg/rc.gemspec'
|
14
|
-
end
|
15
|
-
|
16
|
-
service :github do |s|
|
17
|
-
s.folder = 'web'
|
18
|
-
end
|
19
|
-
|
20
|
-
service :dnote do |s|
|
21
|
-
s.title = 'Source Notes'
|
22
|
-
s.output = 'log/notes.html'
|
23
|
-
end
|
24
|
-
|
25
|
-
service :locat do |s|
|
26
|
-
s.output = 'log/locat.html'
|
27
|
-
end
|
28
|
-
|
29
|
-
service :vclog do |s|
|
30
|
-
s.output = ['log/history.html',
|
31
|
-
'log/changes.html']
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
#
|
36
|
-
# QED test coverage report using SimpleCov.
|
37
|
-
#
|
38
|
-
# Use `$properties.coverage_folder` to set directory in which to store
|
39
|
-
# coverage report this defaults to `log/coverage`.
|
40
|
-
#
|
41
|
-
config :qed, :cov do
|
42
|
-
require 'simplecov'
|
43
|
-
|
44
|
-
dir = $properties.coverage_folder
|
45
|
-
|
46
|
-
SimpleCov.start do
|
47
|
-
coverage_dir(dir || 'log/coverage')
|
48
|
-
#add_group "Label", "lib/qed/directory"
|
49
|
-
end
|
50
|
-
end
|
51
|
-
|
52
|
-
#
|
53
|
-
# Rake tasks
|
54
|
-
#
|
55
|
-
config :rake do
|
56
|
-
desc 'run unit tests'
|
57
|
-
task :test do
|
58
|
-
puts "boo"
|
59
|
-
end
|
60
|
-
end
|
61
|
-
|
62
|
-
#
|
63
|
-
# Example configuration.
|
64
|
-
#
|
65
|
-
config :example do
|
66
|
-
puts "Configuration Example!"
|
67
|
-
end
|
68
|
-
|
data/HISTORY.md
DELETED
data/LICENSE.txt
DELETED
@@ -1,27 +0,0 @@
|
|
1
|
-
Confection (http://rubyworks.github.com/confection)
|
2
|
-
|
3
|
-
Copyright (c) 2011 Rubyworks. All rights reserved.
|
4
|
-
|
5
|
-
License (spdx) BSD-2-Clause
|
6
|
-
|
7
|
-
Redistribution and use in source and binary forms, with or without
|
8
|
-
modification, are permitted provided that the following conditions are met:
|
9
|
-
|
10
|
-
1. Redistributions of source code must retain the above copyright notice,
|
11
|
-
this list of conditions and the following disclaimer.
|
12
|
-
|
13
|
-
2. Redistributions in binary form must reproduce the above copyright
|
14
|
-
notice, this list of conditions and the following disclaimer in the
|
15
|
-
documentation and/or other materials provided with the distribution.
|
16
|
-
|
17
|
-
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
18
|
-
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
19
|
-
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
20
|
-
COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
21
|
-
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
22
|
-
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
23
|
-
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
24
|
-
OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
25
|
-
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
26
|
-
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
27
|
-
|
data/NOTES.md
DELETED
@@ -1,38 +0,0 @@
|
|
1
|
-
# Developer Notes
|
2
|
-
|
3
|
-
|
4
|
-
## 2012-04-07 | Toplevel DSLs
|
5
|
-
|
6
|
-
If it were not for Ruby's mixing toplevel definitions into all
|
7
|
-
objects, I likely would have used the simpler design of
|
8
|
-
just loading the config files directly (via `#load`).
|
9
|
-
|
10
|
-
It's dissapointing that Ruby continues to insist on mixing toplevel
|
11
|
-
methods into all objects. It would be much easier to write script
|
12
|
-
DSLs if it did not, saving a good bit of code. In this case, for
|
13
|
-
instance, I probably could have shaved off 20% to 40% of the
|
14
|
-
current code --neither the Config or the Configuration class
|
15
|
-
would be needed, and the parser could be stripped down to just
|
16
|
-
enough code to collect a list of profiles since that is all it
|
17
|
-
would really be useful for then.
|
18
|
-
|
19
|
-
|
20
|
-
## 2012-04-05 | Multiple Configurations
|
21
|
-
|
22
|
-
Should multiple definitions for the same tool and profile be
|
23
|
-
allowed?
|
24
|
-
|
25
|
-
config :qed, :cov do
|
26
|
-
...
|
27
|
-
end
|
28
|
-
|
29
|
-
config :qed, :cov do
|
30
|
-
...
|
31
|
-
end
|
32
|
-
|
33
|
-
configuration.invoke(:qed, :cov)
|
34
|
-
|
35
|
-
Should both definitions be called, or just the later? I have decide
|
36
|
-
that both will be called. If this becomes a concern, I may add a `#reconfig`
|
37
|
-
method which would first clear the list of matching configurations.
|
38
|
-
|
data/README.md
DELETED
@@ -1,182 +0,0 @@
|
|
1
|
-
# RC - Runtime Configuration
|
2
|
-
|
3
|
-
[Homepage](http://rubyworks.github.com/rc) /
|
4
|
-
[Source Code](http://github.com/rubyworks/rc) /
|
5
|
-
[Report Issue](http://github.com/rubyworks/rc/issues) /
|
6
|
-
[Mailing List](http://googlegroups.com/group/rubyworks-mailinglist) /
|
7
|
-
[IRC Channel](http://chat.us.freenode.net/rubyworks)
|
8
|
-
|
9
|
-
[![Build Status](https://secure.travis-ci.org/rubyworks/rc.png)](http://travis-ci.org/rubyworks/rc)
|
10
|
-
|
11
|
-
|
12
|
-
## Description
|
13
|
-
|
14
|
-
RC, short for *Runtime Configuration*, is multi-tenant configuration system
|
15
|
-
for Ruby tools. If was designed to facilitate Ruby-based configuration for
|
16
|
-
multiple tools in a single file. It is extremely simple, and univerally applicable
|
17
|
-
which makes it easy to understand and flexible in use.
|
18
|
-
|
19
|
-
|
20
|
-
## Installation
|
21
|
-
|
22
|
-
To use RC via tools that support RC directly, there is nothing you need to
|
23
|
-
install. Installing the said tool should install `rc` via a dependency and
|
24
|
-
load `rc` when the tool is used.
|
25
|
-
|
26
|
-
To use RC with tools that don't provide direct support, first install RC
|
27
|
-
in the usual manner via RubyGems.
|
28
|
-
|
29
|
-
$ gem install rc
|
30
|
-
|
31
|
-
Then add `-rc` to your system's `RUBYOPT` environment variable.
|
32
|
-
|
33
|
-
$ export RUBYOPT='-rc'
|
34
|
-
|
35
|
-
You will want to add that to your `.bashrc`, `.profile` or equivalent configuration
|
36
|
-
script.
|
37
|
-
|
38
|
-
|
39
|
-
## Instruction
|
40
|
-
|
41
|
-
To use RC in a project create a master configuration file for the project called
|
42
|
-
`Config.rb`. The file can have any name that matches `.config.rb`, `Config.rb`
|
43
|
-
or `config.rb`, in that order of precedence. In this file add configuration
|
44
|
-
blocks by name of the commandline tool. For example, let's demonstrate how we could
|
45
|
-
use this to configure Rake tasks.
|
46
|
-
|
47
|
-
$ cat Config.rb
|
48
|
-
config :rake do
|
49
|
-
desc 'generate yard docs'
|
50
|
-
task :yard do
|
51
|
-
sh 'yard'
|
52
|
-
end
|
53
|
-
end
|
54
|
-
|
55
|
-
Now when `rake` is run the tasks defined in this configuration will be available.
|
56
|
-
|
57
|
-
You might wonder why anyone would do this. That's where the *multi-tenancy*
|
58
|
-
comes into play. Let's add another configuration.
|
59
|
-
|
60
|
-
$ cat Config.rb
|
61
|
-
title = "MyApp"
|
62
|
-
|
63
|
-
config :rake do
|
64
|
-
desc 'generate yard docs'
|
65
|
-
task :yard do
|
66
|
-
sh "yard doc --title #{title}"
|
67
|
-
end
|
68
|
-
end
|
69
|
-
|
70
|
-
config :qedoc do |doc|
|
71
|
-
doc.title = "#{title} Demos"
|
72
|
-
end
|
73
|
-
|
74
|
-
Now we have configuration for both the rake tool and the qedoc tool in
|
75
|
-
a single file. Thus we gain the advantage of reducing the file count of our
|
76
|
-
project while pulling our tool configurations together into one place.
|
77
|
-
Moreover, these configurations can potentially share settings as demonstrated
|
78
|
-
here via the `title` local variable.
|
79
|
-
|
80
|
-
RC also supports profiles, either via a `profile` block:
|
81
|
-
|
82
|
-
profile :cov
|
83
|
-
config :qed do
|
84
|
-
require 'simplecov'
|
85
|
-
...
|
86
|
-
end
|
87
|
-
end
|
88
|
-
|
89
|
-
Or via a second config argument:
|
90
|
-
|
91
|
-
config :qed, :cov do
|
92
|
-
require 'simplecov'
|
93
|
-
...
|
94
|
-
end
|
95
|
-
|
96
|
-
When utilizing the tool, set the profile via an environment variable.
|
97
|
-
|
98
|
-
$ profile='cov' qed
|
99
|
-
|
100
|
-
Some tools that support RC out-of-the-box, may support a profile command
|
101
|
-
line option for specifying the profile.
|
102
|
-
|
103
|
-
$ qed -p cov
|
104
|
-
|
105
|
-
Still other tools might utilize profiles to a more specific purpose of
|
106
|
-
the tool at hand. Consult the tool's documentation for details.
|
107
|
-
|
108
|
-
|
109
|
-
## Qualifications
|
110
|
-
|
111
|
-
RC can be used with any Ruby-based commandline tool that can be required by
|
112
|
-
the same name as the tool, e.g. `rake` can be required via `require 'rake'`,
|
113
|
-
and there exists some means of configuring the tool via a toplevel/global
|
114
|
-
interface, or the tool has been customized to directly support RC.
|
115
|
-
|
116
|
-
|
117
|
-
## Customization
|
118
|
-
|
119
|
-
A tool can provide dedicated support for RC by loading the `rc/interface` script
|
120
|
-
and defining a `run` procedure. For example, the `detroit` project defines:
|
121
|
-
|
122
|
-
require 'rc/interface'
|
123
|
-
|
124
|
-
RC.run('detroit') do |configs|
|
125
|
-
Detroit.rc_configs = configs
|
126
|
-
end
|
127
|
-
|
128
|
-
When `detroit` gets around to loading a project's build assemblies, it will
|
129
|
-
check this setting and evaluate the configs via Detroit's confgiruation DSL.
|
130
|
-
|
131
|
-
Some tools may also need to run preconfiguration code before allowing RC to
|
132
|
-
process configuration. Probably the most common use for this is to parse
|
133
|
-
commandline arguments for a profile setting as an alternative to normal
|
134
|
-
environment variable.
|
135
|
-
|
136
|
-
RC.run('qed') do
|
137
|
-
if i = ARGV.index('--profile') || ARGV.index('-p')
|
138
|
-
ENV['profile'] = ARGV[i+1]
|
139
|
-
end
|
140
|
-
end
|
141
|
-
|
142
|
-
The `run` method forces the loading of `rc`, which triggers tool configuration,
|
143
|
-
regardless of whether the end-user has set `RUBYOPT="-rc"`. If you wish for your
|
144
|
-
tool to only work when `RUBYOPT` is set, then define `RC.processor` instead of
|
145
|
-
`run`.
|
146
|
-
|
147
|
-
|
148
|
-
## Dependencies
|
149
|
-
|
150
|
-
### Libraries
|
151
|
-
|
152
|
-
RC depends on the [Finder](http://rubyworks.github.com/finder) library
|
153
|
-
to provide reliable load path and Gem searching. This is used when importing
|
154
|
-
configurations from other projects.
|
155
|
-
|
156
|
-
### Core Extensions
|
157
|
-
|
158
|
-
RC uses two core extensions, `#to_h`, which applies to a few different
|
159
|
-
classes, and `String#tabto`. These are *copied* from
|
160
|
-
[Ruby Facets](http://rubyworks.github.com/facets) to ensure a high
|
161
|
-
standard of interoperability.
|
162
|
-
|
163
|
-
Both of these methods have been suggested for inclusion in Ruby proper.
|
164
|
-
Please head over to Ruby Issue Tracker and add your support.
|
165
|
-
|
166
|
-
* http://bugs.ruby-lang.org/issues/749
|
167
|
-
* http://bugs.ruby-lang.org/issues/6056
|
168
|
-
|
169
|
-
|
170
|
-
## Release Notes
|
171
|
-
|
172
|
-
Please see HISTORY.rdoc file.
|
173
|
-
|
174
|
-
|
175
|
-
## Copyrights
|
176
|
-
|
177
|
-
Copyright (c) 2011 Rubyworks
|
178
|
-
|
179
|
-
Confection is distributable in accordance with the **BSD-2-Clause** license.
|
180
|
-
|
181
|
-
See LICENSE.txt file for details.
|
182
|
-
|