knife-director 0.1.1 → 0.1.2

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: 5d1ad7108d7a684d1cbb46eb8fdfb5d6bfb465b0
4
- data.tar.gz: faf71ac4b45128c75c1af4f2cb55fbc3577e76de
3
+ metadata.gz: e51add47bfc73493493af784cb7da92fa424fa27
4
+ data.tar.gz: 4b3c1dfe4f38a0a7a9036dbc85e97c9d8527932b
5
5
  SHA512:
6
- metadata.gz: fc2741245738bf9da4ba0506af18c21510c22051bd4645a8426ac3233a84870062144ca4aeba3a2323f68669589f7840c6dfaccd1ed5620a96dfee98725c3868
7
- data.tar.gz: b391633b30fc107e3c6320d0b4a099f6f4f287aae29d3921f02e11dc39867f2d4e2a687a1141d102d82fa19e316241b047a05a31f63a24b3b32af32113f7be05
6
+ metadata.gz: 39b9bc1b0b73e0c00ac7fe3dfe8283426ca9b9b2f4a7b5ed208f4f51cc0fb14abb5c5fa8c37c547da6129c87043855def721e2ba1bed240f1a6bc46388e10de0
7
+ data.tar.gz: 99f0eb847dbeba3802895924a5dc0a6d96f26ce1dab5c764b637ae91d7a850c1ad60cd86096e5e85e901a516e3c35172d525e47b6a0b263167d5ad7bab7a50f9
@@ -0,0 +1,55 @@
1
+ version: 2
2
+ jobs:
3
+ build:
4
+ docker:
5
+ - image: circleci/ruby:2.4.1-node-browsers
6
+ working_directory: ~/repo
7
+
8
+ steps:
9
+ - checkout
10
+
11
+ - restore_cache:
12
+ keys:
13
+ - v1-dependencies-{{ checksum "Gemfile.lock" }}
14
+ # fallback to using the latest cache if no exact match is found
15
+ - v1-dependencies-
16
+
17
+ - run:
18
+ name: install dependencies
19
+ command: |
20
+ bundle install --jobs=4 --retry=3 --path vendor/bundle
21
+
22
+ - save_cache:
23
+ paths:
24
+ - ./venv
25
+ key: v1-dependencies-{{ checksum "Gemfile.lock" }}
26
+
27
+ - run:
28
+ name: Prepare CodeClimate
29
+ command: |
30
+ curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
31
+
32
+ # run tests!
33
+ - run:
34
+ name: run tests
35
+ command: |
36
+ mkdir /tmp/test-results
37
+ TEST_FILES="$(circleci tests glob "spec/**/*_spec.rb" | circleci tests split --split-by=timings)"
38
+
39
+ bundle exec rspec --format progress \
40
+ --format RspecJunitFormatter \
41
+ --out /tmp/test-results/rspec.xml \
42
+ --format progress \
43
+ ${TEST_FILES}
44
+
45
+ - run:
46
+ name: Report to CodeClimate
47
+ command: |
48
+ bundle exec codeclimate-test-reporter
49
+
50
+ # collect reports
51
+ - store_test_results:
52
+ path: /tmp/test-results
53
+ - store_artifacts:
54
+ path: /tmp/test-results
55
+ destination: test-results
data/.rubocop.yml CHANGED
@@ -6,3 +6,15 @@ Style/Documentation:
6
6
  - 'spec/**/*'
7
7
  - 'test/**/*'
8
8
  - 'lib/knife/director.rb'
