tomo 1.0.0 → 1.1.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: 4ad1c87df7e8fad626e90eb0606c0bb2899a3acf57eb2b9df969bd53c33332de
4
- data.tar.gz: 49ce5c513dfccbe4db1269e0c9385e39aa9940690cd7a6e86c561d54eeb89b54
3
+ metadata.gz: 6475bf477c37fc9b1c28dfac30ed59d5b29a0f9c9bcde84e5df77a3bde38da66
4
+ data.tar.gz: 476f861ba1ed0f17f4767c168ca1c1984487df84c061980c02954111b2d20cbd
5
5
  SHA512:
6
- metadata.gz: 1f2459465ef849c4dc012f594bcb672317909945c1061cb54a9f8e94acb07e91ed04334d28347f1dd4d708e10903ab168a142b4632289e5e9c375aa882c8bdc9
7
- data.tar.gz: 3946a734793b215eb57296eb602ac9bdaf68791c9df541d381b41bd89ee0bc9681fff27a506dd72e5d427bee757727f613f8db7624216eefaf808062740ba9a8
6
+ metadata.gz: fefda893dcede7dff398410779e13bc33d4e23b2d79766cedb5e68268a32179614e3c6cb4a3ba2ab074860cb779142773b8cc786f54719777911901df735309c
7
+ data.tar.gz: d0c9ef9a4c696e3a80b59814f2c4790c4ee0979d72bfcad0d87bed69ac57966c61f43ae5b2cf78ef4ea29e23fd1bfca7163337d3e4fae905424a3d05db408750
data/README.md CHANGED
@@ -191,7 +191,6 @@ Read the [Writing Custom Tasks](https://tomo-deploy.com/tutorials/writing-custom
191
191
  - [Result](https://tomo-deploy.com/api/Result/)
192
192
  - [TaskLibrary](https://tomo-deploy.com/api/TaskLibrary/)
193
193
  - [Testing::MockPluginTester](https://tomo-deploy.com/api/testing/MockPluginTester/)
194
- - [Testing::DockerPluginTester](https://tomo-deploy.com/api/testing/DockerPluginTester/)
195
194
 
196
195
  ## FAQ
197
196
 
@@ -19,4 +19,4 @@ WorkingDirectory=<%= paths.current %>
19
19
  # Environment=PUMA_DEBUG=1
20
20
 
21
21
  [Install]
22
- WantedBy=multi-user.target
22
+ WantedBy=default.target
@@ -6,14 +6,12 @@ module Tomo
6
6
  autoload :CLITester, "tomo/testing/cli_tester"
7
7
  autoload :Connection, "tomo/testing/connection"
8
8
  autoload :DockerImage, "tomo/testing/docker_image"
9
- autoload :DockerPluginTester, "tomo/testing/docker_plugin_tester"
10
9
  autoload :HostExtensions, "tomo/testing/host_extensions"
11
10
  autoload :Local, "tomo/testing/local"
12
11
  autoload :LogCapturing, "tomo/testing/log_capturing"
13
12
  autoload :MockedExecError, "tomo/testing/mocked_exec_error"
14
13
  autoload :MockedExitError, "tomo/testing/mocked_exit_error"
15
14
  autoload :MockPluginTester, "tomo/testing/mock_plugin_tester"
16
- autoload :PluginTester, "tomo/testing/plugin_tester"
17
15
  autoload :RemoteExtensions, "tomo/testing/remote_extensions"
18
16
  autoload :SSHExtensions, "tomo/testing/ssh_extensions"
19
17
 
@@ -1,10 +1,8 @@
1
- FROM ubuntu:18.04
1
+ FROM ubuntu:20.04
2
2
  WORKDIR /provision
3
3
  COPY ./tomo_test_ed25519.pub /root/.ssh/authorized_keys
4
4
  COPY ./ubuntu_setup.sh ./
5
5
  RUN ./ubuntu_setup.sh
6
- COPY ./custom_setup.sh ./
7
- RUN ./custom_setup.sh
8
6
  COPY ./systemctl.rb /usr/local/bin/systemctl
9
7
  RUN chmod a+x /usr/local/bin/systemctl
10
8
  EXPOSE 22
@@ -22,13 +22,8 @@ module Tomo
22
22
  end
23
23
  @running_images = []
24
24
 
25
- attr_accessor :setup_script
26
25
  attr_reader :host
27
26
 
28
- def initialize
29
- @setup_script = "#!/bin/bash\n"
30
- end
31
-
32
27
  def build_and_run
33
28
  raise "Already running!" if frozen?
34
29
 
@@ -74,8 +69,8 @@ module Tomo
74
69
  attr_reader :container_id, :image_id, :private_key_path
75
70
 
76
71
  def pull_base_image_if_needed
77
- images = Local.capture('docker images --format "{{.ID}}" ubuntu:18.04')
78
- Local.capture("docker pull ubuntu:18.04") if images.strip.empty?
72
+ images = Local.capture('docker images --format "{{.ID}}" ubuntu:20.04')
73
+ Local.capture("docker pull ubuntu:20.04") if images.strip.empty?
79
74
  end
80
75
 
81
76
  def set_up_private_key
@@ -121,8 +116,6 @@ module Tomo
121
116
  FILES_TO_COPY.each do |file|
122
117
  FileUtils.cp(File.expand_path(file, __dir__), build_dir)
123
118
  end
124
- IO.write(File.join(build_dir, "custom_setup.sh"), setup_script)
125
- FileUtils.chmod(0o755, File.join(build_dir, "custom_setup.sh"))
126
119
  end
127
120
 
128
121
  def build_dir
@@ -1,10 +1,29 @@
1
1
  module Tomo
2
2
  module Testing
3
- class MockPluginTester < PluginTester
3
+ class MockPluginTester
4
+ include LogCapturing
5
+
4
6
  def initialize(*plugin_names, settings: {}, release: {})
5
- host = Host.parse("testing@host")
6
- host.release.merge!(release)
7
- super(*plugin_names, settings: settings, host: host)
7
+ @host = Host.parse("testing@host")
8
+ @host.release.merge!(release)
9
+ config = Configuration.new
10
+ config.hosts << @host
11
+ config.plugins.push(*plugin_names, "testing")
12
+ config.settings[:application] = "testing"
13
+ config.settings.merge!(settings)
14
+ @runtime = config.build_runtime
15
+ end
16
+
17
+ def call_helper(helper, *args, **kwargs)
18
+ run_task("testing:call_helper", helper, args, kwargs)
19
+ host.helper_values.pop
20
+ end
21
+
22
+ def run_task(task, *args)
23
+ capturing_logger_output do
24
+ runtime.run!(task, *args, privileged: false)
25
+ nil
26
+ end
8
27
  end
9
28
 
10
29
  def executed_script
@@ -21,6 +40,10 @@ module Tomo
21
40
  host.mock(script, **kwargs)
22
41
  self
23
42
  end
43
+
44
+ private
45
+
46
+ attr_reader :host, :runtime
24
47
  end
25
48
  end
26
49
  end
@@ -1,3 +1,3 @@
1
1
  module Tomo
2
- VERSION = "1.0.0".freeze
2
+ VERSION = "1.1.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.0.0
4
+ version: 1.1.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-04-12 00:00:00.000000000 Z
11
+ date: 2020-05-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -66,20 +66,6 @@ dependencies:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
68
  version: '3.4'
69
- - !ruby/object:Gem::Dependency
70
- name: minitest-hooks
71
- requirement: !ruby/object:Gem::Requirement
72
- requirements:
73
- - - "~>"
74
- - !ruby/object:Gem::Version
75
- version: '1.5'
76
- type: :development
77
- prerelease: false
78
- version_requirements: !ruby/object:Gem::Requirement
79
- requirements:
80
- - - "~>"
81
- - !ruby/object:Gem::Version
82
- version: '1.5'
83
69
  - !ruby/object:Gem::Dependency
84
70
  name: minitest-reporters
85
71
  requirement: !ruby/object:Gem::Requirement
@@ -114,28 +100,28 @@ dependencies:
114
100
  requirements:
115
101
  - - '='
116
102
  - !ruby/object:Gem::Version
117
- version: 0.81.0
103
+ version: 0.82.0
118
104
  type: :development
119
105
  prerelease: false
120
106
  version_requirements: !ruby/object:Gem::Requirement
121
107
  requirements:
122
108
  - - '='
123
109
  - !ruby/object:Gem::Version
124
- version: 0.81.0
110
+ version: 0.82.0
125
111
  - !ruby/object:Gem::Dependency
126
112
  name: rubocop-minitest
127
113
  requirement: !ruby/object:Gem::Requirement
128
114
  requirements:
129
115
  - - '='
130
116
  - !ruby/object:Gem::Version
131
- version: 0.8.1
117
+ version: 0.9.0
132
118
  type: :development
133
119
  prerelease: false
134
120
  version_requirements: !ruby/object:Gem::Requirement
135
121
  requirements:
136
122
  - - '='
137
123
  - !ruby/object:Gem::Version
138
- version: 0.8.1
124
+ version: 0.9.0
139
125
  - !ruby/object:Gem::Dependency
140
126
  name: rubocop-performance
141
127
  requirement: !ruby/object:Gem::Requirement
@@ -292,14 +278,12 @@ files:
292
278
  - lib/tomo/testing/cli_tester.rb
293
279
  - lib/tomo/testing/connection.rb
294
280
  - lib/tomo/testing/docker_image.rb
295
- - lib/tomo/testing/docker_plugin_tester.rb
296
281
  - lib/tomo/testing/host_extensions.rb
297
282
  - lib/tomo/testing/local.rb
298
283
  - lib/tomo/testing/log_capturing.rb
299
284
  - lib/tomo/testing/mock_plugin_tester.rb
300
285
  - lib/tomo/testing/mocked_exec_error.rb
301
286
  - lib/tomo/testing/mocked_exit_error.rb
302
- - lib/tomo/testing/plugin_tester.rb
303
287
  - lib/tomo/testing/remote_extensions.rb
304
288
  - lib/tomo/testing/ssh_extensions.rb
305
289
  - lib/tomo/testing/systemctl.rb
@@ -331,7 +315,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
331
315
  - !ruby/object:Gem::Version
332
316
  version: '0'
333
317
  requirements: []
334
- rubygems_version: 3.1.2
318
+ rubygems_version: 3.1.3
335
319
  signing_key:
336
320
  specification_version: 4
337
321
  summary: A friendly CLI for deploying Rails apps ✨
@@ -1,39 +0,0 @@
1
- require "fileutils"
2
- require "securerandom"
3
- require "tmpdir"
4
-
5
- module Tomo
6
- module Testing
7
- class DockerPluginTester < PluginTester
8
- def initialize(*plugin_names, settings: {}, setup_script: nil)
9
- @docker_image = DockerImage.new
10
- @docker_image.setup_script = setup_script if setup_script
11
- @docker_image.build_and_run
12
- host = @docker_image.host
13
- super(
14
- *plugin_names,
15
- settings: @docker_image.ssh_settings.merge(settings),
16
- host: host
17
- )
18
- end
19
-
20
- def run(shell_script, **kwargs)
21
- call_helper(:run, shell_script, **kwargs)
22
- end
23
-
24
- def run_task(task, *args)
25
- Testing.enabling_ssh do
26
- super
27
- end
28
- end
29
-
30
- def teardown
31
- docker_image.stop
32
- end
33
-
34
- private
35
-
36
- attr_reader :docker_image
37
- end
38
- end
39
- end
@@ -1,33 +0,0 @@
1
- module Tomo
2
- module Testing
3
- class PluginTester
4
- include LogCapturing
5
-
6
- def initialize(*plugin_names, settings: {}, host:)
7
- @host = host
8
- config = Configuration.new
9
- config.hosts << @host
10
- config.plugins.push(*plugin_names, "testing")
11
- config.settings[:application] = "testing"
12
- config.settings.merge!(settings)
13
- @runtime = config.build_runtime
14
- end
15
-
16
- def call_helper(helper, *args, **kwargs)
17
- run_task("testing:call_helper", helper, args, kwargs)
18
- host.helper_values.pop
19
- end
20
-
21
- def run_task(task, *args)
22
- capturing_logger_output do
23
- runtime.run!(task, *args, privileged: false)
24
- nil
25
- end
26
- end
27
-
28
- private
29
-
30
- attr_reader :host, :runtime
31
- end
32
- end
33
- end