devbox_launcher 0.7.1 → 1.0.0

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: 73bbdd9915f666e004ef152b8749e333face998265474ecddbf5d01f55a30f01
4
- data.tar.gz: af3b044ffff0318f3fdf622ef688685c7eba44068976703e32255038d79f26ea
3
+ metadata.gz: f36523ab1ba2737746a95069dc0bd49e1e182b9449ff8af6ad7ba2c8eba6fac5
4
+ data.tar.gz: 4d9ec6e2cf0df27fe3ae57d2860312272140a238ab43b460dc1b8b706982f77b
5
5
  SHA512:
6
- metadata.gz: fb0e7f1d59c4a81faa72586cb618d24f3dc75f1a04711427a74846e34ab2fda3df2dac8098211d7734b3d3b5f4c010c6683a5f12efb36c8e13c30ace73291e70
7
- data.tar.gz: 5d558bf0456db555941e8e5b6bf498af28280420f86dd0d2e3b438819a878528889cda7155a8e5050116a783a6f16dec3d47b2704238bbdd5a19230902a130e3
6
+ metadata.gz: 272f2e79480f5439a98797833bb21709ca4137a04f3ea46b0a70b3c473ccac66a0e53e688699923d2a71fed52e11bc704f3ff08fbefb41d86888bc35388251d5
7
+ data.tar.gz: 0321766ede0a716eb6e3d3745213ea2e810cfd74b3fde853dc98627354ac92f610e5983e50f043812eab0d6fb017784801b0780d204a6640ef5dbc29b22194dd
data/CHANGELOG.md CHANGED
@@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
4
4
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
5
5
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6
6
 
7
+ ## [1.0.0] - 2021-12-20
8
+ ### Changed
9
+ - Update compatibility with mutagen 0.12.0. Drops support for previous versions
10
+
7
11
  ## [0.7.1] - 2021-10-14
8
12
  ### Fixed
9
13
  - Explicitly require fileutils for Ruby 3.0 compatibility
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- devbox_launcher (0.7.1)
4
+ devbox_launcher (1.0.0)
5
5
  activesupport (~> 6.0)
6
6
  bcrypt_pbkdf (~> 1.0)
7
7
  ed25519 (~> 1.2)
@@ -14,7 +14,7 @@ PATH
14
14
  GEM
15
15
  remote: https://rubygems.org/
16
16
  specs:
17
- activesupport (6.1.4.1)
17
+ activesupport (6.1.4.4)
18
18
  concurrent-ruby (~> 1.0, >= 1.0.2)
19
19
  i18n (>= 1.6, < 2)
20
20
  minitest (>= 5.1)
@@ -26,12 +26,12 @@ GEM
26
26
  concurrent-ruby (1.1.9)
27
27
  diff-lcs (1.3)
28
28
  ed25519 (1.2.4)
29
- i18n (1.8.10)
29
+ i18n (1.8.11)
30
30
  concurrent-ruby (~> 1.0)
31
31
  method_source (0.9.2)
32
- minitest (5.14.4)
32
+ minitest (5.15.0)
33
33
  net-ssh (5.2.0)
34
- os (1.1.1)
34
+ os (1.1.4)
35
35
  pry (0.12.2)
36
36
  coderay (~> 1.1.0)
37
37
  method_source (~> 0.9.0)
@@ -57,7 +57,7 @@ GEM
57
57
  thor (1.1.0)
58
58
  tzinfo (2.0.4)
59
59
  concurrent-ruby (~> 1.0)
60
- zeitwerk (2.4.2)
60
+ zeitwerk (2.5.1)
61
61
 
62
62
  PLATFORMS
63
63
  ruby
@@ -70,4 +70,4 @@ DEPENDENCIES
70
70
  rspec (~> 3.0)
71
71
 
72
72
  BUNDLED WITH
73
- 2.2.27
73
+ 2.2.28
@@ -33,7 +33,7 @@ module DevboxLauncher
33
33
 
