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 ADDED
@@ -0,0 +1,18 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ coverage
6
+ InstalledFiles
7
+ lib/bundler/man
8
+ pkg
9
+ rdoc
10
+ spec/reports
11
+ test/tmp
12
+ test/version_tmp
13
+ tmp
14
+
15
+ # YARD artifacts
16
+ .yardoc
17
+ _yardoc
18
+ doc/
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in splice.gemspec
4
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,14 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ splice (0.0.1)
5
+
6
+ GEM
7
+ remote: https://rubygems.org/
8
+ specs:
9
+
10
+ PLATFORMS
11
+ ruby
12
+
13
+ DEPENDENCIES
14
+ splice!
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
@@ -0,0 +1,4 @@
1
+ Splice
2
+ ======
3
+
4
+ A simple way to manage linux server configuration.
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env rake
2
+ require "bundler/gem_tasks"
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,5 @@
1
+ splice:
2
+ files: ["/Users/Omar/Desktop/predserv.rb.erb","/Users/Omar/Desktop/pass.txt.erb"]
3
+ database:
4
+ district_name: "Morgan Hill"
5
+ database_server: "192.168.1.1"
@@ -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
@@ -0,0 +1,4 @@
1
+ require "splice/version"
2
+
3
+ module Splice
4
+ end
@@ -0,0 +1,3 @@
1
+ module Splice
2
+ VERSION = "0.1"
3
+ end
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: []