tomo 0.5.0 → 0.6.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 +4 -4
- data/README.md +1 -1
- data/lib/tomo/paths.rb +2 -0
- data/lib/tomo/plugin/bundler/tasks.rb +30 -24
- data/lib/tomo/plugin/bundler.rb +8 -6
- data/lib/tomo/plugin/core/tasks.rb +5 -2
- data/lib/tomo/plugin/git/tasks.rb +30 -8
- data/lib/tomo/plugin/git.rb +1 -0
- data/lib/tomo/templates/config.rb.erb +1 -1
- data/lib/tomo/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4f17c4f644a912a79bac63de1bf2bd3d27d87e3bbe58ffdb63e1ee1ffaea160c
|
4
|
+
data.tar.gz: cc22d62f9bd02f647197a7d691c005a5ddf095141f40c12a8af3ea211fd41c04
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 52e06ed4c55e3d1630108802847c04235b1d48ee26225c1e78207931311333c00003c50e5a204aeb2a6752f9013bd3e2610436f2cc65222ea46bdb08513fbeea
|
7
|
+
data.tar.gz: f898fbf717712c309d5c30431fe6a30c71263c1139a4426ad573e8354506cc69dbfba3b443ff100dd1ce35b67c7c837b17d468698ba12a25762e6455cba07859
|
data/README.md
CHANGED
@@ -111,7 +111,7 @@ Out of the box, tomo will:
|
|
111
111
|
Whereas `tomo setup` is typically run once, you can use `tomo deploy` every time you want to deploy a new version of your app. The deploy command will sequentially run the [deploy](https://tomo-deploy.com/configuration#deployblock) list of tasks specified in `.tomo/config.rb`. You can customize this list to meet the needs of your app. By default, tomo runs these tasks:
|
112
112
|
|
113
113
|
1. Create a release (using the [git:create_release](https://tomo-deploy.com/plugins/git#gitcreate_release) task)
|
114
|
-
2. Build the project (e.g. [bundler:install](https://tomo-deploy.com/plugins/bundler#bundlerinstall), [rails:assets_precompile](
|
114
|
+
2. Build the project (e.g. [bundler:install](https://tomo-deploy.com/plugins/bundler#bundlerinstall), [rails:assets_precompile](https://tomo-deploy.com/plugins/rails#railsassets_precompile))
|
115
115
|
3. Migrate data to the meet the requirements of the new release (e.g. [rails:db_migrate](https://tomo-deploy.com/plugins/rails#railsdb_migrate))
|
116
116
|
4. Make the new release the "current" one ([core:symlink_current](https://tomo-deploy.com/plugins/core#coresymlink_current))
|
117
117
|
5. Restart the app to use the new current release (e.g. [puma:restart](https://tomo-deploy.com/plugins/puma#pumarestart))
|
data/lib/tomo/paths.rb
CHANGED
@@ -1,9 +1,27 @@
|
|
1
|
+
require "yaml"
|
2
|
+
|
1
3
|
module Tomo::Plugin::Bundler
|
2
4
|
class Tasks < Tomo::TaskLibrary
|
5
|
+
CONFIG_SETTINGS = %i[
|
6
|
+
bundler_deployment
|
7
|
+
bundler_gemfile
|
8
|
+
bundler_jobs
|
9
|
+
bundler_path
|
10
|
+
bundler_retry
|
11
|
+
bundler_without
|
12
|
+
].freeze
|
13
|
+
private_constant :CONFIG_SETTINGS
|
14
|
+
|
15
|
+
def config
|
16
|
+
configuration = settings_to_configuration
|
17
|
+
remote.mkdir_p paths.bundler_config.dirname
|
18
|
+
remote.write(text: YAML.dump(configuration), to: paths.bundler_config)
|
19
|
+
end
|
20
|
+
|
3
21
|
def install
|
4
|
-
return if remote.bundle?("check"
|
22
|
+
return if remote.bundle?("check") && !dry_run?
|
5
23
|
|
6
|
-
remote.bundle("install"
|
24
|
+
remote.bundle("install")
|
7
25
|
end
|
8
26
|
|
9
27
|
def clean
|
@@ -23,31 +41,19 @@ module Tomo::Plugin::Bundler
|
|
23
41
|
|
24
42
|
private
|
25
43
|
|
26
|
-
def
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
def check_options
|
31
|
-
gemfile = settings[:bundler_gemfile]
|
32
|
-
path = paths.bundler
|
44
|
+
def settings_to_configuration
|
45
|
+
CONFIG_SETTINGS.each_with_object({}) do |key, config|
|
46
|
+
next if settings[key].nil?
|
33
47
|
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
48
|
+
entry_key = "BUNDLE_#{key.to_s.sub(/^bundler_/, '').upcase}"
|
49
|
+
entry_value = settings.fetch(key)
|
50
|
+
entry_value = entry_value.join(":") if entry_value.is_a?(Array)
|
51
|
+
config[entry_key] = entry_value.to_s
|
52
|
+
end
|
38
53
|
end
|
39
54
|
|
40
|
-
def
|
41
|
-
|
42
|
-
without = settings[:bundler_without]
|
43
|
-
flags = settings[:bundler_install_flags]
|
44
|
-
|
45
|
-
options = check_options.dup
|
46
|
-
options.push("--jobs", jobs) if jobs
|
47
|
-
options.push("--without", without) if without
|
48
|
-
options.push(flags) if flags
|
49
|
-
|
50
|
-
options.flatten
|
55
|
+
def version_setting
|
56
|
+
settings[:bundler_version]
|
51
57
|
end
|
52
58
|
|
53
59
|
def extract_bundler_ver_from_lockfile
|
data/lib/tomo/plugin/bundler.rb
CHANGED
@@ -8,11 +8,13 @@ module Tomo::Plugin
|
|
8
8
|
tasks Tomo::Plugin::Bundler::Tasks
|
9
9
|
helpers Tomo::Plugin::Bundler::Helpers
|
10
10
|
|
11
|
-
defaults
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
11
|
+
defaults bundler_config_path: ".bundle/config",
|
12
|
+
bundler_deployment: true,
|
13
|
+
bundler_gemfile: nil,
|
14
|
+
bundler_jobs: "4",
|
15
|
+
bundler_path: "%<shared_path>/bundle",
|
16
|
+
bundler_retry: "3",
|
17
|
+
bundler_version: nil,
|
18
|
+
bundler_without: %w[development test]
|
17
19
|
end
|
18
20
|
end
|
@@ -60,9 +60,12 @@ module Tomo::Plugin::Core
|
|
60
60
|
|
61
61
|
# rubocop:disable Metrics/AbcSize
|
62
62
|
def log_revision
|
63
|
+
ref = remote.release[:ref]
|
64
|
+
revision = remote.release[:revision]
|
65
|
+
|
63
66
|
message = remote.release[:deploy_date].to_s
|
64
|
-
message << " - #{
|
65
|
-
message << " (#{
|
67
|
+
message << " - #{revision || '<unknown>'}"
|
68
|
+
message << " (#{ref})" if ref && revision && !revision.start_with?(ref)
|
66
69
|
message << " deployed by #{remote.release[:deploy_user] || '<unknown>'}"
|
67
70
|
message << "\n"
|
68
71
|
|
@@ -15,24 +15,45 @@ module Tomo::Plugin::Git
|
|
15
15
|
end
|
16
16
|
end
|
17
17
|
|
18
|
+
# rubocop:disable Metrics/MethodLength
|
18
19
|
def create_release
|
19
|
-
configure_git_attributes
|
20
20
|
remote.chdir(paths.git_repo) do
|
21
21
|
remote.git("remote update --prune")
|
22
|
-
|
22
|
+
end
|
23
|
+
|
24
|
+
store_release_info
|
25
|
+
configure_git_attributes
|
26
|
+
remote.mkdir_p(paths.release)
|
27
|
+
|
28
|
+
remote.chdir(paths.git_repo) do
|
23
29
|
remote.git(
|
24
|
-
"archive #{
|
30
|
+
"archive #{ref.shellescape} | "\
|
25
31
|
"tar -x -f - -C #{paths.release.shellescape}"
|
26
32
|
)
|
27
33
|
end
|
28
|
-
store_release_info
|
29
34
|
end
|
35
|
+
# rubocop:enable Metrics/MethodLength
|
30
36
|
# rubocop:enable Metrics/AbcSize
|
31
37
|
|
32
38
|
private
|
33
39
|
|
34
|
-
def
|
35
|
-
settings[:git_branch]
|
40
|
+
def ref
|
41
|
+
require_setting :git_ref if settings[:git_branch].nil?
|
42
|
+
|
43
|
+
warn_if_ref_overrides_branch
|
44
|
+
settings[:git_ref] || settings[:git_branch]
|
45
|
+
end
|
46
|
+
|
47
|
+
def warn_if_ref_overrides_branch
|
48
|
+
return if defined?(@ref_override_warning)
|
49
|
+
return unless settings[:git_ref] && settings[:git_branch]
|
50
|
+
|
51
|
+
logger.warn(
|
52
|
+
":git_ref (#{settings[:git_ref]}) and "\
|
53
|
+
":git_branch (#{settings[:git_branch]}) are both specified. "\
|
54
|
+
"Ignoring :git_branch."
|
55
|
+
)
|
56
|
+
@ref_override_warning = true
|
36
57
|
end
|
37
58
|
|
38
59
|
def set_origin_url
|
@@ -57,13 +78,14 @@ module Tomo::Plugin::Git
|
|
57
78
|
log = remote.chdir(paths.git_repo) do
|
58
79
|
remote.git(
|
59
80
|
'log -n1 --date=iso --pretty=format:"%H/%cd/%ae" '\
|
60
|
-
"#{
|
81
|
+
"#{ref.shellescape} --",
|
61
82
|
silent: true
|
62
83
|
).stdout.strip
|
63
84
|
end
|
64
85
|
|
65
86
|
sha, date, email = log.split("/", 3)
|
66
|
-
remote.release[:branch] =
|
87
|
+
remote.release[:branch] = ref if ref == settings[:git_branch]
|
88
|
+
remote.release[:ref] = ref
|
67
89
|
remote.release[:author] = email
|
68
90
|
remote.release[:revision] = sha
|
69
91
|
remote.release[:revision_date] = date
|
data/lib/tomo/plugin/git.rb
CHANGED
@@ -29,7 +29,6 @@ set env_vars: {
|
|
29
29
|
SECRET_KEY_BASE: :prompt
|
30
30
|
}
|
31
31
|
set linked_dirs: %w[
|
32
|
-
.bundle
|
33
32
|
log
|
34
33
|
node_modules
|
35
34
|
public/assets
|
@@ -47,6 +46,7 @@ setup do
|
|
47
46
|
run "nodenv:install"
|
48
47
|
run "rbenv:install"
|
49
48
|
run "bundler:upgrade_bundler"
|
49
|
+
run "bundler:config"
|
50
50
|
run "bundler:install"
|
51
51
|
run "rails:db_create"
|
52
52
|
run "rails:db_schema_load"
|
data/lib/tomo/version.rb
CHANGED
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: 0.
|
4
|
+
version: 0.6.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: 2019-
|
11
|
+
date: 2019-09-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -306,7 +306,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
306
306
|
- !ruby/object:Gem::Version
|
307
307
|
version: '0'
|
308
308
|
requirements: []
|
309
|
-
rubygems_version: 3.0.
|
309
|
+
rubygems_version: 3.0.6
|
310
310
|
signing_key:
|
311
311
|
specification_version: 4
|
312
312
|
summary: A simple SSH-based deployment tool, built for Rails
|