tomo 0.4.0 → 0.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +40 -45
- data/lib/tomo/commands/init.rb +1 -1
- data/lib/tomo/plugin/core.rb +2 -1
- data/lib/tomo/plugin/git/tasks.rb +1 -1
- data/lib/tomo/runtime.rb +7 -0
- data/lib/tomo/version.rb +1 -1
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 64db4196df1505dcfb7b3be9098bf1fdcd6583dda180ac2108a01c4b8ee399da
|
4
|
+
data.tar.gz: 2409539abd04df955234e48d26a463a4a5491a2626d482e9b519016f479d3064
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9c4ac76cbece92d504f2e229eb68779c679e9c1389554bcb1a39ef76bf88e15e9543b9b4b711990a6faaf0cdbba6b2a022606bc701fe32342f2e98c2100cbd9e
|
7
|
+
data.tar.gz: dd03847eb940857c45fe7a02b662b07280fe669de17cd778cb8ad542bafc3b81306fff543d37ce2e613ba3ab813356a8bd8f6af47726919d0106c84cb154bf7b
|
data/README.md
CHANGED
@@ -4,9 +4,8 @@
|
|
4
4
|
[![Travis](https://img.shields.io/travis/mattbrictson/tomo.svg?label=travis)](https://travis-ci.org/mattbrictson/tomo)
|
5
5
|
[![Circle](https://circleci.com/gh/mattbrictson/tomo.svg?style=shield)](https://circleci.com/gh/mattbrictson/tomo)
|
6
6
|
[![Code Climate](https://codeclimate.com/github/mattbrictson/tomo/badges/gpa.svg)](https://codeclimate.com/github/mattbrictson/tomo)
|
7
|
-
[![Say Thanks!](https://img.shields.io/badge/Say%20Thanks-!-1EAEDB.svg)](https://saythanks.io/to/mattbrictson)
|
8
7
|
|
9
|
-
Tomo is a friendly command-line tool for deploying Rails apps. It is a new alternative to Capistrano, Mina, and Shipit that
|
8
|
+
Tomo is a friendly command-line tool for deploying Rails apps. It is a new alternative to Capistrano, Mina, and Shipit that aims for simplicity and developer happiness.
|
10
9
|
|
11
10
|
💻 Rich command-line interface with built-in bash completions<br/>
|
12
11
|
☁️ Multi-environment and role-based multi-host support<br/>
|
@@ -16,17 +15,16 @@ Tomo is a friendly command-line tool for deploying Rails apps. It is a new alter
|
|
16
15
|
📚 Quality documentation<br/>
|
17
16
|
🔬 Minimal dependencies<br/>
|
18
17
|
|
19
|
-
This project wouldn't be possible without the generosity of the open source Ruby community. Please support open source projects and your fellow developers by helping answer questions, contributing pull requests to improve code and documentation, or just [drop a note](https://saythanks.io/to/mattbrictson) to say thanks! ❤️
|
20
|
-
|
21
18
|
---
|
22
19
|
|
23
20
|
- [Quick start](#quick-start)
|
21
|
+
- [Usage](#usage)
|
24
22
|
- [Reference documentation](#reference-documentation)
|
25
23
|
- [FAQ](#faq)
|
26
24
|
- [Support](#support)
|
27
25
|
- [License](#license)
|
28
26
|
- [Code of conduct](#code-of-conduct)
|
29
|
-
- [Contribution guide](#contribution-guide)
|
27
|
+
- [Contribution guide](#contribution-guide)
|
30
28
|
|
31
29
|
## Quick start
|
32
30
|
|
@@ -36,19 +34,19 @@ Tomo is distributed as a ruby gem. To install:
|
|
36
34
|
$ gem install tomo
|
37
35
|
```
|
38
36
|
|
39
|
-
|
40
|
-
|
41
|
-
An easy way to kick the tires is to view the `--help`.
|
37
|
+
For instructions on setting up bash completions, run:
|
42
38
|
|
43
|
-
|
39
|
+
```
|
40
|
+
$ tomo completion-script
|
41
|
+
```
|
44
42
|
|
45
43
|
#### Configuring a project
|
46
44
|
|
47
|
-
|
45
|
+
Tomo is configured via a `.tomo/config.rb` file in your project. To get started, you can use `tomo init` to generate a configuration that works for a basic Rails app.
|
48
46
|
|
49
47
|
![$ tomo init](./readme_images/tomo-init.png)
|
50
48
|
|
51
|
-
|
49
|
+
An abbreviated version looks like this:
|
52
50
|
|
53
51
|
```ruby
|
54
52
|
# .tomo/config.rb
|
@@ -86,41 +84,50 @@ deploy do
|
|
86
84
|
end
|
87
85
|
```
|
88
86
|
|
89
|
-
|
90
|
-
|
91
|
-
#### Host setup
|
87
|
+
Check out the [configuration docs](https://tomo-deploy.com/configuration/) for a complete reference.
|
92
88
|
|
93
|
-
|
89
|
+
## Usage
|
94
90
|
|
95
|
-
|
91
|
+
Tomo gives you easy-to-use commands for three common use cases:
|
96
92
|
|
97
|
-
|
93
|
+
1. `tomo setup` prepares a remote host for its first deploy
|
94
|
+
2. `tomo deploy` performs a deployment
|
95
|
+
3. `tomo run` lets you invoke one-off tasks
|
98
96
|
|
99
|
-
|
97
|
+
#### Setup
|
100
98
|
|
101
|
-
|
99
|
+
`tomo setup` prepares the remote host for its first deploy by sequentially running the
|
100
|
+
[setup](https://tomo-deploy.com/configuration#setupblock) list of tasks specified in `.tomo/config.rb`. These tasks typically create directories, initialize data stores, install prerequisite tools, and perform other one-time actions that are necessary before a deploy can take place.
|
102
101
|
|
103
|
-
|
102
|
+
Out of the box, tomo will:
|
104
103
|
|
105
|
-
|
104
|
+
- Configure necessary environment variables, like `RAILS_ENV` and `SECRET_KEY_BASE`
|
105
|
+
- Install Ruby, Bundler, Node, Yarn, and dependencies
|
106
|
+
- Create all necessary deployment directories
|
107
|
+
- Create the Rails database, load the schema, and insert seed data
|
106
108
|
|
107
|
-
|
109
|
+
#### Deploy
|
108
110
|
|
109
|
-
|
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:
|
110
112
|
|
111
|
-
|
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](../plugins/rails.md#railsassets_precompile))
|
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
|
+
4. Make the new release the "current" one ([core:symlink_current](https://tomo-deploy.com/plugins/core#coresymlink_current))
|
117
|
+
5. Restart the app to use the new current release (e.g. [puma:restart](https://tomo-deploy.com/plugins/puma#pumarestart))
|
118
|
+
6. Perform any cleanup (e.g. [bundler:clean](https://tomo-deploy.com/plugins/bundler#bundlerclean))
|
112
119
|
|
113
|
-
####
|
120
|
+
#### Run
|
114
121
|
|
115
|
-
Tomo can also `run` individual remote tasks.
|
122
|
+
Tomo can also `run` individual remote tasks on demand. You can use the `tasks` command to see the list of tasks tomo knows about.
|
116
123
|
|
117
124
|
![$ tomo tasks](./readme_images/tomo-tasks.png)
|
118
125
|
|
119
|
-
One of the built-in Rails tasks is `rails:console`, which brings up a fully-interactive Rails console over SSH.
|
126
|
+
One of the built-in Rails tasks is `rails:console`, which brings up a fully-interactive Rails console over SSH.
|
120
127
|
|
121
|
-
![$ tomo run rails:console
|
128
|
+
![$ tomo run rails:console](./readme_images/tomo-run-rails-console.png)
|
122
129
|
|
123
|
-
####
|
130
|
+
#### Extending tomo
|
124
131
|
|
125
132
|
Tomo has many plugins built-in, but you can easily add your own to extend tomo with custom tasks. By convention, custom plugins are stored in `.tomo/plugins/`. These plugins can define tasks as plain ruby methods. For example:
|
126
133
|
|
@@ -144,13 +151,9 @@ plugin "./plugins/my-plugin.rb"
|
|
144
151
|
|
145
152
|
And run it!
|
146
153
|
|
147
|
-
![$ tomo run my-plugin:hello
|
154
|
+
![$ tomo run my-plugin:hello](./readme_images/tomo-run-hello.png)
|
148
155
|
|
149
|
-
|
150
|
-
|
151
|
-
And just like that, you are now already familiar with the basics of tomo and how to extend it! Tomo is even more friendly and powerful with the help of bash completions. If you use bash, run `tomo completion-script` for instructions on setting them up.
|
152
|
-
|
153
|
-
To prepare your existing project for a real deploy, check out the sections of the reference documentation on [configuration](https://tomo-deploy.com/configuration/), [writing custom tasks](https://tomo-deploy.com/tutorials/writing-custom-tasks/), the [setup command](https://tomo-deploy.com/commands/setup/), and the [deploy command](https://tomo-deploy.com/commands/deploy/). There is also a tutorial that walks through [deploying a new Rails app from scratch](https://tomo-deploy.com/tutorials/deploying-rails-from-scratch/) [TODO]. If you have questions, check out the [FAQ](#faq) and [support](#support) notes below. Enjoy using tomo!
|
156
|
+
Read the [Writing Custom Tasks](https://tomo-deploy.com/tutorials/writing-custom-tasks/) tutorial for an in-depth guide to extending tomo.
|
154
157
|
|
155
158
|
## Reference documentation
|
156
159
|
|
@@ -198,15 +201,7 @@ set ssh_strict_host_key_checking: true # or false
|
|
198
201
|
|
199
202
|
## Support
|
200
203
|
|
201
|
-
|
202
|
-
|
203
|
-
1. Improve test coverage
|
204
|
-
2. Keep the project free of any serious bugs
|
205
|
-
3. Stay up to date with the latest versions of Ruby and gem dependencies
|
206
|
-
|
207
|
-
If you'd like to help by submitting a pull request, that would be much appreciated! Check out the contribution guide to get started.
|
208
|
-
|
209
|
-
Otherwise if you want to report a bug, or have ideas, feedback or questions about Tomo, [let me know via GitHub issues](https://github.com/mattbrictson/tomo/issues/new) and I will do my best to provide a helpful answer. Happy hacking! —Matt
|
204
|
+
This project is a labor of love and I can only spend a few hours a week maintaining it, at most. If you'd like to help by submitting a pull request, or if you've discovered a bug that needs my attention, please let me know. Check out [CONTRIBUTING.md](https://github.com/mattbrictson/tomo/blob/master/CONTRIBUTING.md) to get started. Happy hacking! —Matt
|
210
205
|
|
211
206
|
## License
|
212
207
|
|
@@ -218,4 +213,4 @@ Everyone interacting in the Tomo project’s codebases, issue trackers, chat roo
|
|
218
213
|
|
219
214
|
## Contribution guide
|
220
215
|
|
221
|
-
[
|
216
|
+
Interested in filing a bug report, feature request, or opening a PR? Excellent! Please read the short [CONTRIBUTING.md](https://github.com/mattbrictson/tomo/blob/master/CONTRIBUTING.md) guidelines before you dive in.
|
data/lib/tomo/commands/init.rb
CHANGED
data/lib/tomo/plugin/core.rb
CHANGED
@@ -16,12 +16,13 @@ module Tomo::Plugin
|
|
16
16
|
keep_releases: 10,
|
17
17
|
linked_dirs: [],
|
18
18
|
linked_files: [],
|
19
|
+
local_user: nil, # determined at runtime
|
19
20
|
release_json_path: "%<release_path>/.tomo_release.json",
|
20
21
|
releases_path: "%<deploy_to>/releases",
|
21
22
|
revision_log_path: "%<deploy_to>/revisions.log",
|
22
23
|
shared_path: "%<deploy_to>/shared",
|
23
24
|
tmp_path: "/tmp/tomo",
|
24
|
-
run_args: []
|
25
|
+
run_args: [] # determined at runtime
|
25
26
|
)
|
26
27
|
end
|
27
28
|
end
|
@@ -68,7 +68,7 @@ module Tomo::Plugin::Git
|
|
68
68
|
remote.release[:revision] = sha
|
69
69
|
remote.release[:revision_date] = date
|
70
70
|
remote.release[:deploy_date] = Time.now.to_s
|
71
|
-
remote.release[:deploy_user] =
|
71
|
+
remote.release[:deploy_user] = settings.fetch(:local_user)
|
72
72
|
end
|
73
73
|
# rubocop:enable Metrics/MethodLength
|
74
74
|
# rubocop:enable Metrics/AbcSize
|
data/lib/tomo/runtime.rb
CHANGED
@@ -18,6 +18,12 @@ module Tomo
|
|
18
18
|
autoload :TaskRunner, "tomo/runtime/task_runner"
|
19
19
|
autoload :UnknownTaskError, "tomo/runtime/unknown_task_error"
|
20
20
|
|
21
|
+
def self.local_user
|
22
|
+
ENV["USER"] || ENV["USERNAME"] || `whoami`.chomp
|
23
|
+
rescue StandardError
|
24
|
+
nil
|
25
|
+
end
|
26
|
+
|
21
27
|
attr_reader :tasks
|
22
28
|
|
23
29
|
def initialize(deploy_tasks:, setup_tasks:, hosts:, task_filter:,
|
@@ -65,6 +71,7 @@ module Tomo
|
|
65
71
|
|
66
72
|
def new_task_runner(release_type, args)
|
67
73
|
run_settings = { release_path: release_path_for(release_type) }
|
74
|
+
.merge(local_user: Runtime.local_user)
|
68
75
|
.merge(settings)
|
69
76
|
.merge(run_args: args)
|
70
77
|
|
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.
|
4
|
+
version: 0.4.1
|
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-08-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -114,28 +114,28 @@ dependencies:
|
|
114
114
|
requirements:
|
115
115
|
- - '='
|
116
116
|
- !ruby/object:Gem::Version
|
117
|
-
version: 0.
|
117
|
+
version: 0.74.0
|
118
118
|
type: :development
|
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.74.0
|
125
125
|
- !ruby/object:Gem::Dependency
|
126
126
|
name: rubocop-performance
|
127
127
|
requirement: !ruby/object:Gem::Requirement
|
128
128
|
requirements:
|
129
129
|
- - '='
|
130
130
|
- !ruby/object:Gem::Version
|
131
|
-
version: 1.4.
|
131
|
+
version: 1.4.1
|
132
132
|
type: :development
|
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: 1.4.
|
138
|
+
version: 1.4.1
|
139
139
|
description:
|
140
140
|
email:
|
141
141
|
- opensource@mattbrictson.com
|