forj 0.0.26 → 0.0.27

Sign up to get free protection for your applications and to get access to all the features.
Files changed (7) hide show
  1. data/Gemfile +1 -1
  2. data/bin/forj +25 -31
  3. data/lib/boot.rb +19 -8
  4. data/lib/ssh.rb +10 -1
  5. metadata +15 -18
  6. data/.rspec +0 -3
  7. data/.rubocop.yml +0 -22
data/Gemfile CHANGED
@@ -25,5 +25,5 @@ gem 'fog', '1.19.0'
25
25
  gem 'git', '>=1.2.7'
26
26
  gem 'rainbow'
27
27
  gem 'rbx-require-relative', '~> 0.0.7'
28
- gem 'thor', '~>0.16.0'
28
+ gem 'thor', '~>0.19.1'
29
29
  gem 'hpcloud', '~>2.0.8'
data/bin/forj CHANGED
@@ -25,10 +25,11 @@ require_relative '../lib/down.rb'
25
25
  include Down
26
26
  require_relative '../lib/setup.rb'
27
27
  include Setup
28
+ require_relative '../lib/ssh.rb'
29
+ include Ssh
28
30
 
29
31
 
30
32
  class Forj < Thor
31
-
32
33
  desc 'help', 'Display forj cli help'
33
34
  def help
34
35
  puts 'forj cli commands'
@@ -47,56 +48,49 @@ class Forj < Thor
47
48
  puts ' down: delete the Maestro box and all systems installed by the blueprint'
48
49
  puts ' -name: name for the maestro box'
49
50
  puts ' setup: set the credentials for forj cli'
50
- puts ''
51
- puts ' -credentials:'
52
- puts ' hpcloud:'
53
- puts ' access_key: access key from hpcloud'
54
- puts ' secret_key: secret key from hpcloud'
55
- puts ' auth_uri: identity endpoint'
56
- puts ' tenant_id: id for the tenant you want to use'
57
- puts ' availability_zone: which availability zone will be deployed'
51
+ puts ' -credentials:'
52
+ puts ' hpcloud:'
53
+ puts ' access_key: access key from hpcloud'
54
+ puts ' secret_key: secret key from hpcloud'
55
+ puts ' auth_uri: identity endpoint'
56
+ puts ' tenant_id: id for the tenant you want to use'
57
+ puts ' availability_zone: which availability zone will be deployed'
58
58
  puts ''
59
59
  end
60
60
 
61
61
  desc 'boot', 'boot a Maestro box and instruct it to provision the blueprint'
62
62
 
63
- method_option :build_conf_dir, :aliases => '-bcd', :desc => 'Defines the build configuration directory to load the build configuration file. You can set FORJ_BLD_CONF_DIR. By default, it will look in your current directory.'
64
- method_option :build_conf, :aliases => '-bc', :desc => 'The build config file to load <confdir>/<BoxName>.<Config>.env. By default, uses "master" as Config.'
65
- method_option :branch, :aliases => '-gb', :desc => 'The build will extract from git branch name. It sets the configuration build <config> to the branch name <branch>.'
66
- method_option :test_box, :aliases => '-tb', :desc => 'Create test-box meta from the repository path provided.'
67
- method_option :git_repo, :aliases => '-gr', :desc => 'The box built will use a different git repository sent out to <user_data>. This repository needs to be read only. No keys are sent.'
68
- method_option :boothook, :aliases => '-b', :desc => 'By default, boothook file used is build/bin/build-tools/boothook.sh. Use this option to set another one.'
69
- method_option :box_name, :aliases => '-bn', :desc => 'Defines the name of the box or box image to build.'
63
+ method_option :build, :aliases => '-b', :desc => 'Replace the default build.sh'
64
+ method_option :build_config_dir, :aliases => '-bcd', :desc => 'Defines the build configuration directory to load the build configuration file. You can set FORJ_BLD_CONF_DIR. By default, it will look in your current directory.'
65
+ method_option :build_config, :aliases => '-bc', :desc => 'The build config file to load <confdir>/<BoxName>.<Config>.env. By default, uses "master" as Config.'
66
+ method_option :branch, :aliases => '-gb', :desc => 'The build will extract from git branch name. It sets the configuration build <config> to the branch name <branch>.'
67
+ method_option :test_box, :aliases => '-tb', :desc => 'Create test-box meta from the repository path provided.'
68
+ method_option :git_repo, :aliases => '-gr', :desc => 'The box built will use a different git repository sent out to <user_data>. This repository needs to be read only. No keys are sent.'
69
+ method_option :boothook, :aliases => '-b', :desc => 'By default, boothook file used is build/bin/build-tools/boothook.sh. Use this option to set another one.'
70
+ method_option :box_name, :aliases => '-bn', :desc => 'Defines the name of the box or box image to build.'
70
71
 
