kaigara 0.0.4 → 0.0.5

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: 27b2d14abab4ae27f1ff469bdc05ff998cf23b82
4
- data.tar.gz: a65cda128d283f4092df23e47fbf369b2b1b7a4f
3
+ metadata.gz: cab61ce6c23bcb33686b23d28dd84be586751269
4
+ data.tar.gz: 8e0d5fdb695244be85af5e5f5ec3d43a4512fb7d
5
5
  SHA512:
6
- metadata.gz: 4248c5a01785e3f72c7479f2e22d12a463232c3b7efa69e579c1a841cb64ebb362eb5e297d1fb0792feab4da61d52d075fa83ec76bc485135d004c4e502e839c
7
- data.tar.gz: e38727d87078ff6dce24177fb2a2bfc2bc1ea2abbbdaf44acf572d701057f954bc6d60c86851367e8c3dc7b793bb06bfb0bb2a2b308da3225ce0b2cf60c9876a
6
+ metadata.gz: 6eaaec1a9342bbd83ff09e4415624ba6c632b77dc512c247799e710859cf7fabb3a31c75e10dfb884a45dd118028e66f8a31b30ef6be2c7b6e4cb40b2d04a6f3
7
+ data.tar.gz: d9095141fe48d5fba4b74a10653a1902c7a3a706754aa7657c546ff634b5892ac7462f60c60e5c59f0c11c66184c23d45e026608684a9d2e2a650181975e2d68
@@ -12,11 +12,12 @@ module Kaigara
12
12
 
13
13
  desc 'create NAME', 'Create a new sysops project'
14
14
  #
15
- # Creates an folder with kaigara project. It includes:
15
+ # Creates a folder with kaigara project. It includes:
16
16
  # * +operations/+ - directory for future kaigara scripts
17
17
  # * +resources/+ - directory for any sources (scripts to template, etc.)
18
18
  # * +metadata.rb+ - file where you should store all your variables (including environment)
19
19
  # * +Vagrantfile+ - if you use Vagrant, you know what is it
20
+ # * +Dockerfile+ - a template to generate Dockerfiles
20
21
  #
21
22
  def create(name)
22
23
  package = Package.new(name)
@@ -27,6 +28,7 @@ module Kaigara
27
28
  empty_directory(File.join(name, 'resources'))
28
29
  template('metadata.rb.erb', File.join(name, 'metadata.rb'))
29
30
  template('Vagrantfile.erb', File.join(name, 'Vagrantfile'))
31
+ template('Dockerfile.erb', File.join(name, 'Dockerfile'))
30
32
  end
31
33
 
32
34
  desc 'generate <name>', 'Generate a new operation'
@@ -45,17 +47,17 @@ module Kaigara
45
47
  exit 1
46
48
  end
47
49
 
48
- desc 'exec', 'Execute a package'
50
+ desc 'exec [OPERATION ...]', 'Execute a package'
49
51
  method_option :path, aliases: '-p', desc: 'Project path', default: '.'
50
52
  #
51
53
  # Executes every script in +operations/+
52
54
  # <tt>-p</tt> <i>[path]</i>:: set project path
53
55
  #
54
- def exec
56
+ def exec(*operations)
55
57
  package = Package.new(options[:path])
56
58
  say "Executing #{package.full_name}...", :yellow
57
59
  package.load!
58
- package.run!
60
+ package.run!(operations)
59
61
  end
60
62
  end
61
63
  end
@@ -121,6 +121,26 @@ module Kaigara
121
121
  end
122
122
  end
123
123
 
124
+ #
125
+ # Creates a file with the specified content
126
+ #
127
+ def file(filepath, content, opts = {overwrite: true})
128
+ if !opts[:overwrite] and File.exists?(filepath)
129
+ raise "File #{filepath} exists"
130
+ end
131
+
132
+ File.open(filepath, "w") do |fd|
133
+ fd.write(content)
134
+ end
135
+ end
136
+
137
+ #
138
+ # Configure the hostname of the machine
139
+ #
140
+ def hostname(hostname)
141
+ file("/etc/hostname", hostname)
142
+ end
143
+
124
144
  #
