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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: acc6a47fe4fff17461030df134aa1cb031fd76dc
4
- data.tar.gz: 00cdc79f10256f59cc10ed4463fe0ea487799e2c
3
+ metadata.gz: 2f8d152eb3858ec7500f47fc6067b2fb9bbd98e1
4
+ data.tar.gz: fe2719f70d0f4281c3292fb4de3f30fe86731fb9
5
5
  SHA512:
6
- metadata.gz: 8a97dc7437223a011847ad03a4fe4444655afd2697d69e785e356da7b61f4857a57ab90e0456784df6c2c12dd8ec244184a7e594e0c94decb1e55f98dee48ba5
7
- data.tar.gz: db5c601904cf450d84420db6e37ec37fd0dcb6ab63228d58185b7dbf1be9f0fdfbd83cff341a933d09220f759b50907ac2e2ce905576b7eaa04b0432a0c9bd34
6
+ metadata.gz: 545733c342cdb4f5d4b1e6b131e1d2d2f263584e62d21f8161a2bdd77cbb2d06deb9f1bd7fd334af756f11a51052a452a1b6f7f599194a7364d101b8ba34875b
7
+ data.tar.gz: 529633bf959059e55c14c9dc73e22b77f592a23d8d6e9483e1c80e6a6cd7c0c5130ef8a5403b80e4a2ddebbd76999cb3f8f2ffcebd35662a4c94799ff6de6347
@@ -27,4 +27,5 @@ Gem::Specification.new do |spec|
27
27
  spec.add_development_dependency "bundler", "~> 1.11"
28
28
  spec.add_development_dependency "rake", "~> 10.0"
29
29
  spec.add_development_dependency "rspec", "~> 3.0"
30
+ spec.add_development_dependency "byebug", "~> 9"
30
31
  end
@@ -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 = "/#{tpl_file}" if destination.nil?
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
- File.write(destination, ERB.new(File.read(tpl_file), nil, "-", "@output_buffer").result(context))
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
  #
@@ -1,4 +1,4 @@
1
1
  module Kaigara
2
- VERSION = "0.0.8"
2
+ VERSION = "0.0.9"
3
3
  end
4
4
 
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.8
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-07 00:00:00.000000000 Z
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: