devbox_launcher 0.1.0 → 0.2.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: 47bd56cd1236592f71bf6b836ffd42bb2eaa79534f338af4e8218c7ec1597c22
4
- data.tar.gz: 2b22d988c80f27f2f3f3c3c23ac9b92bddd4ae258dda0f7979623daff9e982db
3
+ metadata.gz: bb15ad0ea9b993eb803001449bff9970a345d12f872ae973a551e5899b3f3401
4
+ data.tar.gz: c4586ec0d2658d7eba82d88550afc849342a5675d7dde501ff1cdf9aae838119
5
5
  SHA512:
6
- metadata.gz: 56d053b7fec492b8399ad3e1aa170b4ba03cbeb242a49dab12486fff44d334928fd54605032c706143728447a18c6cfc1993154e427e17d6503f0787479f634d
7
- data.tar.gz: c02c5d508262e7e96f2654611352c330529abfb4cf7923517ec9bbc652ec700459cdd7806267f547c5074fc411be1bf25530442123210128ca616f8e314d43ce
6
+ metadata.gz: 0f244644671795da723b0eca23a9546fceabe1c98897362767070b2582c95b58fa94ad27ea57161cd0c2dbfd2a76518c8c0c5f693a724e732289c7a6dfbb8ee8
7
+ data.tar.gz: 3f49c7aff85f9a3500e9da5139cfddd178734a9413cd5f0e03cb3d95b6b684864b3983a8242de5041ac744b34b490cb605902a1c7256bed3c9629f8d28ed6a6e
data/Gemfile.lock CHANGED
@@ -1,33 +1,34 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- devbox_launcher (0.1.0)
5
- activesupport
6
- bcrypt_pbkdf
7
- ed25519
8
- net-ssh
9
- ssh-config
10
- thor
4
+ devbox_launcher (0.2.0)
5
+ activesupport (~> 6.0)
6
+ bcrypt_pbkdf (~> 1.0)
7
+ ed25519 (~> 1.2)
8
+ net-ssh (~> 5.2)
9
+ ssh-config (= 0.1.3)
10
+ thor (~> 1.0)
11
11
 
12
12
  GEM
13
13
  remote: https://rubygems.org/
14
14
  specs:
15
- activesupport (6.0.0)
15
+ activesupport (6.0.2.1)
16
16
  concurrent-ruby (~> 1.0, >= 1.0.2)
17
17
  i18n (>= 0.7, < 2)
18
18
  minitest (~> 5.1)
19
19
  tzinfo (~> 1.1)
20
- zeitwerk (~> 2.1, >= 2.1.8)
20
+ zeitwerk (~> 2.2)
21
21
  bcrypt_pbkdf (1.0.1)
22
22
  byebug (11.0.1)
23
23
  coderay (1.1.2)
24
24
  concurrent-ruby (1.1.5)
25
+ deep_fetch (0.0.5)
25
26
  diff-lcs (1.3)
26
27
  ed25519 (1.2.4)
27
- i18n (1.6.0)
28
+ i18n (1.8.2)
28
29
  concurrent-ruby (~> 1.0)
29
30
  method_source (0.9.2)
30
- minitest (5.12.2)
31
+ minitest (5.14.0)
31
32
  net-ssh (5.2.0)
32
33
  pry (0.12.2)
33
34
  coderay (~> 1.1.0)
@@ -52,9 +53,9 @@ GEM
52
53
  ssh-config (0.1.3)
53
54
  thor (1.0.1)
54
55
  thread_safe (0.3.6)
55
- tzinfo (1.2.5)
56
+ tzinfo (1.2.6)
56
57
  thread_safe (~> 0.1)
57
- zeitwerk (2.1.10)
58
+ zeitwerk (2.2.2)
58
59
 
59
60
  PLATFORMS
60
61
  ruby
@@ -14,7 +14,7 @@ Gem::Specification.new do |spec|
14
14
 
15
15
  spec.metadata["allowed_push_host"] = "https://rubygems.org"
16
16
 
17
- spec.metadata["homepage_uri"] = "https://github.com/bloom-solutions/devbox_launcher"
17
+ spec.metadata["homepage_uri"] = spec.homepage
18
18
  spec.metadata["source_code_uri"] = "https://github.com/bloom-solutions/devbox_launcher"
19
19
  spec.metadata["changelog_uri"] = "https://github.com/bloom-solutions/devbox_launcher/blob/master/CHANGELOG.md"
20
20
 