34
34
  wait_boot
35
35
 
36
- reset_mutagen_session
36
+ mutagen_session.reset
37
37
 
38
38
  connect_mosh || connect_ssh
39
39
  end
@@ -111,68 +111,10 @@ module DevboxLauncher
111
111
  ssh_config.save
112
112
  end
113
113
 
114
- def reset_mutagen_session
115
- return if !mutagen_config.configured?
116
-
117
- terminate_mutagen_session
118
- create_mutagen_session
119
- watch_alpha if OS.linux?
120
- end
121
-
122
- def terminate_mutagen_session
123
- puts "Terminating mutagen session..."
124
- terminate_mutagen_cmd =
125
- %Q(mutagen terminate --label-selector=#{label})
126
- terminate_mutagen_stdout,
127
- terminate_mutagen_stderr,
128
- terminate_mutagen_status =
129
- Open3.capture3(terminate_mutagen_cmd)
130
-
131
- if not terminate_mutagen_status.success?
132
- # mutagen prints to stdout and stderr
133
- msg = "Failed to terminate mutagen sessions: " \
134
- "#{terminate_mutagen_stdout} -" \
135
- "#{terminate_mutagen_stderr}"
136
- fail msg
137
- end
138
- end
139
-
140
114
  def label
141
115
  "#{username}=#{name}"
142
116
  end
143
117
 
144
- def create_mutagen_session
145
- puts "Create mutagen session syncing local " \
146
- "#{mutagen_config.alpha_dir} with " \
147
- "#{hostname} #{mutagen_config.beta_dir}"
148
-
149
- create_mutagen_cmd = [
150
- "mutagen sync create",
151
- mutagen_config.alpha_dir,
152
- "#{hostname}:#{mutagen_config.beta_dir}",
153
- "--label=#{label}",
154
- ]
155
- create_mutagen_cmd << "--watch-mode-alpha=no-watch" if OS.linux?
156
-
157
- create_mutagen_stdout,
158
- create_mutagen_stderr,
159
- create_mutagen_status =
160
- Open3.capture3(create_mutagen_cmd.join(" "))
161
-
162
- if not create_mutagen_status.success?
163
- # mutagen prints to stdout and stderr
164
- msg = "Failed to create mutagen sessions: " \
165
- "#{create_mutagen_stdout} -" \
166
- "#{create_mutagen_stderr}"
167
- fail msg
168
- end
169
- end
170
-
171
- def watch_alpha
172
- watchman = Watchman.new(dir: mutagen_config.alpha_dir)
173
- watchman.trigger("mutagen sync flush --label-selector=#{label}")
174
- end
175
-
176
118
  def box_name_from_config
177
119
  passed_in_box_name = @account_and_box_name.split("/")[1]
178
120
 
@@ -246,6 +188,13 @@ module DevboxLauncher
246
188
  ].join(" ")
247
189
  end
248
190
 
191
+ def mutagen_session
192
+ @mutagen_session ||= MutagenSession.new(
193
+ label: label,
194
+ config: mutagen_config,
195
+ hostname: hostname,
196
+ )
197
+ end
249
198
 
250
199
  end
251
200
  end
@@ -10,7 +10,7 @@ module DevboxLauncher
10
10
  end
11
11
 
12
12
  def mutagen_config
13
- Mutagen.new(config[:mutagen])
13
+ MutagenConfig.new(config[:mutagen])
14
14
  end
15
15
 
16
16
  def project
