terraspace 0.5.1 → 0.5.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
  SHA256:
3
- metadata.gz: f43880b8fc93060a328decf3fa5ac770253341995ec800e6d38b86f7696d5912
4
- data.tar.gz: 9337cb32f020b54e5693aa2dde06960c22a8fd8755ff55bf1ebb0ebf4cd2fccf
3
+ metadata.gz: f6a2a88fa818f4181306424fffdba0416c2df409e464b632ea941e761b8ed275
4
+ data.tar.gz: eaf2ce61be5ff4b72f01e6f4ca9da7eb4ee573f42e5865319a90630659544c2e
5
5
  SHA512:
6
- metadata.gz: '09047e18b86cf30f2a013c7c20f864ef3540120f7f70c12bae854f80f60f952a84e109811ab59aa078e331c0fc34134c9f84dd85f73d7dab5c08ee2208454c17'
7
- data.tar.gz: 69eb21940249f6566de22d88dd33165d4265aed490deafc81659ac59d04f7c9b1436ae4b2cbdc09e74f6279e82fdbaa620001610fd2022584dcc599e23bda10e
6
+ metadata.gz: b6b38903334e7855e19517ec79059dd9887d85aa44819ed811af0deedaae8fbed5d8502546e675302c786604a7c110313a27b312a5489cff26071a9c784e8bd0
7
+ data.tar.gz: f117135d46f25c238e89a459666ade7fe4ef944726abae05fe9af4e6101e42198d5f91d39e06f42bfbb20f987f172ac4b677d08e3bf66c84272c0746751fdcfe
@@ -3,6 +3,11 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  This project *loosely tries* to adhere to [Semantic Versioning](http://semver.org/), even before v1.0.
5
5
 
6
+ ## [0.5.2] - 2020-11-27
7
+ - [#59](https://github.com/boltops-tools/terraspace/pull/59) only run bundler/setup within terraspace project and check standalone install
8
+ - fix terraspace help
9
+ - fix terraspace setup check when terraform is not installed
10
+
6
11
  ## [0.5.1] - 2020-11-17
7
12
  - [#56](https://github.com/boltops-tools/terraspace/pull/56) fix arg and hook generators
8
13
  - fix ci build
@@ -1,7 +1,5 @@
1
- if File.exist?("config/app.rb")
2
- require "terraspace/bundle"
3
- Terraspace::Bundle.setup
4
- end
1
+ require "terraspace/bundle"
2
+ Terraspace::Bundle.setup
5
3
  require "zeitwerk"
6
4
 
7
5
  module Terraspace
@@ -8,6 +8,7 @@ module Terraspace
8
8
  #
9
9
  def setup
10
10
  return unless gemfile?
11
+ return unless terraspace_project?
11
12
  Kernel.require "bundler/setup"
12
13
  Bundler.setup # Same as Bundler.setup(:default)
13
14
  rescue LoadError => e
@@ -16,12 +17,17 @@ module Terraspace
16
17
 
17
18
  def require
18
19
  return unless gemfile?
20
+ return unless terraspace_project?
19
21
  Kernel.require "bundler/setup"
20
22
  Bundler.require(*bundler_groups)
21
23
  rescue LoadError => e
22
24
  handle_error(e)
23
25
  end
24
26
 
27
+ def terraspace_project?
28
+ File.exist?("config/app.rb")
29
+ end
30
+
25
31
  def handle_error(e)
26
32
  puts e.message
27
33
  return if e.message.include?("already activated")
@@ -39,6 +39,11 @@ class Terraspace::CLI
39
39
  end
40
40
 
41
41
  def ok?
42
+ unless terraform_bin
43
+ puts "Terraform not installed. Unable to detect a terraform command. Please double check that terraform is installed."
44
+ exit 1
45
+ end
46
+
42
47
  version = terraform_version_message.sub(/.*v/,'') # => 0.12.24
43
48
  unless version.match(/\d+\.\d+\.\d+/) # just parse did not find the version number
44
49
  puts "WARN: Unable to get the terraform version".color(:yellow)
@@ -30,6 +30,7 @@ module Terraspace
30
30
  include Terraspace::Util::Logging
31
31
 
32
32
  def dispatch(m, args, options, config)
33
+ check_standalone_install!
33
34
  check_project!(args.first)
34
35
 
35
36
  # Allow calling for help via:
@@ -58,8 +59,41 @@ module Terraspace
58
59
  super
59
60
  end
60
61
 
62
+ def check_standalone_install!
63
+ return unless opt?
64
+ version_manager = "rvm" if rvm?
65
+ version_manager = "rbenv" if rbenv?
66
+ if rbenv? || rvm?
67
+ puts <<~EOL.color(:yellow)
68
+ WARN: It looks like a standalone Terraspace install and #{version_manager} is also in use.
69
+ Different gems from the standalone Terraspace install and #{version_manager} can cause all kinds of trouble.
70
+ Please install Terraspace as a gem instead and remove the standalone Terraspace /opt/terraspace installation.
71
+ See: https://terraspace.cloud/docs/install/gem/
72
+ EOL
73
+ end
74
+ end
75
+
76
+ def opt?
77
+ paths = ENV['PATH'].split(':')
78
+ opt = paths.detect { |p| p.include?('/opt/terraspace') }
79
+ opt && File.exist?('/opt/terraspace')
80
+ end
81
+
82
+ def rvm?
83
+ paths = ENV['PATH'].split(':')
84
+ rvm = paths.detect { |p| p.include?('/rvm/') || p.include?('/.rvm/') }
85
+ rvm && system("type rvm > /dev/null 2>&1")
86
+ end
87
+
88
+ def rbenv?
89
+ paths = ENV['PATH'].split(':')
90
+ rbenv = paths.detect { |p| p.include?('/rbenv/') || p.include?('/.rbenv/') }
91
+ rbenv && system("type rbenv > /dev/null 2>&1")
92
+ end
93
+
61
94
  def check_project!(command_name)
62
95
  return if subcommand?
96
+ return if command_name.nil?
63
97
  return if %w[-h -v completion completion_script help new test version].include?(command_name)
64
98
  return if File.exist?("#{Terraspace.root}/config/app.rb")
65
99
  logger.error "ERROR: It doesnt look like this is a terraspace project. Are you sure you are in a terraspace project?".color(:red)
@@ -1,3 +1,3 @@
1
1
  module Terraspace
2
- VERSION = "0.5.1"
2
+ VERSION = "0.5.2"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: terraspace
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.1
4
+ version: 0.5.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tung Nguyen
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-11-17 00:00:00.000000000 Z
11
+ date: 2020-11-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport