configurious 0.3.0
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.
- checksums.yaml +7 -0
- data/.gitignore +63 -0
- data/.rspec +2 -0
- data/.travis.yml +5 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +21 -0
- data/README.md +43 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/configurious.gemspec +39 -0
- data/exe/configurious +6 -0
- data/lib/configurious/operations.rb +146 -0
- data/lib/configurious/transformer.rb +60 -0
- data/lib/configurious/version.rb +3 -0
- data/lib/configurious.rb +59 -0
- metadata +146 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 2b776b2ebd26ec4554b9c10c8667b04c355fb541
|
4
|
+
data.tar.gz: 95adeafd31f2be2412f719dbf3e99a5ce05830f6
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 3339ee7341dfa486a686515db089d185331c2af76c577e69d36adbe21f0a1c1874adbe8e7058ab2fa6ad238bdc1d85dd982b3004b6c94aee38baefb1da8fdd4f
|
7
|
+
data.tar.gz: f969a92c90834317dca3aab6b08da228ac9001b100d945050ff16f33e762a10e3cd4858180983e0b858d114398da6557353622c41554e909d5622ea78b61b0af
|
data/.gitignore
ADDED
@@ -0,0 +1,63 @@
|
|
1
|
+
/.bundle/
|
2
|
+
/.yardoc
|
3
|
+
/Gemfile.lock
|
4
|
+
/_yardoc/
|
5
|
+
/coverage/
|
6
|
+
/doc/
|
7
|
+
/pkg/
|
8
|
+
/spec/reports/
|
9
|
+
/tmp/
|
10
|
+
|
11
|
+
# rspec failure tracking
|
12
|
+
.rspec_status
|
13
|
+
*.gem
|
14
|
+
*.rbc
|
15
|
+
/.config
|
16
|
+
/coverage/
|
17
|
+
/InstalledFiles
|
18
|
+
/pkg/
|
19
|
+
/spec/reports/
|
20
|
+
/spec/examples.txt
|
21
|
+
/test/tmp/
|
22
|
+
/test/version_tmp/
|
23
|
+
/tmp/
|
24
|
+
|
25
|
+
# Used by dotenv library to load environment variables.
|
26
|
+
# .env
|
27
|
+
|
28
|
+
## Specific to RubyMotion:
|
29
|
+
.dat*
|
30
|
+
.repl_history
|
31
|
+
build/
|
32
|
+
*.bridgesupport
|
33
|
+
build-iPhoneOS/
|
34
|
+
build-iPhoneSimulator/
|
35
|
+
|
36
|
+
## Specific to RubyMotion (use of CocoaPods):
|
37
|
+
#
|
38
|
+
# We recommend against adding the Pods directory to your .gitignore. However
|
39
|
+
# you should judge for yourself, the pros and cons are mentioned at:
|
40
|
+
# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
|
41
|
+
#
|
42
|
+
# vendor/Pods/
|
43
|
+
|
44
|
+
## Documentation cache and generated files:
|
45
|
+
/.yardoc/
|
46
|
+
/_yardoc/
|
47
|
+
/doc/
|
48
|
+
/rdoc/
|
49
|
+
|
50
|
+
## Environment normalization:
|
51
|
+
/.bundle/
|
52
|
+
/vendor/bundle
|
53
|
+
/lib/bundler/man/
|
54
|
+
|
55
|
+
# for a library or gem, you might want to ignore these files since the code is
|
56
|
+
# intended to run in multiple environments; otherwise, check them in:
|
57
|
+
# Gemfile.lock
|
58
|
+
# .ruby-version
|
59
|
+
# .ruby-gemset
|
60
|
+
|
61
|
+
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
|
62
|
+
.rvmrc
|
63
|
+
.byebug_history
|
data/.rspec
ADDED
data/.travis.yml
ADDED
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
2
|
+
|
3
|
+
## Our Pledge
|
4
|
+
|
5
|
+
In the interest of fostering an open and welcoming environment, we as
|
6
|
+
contributors and maintainers pledge to making participation in our project and
|
7
|
+
our community a harassment-free experience for everyone, regardless of age, body
|
8
|
+
size, disability, ethnicity, gender identity and expression, level of experience,
|
9
|
+
nationality, personal appearance, race, religion, or sexual identity and
|
10
|
+
orientation.
|
11
|
+
|
12
|
+
## Our Standards
|
13
|
+
|
14
|
+
Examples of behavior that contributes to creating a positive environment
|
15
|
+
include:
|
16
|
+
|
17
|
+
* Using welcoming and inclusive language
|
18
|
+
* Being respectful of differing viewpoints and experiences
|
19
|
+
* Gracefully accepting constructive criticism
|
20
|
+
* Focusing on what is best for the community
|
21
|
+
* Showing empathy towards other community members
|
22
|
+
|
23
|
+
Examples of unacceptable behavior by participants include:
|
24
|
+
|
25
|
+
* The use of sexualized language or imagery and unwelcome sexual attention or
|
26
|
+
advances
|
27
|
+
* Trolling, insulting/derogatory comments, and personal or political attacks
|
28
|
+
* Public or private harassment
|
29
|
+
* Publishing others' private information, such as a physical or electronic
|
30
|
+
address, without explicit permission
|
31
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
32
|
+
professional setting
|
33
|
+
|
34
|
+
## Our Responsibilities
|
35
|
+
|
36
|
+
Project maintainers are responsible for clarifying the standards of acceptable
|
37
|
+
behavior and are expected to take appropriate and fair corrective action in
|
38
|
+
response to any instances of unacceptable behavior.
|
39
|
+
|
40
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
41
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
42
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
43
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
44
|
+
threatening, offensive, or harmful.
|
45
|
+
|
46
|
+
## Scope
|
47
|
+
|
48
|
+
This Code of Conduct applies both within project spaces and in public spaces
|
49
|
+
when an individual is representing the project or its community. Examples of
|
50
|
+
representing a project or community include using an official project e-mail
|
51
|
+
address, posting via an official social media account, or acting as an appointed
|
52
|
+
representative at an online or offline event. Representation of a project may be
|
53
|
+
further defined and clarified by project maintainers.
|
54
|
+
|
55
|
+
## Enforcement
|
56
|
+
|
57
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
58
|
+
reported by contacting the project team at chris-ortman@uiowa.edu. All
|
59
|
+
complaints will be reviewed and investigated and will result in a response that
|
60
|
+
is deemed necessary and appropriate to the circumstances. The project team is
|
61
|
+
obligated to maintain confidentiality with regard to the reporter of an incident.
|
62
|
+
Further details of specific enforcement policies may be posted separately.
|
63
|
+
|
64
|
+
Project maintainers who do not follow or enforce the Code of Conduct in good
|
65
|
+
faith may face temporary or permanent repercussions as determined by other
|
66
|
+
members of the project's leadership.
|
67
|
+
|
68
|
+
## Attribution
|
69
|
+
|
70
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
71
|
+
available at [http://contributor-covenant.org/version/1/4][version]
|
72
|
+
|
73
|
+
[homepage]: http://contributor-covenant.org
|
74
|
+
[version]: http://contributor-covenant.org/version/1/4/
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2017 Chris Ortman
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
# Configurious
|
2
|
+
|
3
|
+
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/configurious`. To experiment with that code, run `bin/console` for an interactive prompt.
|
4
|
+
|
5
|
+
TODO: Delete this and the text above, and describe your gem
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
gem 'configurious'
|
13
|
+
```
|
14
|
+
|
15
|
+
And then execute:
|
16
|
+
|
17
|
+
$ bundle
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
|
21
|
+
$ gem install configurious
|
22
|
+
|
23
|
+
## Usage
|
24
|
+
|
25
|
+
TODO: Write usage instructions here
|
26
|
+
|
27
|
+
## Development
|
28
|
+
|
29
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
30
|
+
|
31
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
32
|
+
|
33
|
+
## Contributing
|
34
|
+
|
35
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/configurious. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
36
|
+
|
37
|
+
## License
|
38
|
+
|
39
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
40
|
+
|
41
|
+
## Code of Conduct
|
42
|
+
|
43
|
+
Everyone interacting in the Configurious project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/configurious/blob/master/CODE_OF_CONDUCT.md).
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "configurious"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path("../lib", __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require "configurious/version"
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "configurious"
|
8
|
+
spec.version = Configurious::VERSION
|
9
|
+
spec.authors = ["Chris Ortman"]
|
10
|
+
spec.email = ["chris-ortman@uiowa.edu"]
|
11
|
+
|
12
|
+
spec.summary = %q{Script changes to configuration files}
|
13
|
+
spec.description = %q{A DSL for scripting changes to configuration files}
|
14
|
+
spec.homepage = "https://github.com/chrisortman/configurious"
|
15
|
+
spec.license = "MIT"
|
16
|
+
|
17
|
+
# Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
|
18
|
+
# to allow pushing to a single host or delete this section to allow pushing to any host.
|
19
|
+
if spec.respond_to?(:metadata)
|
20
|
+
spec.metadata["allowed_push_host"] = "https://rubygems.org"
|
21
|
+
else
|
22
|
+
raise "RubyGems 2.0 or newer is required to protect against " \
|
23
|
+
"public gem pushes."
|
24
|
+
end
|
25
|
+
|
26
|
+
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
27
|
+
f.match(%r{^(test|spec|features)/})
|
28
|
+
end
|
29
|
+
spec.bindir = "exe"
|
30
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
31
|
+
spec.require_paths = ["lib"]
|
32
|
+
|
33
|
+
spec.add_dependency 'activesupport', '> 1'
|
34
|
+
spec.add_dependency 'commander'
|
35
|
+
spec.add_development_dependency "bundler", "~> 1.15"
|
36
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
37
|
+
spec.add_development_dependency "rspec", "~> 3.0"
|
38
|
+
spec.add_development_dependency "byebug"
|
39
|
+
end
|
data/exe/configurious
ADDED
@@ -0,0 +1,146 @@
|
|
1
|
+
require 'byebug'
|
2
|
+
require 'active_support/core_ext/hash'
|
3
|
+
|
4
|
+
module Configurious
|
5
|
+
module Operations
|
6
|
+
class OperationBase
|
7
|
+
|
8
|
+
attr_accessor :path, :content
|
9
|
+
|
10
|
+
def simple_path?
|
11
|
+
!@path.include?('.')
|
12
|
+
end
|
13
|
+
|
14
|
+
def normalize_content!
|
15
|
+
if @content.is_a? Hash
|
16
|
+
@content.stringify_keys!
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
# Handles retrieving the content
|
21
|
+
# we really want to update from the
|
22
|
+
# content that is passed in
|
23
|
+
#
|
24
|
+
# It's expected that the outer most
|
25
|
+
# node comes in and then we need to
|
26
|
+
# look at our key and if we have a
|
27
|
+
# path we need to traverse it
|
28
|
+
def select_node(dict)
|
29
|
+
if simple_path?
|
30
|
+
[path, dict]
|
31
|
+
else
|
32
|
+
traverse_path(path,dict)
|
33
|
+
end
|
34
|
+
|
35
|
+
end
|
36
|
+
|
37
|
+
def traverse_path(path, dict)
|
38
|
+
@traverse_messages = ["Traversing path #{path}"]
|
39
|
+
|
40
|
+
path_parts = path.split('.')
|
41
|
+
piece = dict
|
42
|
+
|
43
|
+
path_parts[0..-2].each do |key|
|
44
|
+
|
45
|
+
case
|
46
|
+
when piece.is_a?(Hash) && piece.has_key?(key)
|
47
|
+
@traverse_messages << "Traversed path part #{key}"
|
48
|
+
piece = piece[key]
|
49
|
+
when piece.is_a?(String)
|
50
|
+
@traverse_messages << "Tried traversing to #{key} but the current piece #{piece} is not a hash"
|
51
|
+
return [key, nil]
|
52
|
+
else
|
53
|
+
@traverse_messages << "Could not find #{key} in current piece. Existing Keys: #{piece.keys.join(',')}"
|
54
|
+
return [key, nil]
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
[path_parts.last, piece]
|
59
|
+
|
60
|
+
end
|
61
|
+
|
62
|
+
def apply(existing_content)
|
63
|
+
self.normalize_content!
|
64
|
+
|
65
|
+
key, dict = select_node(existing_content)
|
66
|
+
if dict && dict.is_a?(Hash)
|
67
|
+
do_operation(dict, key)
|
68
|
+
elsif dict.is_a?(String)
|
69
|
+
raise "It looks like you selected a value when you meant to select a dictionary. Path #{path} resolves to #{dict}"
|
70
|
+
else
|
71
|
+
extra = @traverse_messages&.join("\n") || ""
|
72
|
+
raise "No node at path '#{path}'\n #{extra}"
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
# Performs the actual transform
|
77
|
+
# Is given the dictionary to transform
|
78
|
+
# and the key that should be transformed
|
79
|
+
def do_operation(dict, key)
|
80
|
+
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
class Replace < OperationBase
|
85
|
+
|
86
|
+
attr_accessor :part
|
87
|
+
|
88
|
+
def do_operation(dict, key)
|
89
|
+
|
90
|
+
raise "Cannot replace key '#{key}' because it does not already exist" unless dict.has_key?(key)
|
91
|
+
|
92
|
+
if @part
|
93
|
+
old = dict[key]
|
94
|
+
dict[key] = old.gsub(@part,@content)
|
95
|
+
else
|
96
|
+
dict[key] = @content
|
97
|
+
end
|
98
|
+
end
|
99
|
+
|
100
|
+
end
|
101
|
+
|
102
|
+
class Add < OperationBase
|
103
|
+
|
104
|
+
def do_operation(dict, key)
|
105
|
+
|
106
|
+
raise "Cannot add element, key already exists: #{key}" if dict.has_key?(key)
|
107
|
+
|
108
|
+
dict[key] = self.content
|
109
|
+
end
|
110
|
+
end
|
111
|
+
|
112
|
+
class Update < OperationBase
|
113
|
+
|
114
|
+
def applies(&block)
|
115
|
+
@transform = Configurious::Transformer.new
|
116
|
+
case block.arity
|
117
|
+
when 0
|
118
|
+
@transform.instance_eval(&block)
|
119
|
+
else
|
120
|
+
yield @transform
|
121
|
+
end
|
122
|
+
end
|
123
|
+
|
124
|
+
def do_operation(dict, key)
|
125
|
+
@transform.apply(dict[key])
|
126
|
+
end
|
127
|
+
|
128
|
+
end
|
129
|
+
|
130
|
+
class Remove < OperationBase
|
131
|
+
|
132
|
+
def do_operation(dict, key)
|
133
|
+
dict.delete(key)
|
134
|
+
end
|
135
|
+
|
136
|
+
end
|
137
|
+
|
138
|
+
class ChangeKey < OperationBase
|
139
|
+
|
140
|
+
def do_operation(dict, key)
|
141
|
+
v = dict.delete(key)
|
142
|
+
dict[content] = v
|
143
|
+
end
|
144
|
+
end
|
145
|
+
end
|
146
|
+
end
|
@@ -0,0 +1,60 @@
|
|
1
|
+
require 'configurious/operations'
|
2
|
+
|
3
|
+
module Configurious
|
4
|
+
|
5
|
+
class Transformer
|
6
|
+
|
7
|
+
def initialize
|
8
|
+
@steps = []
|
9
|
+
end
|
10
|
+
|
11
|
+
def add(path, value)
|
12
|
+
op = Configurious::Operations::Add.new
|
13
|
+
op.path = path
|
14
|
+
op.content = value
|
15
|
+
@steps << op
|
16
|
+
end
|
17
|
+
|
18
|
+
def replace(path, with:, part: nil)
|
19
|
+
r = Configurious::Operations::Replace.new
|
20
|
+
r.path = path
|
21
|
+
r.part = part
|
22
|
+
r.content = with
|
23
|
+
@steps << r
|
24
|
+
end
|
25
|
+
|
26
|
+
def change(path, to:)
|
27
|
+
r = Configurious::Operations::Replace.new
|
28
|
+
r.path = path
|
29
|
+
r.content = to
|
30
|
+
@steps << r
|
31
|
+
end
|
32
|
+
|
33
|
+
def update(path, &block)
|
34
|
+
r = Configurious::Operations::Update.new
|
35
|
+
r.path = path
|
36
|
+
r.applies(&block)
|
37
|
+
@steps << r
|
38
|
+
end
|
39
|
+
|
40
|
+
def remove(path)
|
41
|
+
r = Configurious::Operations::Remove.new
|
42
|
+
r.path = path
|
43
|
+
@steps << r
|
44
|
+
end
|
45
|
+
|
46
|
+
def change_key(path, to:)
|
47
|
+
r = Configurious::Operations::ChangeKey.new
|
48
|
+
r.path = path
|
49
|
+
r.content = to
|
50
|
+
@steps << r
|
51
|
+
end
|
52
|
+
|
53
|
+
def apply(content)
|
54
|
+
@steps.each do |t|
|
55
|
+
t.apply(content)
|
56
|
+
end
|
57
|
+
content
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
data/lib/configurious.rb
ADDED
@@ -0,0 +1,59 @@
|
|
1
|
+
require 'yaml'
|
2
|
+
require 'commander'
|
3
|
+
|
4
|
+
require "configurious/version"
|
5
|
+
require "configurious/transformer"
|
6
|
+
|
7
|
+
module Configurious
|
8
|
+
# Your code goes here...
|
9
|
+
def self.transform(file)
|
10
|
+
contents = YAML.load_file file
|
11
|
+
transformer = Transformer.new
|
12
|
+
yield transformer
|
13
|
+
transformer.apply(contents)
|
14
|
+
contents.to_yaml
|
15
|
+
end
|
16
|
+
|
17
|
+
def self.apply(ifile, script)
|
18
|
+
Configurious.transform(ifile) do |t|
|
19
|
+
t.instance_eval script
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
class CLI
|
24
|
+
|
25
|
+
include Commander::Methods
|
26
|
+
# include whatever modules you need
|
27
|
+
|
28
|
+
def run
|
29
|
+
program :name, 'configurious'
|
30
|
+
program :version, Configurious::VERSION
|
31
|
+
program :description, 'Allows scripting of changes to yaml files'
|
32
|
+
|
33
|
+
command :poop do |c|
|
34
|
+
c.syntax = "configurious poop"
|
35
|
+
c.summary = "It's poopy"
|
36
|
+
c.action do |args, options|
|
37
|
+
puts "I have #{args.inspect}"
|
38
|
+
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
command :apply do |c|
|
43
|
+
c.syntax = 'configurious apply [options]'
|
44
|
+
c.summary = ''
|
45
|
+
c.description = ''
|
46
|
+
c.example 'description', 'command example'
|
47
|
+
c.action do |args, options|
|
48
|
+
|
49
|
+
tfile, ifile = args
|
50
|
+
result = Configurious.apply(ifile,File.read(tfile))
|
51
|
+
puts result
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
run!
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
end
|
metadata
ADDED
@@ -0,0 +1,146 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: configurious
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.3.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Chris Ortman
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2019-08-27 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: activesupport
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: commander
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: bundler
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '1.15'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '1.15'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rake
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '10.0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '10.0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rspec
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '3.0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '3.0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: byebug
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
description: A DSL for scripting changes to configuration files
|
98
|
+
email:
|
99
|
+
- chris-ortman@uiowa.edu
|
100
|
+
executables:
|
101
|
+
- configurious
|
102
|
+
extensions: []
|
103
|
+
extra_rdoc_files: []
|
104
|
+
files:
|
105
|
+
- ".gitignore"
|
106
|
+
- ".rspec"
|
107
|
+
- ".travis.yml"
|
108
|
+
- CODE_OF_CONDUCT.md
|
109
|
+
- Gemfile
|
110
|
+
- LICENSE.txt
|
111
|
+
- README.md
|
112
|
+
- Rakefile
|
113
|
+
- bin/console
|
114
|
+
- bin/setup
|
115
|
+
- configurious.gemspec
|
116
|
+
- exe/configurious
|
117
|
+
- lib/configurious.rb
|
118
|
+
- lib/configurious/operations.rb
|
119
|
+
- lib/configurious/transformer.rb
|
120
|
+
- lib/configurious/version.rb
|
121
|
+
homepage: https://github.com/chrisortman/configurious
|
122
|
+
licenses:
|
123
|
+
- MIT
|
124
|
+
metadata:
|
125
|
+
allowed_push_host: https://rubygems.org
|
126
|
+
post_install_message:
|
127
|
+
rdoc_options: []
|
128
|
+
require_paths:
|
129
|
+
- lib
|
130
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
131
|
+
requirements:
|
132
|
+
- - ">="
|
133
|
+
- !ruby/object:Gem::Version
|
134
|
+
version: '0'
|
135
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
136
|
+
requirements:
|
137
|
+
- - ">="
|
138
|
+
- !ruby/object:Gem::Version
|
139
|
+
version: '0'
|
140
|
+
requirements: []
|
141
|
+
rubyforge_project:
|
142
|
+
rubygems_version: 2.6.14.3
|
143
|
+
signing_key:
|
144
|
+
specification_version: 4
|
145
|
+
summary: Script changes to configuration files
|
146
|
+
test_files: []
|