regenbogenschmetterlingeinhornkatzchen 0.0.2 → 0.0.3
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.
- checksums.yaml +4 -4
- data/README.md +61 -0
- data/bin/regenbogenschmetterlingeinhornkatzchen +46 -11
- data/lib/cdkconfig.rb +53 -0
- data/regenbogenschmetterlingeinhornkatzchen.gemspec +1 -1
- metadata +25 -25
- data/lib/config.rb +0 -16
- data/lib/regenbogenschmetterlingeinhornkatzchen.rb +0 -114
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: b47bbeaf386ec00a1fd40a45374c267c276c43fd
|
|
4
|
+
data.tar.gz: 96b8e8b2d3a3932dc2904daca2545895addc2384
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 76f8b21dd1492a7dbfa5b399862ccb33803d00ab80cfc944f15d6f4357c270207ade420eb47ebc9557b62e8bc249544b0f1fde4e29f1c176fffa7233e1c1b442
|
|
7
|
+
data.tar.gz: a1bef50f51c99c794fd06860dddd7bce0d259e94a54e0d9601ee0a70dc5e389f8f2f2628aa7d214d4378f0596233ae5cf93fcc158b12978805f3cb66f8aac84c
|
data/README.md
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# Regenbogenschmetterlingeinhornkätzchen
|
|
2
|
+
|
|
3
|
+
This is pre alpha software, its aim is to ease development with containers on exotic platforms like Windows or Mac.
|
|
4
|
+
|
|
5
|
+
CDK expects you to have installed vagrant,
|
|
6
|
+
if not you can do so [here](https://www.vagrantup.com/downloads)
|
|
7
|
+
|
|
8
|
+
And downloaded boxes with following names:
|
|
9
|
+
rhel-7.0, rhel-7.1-atomic, centos-server-7, centos-atomic-7
|
|
10
|
+
(box downloading will be part of this project soon)
|
|
11
|
+
|
|
12
|
+
##Installation
|
|
13
|
+
|
|
14
|
+
There are two ways how to install cdk
|
|
15
|
+
|
|
16
|
+
###From source
|
|
17
|
+
```bash
|
|
18
|
+
git clone git@github.com:humaton/regenbogenschmetterlingeinhornkatzchen.git
|
|
19
|
+
cd regenbogenschmetterlingeinhornkatzchen
|
|
20
|
+
gem build regenbogenschmetterlingeinhornkatzchen.gemspec
|
|
21
|
+
gem install regenbogenschmetterlingeinhornkatzchen-0.0.2.gem
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
###Rubygems
|
|
25
|
+
```bash
|
|
26
|
+
$gem install regenbogenschmetterlingeinhornkatzchen
|
|
27
|
+
```
|
|
28
|
+
##Usage
|
|
29
|
+
Initialize CDK environment:
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
$regenbogenschmetterlingeinhornkatzchen initialize
|
|
33
|
+
```
|
|
34
|
+
You will be asked couple of questions about your development setup.
|
|
35
|
+
Followed by download and import of vagrant box.
|
|
36
|
+
|
|
37
|
+
Install CDK vagrant plugins:
|
|
38
|
+
```bash
|
|
39
|
+
$regenbogenschmetterlingeinhornkatzchen vagrant --install-cdk-plugins
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Create new project with centos-atomic backend for container deployement:
|
|
43
|
+
```bash
|
|
44
|
+
$regenbogenschmetterlingeinhornkatzchen new --name gabelstapler --host centos-atomic
|
|
45
|
+
$cd gabelstapler
|
|
46
|
+
$regenbogenschmetterlingeinhornkatzchen run
|
|
47
|
+
```
|
|
48
|
+
More info:
|
|
49
|
+
```bash
|
|
50
|
+
$regenbogenschmetterlingeinhornkatzchen --help
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
TODO:
|
|
56
|
+
- [ ]Download boxes
|
|
57
|
+
- [] Plug in DevAssistant (where? how?)
|
|
58
|
+
- [ ]Generate vagrantfiles based on currently available images
|
|
59
|
+
- [ ]Pass config options to docker provider
|
|
60
|
+
- [ ]Use config options to setup default setting for new projects
|
|
61
|
+
- [ ]Keep track about CDK projects generated/runned by cdk
|
|
@@ -2,15 +2,18 @@
|
|
|
2
2
|
|
|
3
3
|
require 'rubygems'
|
|
4
4
|
require 'commander/import'
|
|
5
|
+
require 'cdkconfig'
|
|
5
6
|
|
|
6
|
-
program :version, '0.0.
|
|
7
|
+
program :version, '0.0.3'
|
|
7
8
|
program :description, 'Pllm'
|
|
8
9
|
|
|
9
10
|
adb_path = File.join(File.dirname(__FILE__), '..') + "/adb-atomic-developer-bundle/components"
|
|
10
11
|
centos_adb_path = adb_path+"/centos/centos-with-docker"
|
|
11
12
|
rhel_adb_path = adb_path+"/rhel/rhel-with-docker"
|
|
12
|
-
vagrant_base_cmd = "VAGRANT_LOG=info vagrant"
|
|
13
|
+
vagrant_base_cmd = "vagrant" #"VAGRANT_LOG=info vagrant"
|
|
13
14
|
dockerfile_example_path = File.join(File.dirname(__FILE__), '..') + "/examples/Dockerfile"
|
|
15
|
+
dockerfile_example_script_path = File.join(File.dirname(__FILE__), '..') + "/examples/start.sh"
|
|
16
|
+
|
|
14
17
|
|
|
15
18
|
command :new do |c|
|
|
16
19
|
c.syntax = 'cdk new [options]'
|
|
@@ -55,10 +58,11 @@ command :new do |c|
|
|
|
55
58
|
say "#{options.name} Guest Vagrantfile prepared"
|
|
56
59
|
|
|
57
60
|
if agree "do you want to generate Dockerfile?", false
|
|
58
|
-
|
|
61
|
+
FileUtils.cp dockerfile_example_path, "./#{options.name}/"
|
|
62
|
+
FileUtils.cp dockerfile_example_script_path, "./#{options.name}/start.sh"
|
|
59
63
|
end
|
|
60
64
|
else
|
|
61
|
-
say "You have to specify name
|
|
65
|
+
say "You have to specify name"
|
|
62
66
|
end
|
|
63
67
|
end
|
|
64
68
|
end
|
|
@@ -68,16 +72,25 @@ command :vagrant do |c|
|
|
|
68
72
|
c.summary = 'Get vagrant box'
|
|
69
73
|
c.example 'Get centos Vagrantbox from atlas and change name to centos-7.0 after', 'cdk vagrant --getbox humaton/centos-7'
|
|
70
74
|
c.option '--getbox NAME', String, 'image name from atlas.hashicorp.com'
|
|
75
|
+
c.option '--install-cdk-plugins', 'Install vagrant plugins for better CDK experience'
|
|
71
76
|
c.action do |args, options|
|
|
72
77
|
# Do something or c.when_called Cdk::Commands::List 'vagrant up humaton/centos-7 --provider libvirt'
|
|
73
78
|
if options.getbox
|
|
79
|
+
|
|
74
80
|
if system("#{vagrant_base_cmd} box add #{options.getbox}")
|
|
75
81
|
say("Vagrant box was added")
|
|
76
82
|
else
|
|
77
83
|
say("There was a problem with vagrant box import")
|
|
78
84
|
end
|
|
79
|
-
|
|
80
|
-
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
if options.install_cdk_plugins
|
|
88
|
+
plugins = ["vagrant-registration","vagrant-atomic"]
|
|
89
|
+
plugins.each do |p|
|
|
90
|
+
say("Installing plugins...")
|
|
91
|
+
say("Vagrant registration plugin installed") if system("#{vagrant_base_cmd} plugin install vagrant-registration")
|
|
92
|
+
say("Vagrant atomic plugin installed") if system("#{vagrant_base_cmd} plugin install vagrant-atomic")
|
|
93
|
+
end
|
|
81
94
|
end
|
|
82
95
|
|
|
83
96
|
end
|
|
@@ -105,7 +118,7 @@ command :list do |c|
|
|
|
105
118
|
end
|
|
106
119
|
end
|
|
107
120
|
|
|
108
|
-
command :destroy do |c|
|
|
121
|
+
command :destroy do |c|
|
|
109
122
|
c.syntax = 'cdk destroy [options]'
|
|
110
123
|
c.summary = 'Delete cdk data'
|
|
111
124
|
c.description = 'rm -rf of project directory with possibility to cleanup vagrant machines associated with container'
|
|
@@ -114,9 +127,10 @@ command :destroy do |c|
|
|
|
114
127
|
c.action do |args, options|
|
|
115
128
|
# Do something or c.when_called Cdk::Commands::Destroy
|
|
116
129
|
end
|
|
130
|
+
end
|
|
117
131
|
|
|
118
132
|
command :host do |c|
|
|
119
|
-
c.syntax = '
|
|
133
|
+
c.syntax = 'cdk host [options]'
|
|
120
134
|
c.summary = ''
|
|
121
135
|
c.description = ''
|
|
122
136
|
c.example 'description', 'command example'
|
|
@@ -130,8 +144,29 @@ command :destroy do |c|
|
|
|
130
144
|
end
|
|
131
145
|
# Do something or c.when_called Cdk::Commands::List
|
|
132
146
|
end
|
|
133
|
-
end
|
|
134
|
-
|
|
147
|
+
end
|
|
148
|
+
|
|
149
|
+
command :initialize do |c|
|
|
150
|
+
c.syntax = 'cdk initialize [options]'
|
|
151
|
+
c.summary = 'Initialize CDK configuration'
|
|
152
|
+
c.description = 'Create .cdk/config.yaml with some important preconfigured data'
|
|
153
|
+
c.action do |args, options|
|
|
154
|
+
say("Setup options")
|
|
155
|
+
|
|
156
|
+
docker_host = choose("Docker default host?", :docker, :atomic)
|
|
157
|
+
docker_host_os = choose("Docker host default OS?", :centos, :rhel )
|
|
158
|
+
virt_backend = choose("Prefered virtualisation method?", :libvirt, :vbox, :wmvare)
|
|
159
|
+
|
|
160
|
+
vagrant = `which vagrant`
|
|
161
|
+
conf = Cdkconfig.new(docker_host.to_s, docker_host_os.to_s, vagrant.to_s, virt_backend.to_s)
|
|
162
|
+
conf.save_config
|
|
163
|
+
download = agree("Download centos atomic box for provider: #{virt_backend}? [Y/N] ", false)
|
|
164
|
+
|
|
165
|
+
if download
|
|
166
|
+
system("vagrant box add #{conf.default_centos_box} --name centos-atomic-7")
|
|
167
|
+
end
|
|
168
|
+
end
|
|
169
|
+
end
|
|
170
|
+
|
|
135
171
|
|
|
136
|
-
end
|
|
137
172
|
|
data/lib/cdkconfig.rb
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
require "yaml"
|
|
2
|
+
|
|
3
|
+
class Cdkconfig
|
|
4
|
+
attr_accessor :default_docker_provider, :containers, :vagrant,
|
|
5
|
+
:default_docker_provider_os, :default_virt_provider,
|
|
6
|
+
:default_virt_provider,
|
|
7
|
+
:centos_atomic_libvirt, :centos_atomic_vbox,
|
|
8
|
+
:subscribtion_username, :subscribtion_password
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
def initialize(default_docker_provider, default_provider_os = "centos",
|
|
12
|
+
vagrant = false, default_virt_provider = "virtualbox",
|
|
13
|
+
subscribtion_username = nil, subscribtion_password = nil)
|
|
14
|
+
|
|
15
|
+
self.default_docker_provider = default_docker_provider
|
|
16
|
+
self.default_docker_provider_os = default_provider_os
|
|
17
|
+
self.vagrant = vagrant
|
|
18
|
+
self.default_virt_provider = default_virt_provider
|
|
19
|
+
self.centos_atomic_vbox = "http://buildlogs.centos.org/rolling/7/isos/x86_64/CentOS-7-x86_64-AtomicHost-Vagrant-VirtualBox.box"
|
|
20
|
+
self.centos_atomic_libvirt = "http://buildlogs.centos.org/rolling/7/isos/x86_64/CentOS-7-x86_64-AtomicHost-Vagrant-LibVirt-20150228_01.box"
|
|
21
|
+
create_config_dir
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def default_centos_box
|
|
25
|
+
if @default_virt_provider == "libvirt"
|
|
26
|
+
@centos_atomic_libvirt
|
|
27
|
+
else
|
|
28
|
+
@centos_atomic_vbox
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def self.load_config
|
|
33
|
+
YAML.load(File.read(File.expand_path("~")+'/.cdk/config.yaml'))
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def save_config
|
|
37
|
+
File.open(File.expand_path("~")+'/.cdk/config.yaml', 'w') {|f| f.write(YAML.dump(self)) }
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
def create_config_dir
|
|
41
|
+
unless File.directory? File.expand_path("~")+"/.cdk"
|
|
42
|
+
FileUtils.mkdir_p File.expand_path("~")+"/.cdk"
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
def self.config_exists?
|
|
47
|
+
if File.exist?(File.expand_path("~")+"/.cdk/config.yaml") || File.directory?(File.expand_path("~")+"/.cdk")
|
|
48
|
+
true
|
|
49
|
+
else
|
|
50
|
+
false
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: regenbogenschmetterlingeinhornkatzchen
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0.
|
|
4
|
+
version: 0.0.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Tomas Hrcka
|
|
@@ -17,47 +17,47 @@ executables:
|
|
|
17
17
|
extensions: []
|
|
18
18
|
extra_rdoc_files: []
|
|
19
19
|
files:
|
|
20
|
-
-
|
|
21
|
-
-
|
|
22
|
-
-
|
|
23
|
-
-
|
|
20
|
+
- examples/Dockerfile
|
|
21
|
+
- examples/start.sh
|
|
22
|
+
- LICENSE
|
|
23
|
+
- README.md
|
|
24
|
+
- lib/cdkconfig.rb
|
|
25
|
+
- bin/regenbogenschmetterlingeinhornkatzchen
|
|
24
26
|
- adb-atomic-developer-bundle/tests/rhel-with-docker/test-rhel-docker.sh
|
|
27
|
+
- adb-atomic-developer-bundle/tests/standalone-rhel/test-base-rhel.withKnownBug.sh
|
|
28
|
+
- adb-atomic-developer-bundle/tests/standalone-rhel/test-base-rhel.sh
|
|
29
|
+
- adb-atomic-developer-bundle/extras/vagrant-dockerfile/Dockerfile
|
|
30
|
+
- adb-atomic-developer-bundle/extras/vagrant-dockerfile/runner.sh
|
|
25
31
|
- adb-atomic-developer-bundle/motivation.md
|
|
26
|
-
- adb-atomic-developer-bundle/
|
|
32
|
+
- adb-atomic-developer-bundle/LICENSE
|
|
27
33
|
- adb-atomic-developer-bundle/components/rhel/rhel-standalone/README.md
|
|
28
34
|
- adb-atomic-developer-bundle/components/rhel/rhel-standalone/Vagrantfile
|
|
29
|
-
- adb-atomic-developer-bundle/components/rhel/rhel-with-docker/rhel-docker-host/Vagrantfile
|
|
30
35
|
- adb-atomic-developer-bundle/components/rhel/rhel-with-docker/atomic-docker-host/Vagrantfile
|
|
36
|
+
- adb-atomic-developer-bundle/components/rhel/rhel-with-docker/sample-dev/rhel-Vagrantfile
|
|
31
37
|
- adb-atomic-developer-bundle/components/rhel/rhel-with-docker/sample-dev/atomic-Vagrantfile
|
|
32
38
|
- adb-atomic-developer-bundle/components/rhel/rhel-with-docker/sample-dev/README.md
|
|
33
|
-
- adb-atomic-developer-bundle/components/rhel/rhel-with-docker/sample-dev/rhel-Vagrantfile
|
|
34
39
|
- adb-atomic-developer-bundle/components/rhel/rhel-with-docker/sample-dev/Vagrantfile
|
|
40
|
+
- adb-atomic-developer-bundle/components/rhel/rhel-with-docker/rhel-docker-host/Vagrantfile
|
|
41
|
+
- adb-atomic-developer-bundle/components/rhel/README.md
|
|
42
|
+
- adb-atomic-developer-bundle/components/boxes/vagrant-boxes.md
|
|
43
|
+
- adb-atomic-developer-bundle/components/centos/centos-standalone/UNTESTED
|
|
35
44
|
- adb-atomic-developer-bundle/components/centos/centos-standalone/README.md
|
|
36
45
|
- adb-atomic-developer-bundle/components/centos/centos-standalone/Vagrantfile
|
|
37
|
-
- adb-atomic-developer-bundle/components/centos/centos-standalone/UNTESTED
|
|
38
|
-
- adb-atomic-developer-bundle/components/centos/centos-with-docker/centos-docker-host/Vagrantfile
|
|
39
|
-
- adb-atomic-developer-bundle/components/centos/centos-with-docker/centos-docker-host/UNTESTED
|
|
40
|
-
- adb-atomic-developer-bundle/components/centos/centos-with-docker/atomic-docker-host/Vagrantfile
|
|
41
46
|
- adb-atomic-developer-bundle/components/centos/centos-with-docker/atomic-docker-host/UNTESTED
|
|
47
|
+
- adb-atomic-developer-bundle/components/centos/centos-with-docker/atomic-docker-host/Vagrantfile
|
|
42
48
|
- adb-atomic-developer-bundle/components/centos/centos-with-docker/sample-dev/atomic-Vagrantfile
|
|
43
|
-
- adb-atomic-developer-bundle/components/centos/centos-with-docker/sample-dev/README.md
|
|
44
|
-
- adb-atomic-developer-bundle/components/centos/centos-with-docker/sample-dev/Vagrantfile
|
|
45
49
|
- adb-atomic-developer-bundle/components/centos/centos-with-docker/sample-dev/centos-Vagrantfile
|
|
46
50
|
- adb-atomic-developer-bundle/components/centos/centos-with-docker/sample-dev/UNTESTED
|
|
47
|
-
- adb-atomic-developer-bundle/components/
|
|
48
|
-
- adb-atomic-developer-bundle/
|
|
49
|
-
- adb-atomic-developer-bundle/
|
|
50
|
-
-
|
|
51
|
-
-
|
|
52
|
-
- examples/start.sh
|
|
53
|
-
- lib/regenbogenschmetterlingeinhornkatzchen.rb
|
|
54
|
-
- lib/config.rb
|
|
51
|
+
- adb-atomic-developer-bundle/components/centos/centos-with-docker/sample-dev/README.md
|
|
52
|
+
- adb-atomic-developer-bundle/components/centos/centos-with-docker/sample-dev/Vagrantfile
|
|
53
|
+
- adb-atomic-developer-bundle/components/centos/centos-with-docker/centos-docker-host/UNTESTED
|
|
54
|
+
- adb-atomic-developer-bundle/components/centos/centos-with-docker/centos-docker-host/Vagrantfile
|
|
55
|
+
- adb-atomic-developer-bundle/README.md
|
|
55
56
|
- regenbogenschmetterlingeinhornkatzchen.gemspec
|
|
56
|
-
-
|
|
57
|
+
- .gitignore
|
|
57
58
|
- .gitmodules
|
|
58
|
-
- adb-atomic-developer-bundle/.git
|
|
59
59
|
- adb-atomic-developer-bundle/.gitignore
|
|
60
|
-
-
|
|
60
|
+
- adb-atomic-developer-bundle/.git
|
|
61
61
|
homepage: https://github.com/humaton/regenbogenschmetterlingeinhornkatzchen
|
|
62
62
|
licenses:
|
|
63
63
|
- GPL-2.0
|
data/lib/config.rb
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
class Config
|
|
2
|
-
attr_accessor :default_docker_provider, :containers, :vagrant
|
|
3
|
-
|
|
4
|
-
def new(default_provider, vagrant = false)
|
|
5
|
-
self.default_docker_provider = default_provider
|
|
6
|
-
self.vagrant = vagrant
|
|
7
|
-
end
|
|
8
|
-
|
|
9
|
-
def load_config
|
|
10
|
-
|
|
11
|
-
end
|
|
12
|
-
|
|
13
|
-
def save_config
|
|
14
|
-
|
|
15
|
-
end
|
|
16
|
-
end
|
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env ruby
|
|
2
|
-
|
|
3
|
-
require 'rubygems'
|
|
4
|
-
require 'commander/import'
|
|
5
|
-
|
|
6
|
-
program :version, '0.0.1'
|
|
7
|
-
program :description, 'Pllm'
|
|
8
|
-
|
|
9
|
-
adb_path = "adb-atomic-developer-bundle/components"
|
|
10
|
-
centos_adb_path = adb_path+"/centos/centos-with-docker"
|
|
11
|
-
rhel_adb_path = adb_path+"/rhel/rhel-with-docker"
|
|
12
|
-
vagrant_base_cmd = "vagrant"
|
|
13
|
-
dockerfile_example_path = "./examples/Dockerfile"
|
|
14
|
-
|
|
15
|
-
command :new do |c|
|
|
16
|
-
c.syntax = 'cdk new [options]'
|
|
17
|
-
c.summary = 'Create new container'
|
|
18
|
-
c.description = 'Create directory with container and host configurations'
|
|
19
|
-
c.example 'Create new container configuration with atomic host to deploy', 'cdk new Geablestapler --host rhel-atomic'
|
|
20
|
-
c.option '--name NAME', String, 'Define name of a container'
|
|
21
|
-
c.option '--host TYPE', String, 'Define host to setup to later deployement'
|
|
22
|
-
c.action do |args, options|
|
|
23
|
-
if options.name && options.host
|
|
24
|
-
FileUtils.mkdir_p "#{options.name}/host"
|
|
25
|
-
host_vagrant_file_path = ""
|
|
26
|
-
guest_vagrant_file_path = ""
|
|
27
|
-
|
|
28
|
-
case options.host
|
|
29
|
-
when "rhel-atomic"
|
|
30
|
-
host_vagrant_file_path = rhel_adb_path+'/atomic-docker-host/Vagrantfile'
|
|
31
|
-
guest_vagrant_file_path = rhel_adb_path+'/sample-dev/Vagrantfile'
|
|
32
|
-
when "rhel-docker"
|
|
33
|
-
host_vagrant_file_path = rhel_adb_path+'/rhel-docker-host/Vagrantfile'
|
|
34
|
-
guest_vagrant_file_path = rhel_adb_path+'/sample-dev/Vagrantfile'
|
|
35
|
-
when "centos-atomic"
|
|
36
|
-
host_vagrant_file_path = centos_adb_path+'/atomic-docker-host/Vagrantfile'
|
|
37
|
-
guest_vagrant_file_path = centos_adb_path+'/sample-dev/Vagrantfile'
|
|
38
|
-
when "centos-docker"
|
|
39
|
-
host_vagrant_file_path = centos_adb_path+'/centos-docker-host/Vagrantfile'
|
|
40
|
-
guest_vagrant_file_path = centos_adb_path+'/sample-dev/Vagrantfile'
|
|
41
|
-
end
|
|
42
|
-
|
|
43
|
-
FileUtils.cp host_vagrant_file_path, "./#{options.name}/host/"
|
|
44
|
-
say "#{options.host} host Vagrantfile prepared"
|
|
45
|
-
FileUtils.cp guest_vagrant_file_path, "./#{options.name}/"
|
|
46
|
-
|
|
47
|
-
text = File.read("./#{options.name}/Vagrantfile")
|
|
48
|
-
new_contents = text.gsub(/(d.vagrant_vagrantfile[A-Za-z\t . _ = " \/ -]+)/, "d.vagrant_vagrantfile = \"./host/Vagrantfile\"")
|
|
49
|
-
# To write changes to the file, use:
|
|
50
|
-
File.open("./#{options.name}/Vagrantfile", "w") {|file| file.puts new_contents }
|
|
51
|
-
|
|
52
|
-
say "#{options.name} Guest Vagrantfile prepared"
|
|
53
|
-
|
|
54
|
-
if agree "do you want to generate Dockerfile?", false
|
|
55
|
-
FileUtils.cp dockerfile_example_path, "./#{options.name}/"
|
|
56
|
-
end
|
|
57
|
-
else
|
|
58
|
-
say "You have to specify name and host"
|
|
59
|
-
end
|
|
60
|
-
end
|
|
61
|
-
end
|
|
62
|
-
|
|
63
|
-
command :run do |c|
|
|
64
|
-
c.syntax = 'cdk run'
|
|
65
|
-
c.summary = 'Run container on host using vagrant'
|
|
66
|
-
c.description = 'This command invokes vagrant up in current directory'
|
|
67
|
-
c.example 'Run container from Vagrantfile in current directory', 'cdk run'
|
|
68
|
-
c.action do |args, options|
|
|
69
|
-
# Do something or c.when_called Cdk::Commands::List
|
|
70
|
-
exec("#{vagrant_base_cmd} up")
|
|
71
|
-
end
|
|
72
|
-
end
|
|
73
|
-
|
|
74
|
-
command :list do |c|
|
|
75
|
-
c.syntax = 'cdk list [options]'
|
|
76
|
-
c.summary = ''
|
|
77
|
-
c.description = ''
|
|
78
|
-
c.example 'description', 'command example'
|
|
79
|
-
c.option '--some-switch', 'Some switch that does something'
|
|
80
|
-
c.action do |args, options|
|
|
81
|
-
# Do something or c.when_called Cdk::Commands::List
|
|
82
|
-
end
|
|
83
|
-
end
|
|
84
|
-
|
|
85
|
-
command :destroy do |c|
|
|
86
|
-
c.syntax = 'cdk destroy [options]'
|
|
87
|
-
c.summary = ''
|
|
88
|
-
c.description = ''
|
|
89
|
-
c.example 'description', 'command example'
|
|
90
|
-
c.option '--some-switch', 'Some switch that does something'
|
|
91
|
-
c.action do |args, options|
|
|
92
|
-
# Do something or c.when_called Cdk::Commands::Destroy
|
|
93
|
-
end
|
|
94
|
-
|
|
95
|
-
command :host do |c|
|
|
96
|
-
c.syntax = 'sdc host [options]'
|
|
97
|
-
c.summary = ''
|
|
98
|
-
c.description = ''
|
|
99
|
-
c.example 'description', 'command example'
|
|
100
|
-
c.option '--create', 'Some switch that does something'
|
|
101
|
-
c.option '--delete', 'Some switch that does something'
|
|
102
|
-
c.option '--list', 'Some switch that does something'
|
|
103
|
-
c.action do |args, options|
|
|
104
|
-
if options.list
|
|
105
|
-
say("Your current options:")
|
|
106
|
-
say("rhel-docker, rhel-atomic, centos-docker, centos-atomic")
|
|
107
|
-
end
|
|
108
|
-
# Do something or c.when_called Cdk::Commands::List
|
|
109
|
-
end
|
|
110
|
-
end
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
end
|
|
114
|
-
|