capistrano-remote 0.1.0 → 0.2.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/CHANGELOG.md +18 -0
- data/Gemfile +1 -1
- data/README.md +1 -1
- data/Rakefile +1 -1
- data/bin/console +3 -3
- data/capistrano-remote.gemspec +13 -13
- data/lib/capistrano/remote.rb +3 -3
- data/lib/capistrano/remote/runner.rb +22 -5
- data/lib/capistrano/remote/version.rb +2 -2
- data/lib/capistrano/tasks/remote.rake +15 -4
- metadata +5 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: da76f0d7bf5b90ddda1a32a193d061bf316c2b8d
|
4
|
+
data.tar.gz: 6afd603dc39969d71f1823da7f1758fb699233a9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3a2e432292228d2e47ee02a27fd0d1695eb90559e77a8bb8c449eef935999d1d2380daf512ed46c065b2aa5c98980abd0dfa46023938c54994560a1b7a2681d2
|
7
|
+
data.tar.gz: a0b909fe24f1aa23defb367e32151cc1208c0b2add6e869c4855489af39a0997ebb834e705c08ba628025b753dceb3f6872a4adad3ce18a73884c047c5154f54
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
# Change Log
|
2
|
+
|
3
|
+
All notable changes to this project will be documented in this file.
|
4
|
+
This project adheres to [Semantic Versioning](http://semver.org/).
|
5
|
+
|
6
|
+
## [0.2.0] - 2016-02-15
|
7
|
+
|
8
|
+
### Added
|
9
|
+
|
10
|
+
- A changelog (this one)
|
11
|
+
- Support for running rake tasks remotely: `cap remote:rake task=about`
|
12
|
+
|
13
|
+
## [0.1.0]
|
14
|
+
|
15
|
+
### Added
|
16
|
+
|
17
|
+
- Support for running rails console remotely
|
18
|
+
- Support for running rails dbconsole remotely
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -57,7 +57,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
|
|
57
57
|
|
58
58
|
## Contributing
|
59
59
|
|
60
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/substancelab/capistrano-remote. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](contributor-covenant.org) code of conduct.
|
60
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/substancelab/capistrano-remote. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
61
61
|
|
62
62
|
|
63
63
|
## License
|
data/Rakefile
CHANGED
@@ -1 +1 @@
|
|
1
|
-
require
|
1
|
+
require 'bundler/gem_tasks'
|
data/bin/console
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
-
require
|
4
|
-
require
|
3
|
+
require 'bundler/setup'
|
4
|
+
require 'capistrano/remote'
|
5
5
|
|
6
6
|
# You can add fixtures and/or initialization code here to make experimenting
|
7
7
|
# with your gem easier. You can also use a different console, if you like.
|
@@ -10,5 +10,5 @@ require "capistrano/remote"
|
|
10
10
|
# require "pry"
|
11
11
|
# Pry.start
|
12
12
|
|
13
|
-
require
|
13
|
+
require 'irb'
|
14
14
|
IRB.start
|
data/capistrano-remote.gemspec
CHANGED
@@ -1,16 +1,16 @@
|
|
1
1
|
# coding: utf-8
|
2
|
-
lib = File.expand_path(
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
3
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
-
require
|
4
|
+
require 'capistrano/remote/version'
|
5
5
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
|
-
spec.name =
|
7
|
+
spec.name = 'capistrano-remote'
|
8
8
|
spec.version = Capistrano::Remote::VERSION
|
9
|
-
spec.authors = [
|
10
|
-
spec.email = [
|
9
|
+
spec.authors = ['Jakob Skjerning']
|
10
|
+
spec.email = ['jakob@mentalized.net']
|
11
11
|
|
12
12
|
spec.summary = \
|
13
|
-
|
13
|
+
'Capistrano tasks to start a Rails console or dbconsole on your servers'
|
14
14
|
spec.description = <<-EOF
|
15
15
|
Every so often you need to look at your production data or otherwise run
|
16
16
|
some manual maintenance tasks in your production Rails application.
|
@@ -19,18 +19,18 @@ Gem::Specification.new do |spec|
|
|
19
19
|
dbconsole on your servers without manually SSH'ing.
|
20
20
|
EOF
|
21
21
|
|
22
|
-
spec.homepage =
|
23
|
-
spec.license =
|
22
|
+
spec.homepage = 'https://github.com/substancelab/capistrano-remote'
|
23
|
+
spec.license = 'MIT'
|
24
24
|
|
25
25
|
spec.files = `git ls-files -z`.split("\x0").reject { |f|
|
26
26
|
f.match(%r{^(test|spec|features)/})
|
27
27
|
}
|
28
|
-
spec.bindir =
|
28
|
+
spec.bindir = 'exe'
|
29
29
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
30
|
-
spec.require_paths = [
|
30
|
+
spec.require_paths = ['lib']
|
31
31
|
|
32
|
-
spec.add_dependency
|
32
|
+
spec.add_dependency 'capistrano', '~> 3.0'
|
33
33
|
|
34
|
-
spec.add_development_dependency
|
35
|
-
spec.add_development_dependency
|
34
|
+
spec.add_development_dependency 'bundler', '~> 1.10'
|
35
|
+
spec.add_development_dependency 'rake', '~> 10.0'
|
36
36
|
end
|
data/lib/capistrano/remote.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
require
|
2
|
-
require
|
1
|
+
require 'capistrano/remote/runner'
|
2
|
+
require 'capistrano/remote/version'
|
3
3
|
|
4
4
|
# Load the actual tasks
|
5
|
-
load File.expand_path(
|
5
|
+
load File.expand_path('../tasks/remote.rake', __FILE__)
|
@@ -1,5 +1,6 @@
|
|
1
1
|
module Capistrano
|
2
|
-
module Remote
|
2
|
+
module Remote # :nodoc:
|
3
|
+
# The primary interface for actually running tasks on a remote host.
|
3
4
|
class Runner
|
4
5
|
attr_reader :host
|
5
6
|
|
@@ -7,10 +8,12 @@ module Capistrano
|
|
7
8
|
@host = host
|
8
9
|
end
|
9
10
|
|
10
|
-
def
|
11
|
-
|
12
|
-
|
13
|
-
|
11
|
+
def rake(task)
|
12
|
+
run_interactively(in_current_path(rake_command(task)))
|
13
|
+
end
|
14
|
+
|
15
|
+
def rails(command)
|
16
|
+
run_interactively(in_current_path(rails_command(command)))
|
14
17
|
end
|
15
18
|
|
16
19
|
private
|
@@ -23,10 +26,24 @@ module Capistrano
|
|
23
26
|
host.hostname
|
24
27
|
end
|
25
28
|
|
29
|
+
def in_current_path(command)
|
30
|
+
"cd #{current_path} && #{command}"
|
31
|
+
end
|
32
|
+
|
26
33
|
def rails_command(command)
|
27
34
|
"#{bundle_command} exec rails #{command}"
|
28
35
|
end
|
29
36
|
|
37
|
+
def rake_command(arguments)
|
38
|
+
command = fetch(:rake_command, SSHKit.config.command_map[:rake])
|
39
|
+
"#{command} #{arguments}"
|
40
|
+
end
|
41
|
+
|
42
|
+
def run_interactively(remote_command)
|
43
|
+
local_command = "ssh -l #{user} #{hostname} -t \"#{remote_command}\""
|
44
|
+
exec local_command
|
45
|
+
end
|
46
|
+
|
30
47
|
def user
|
31
48
|
fetch(:user, host.user)
|
32
49
|
end
|
@@ -1,21 +1,32 @@
|
|
1
1
|
namespace :remote do
|
2
|
-
desc
|
2
|
+
desc 'Run and attach to a remote Rails console'
|
3
3
|
task :console do
|
4
4
|
rails_env = fetch(:rails_env)
|
5
5
|
on roles(:db) do |host|
|
6
|
-
Capistrano::Remote::Runner.new(host).
|
6
|
+
Capistrano::Remote::Runner.new(host).rails(
|
7
7
|
"console #{rails_env}"
|
8
8
|
)
|
9
9
|
end
|
10
10
|
end
|
11
11
|
|
12
|
-
desc
|
12
|
+
desc 'Run and attach to a remote Rails database console'
|
13
13
|
task :dbconsole do
|
14
14
|
rails_env = fetch(:rails_env)
|
15
15
|
on roles(:db) do |host|
|
16
|
-
Capistrano::Remote::Runner.new(host).
|
16
|
+
Capistrano::Remote::Runner.new(host).rails(
|
17
17
|
"dbconsole #{rails_env} -p"
|
18
18
|
)
|
19
19
|
end
|
20
20
|
end
|
21
|
+
|
22
|
+
desc 'Run a remote rake task.
|
23
|
+
Specify the task to run using the `task` environment variable.'
|
24
|
+
task :rake do
|
25
|
+
rails_env = fetch(:rails_env)
|
26
|
+
on roles(:db) do |host|
|
27
|
+
Capistrano::Remote::Runner.new(host).rake(
|
28
|
+
"RAILS_ENV=#{rails_env} #{ENV['task']}"
|
29
|
+
)
|
30
|
+
end
|
31
|
+
end
|
21
32
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: capistrano-remote
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jakob Skjerning
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-02-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: capistrano
|
@@ -65,6 +65,7 @@ extensions: []
|
|
65
65
|
extra_rdoc_files: []
|
66
66
|
files:
|
67
67
|
- ".gitignore"
|
68
|
+
- CHANGELOG.md
|
68
69
|
- CODE_OF_CONDUCT.md
|
69
70
|
- Gemfile
|
70
71
|
- LICENSE.txt
|
@@ -97,8 +98,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
97
98
|
version: '0'
|
98
99
|
requirements: []
|
99
100
|
rubyforge_project:
|
100
|
-
rubygems_version: 2.4.
|
101
|
+
rubygems_version: 2.4.8
|
101
102
|
signing_key:
|
102
103
|
specification_version: 4
|
103
104
|
summary: Capistrano tasks to start a Rails console or dbconsole on your servers
|
104
105
|
test_files: []
|
106
|
+
has_rdoc:
|