kaigara 0.0.8 → 0.0.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/kaigara.gemspec +1 -0
- data/lib/kaigara/dsl.rb +10 -36
- data/lib/kaigara/version.rb +1 -1
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2f8d152eb3858ec7500f47fc6067b2fb9bbd98e1
|
4
|
+
data.tar.gz: fe2719f70d0f4281c3292fb4de3f30fe86731fb9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 545733c342cdb4f5d4b1e6b131e1d2d2f263584e62d21f8161a2bdd77cbb2d06deb9f1bd7fd334af756f11a51052a452a1b6f7f599194a7364d101b8ba34875b
|
7
|
+
data.tar.gz: 529633bf959059e55c14c9dc73e22b77f592a23d8d6e9483e1c80e6a6cd7c0c5130ef8a5403b80e4a2ddebbd76999cb3f8f2ffcebd35662a4c94799ff6de6347
|
data/kaigara.gemspec
CHANGED
data/lib/kaigara/dsl.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'fileutils'
|
2
|
+
|
1
3
|
module Kaigara
|
2
4
|
module DSL
|
3
5
|
include Thor::Base
|
@@ -37,14 +39,20 @@ module Kaigara
|
|
37
39
|
#
|
38
40
|
def template(source, target = nil)
|
39
41
|
Environment.load_variables(self)
|
42
|
+
source.gsub!(/^\//,'')
|
40
43
|
tpl_file = 'resources/' + source + '.erb'
|
41
44
|
destination = target
|
42
|
-
destination = "/#{
|
45
|
+
destination = "/#{source}" if destination.nil?
|
43
46
|
destination.gsub!(/\.erb$/,'')
|
44
47
|
context = instance_eval("binding")
|
45
48
|
|
46
49
|
say "Rendering template #{tpl_file} to #{destination}", :yellow
|
47
|
-
|
50
|
+
|
51
|
+
dest_dir = File.dirname(destination)
|
52
|
+
content = ERB.new(File.read(tpl_file), nil, "-", "@output_buffer")
|
53
|
+
|
54
|
+
FileUtils.mkdir_p(dest_dir) unless Dir.exist? dest_dir
|
55
|
+
File.write(destination, content.result(context))
|
48
56
|
|
49
57
|
return destination
|
50
58
|
end
|
@@ -94,40 +102,6 @@ module Kaigara
|
|
94
102
|
end
|
95
103
|
end
|
96
104
|
|
97
|
-
#
|
98
|
-
# Add common additional repositories
|
99
|
-
#
|
100
|
-
def repo_extended
|
101
|
-
redhat_family? do
|
102
|
-
package("epel-release")
|
103
|
-
package_update
|
104
|
-
end
|
105
|
-
end
|
106
|
-
|
107
|
-
#
|
108
|
-
# Update the local repository cache
|
109
|
-
#
|
110
|
-
def package_update
|
111
|
-
if debian_family?
|
112
|
-
execute("apt-get update")
|
113
|
-
elsif redhat_family?
|
114
|
-
execute("yum update -y")
|
115
|
-
end
|
116
|
-
end
|
117
|
-
|
118
|
-
#
|
119
|
-
# Install the package depending on OS
|
120
|
-
#
|
121
|
-
def package(name, version = nil)
|
122
|
-
if debian_family?
|
123
|
-
execute("apt-get install -y #{ name }")
|
124
|
-
elsif redhat_family?
|
125
|
-
execute("yum install -y #{ name }")
|
126
|
-
else
|
127
|
-
raise "OS not supported"
|
128
|
-
end
|
129
|
-
end
|
130
|
-
|
131
105
|
#
|
132
106
|
# Creates a file with the specified content
|
133
107
|
#
|
data/lib/kaigara/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kaigara
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Helios Technologies
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-07-
|
11
|
+
date: 2016-07-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -80,6 +80,20 @@ dependencies:
|
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
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: '9'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '9'
|
83
97
|
description: Kaigara is an extensible shell command line for managing simple system
|
84
98
|
operations.
|
85
99
|
email:
|