devbox_launcher 0.7.1 → 1.1.1

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: 7dba24702fd7a8544853fb57f70e2eacefde9baaad77c89395e02386a7cb8f8e
4
+ data.tar.gz: c1429492e09d53cb713aff3350dc9f9bb1493cfde9f3ab5b13661e55a0ae9cfd
5
5
  SHA512:
6
- metadata.gz: fb0e7f1d59c4a81faa72586cb618d24f3dc75f1a04711427a74846e34ab2fda3df2dac8098211d7734b3d3b5f4c010c6683a5f12efb36c8e13c30ace73291e70
7
- data.tar.gz: 5d558bf0456db555941e8e5b6bf498af28280420f86dd0d2e3b438819a878528889cda7155a8e5050116a783a6f16dec3d47b2704238bbdd5a19230902a130e3
6
+ metadata.gz: 1a2575b81a0874f3feeae362f34629ac12dc911a10724304ad7a02ce9e682c030f0c1be9219c4f54a59dcd84a289163e040c256cc56c85c84ca54894d6058b5b
7
+ data.tar.gz: b4de4abcd93eef4da20fa422ddc1f19613cb8d3d9faa6415ddfd32eabf68fd5a10c3bb0f1df0e1191bb64491e3ba6b4256c0218ac9a75631023c91bf7d014fe0
data/CHANGELOG.md CHANGED
@@ -4,6 +4,19 @@ 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.1.1] - 2022-04-25
8
+ ### Fixed
9
+ - Conflicts between beta and alpha
10
+
11
+ ## [1.1.0] - 2022-04-18
12
+ ### Changed
13
+ - Ignore version control system directories like `.git`. You will be unable to use git in the remote machine.
14
+ - Ignore `.DS_Store` files
15
+
16
+ ## [1.0.0] - 2021-12-20
17
+ ### Changed
18
+ - Update compatibility with mutagen 0.12.0. Drops support for previous versions
19
+
7
20
  ## [0.7.1] - 2021-10-14
8
21
  ### Fixed
9
22
  - 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.1.1)
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.5)
18
18
  concurrent-ruby (~> 1.0, >= 1.0.2)
19
19
  i18n (>= 1.6, < 2)
20
20
  minitest (>= 5.1)
@@ -23,15 +23,15 @@ GEM
23
23
  bcrypt_pbkdf (1.1.0)
24
24
  byebug (11.0.1)
25
25
  coderay (1.1.2)
26
- concurrent-ruby (1.1.9)
26
+ concurrent-ruby (1.1.10)
27
27
  diff-lcs (1.3)
28
- ed25519 (1.2.4)
29
- i18n (1.8.10)
28
+ ed25519 (1.3.0)
29
+ i18n (1.10.0)
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)
@@ -54,10 +54,10 @@ GEM
54
54
  rspec-support (3.9.0)
55
55
  ruby-watchman (0.0.2)
56
56
  ssh-config (0.1.3)
57
- thor (1.1.0)
57
+ thor (1.2.1)
58
58
  tzinfo (2.0.4)
59
59
  concurrent-ruby (~> 1.0)
60
- zeitwerk (2.4.2)
60
+ zeitwerk (2.5.4)
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,86 @@
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
+ "--sync-mode=two-way-resolved",
42
+ "--ignore-vcs",
43
+ "--ignore=.DS_Store"
44
+ ]
45
+ str << "--watch-mode-alpha=no-watch" if linux?
46
+ str.join(" ")
47
+ end
48
+
49
+ def terminate_cmd
50
+ %Q(mutagen sync terminate --label-selector=#{label})
51
+ end
52
+
53
+ def terminate
54
+ puts "Terminating mutagen session..."
55
+ terminate_stdout,
56
+ terminate_stderr,
57
+ terminate_status =
58
+ Open3.capture3(terminate_cmd)
59
+
60
+ if not terminate_status.success?
61
+ # mutagen prints to stdout and stderr
62
+ msg = "Failed to terminate mutagen sessions: " \
63
+ "#{terminate_stdout} -" \
64
+ "#{terminate_stderr}"
65
+ fail msg
66
+ end
67
+ end
68
+
69
+ def watch_alpha
70
+ watchman.trigger("mutagen sync flush --label-selector=#{label}")
71
+ end
72
+
73
+ def watchman
74
+ @watchman ||= Watchman.new(dir: config.alpha_dir)
75
+ end
76
+
77
+ def reset
78
+ return if !config.configured?
79
+
80
+ terminate
81
+ create
82
+ watch_alpha if linux?
83
+ end
84
+
85
+ end
86
+ end
@@ -1,3 +1,3 @@
1
1
  module DevboxLauncher
2
- VERSION = "0.7.1"
2
+ VERSION = "1.1.1"
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.1.1
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: 2022-04-25 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