71
72
  def boot(blueprint, on, cloud_provider, as, name, test = false)
72
- build_conf_dir = options[:build_conf_dir]
73
- branch = options[:branch]
74
- unless branch
75
- branch = 'master'
76
- end
77
- if options[:build_conf_dir]
78
- Boot::boot(blueprint, cloud_provider, name, build_conf_dir, branch, test)
79
- else
80
- Boot::boot(blueprint, cloud_provider, name, nil, nil, test)
81
- end
82
-
73
+ Boot.boot(blueprint, cloud_provider, name,
74
+ options[:build], options[:build_config_dir],
75
+ options[:build_config], options[:branch],
76
+ options[:git_repo], options[:boothook],
77
+ options[:box_name], test)
83
78
  end
84
79
 
85
80
  desc 'down', 'delete the Maestro box and all systems installed by the blueprint'
86
81
  def down(name)
87
- Down::down(name)
82
+ Down.down(name)
88
83
  end
89
84
 
90
85
  desc 'ssh', 'connect to your forge thru ssh'
91
86
  def ssh
92
- puts 'ssh'
87
+ Ssh.connect
93
88
  end
94
89
 
95
90
  desc 'setup', 'set the credentials for forj cli'
96
91
  def setup
97
- Setup::setup
92
+ Setup.setup
98
93
  end
99
-
100
94
  end
101
95
 
102
96
 
data/lib/boot.rb CHANGED
@@ -35,7 +35,10 @@ include Helpers
35
35
  # Boot module
36
36
  #
37
37
  module Boot
38
- def boot(blueprint, cloud_provider, name, build_config_dir, branch, test = false)
38
+ def boot(blueprint, cloud_provider, name,
39
+ build, build_config_dir, build_config,
40
+ branch, git_repo, boothook, box_name,
41
+ test = false)
39
42
  begin
40
43
  initial_msg = 'booting %s on %s' % [blueprint , cloud_provider]
41
44
 
@@ -74,13 +77,21 @@ module Boot
74
77
  build_path = home + '/.forj/maestro/build'
75
78
  Dir.chdir(build_path)
76
79
 
77
- if build_config_dir
78
- command = 'bin/build.sh --build_ID maestro.%s --box-name maestro --build-conf-dir %s --build-config box-13.5 --gitBranch %s' % [name,build_config_dir, branch]
79
- elsif blueprint != 'redstone'
80
- command = 'bin/build.sh --build_ID %s --box-name maestro --build-conf-dir ~/.forj/maestro/build/conf --build-config box --blueprint %s' % [name, blueprint]
81
- else
82
- command = 'bin/build.sh --build_ID %s --box-name maestro --build-conf-dir ~/.forj/maestro/build/conf --build-config box' % [name]
83
- end
80
+ build = 'bin/build.sh' unless build
81
+
82
+ build_config_dir = '~/.forj/maestro/build/conf' unless build_config_dir
83
+
84
+ build_config = 'box' unless build_config
85
+
86
+ branch = 'master' unless branch
87
+
88
+ git_repo = 'review:forj-oss/maestro' unless git_repo
89
+
90
+ box_name = 'maestro' unless box_name
91
+
92
+ boothook = '~/.forj/maestro/build/bin/build-tools/boothook.sh' unless boothook
93
+
94
+ command = '%s --build_ID %s --box-name %s --build-conf-dir %s --build-config %s --gitBranch %s --gitRepo %s --boothook %s' % [build, name, box_name, build_config_dir, build_config, branch, git_repo, boothook]
84
95
 