9
+
10
+ Metrics/BlockLength:
11
+ Exclude:
12
+ - "spec/**/*"
13
+
14
+ Style/BlockDelimiters:
15
+ EnforcedStyle: semantic
16
+ FunctionalMethods:
17
+ - let
18
+ - let!
19
+ - expect
20
+ - git_source
data/README.md CHANGED
@@ -1,3 +1,9 @@
1
+ [![Gem Version](https://badge.fury.io/rb/knife-director.svg)](https://badge.fury.io/rb/knife-director)
2
+ [![CircleCI](https://circleci.com/gh/elastic-infra/knife-director.svg?style=svg)](https://circleci.com/gh/elastic-infra/knife-director)
3
+ [![Code Climate](https://codeclimate.com/github/elastic-infra/knife-director/badges/gpa.svg)](https://codeclimate.com/github/elastic-infra/knife-director)
4
+ [![Test Coverage](https://codeclimate.com/github/elastic-infra/knife-director/badges/coverage.svg)](https://codeclimate.com/github/elastic-infra/knife-director/coverage)
5
+ [![Issue Count](https://codeclimate.com/github/elastic-infra/knife-director/badges/issue_count.svg)](https://codeclimate.com/github/elastic-infra/knife-director)
6
+
1
7
  # Knife::Director
2
8
 
3
9
  This gem provides wrappers for `knife bootstrap` or `knife zero` and so on.
@@ -30,9 +36,9 @@ knife director bootstrap windows $target -E $env
30
36
 
31
37
  ## Provided commands
32
38
 
33
- ### knife director bootstrap XXX
39
+ ### knife director bootstrap $OS
34
40
 
35
- `XXX` can be `linux` or `windows`.
41
+ `$OS` can be `linux` or `windows`.
36
42
 
37
43
  It wraps `knife bootstrap` or `knife bootstrap windows winrm`.
38
44
  You can't omit `-E (--environment)` option.
@@ -26,7 +26,10 @@ Gem::Specification.new do |spec|
26
26
  spec.add_development_dependency 'bundler', '~> 1.15'
27
27
  spec.add_development_dependency 'rake', '~> 10.0'
28
28
  spec.add_development_dependency 'rspec', '~> 3.0'
29
+ spec.add_development_dependency 'rspec_junit_formatter'
29
30
  spec.add_development_dependency 'chef', '>= 12.2.1'
31
+ spec.add_development_dependency 'simplecov'
32
+ spec.add_development_dependency 'codeclimate-test-reporter', '~> 1.0.0'
30
33
  spec.add_dependency 'knife-zero'
31
34
  spec.add_dependency 'knife-windows'
32
35
  spec.add_dependency 'knife-bootstrap-resolver'
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ElasticInfra
4
+ # Common DirectorBootstrap module
5
+ module DirectorBootstrapBase
6
+ def bootstrap_template
7
+ return nil if config[:bootstrap_template] == '__no_template__'
8
+ config[:bootstrap_template] || @default_template
9
+ end
10
+
11
+ def run
12
+ unless config[:environment]
13
+ puts 'You must specify environment other than _default'
14
+ show_usage
15
+ exit 1
16
+ end
17
+ target_hostname = name_args[0].gsub(/.*@/, '')
18
+ config[:chef_node_name] ||= target_hostname
19
+ config[:bootstrap_template] = bootstrap_template
20
+ super
21
+ end
22
+ end
23
+ end
@@ -3,6 +3,7 @@
3
3
  require 'chef/knife'
4
4
  require 'chef/knife/bootstrap'
5
5
  require 'chef/knife/bootstrap_resolver'
6
+ require 'chef/knife/director_bootstrap_base'
6
7
 
7
8
  module ElasticInfra
8
9
  # knife bootstrap wrapper for Linux
@@ -13,6 +14,10 @@ module ElasticInfra
13
14
  # host0001 -N host0001 \
14
15
  # -E production \
15
16
  # -t linux
17
+ DEFAULT_TEMPLATE = 'linux'
18
+
19
+ include DirectorBootstrapBase
20
+
16
21
  deps do
17
22
  Chef::Knife::Bootstrap.load_deps
18
23
  end
@@ -23,24 +28,8 @@ module ElasticInfra
23
28
  self.options = Bootstrap.options.merge(options)
24
29
 
25
30
  def initialize(argv = [])
31
+ @default_template = DEFAULT_TEMPLATE
26
32
  super
27
33
  end
28
-
29
- def run
30
- unless config[:environment]
31
- puts 'You must specify environment other than _default'
32
- show_usage
33
- exit 1
34
- end
35
- target_hostname = name_args[0].gsub(/.*@/, '')
36
- config[:chef_node_name] ||= target_hostname
37
- config[:bootstrap_template] = bootstrap_template
38
- super
39
- end
40
-
41
- def bootstrap_template
42
- return nil if config[:bootstrap_template] == '__no_template__'
43
- config[:bootstrap_template] || 'linux'
44
- end
45
34
  end
46
35
  end
@@ -12,6 +12,10 @@ module ElasticInfra
12
12
  # host0001 -N host0001 \
13
13
  # -E production \
14
14
  # --bootstrap-template windows
15
+ DEFAULT_TEMPLATE = 'windows'
16
+
17
+ include DirectorBootstrapBase
18
+
15
19
  deps do
16
20
  Chef::Knife::BootstrapWindowsWinrm.load_deps
17
21
  end
@@ -21,21 +25,9 @@ module ElasticInfra
21
25
 
22
26
  self.options = BootstrapWindowsWinrm.options.merge(options)
23
27
 
24
- def run
25
- unless config[:environment]
26
- puts 'You must specify environment other than _default'
27
- show_usage
28
- exit 1
29
- end
30
- target_hostname = name_args[0].gsub(/.*@/, '')
31
- config[:chef_node_name] ||= target_hostname
32
- config[:bootstrap_template] = bootstrap_template
28
+ def initialize(argv = [])
29
+ @default_template = DEFAULT_TEMPLATE
33
30
  super
34
31
  end
35
-
36
- def bootstrap_template
37
- return nil if config[:bootstrap_template] == '__no_template__'
38
- config[:bootstrap_template] || 'windows'
39
- end
40
32
  end
41
33
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Knife
4
4
  module Director
5
- VERSION = '0.1.1'
5
+ VERSION = '0.1.2'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: knife-director
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - limitusus
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-08-29 00:00:00.000000000 Z
11
+ date: 2017-08-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -52,6 +52,20 @@ dependencies:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: '3.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rspec_junit_formatter
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
55
69
  - !ruby/object:Gem::Dependency
56
70
  name: chef
57
71
  requirement: !ruby/object:Gem::Requirement
@@ -66,6 +80,34 @@ dependencies:
66
80
  - - ">="
67
81
  - !ruby/object:Gem::Version
68
82
  version: 12.2.1
83
+ - !ruby/object:Gem::Dependency
84
+ name: simplecov
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: codeclimate-test-reporter
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: 1.0.0
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: 1.0.0
69
111
  - !ruby/object:Gem::Dependency
70
112
  name: knife-zero
71
113
  requirement: !ruby/object:Gem::Requirement
@@ -115,6 +157,7 @@ executables: []
115
157
  extensions: []
116
158
  extra_rdoc_files: []
117
159
  files:
160
+ - ".circleci/config.yml"
118
161
  - ".gitignore"
119
162
  - ".rspec"
120
163
  - ".rubocop.yml"
@@ -127,6 +170,7 @@ files:
127
170
  - bin/console
128
171
  - bin/setup
129
172
  - knife-director.gemspec
173
+ - lib/chef/knife/director_bootstrap_base.rb
130
174
  - lib/chef/knife/director_bootstrap_linux.rb
131
175
  - lib/chef/knife/director_bootstrap_windows.rb
132
176
  - lib/knife/director.rb