splice 0.1
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/.gitignore +18 -0
- data/Gemfile +4 -0
- data/Gemfile.lock +14 -0
- data/LICENSE +22 -0
- data/README.md +4 -0
- data/Rakefile +2 -0
- data/bin/splice +12 -0
- data/dna.yml +5 -0
- data/lib/execution_context.rb +33 -0
- data/lib/splice.rb +4 -0
- data/lib/splice/version.rb +3 -0
- data/splice.gemspec +17 -0
- metadata +58 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2012 Omar Qazi
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
data/Rakefile
ADDED
data/bin/splice
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'pp'
|
3
|
+
require 'execution_context'
|
4
|
+
include Splice
|
5
|
+
|
6
|
+
context = ExecutionContext.new
|
7
|
+
|
8
|
+
if context.settings["splice"]["files"] and context.settings["splice"]["files"].count > 0
|
9
|
+
context.settings["splice"]["files"].each {|p| context.parse(p); puts "Parsed and wrote file #{p}" }
|
10
|
+
else
|
11
|
+
puts "ERROR: No files specified for processing."
|
12
|
+
end
|
data/dna.yml
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
SEARCH_PATHS = ["dna.yml","/tmp/dna.yml", "/etc/dna.yml"] #Search paths, in order of priority
|
2
|
+
require 'erb'
|
3
|
+
module Splice
|
4
|
+
class ExecutionContext
|
5
|
+
attr_accessor :settings
|
6
|
+
|
7
|
+
def initialize(search_tmp = false)
|
8
|
+
@settings = Hash.new
|
9
|
+
|
10
|
+
SEARCH_PATHS.each do |path|
|
11
|
+
is_not_tmp = true unless path == "/tmp/dna.yml" and search_tmp == false
|
12
|
+
|
13
|
+
if File.exists?(path) and is_not_tmp
|
14
|
+
path_settings = YAML.load_file(path)
|
15
|
+
path_settings.each_pair {|key,value| @settings[key] ||= value}
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
|
20
|
+
end
|
21
|
+
|
22
|
+
def parse(some_file)
|
23
|
+
e = ERB.new File.read(some_file)
|
24
|
+
result = e.result(binding)
|
25
|
+
new_path = some_file.split(".")
|
26
|
+
new_path.delete_at(new_path.count - 1) #Delete the erb extension
|
27
|
+
new_path = new_path.join(".")
|
28
|
+
|
29
|
+
File.open(new_path,'w') {|f| f.write(result) }
|
30
|
+
result
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
data/lib/splice.rb
ADDED
data/splice.gemspec
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
require File.expand_path('../lib/splice/version', __FILE__)
|
3
|
+
|
4
|
+
Gem::Specification.new do |gem|
|
5
|
+
gem.authors = ["Omar Qazi"]
|
6
|
+
gem.email = ["omar@predpol.com"]
|
7
|
+
gem.description = "A simple way to manage Linux server configurations."
|
8
|
+
gem.summary = "A simple way to manage Linux server configurations."
|
9
|
+
gem.homepage = "http://github.com/Predpol/Splice"
|
10
|
+
|
11
|
+
gem.files = `git ls-files`.split($\)
|
12
|
+
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
13
|
+
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
14
|
+
gem.name = "splice"
|
15
|
+
gem.require_paths = ["lib"]
|
16
|
+
gem.version = Splice::VERSION
|
17
|
+
end
|
metadata
ADDED
@@ -0,0 +1,58 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: splice
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: '0.1'
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Omar Qazi
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2012-07-03 00:00:00.000000000 Z
|
13
|
+
dependencies: []
|
14
|
+
description: A simple way to manage Linux server configurations.
|
15
|
+
email:
|
16
|
+
- omar@predpol.com
|
17
|
+
executables:
|
18
|
+
- splice
|
19
|
+
extensions: []
|
20
|
+
extra_rdoc_files: []
|
21
|
+
files:
|
22
|
+
- .gitignore
|
23
|
+
- Gemfile
|
24
|
+
- Gemfile.lock
|
25
|
+
- LICENSE
|
26
|
+
- README.md
|
27
|
+
- Rakefile
|
28
|
+
- bin/splice
|
29
|
+
- dna.yml
|
30
|
+
- lib/execution_context.rb
|
31
|
+
- lib/splice.rb
|
32
|
+
- lib/splice/version.rb
|
33
|
+
- splice.gemspec
|
34
|
+
homepage: http://github.com/Predpol/Splice
|
35
|
+
licenses: []
|
36
|
+
post_install_message:
|
37
|
+
rdoc_options: []
|
38
|
+
require_paths:
|
39
|
+
- lib
|
40
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0'
|
46
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
47
|
+
none: false
|
48
|
+
requirements:
|
49
|
+
- - ! '>='
|
50
|
+
- !ruby/object:Gem::Version
|
51
|
+
version: '0'
|
52
|
+
requirements: []
|
53
|
+
rubyforge_project:
|
54
|
+
rubygems_version: 1.8.24
|
55
|
+
signing_key:
|
56
|
+
specification_version: 3
|
57
|
+
summary: A simple way to manage Linux server configurations.
|
58
|
+
test_files: []
|