85
96
  Kernel.system(command)
86
97
  Dir.chdir(current_dir)
data/lib/ssh.rb CHANGED
@@ -13,4 +13,13 @@
13
13
  # distributed under the License is distributed on an "AS IS" BASIS,
14
14
  # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
15
  # See the License for the specific language governing permissions and
16
- # limitations under the License.
16
+ # limitations under the License.
17
+
18
+ #
19
+ # ssh module
20
+ #
21
+ module Ssh
22
+ def connect
23
+ puts 'ssh'
24
+ end
25
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: forj
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.26
4
+ version: 0.0.27
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,18 +13,18 @@ date: 2014-06-12 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: thor
16
- requirement: &6798920 !ruby/object:Gem::Requirement
16
+ requirement: &13745640 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
20
20
  - !ruby/object:Gem::Version
21
- version: 0.16.0
21
+ version: 0.19.1
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *6798920
24
+ version_requirements: *13745640
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: nokogiri
27
- requirement: &6798140 !ruby/object:Gem::Requirement
27
+ requirement: &13791200 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ~>
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: 1.5.11
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *6798140
35
+ version_requirements: *13791200
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: fog
38
- requirement: &6794340 !ruby/object:Gem::Requirement
38
+ requirement: &13788180 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ~>
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: 1.19.0
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *6794340
46
+ version_requirements: *13788180
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: hpcloud
49
- requirement: &6793360 !ruby/object:Gem::Requirement
49
+ requirement: &13673420 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ~>
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: 2.0.8
55
55
  type: :runtime
56
56
  prerelease: false
57
- version_requirements: *6793360
57
+ version_requirements: *13673420
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: git
60
- requirement: &6792560 !ruby/object:Gem::Requirement
60
+ requirement: &13672220 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ! '>='
@@ -65,10 +65,10 @@ dependencies:
65
65
  version: 1.2.7
66
66
  type: :runtime
67
67
  prerelease: false
68
- version_requirements: *6792560
68
+ version_requirements: *13672220
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rbx-require-relative
71
- requirement: &6791900 !ruby/object:Gem::Requirement
71
+ requirement: &13670800 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ~>
@@ -76,7 +76,7 @@ dependencies:
76
76
  version: 0.0.7
77
77
  type: :runtime
78
78
  prerelease: false
79
- version_requirements: *6791900
79
+ version_requirements: *13670800
80
80
  description: forj command line
81
81
  email:
82
82
  - forj@forj.io
@@ -110,13 +110,10 @@ files:
110
110
  - Rakefile
111
111
  - Gemfile
112
112
  - README.md
113
- - .rspec
114
- - .rubocop.yml
115
113
  homepage: https://forj.io
116
114
  licenses:
117
115
  - Apache License, Version 2.0.
118
- post_install_message: ! "Go to docs.forj.io for more\n information
119
- on how to use forj cli"
116
+ post_install_message: Go to docs.forj.io for more information on how to use forj cli
120
117
  rdoc_options: []
121
118
  require_paths:
122
119
  - lib
data/.rspec DELETED
@@ -1,3 +0,0 @@
1
- --color
2
- --warnings
3
- --require spec_helper
data/.rubocop.yml DELETED
@@ -1,22 +0,0 @@
1
- # (c) Copyright 2014 Hewlett-Packard Development Company, L.P.
2
- #
3
- # Licensed under the Apache License, Version 2.0 (the "License");
4
- # you may not use this file except in compliance with the License.
5
- # You may obtain a copy of the License at
6
- #
7
- # http://www.apache.org/licenses/LICENSE-2.0
8
- #
9
- # Unless required by applicable law or agreed to in writing, software
10
- # distributed under the License is distributed on an "AS IS" BASIS,
11
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- # See the License for the specific language governing permissions and
13
- # limitations under the License.
14
-
15
- # limit lines to 80 characters.
16
- LineLength:
17
- Max: 200
18
- Enabled: true
19
- # disabled while we still support ruby 1.8
20
- HashSyntax:
21
- Description: 'Prefer Ruby 1.9 hash syntax over 1.8 syntax'
22
- Enabled: false