125
145
  # Templates ERB template. You can use variables from metadata.rb in your templates.
126
146
  # <tt>name</tt> - template name, without '.erb'
@@ -49,9 +49,11 @@ module Kaigara
49
49
  end
50
50
 
51
51
  # Execute operations in the operations directory one by one
52
- def run!
52
+ def run!(operations)
53
53
  Dir[File.join(@operations_dir, '*.rb')].each do |x|
54
- execute_operation!(x)
54
+ if operations.empty? or operations.find { |op| x.include?(op) }
55
+ execute_operation!(x)
56
+ end
55
57
  end
56
58
  end
57
59
 
@@ -0,0 +1,9 @@
1
+ FROM heliostech/kaigara
2
+
3
+ COPY metadata.rb /root/metadata.rb
4
+ COPY operations /root/operations
5
+ COPY resources /root/resources
6
+
7
+ RUN kaish sysops exec
8
+
9
+ WORKDIR /root
@@ -6,9 +6,6 @@ require "kaigara"
6
6
  # You can add fixtures and/or initialization code here to make experimenting
7
7
  # with your gem easier. You can also use a different console, if you like.
8
8
 
9
- # (If you use this, don't forget to add pry to your Gemfile!)
10
- # require "pry"
11
- # Pry.start
9
+ require "pry"
12
10
 
13
- require "irb"
14
- IRB.start
11
+ Pry.start
data/kaigara.gemspec CHANGED
@@ -14,7 +14,7 @@ Gem::Specification.new do |spec|
14
14
  spec.homepage = "https://github.com/helios-technologies/kaigara"
15
15
  spec.license = "MIT"
16
16
 
17
- spec.executables = ["kaish","console","setup"]
17
+ spec.executables = ["kaish","kaisole"]
18
18
 
19
19
  spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
20
20
  spec.bindir = "bin"
@@ -22,6 +22,7 @@ Gem::Specification.new do |spec|
22
22
  spec.require_paths = ["lib"]
23
23
 
24
24
  spec.add_runtime_dependency "thor", "~> 0.19.1"
25
+ spec.add_runtime_dependency "pry"
25
26
 
26
27
  spec.add_development_dependency "bundler", "~> 1.11"
27
28
  spec.add_development_dependency "rake", "~> 10.0"
@@ -1,4 +1,4 @@
1
1
  module Kaigara
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
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.4
4
+ version: 0.0.5
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-06-22 00:00:00.000000000 Z
11
+ date: 2016-07-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -24,6 +24,20 @@ dependencies:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: 0.19.1
27
+ - !ruby/object:Gem::Dependency
28
+ name: pry
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'
27
41
  - !ruby/object:Gem::Dependency
28
42
  name: bundler
29
43
  requirement: !ruby/object:Gem::Requirement
@@ -71,8 +85,8 @@ description: Kaigara is an extensible shell command line for managing simple sys
71
85
  email:
72
86
  - contact@heliostech.fr
73
87
  executables:
74
- - console
75
88
  - kaish
89
+ - kaisole
76
90
  - setup
77
91
  extensions: []
78
92
  extra_rdoc_files: []
@@ -89,11 +103,12 @@ files:
89
103
  - app/models/sysops/operation.rb
90
104
  - app/models/sysops/package.rb
91
105
  - app/models/sysops/spec.rb
106
+ - app/templates/sysops/Dockerfile.erb
92
107
  - app/templates/sysops/Vagrantfile.erb
93
108
  - app/templates/sysops/metadata.rb.erb
94
109
  - app/templates/sysops/operation.rb.erb
95
- - bin/console
96
110
  - bin/kaish
111
+ - bin/kaisole
97
112
  - bin/setup
98
113
  - kaigara.gemspec
99
114
  - lib/kaigara.rb