kamino 0.1.0 → 0.2.0

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/lib/kamino/cli.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  require 'thor'
2
+ require 'kamino/config'
2
3
 
3
4
  module Kamino
4
5
  class CLI < Thor
@@ -10,9 +11,10 @@ module Kamino
10
11
 
11
12
  desc 'rails', "Makes your Rails app cloneable"
12
13
  def rails
14
+ say "Setting VM to hostname #{Kamino.config.default_app_name} #{Kamino.config.default_host_ip}", :yellow
13
15
  target = Dir.pwd
14
16
  template File.join('rails', 'Berksfile.erb'), File.join(target, 'Berksfile')
15
- template File.join('rails', 'Vagrantfile.erb'), File.join(target, 'Vagrantfile')
17
+ template File.join('rails', 'Vagrantfile.erb'), File.join(target, 'Vagrantfile'), Kamino.config.options
16
18
  append_file(File.join(target, 'Gemfile')) { <<END }
17
19
 
18
20
  # Berkshelf manages your cookbooks like bundler
@@ -0,0 +1,46 @@
1
+ require 'rlet'
2
+ require 'yaml'
3
+
4
+ module Kamino
5
+ # Right now in the interest of time, I am not separating out the
6
+ # Rails-specific stuff. Probably the best way is having a kamino/rails
7
+ # directory and making this Kamino::Rails::Config
8
+ #
9
+ # Originally, this was intended as a way to dynamically fill in
10
+ # Vagrantfile. However, Vagrant 1.1 onward is its own self-contained
11
+ # tool with its own embedded Ruby and gems. We'd have to make a plugin.
12
+ # That might be the way moving forward, but for the purpose of this
13
+ # initial demo, we're going to use this to generate static config.
14
+
15
+ class Config
16
+ include Let
17
+
18
+ let(:default_app_name) { File.basename(Dir.pwd) }
19
+ let(:default_host_ip) { "33.33.33.#{rand(252) + 2}" }
20
+
21
+ let(:development_name) { database_config['development']['database'] }
22
+ let(:test_name) { database_config['test']['database'] }
23
+ let(:username) { database_config['development']['username'] }
24
+ let(:password) { database_config['development']['password'] }
25
+
26
+ let(:database_config) { YAML.load_file database_yml_file }
27
+
28
+ let(:database_yml_file) { File.join config_dir, 'database.yml' }
29
+ let(:config_dir) { File.join Dir.pwd, 'config' }
30
+
31
+ let(:options) do
32
+ {
33
+ :app_name => default_app_name,
34
+ :host_ip => default_host_ip,
35
+ :development_name => development_name,
36
+ :test_name => test_name,
37
+ :username => username,
38
+ :password => password
39
+ }
40
+ end
41
+ end
42
+
43
+ def self.config
44
+ @config ||= Kamino::Config.new
45
+ end
46
+ end
@@ -1,3 +1,3 @@
1
1
  module Kamino
2
- VERSION='0.1.0'
2
+ VERSION='0.2.0'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kamino
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -27,6 +27,22 @@ dependencies:
27
27
  - - ! '>='
28
28
  - !ruby/object:Gem::Version
29
29
  version: '0'
30
+ - !ruby/object:Gem::Dependency
31
+ name: rlet
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ type: :runtime
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
30
46
  - !ruby/object:Gem::Dependency
31
47
  name: rspec
32
48
  requirement: !ruby/object:Gem::Requirement
@@ -54,6 +70,7 @@ extra_rdoc_files: []
54
70
  files:
55
71
  - bin/kamino
56
72
  - lib/kamino/cli.rb
73
+ - lib/kamino/config.rb
57
74
  - lib/kamino/version.rb
58
75
  - lib/kamino.rb
59
76
  - LICENSE