tomo 1.2.0 → 1.3.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 115894083bfa6e3a5bae19a6f13bcdecb64cafa048330a5983ff06c56c0a4afd
4
- data.tar.gz: a56fd377d7af6322c87864993d84f63320d44684d61aa93e43b5b455f3831cef
3
+ metadata.gz: '098582c6866a637c63527b1bf1fecd347686cf1472ddf4e93b11002180b4e0c3'
4
+ data.tar.gz: 74ea3479cd90f9d3cf038d7b8e6cffa0200a98a51562798ba1b852ca66866f4e
5
5
  SHA512:
6
- metadata.gz: a126544a598ca800627fb65602793ef52929f89d8fc4dd4efff32cae78e667a48987e8a1acea1541897125c6b3402ef57703f691db2b6d143044b6dc4433feb6
7
- data.tar.gz: '0582041ef4e25413d349e9799335d0a9794e926a7bfe54b0a67f4287a0146cf91be246b1df118debf19cec53e5088eba474a8214dd9111b4dd4952480d7e37af'
6
+ metadata.gz: 7ddd09600b3eae9914c7641b08f169f7f802297cf76170b7faffc0d0cb75cd0af22071c5e8d358c244464efe00672d4573054f30a2947b258aaef3af98e9ed74
7
+ data.tar.gz: 78c334db75ce535dd00c434fb3a4a927af4369d7f747cc3776334146c9c41bbae785ddb15e4ec42bdea59a66223a3836644f6bf0ec74e42f57c6de85fc822025
@@ -12,9 +12,10 @@ module Tomo
12
12
  def_delegators :@instance, :interactive?, :prompt, :menu
13
13
  end
14
14
 
15
- def initialize(env=ENV, input=$stdin)
15
+ def initialize(env=ENV, input=$stdin, output=$stdout)
16
16
  @env = env
17
17
  @input = input
18
+ @output = output
18
19
  end
19
20
 
20
21
  def interactive?
@@ -24,7 +25,7 @@ module Tomo
24
25
  def prompt(question)
25
26
  assert_interactive
26
27
 
27
- print question
28
+ output.print question
28
29
  line = input.gets
29
30
  raise_non_interactive if line.nil?
30
31
 
@@ -39,7 +40,7 @@ module Tomo
39
40
 
40
41
  private
41
42
 
42
- attr_reader :env, :input
43
+ attr_reader :env, :input, :output
43
44
 
44
45
  CI_VARS = %w[
45
46
  JENKINS_HOME
@@ -1,7 +1,7 @@
1
1
  require "monitor"
2
2
 
3
3
  module Tomo::Plugin::Env
4
- class Tasks < Tomo::TaskLibrary
4
+ class Tasks < Tomo::TaskLibrary # rubocop:disable Metrics/ClassLength
5
5
  include MonitorMixin
6
6
 
7
7
  def show
@@ -10,8 +10,8 @@ module Tomo::Plugin::Env
10
10
  end
11
11
 
12
12
  def setup
13
- update
14
13
  modify_bashrc
14
+ update
15
15
  end
16
16
 
17
17
  def update
@@ -103,12 +103,37 @@ module Tomo::Plugin::Env
103
103
  existing_rc = remote.capture("cat", paths.bashrc, raise_on_error: false)
104
104
  return if existing_rc.include?(". #{env_path}")
105
105
 
106
+ fail_if_different_app_already_configured!(existing_rc)
107
+
106
108
  remote.write(text: <<~BASHRC + existing_rc, to: paths.bashrc)
107
- if [ -f #{env_path} ]; then
108
- . #{env_path}
109
- fi
109
+ if [ -f #{env_path} ]; then # DO NOT MODIFY THESE LINES
110
+ . #{env_path} # ENV MAINTAINED BY TOMO
111
+ fi #{' ' * env_path.to_s.length}# END TOMO ENV
110
112
 
111
113
  BASHRC
112
114
  end
115
+
116
+ def fail_if_different_app_already_configured!(bashrc)
117
+ existing_env_path = bashrc[/\s*\.\s+(.+)\s+# ENV MAINTAINED BY TOMO/, 1]
118
+ return if existing_env_path.nil?
119
+
120
+ die <<~REASON
121
+ Based on the contents of #{paths.bashrc}, it looks like another application
122
+ is already being deployed via tomo to this host, using the following envrc
123
+ path:
124
+
125
+ #{existing_env_path}
126
+
127
+ Tomo is designed such that only one application can be deployed to a given
128
+ user@host. To deploy multiple applications to the same host, use a separate
129
+ deployer user per app. Refer to the tomo FAQ for details:
130
+
131
+ https://tomo-deploy.com/#faq
132
+
133
+ You may be receiving this message in error if you recently renamed or
134
+ reconfigured your application. In this case, remove the references to the
135
+ old envrc path in the host's #{paths.bashrc} and re-run env:setup.
136
+ REASON
137
+ end
113
138
  end
114
139
  end
@@ -1,3 +1,3 @@
1
1
  module Tomo
2
- VERSION = "1.2.0".freeze
2
+ VERSION = "1.3.0".freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tomo
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matt Brictson
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-07-11 00:00:00.000000000 Z
11
+ date: 2020-08-08 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Tomo is a feature-rich deployment tool that contains everything you need
14
14
  to deploy a basic Rails app out of the box. It has an opinionated, production-tested