@@ -0,0 +1,24 @@
1
+ module DevboxLauncher
2
+ class MutagenConfig
3
+
4
+ attr_reader :config
5
+
6
+ def initialize(config)
7
+ @config = config
8
+ end
9
+
10
+ def configured?
11
+ return false if config.nil?
12
+ [alpha_dir, beta_dir].all?(&:present?)
13
+ end
14
+
15
+ def alpha_dir
16
+ config[:alpha]
17
+ end
18
+
19
+ def beta_dir
20
+ config[:beta]
21
+ end
22
+
23
+ end
24
+ end
@@ -0,0 +1,83 @@
1
+ module DevboxLauncher
2
+ class MutagenSession
3
+
4
+ attr_reader :label, :config, :hostname
5
+
6
+ def initialize(label:, config:, hostname:)
7
+ @label = label
8
+ @config = config
9
+ @hostname = hostname
10
+ end
11
+
12
+ def create
13
+ puts "Create mutagen session syncing local " \
14
+ "#{config.alpha_dir} with " \
15
+ "#{hostname} #{config.beta_dir}"
16
+
17
+ create_stdout,
18
+ create_stderr,
19
+ create_status =
20
+ Open3.capture3(create_cmd)
21
+
22
+ if not create_status.success?
23
+ # mutagen prints to stdout and stderr
24
+ msg = "Failed to create mutagen sessions: " \
25
+ "#{create_stdout} -" \
26
+ "#{create_stderr}"
27
+ fail msg
28
+ end
29
+ end
30
+
31
+ def linux?
32
+ OS.linux?
33
+ end
34
+
35
+ def create_cmd
36
+ str = [
37
+ "mutagen sync create",
38
+ config.alpha_dir,
39
+ "#{hostname}:#{config.beta_dir}",
40
+ "--label=#{label}",
41
+ ]
42
+ str << "--watch-mode-alpha=no-watch" if linux?
43
+ str.join(" ")
44
+ end
45
+
46
+ def terminate_cmd
47
+ %Q(mutagen sync terminate --label-selector=#{label})
48
+ end
49
+
50
+ def terminate
51
+ puts "Terminating mutagen session..."
52
+ terminate_stdout,
53
+ terminate_stderr,
54
+ terminate_status =
55
+ Open3.capture3(terminate_cmd)
56
+
57
+ if not terminate_status.success?
58
+ # mutagen prints to stdout and stderr
59
+ msg = "Failed to terminate mutagen sessions: " \
60
+ "#{terminate_stdout} -" \
61
+ "#{terminate_stderr}"
62
+ fail msg
63
+ end
64
+ end
65
+
66
+ def watch_alpha
67
+ watchman.trigger("mutagen sync flush --label-selector=#{label}")
68
+ end
69
+
70
+ def watchman
71
+ @watchman ||= Watchman.new(dir: config.alpha_dir)
72
+ end
73
+
74
+ def reset
75
+ return if !config.configured?
76
+
77
+ terminate
78
+ create
79
+ watch_alpha if linux?
80
+ end
81
+
82
+ end
83
+ end
@@ -1,3 +1,3 @@
1
1
  module DevboxLauncher
2
- VERSION = "0.7.1"
2
+ VERSION = "1.0.0"
3
3
  end
@@ -19,7 +19,8 @@ end
19
19
  require "devbox_launcher/cli"
20
20
  require "devbox_launcher/watchman"
21
21
  require "devbox_launcher/models/description"
22
- require "devbox_launcher/models/mutagen"
22
+ require "devbox_launcher/models/mutagen_config"
23
+ require "devbox_launcher/models/mutagen_session"
23
24
  require "devbox_launcher/models/box"
24
25
  require "devbox_launcher/models/account_config"
25
26
  require "devbox_launcher/models/box_config"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: devbox_launcher
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.1
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ramon Tayag
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-10-14 00:00:00.000000000 Z
11
+ date: 2021-12-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -195,6 +195,8 @@ files:
195
195
  - lib/devbox_launcher/models/box_config.rb
196
196
  - lib/devbox_launcher/models/description.rb
197
197
  - lib/devbox_launcher/models/mutagen.rb
198
+ - lib/devbox_launcher/models/mutagen_config.rb
199
+ - lib/devbox_launcher/models/mutagen_session.rb
198
200
  - lib/devbox_launcher/version.rb
199
201
  - lib/devbox_launcher/watchman.rb
200
202
  homepage: https://github.com/bloom-solutions/devbox_launcher