devbox_launcher 0.7.0 → 1.1.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: c247836992ba6c6f8b7dc733aca134394ea41eaf0ccf1026e72837992d77aa57
4
- data.tar.gz: 7fde1e5aeff66e1b199d9b1bac17d80368c50d90eb74cd7ddf29fa9923122886
3
+ metadata.gz: c1fc786af61f55bf9d437475367c702ffd752c96e4bb00c2bd033e45eb939878
4
+ data.tar.gz: 598cba8e569b9a44311dd70e938ef62659574fd110efa764c644db96c2bad2c0
5
5
  SHA512:
6
- metadata.gz: 5bb774576f0003c53c757751b3d502cfedee2f4ef685a0e15031265f80f8d70bcf106f1cd752492f496f1ccce42068d8bceb33219de2b833b0022b1aae348bc2
7
- data.tar.gz: d8fe891e797ba651ee5591ee309d6ab51045179746af5b57c88d75e32773321accb2ae60332bf1bc79a4028f2347f3f49493daabf4b9edba176211f69ee7ded8
6
+ metadata.gz: b3724e11198243e0a29b9a902e09902a040d0b5011da0d2e6db23a37696ba07a39109f602bb68e1a09456e350eca62d4eb37b8cb87e984927acf7f880a41e6f3
7
+ data.tar.gz: 4692fd01fb512aafdbdc9674c911e73128ae4bb7b7e1b270b98ae706065ee88e4efcedf40776136db86060839acf0aec1d24b9f139467e18991d9afa5c2dc8b9
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.0] - 2022-04-18
8
+ ### Changed
9
+ - Ignore version control system directories like `.git`. You will be unable to use git in the remote machine.
10
+ - Ignore `.DS_Store` files
11
+
12
+ ## [1.0.0] - 2021-12-20
13
+ ### Changed
14
+ - Update compatibility with mutagen 0.12.0. Drops support for previous versions
15
+
16
+ ## [0.7.1] - 2021-10-14
17
+ ### Fixed
18
+ - Explicitly require fileutils for Ruby 3.0 compatibility
19
+
7
20
  ## [0.7.0] - 2021-09-23
8
21
  ### Added
9
22
  - Add ability to set a box's user and identity_file
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- devbox_launcher (0.7.0)
4
+ devbox_launcher (1.1.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.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.1.4
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,85 @@
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
+ "--ignore-vcs",
42
+ "--ignore=.DS_Store"
43
+ ]
44
+ str << "--watch-mode-alpha=no-watch" if linux?
45
+ str.join(" ")
46
+ end
47
+
48
+ def terminate_cmd
49
+ %Q(mutagen sync terminate --label-selector=#{label})
50
+ end
51
+
52
+ def terminate
53
+ puts "Terminating mutagen session..."
54
+ terminate_stdout,
55
+ terminate_stderr,
56
+ terminate_status =
57
+ Open3.capture3(terminate_cmd)
58
+
59
+ if not terminate_status.success?
60
+ # mutagen prints to stdout and stderr
61
+ msg = "Failed to terminate mutagen sessions: " \
62
+ "#{terminate_stdout} -" \
63
+ "#{terminate_stderr}"
64
+ fail msg
65
+ end
66
+ end
67
+
68
+ def watch_alpha
69
+ watchman.trigger("mutagen sync flush --label-selector=#{label}")
70
+ end
71
+
72
+ def watchman
73
+ @watchman ||= Watchman.new(dir: config.alpha_dir)
74
+ end
75
+
76
+ def reset
77
+ return if !config.configured?
78
+
79
+ terminate
80
+ create
81
+ watch_alpha if linux?
82
+ end
83
+
84
+ end
85
+ end
@@ -1,3 +1,3 @@
1
1
  module DevboxLauncher
2
- VERSION = "0.7.0"
2
+ VERSION = "1.1.0"
3
3
  end
@@ -3,6 +3,7 @@ require "active_support/core_ext/object/blank"
3
3
  require "ssh-config"
4
4
  require "open3"
5
5
  require "thor"
6
+ require "fileutils"
6
7
  require "net/ssh"
7
8
  require "os"
8
9
  require "ruby-watchman"
@@ -18,7 +19,8 @@ end
18
19
  require "devbox_launcher/cli"
19
20
  require "devbox_launcher/watchman"
20
21
  require "devbox_launcher/models/description"
21
- require "devbox_launcher/models/mutagen"
22
+ require "devbox_launcher/models/mutagen_config"
23
+ require "devbox_launcher/models/mutagen_session"
22
24
  require "devbox_launcher/models/box"
23
25
  require "devbox_launcher/models/account_config"
24
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.0
4
+ version: 1.1.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-09-23 00:00:00.000000000 Z
11
+ date: 2022-04-18 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