@@ -24,17 +24,19 @@ Gem::Specification.new do |spec|
24
24
  `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
25
25
  end
26
26
  spec.bindir = "bin"
27
- spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
27
+ spec.executables =
28
+ spec.files.grep(%r{^exe/}) { |f| File.basename(f) } +
29
+ spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
28
30
  spec.require_paths = ["lib"]
29
31
 
30
32
  spec.add_development_dependency "bundler", "~> 2.0"
31
33
  spec.add_development_dependency "rake", "~> 10.0"
32
34
  spec.add_development_dependency "rspec", "~> 3.0"
33
35
 
34
- spec.add_runtime_dependency "thor"
35
- spec.add_runtime_dependency "net-ssh"
36
- spec.add_runtime_dependency "ed25519"
37
- spec.add_runtime_dependency "bcrypt_pbkdf"
38
- spec.add_runtime_dependency "ssh-config"
39
- spec.add_runtime_dependency "activesupport"
36
+ spec.add_runtime_dependency "thor", "~> 1.0"
37
+ spec.add_runtime_dependency "net-ssh", "~> 5.2"
38
+ spec.add_runtime_dependency "ed25519", "~> 1.2"
39
+ spec.add_runtime_dependency "bcrypt_pbkdf", "~> 1.0"
40
+ spec.add_runtime_dependency "ssh-config", "0.1.3"
41
+ spec.add_runtime_dependency "activesupport", "~> 6.0"
40
42
  end
@@ -61,10 +61,48 @@ module DevboxLauncher
61
61
 
62
62
  wait_boot(hostname, username)
63
63
 
64
- mutagen_alpha_dir = config[:mutagen][:alpha] if config[:mutagen]
65
- mutagen_beta_dir = config[:mutagen][:beta] if config[:mutagen]
64
+ reset_mutagen_session(
65
+ mutagen_config: config[:mutagen],
66
+ hostname: hostname,
67
+ )
68
+
69
+ if options[:mosh]
70
+ mosh_command = %Q(mosh #{hostname})
71
+ system(mosh_command)
72
+ end
73
+ end
74
+
75
+ no_commands do
76
+ def wait_boot(hostname, username)
77
+ Net::SSH.start(hostname, username, timeout: WAIT_BOOT_IN_SECONDS) do |ssh|
78
+ puts "[#{ssh.exec!('date').chomp}] Machine booted"
79
+ end
80
+ rescue Net::SSH::ConnectionTimeout, Net::SSH::Disconnect, Errno::ECONNRESET
81
+ puts "Not booted. Waiting #{WAIT_BOOT_IN_SECONDS} seconds before trying again..."
82
+ wait_boot hostname, username
83
+ end
84
+
85
+ def set_ssh_config!(hostname, username:, ip:)
86
+ FileUtils.touch(SSH_CONFIG_PATH)
87
+ config = ConfigFile.new
88
+ args = {
89
+ "HostName" => ip,
90
+ "User" => username,
91
+ "IdentityFile" => DEFAULT_IDENTIFY_FILE_PATH,
92
+ }
93
+ args.each do |key, value|
94
+ config.set(hostname, key, value)
95
+ end
96
+ config.save
97
+ end
98
+
99
+ def reset_mutagen_session(mutagen_config:, hostname:)
100
+ return if mutagen_config.nil?
101
+ alpha_dir = mutagen_config[:alpha]
102
+ beta_dir = mutagen_config[:beta]
103
+
104
+ return if alpha_dir.nil? || beta_dir.nil?
66
105
 
67
- if [mutagen_alpha_dir, mutagen_beta_dir].all?
68
106
  puts "Terminating all mutagen sessions..."
69
107
  terminate_mutagen_command = %Q(mutagen terminate --all)
70
108
  terminate_mutagen_stdout,
@@ -80,11 +118,12 @@ module DevboxLauncher
80
118
  fail msg
81
119
  end
82
120
 
83
- puts "Create mutagen session syncing local #{mutagen_alpha_dir} with #{hostname} #{mutagen_beta_dir}"
121
+ puts "Create mutagen session syncing local #{alpha_dir} " \
122
+ "with #{hostname} #{beta_dir}"
84
123
  create_mutagen_command = [
85
124
  "mutagen sync create",
86
- mutagen_alpha_dir,
87
- "#{hostname}:#{mutagen_beta_dir}",
125
+ alpha_dir,
126
+ "#{hostname}:#{beta_dir}",
88
127
  ].join(" ")
89
128
  create_mutagen_stdout,
90
129
  create_mutagen_stderr,
@@ -99,36 +138,6 @@ module DevboxLauncher
99
138
  fail msg
100
139
  end
101
140
  end
102
-
103
- if options[:mosh]
104
- mosh_command = %Q(mosh #{hostname})
105
- system(mosh_command)
106
- end
107
- end
108
-
109
- no_commands do
110
- def wait_boot(hostname, username)
111
- Net::SSH.start(hostname, username, timeout: WAIT_BOOT_IN_SECONDS) do |ssh|
112
- puts "[#{ssh.exec!('date').chomp}] Machine booted"
113
- end
114
- rescue Net::SSH::ConnectionTimeout, Net::SSH::Disconnect, Errno::ECONNRESET
115
- puts "Not booted. Waiting #{WAIT_BOOT_IN_SECONDS} seconds before trying again..."
116
- wait_boot hostname, username
117
- end
118
-
119
- def set_ssh_config!(hostname, username:, ip:)
120
- FileUtils.touch(SSH_CONFIG_PATH)
121
- config = ConfigFile.new
122
- args = {
123
- "HostName" => ip,
124
- "User" => username,
125
- "IdentityFile" => DEFAULT_IDENTIFY_FILE_PATH,
126
- }
127
- args.each do |key, value|
128
- config.set(hostname, key, value)
129
- end
130
- config.save
131
- end
132
141
  end
133
142
 
134
143
  end
@@ -1,3 +1,3 @@
1
1
  module DevboxLauncher
2
- VERSION = "0.1.0"
2
+ VERSION = "0.2.0"
3
3
  end
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.1.0
4
+ version: 0.2.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: 2020-01-12 00:00:00.000000000 Z
11
+ date: 2020-01-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -56,90 +56,93 @@ dependencies:
56
56
  name: thor
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ">="
59
+ - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '0'
61
+ version: '1.0'
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - ">="
66
+ - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: '0'
68
+ version: '1.0'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: net-ssh
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - ">="
73
+ - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: '0'
75
+ version: '5.2'
76
76
  type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - ">="
80
+ - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: '0'
82
+ version: '5.2'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: ed25519
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - ">="
87
+ - - "~>"
88
88
  - !ruby/object:Gem::Version
89
- version: '0'
89
+ version: '1.2'
90
90
  type: :runtime
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - ">="
94
+ - - "~>"
95
95
  - !ruby/object:Gem::Version
96
- version: '0'
96
+ version: '1.2'
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: bcrypt_pbkdf
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
- - - ">="
101
+ - - "~>"
102
102
  - !ruby/object:Gem::Version
103
- version: '0'
103
+ version: '1.0'
104
104
  type: :runtime
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
- - - ">="
108
+ - - "~>"
109
109
  - !ruby/object:Gem::Version
110
- version: '0'
110
+ version: '1.0'
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: ssh-config
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
- - - ">="
115
+ - - '='
116
116
  - !ruby/object:Gem::Version
117
- version: '0'
117
+ version: 0.1.3
118
118
  type: :runtime
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
- - - ">="
122
+ - - '='
123
123
  - !ruby/object:Gem::Version
124
- version: '0'
124
+ version: 0.1.3
125
125
  - !ruby/object:Gem::Dependency
126
126
  name: activesupport
127
127
  requirement: !ruby/object:Gem::Requirement
128
128
  requirements:
129
- - - ">="
129
+ - - "~>"
130
130
  - !ruby/object:Gem::Version
131
- version: '0'
131
+ version: '6.0'
132
132
  type: :runtime
133
133
  prerelease: false
134
134
  version_requirements: !ruby/object:Gem::Requirement
135
135
  requirements:
136
- - - ">="
136
+ - - "~>"
137
137
  - !ruby/object:Gem::Version
138
- version: '0'
138
+ version: '6.0'
139
139
  description:
140
140
  email:
141
141
  - ramon.tayag@gmail.com
142
- executables: []
142
+ executables:
143
+ - console
144
+ - devbox
145
+ - setup
143
146
  extensions: []
144
147
  extra_rdoc_files: []
145
148
  files:
@@ -183,7 +186,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
183
186
  - !ruby/object:Gem::Version
184
187
  version: '0'
185
188
  requirements: []
186
- rubygems_version: 3.1.2
189
+ rubygems_version: 3.0.6
187
190
  signing_key:
188
191
  specification_version: 4
189
192
  summary: Conveniently launch your devbox