capx 0.0.1 → 0.0.2
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 +32 -0
- data/bin/capx +4 -3
- data/capx.gemspec +2 -2
- data/lib/capx/runner.rb +3 -3
- data/lib/capx/version.rb +1 -1
- metadata +5 -4
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: f5a2d415eadfd1beaadc13cfa665662b0804537d16fda29f9d7a971b0661c880
|
|
4
|
+
data.tar.gz: a4862ab6b346307c66ca05cdf4b103d9fbb56929a512ad1440a113a39e491bfa
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 59bc2ee34a9ca4488b0ca79f71f85db2cacd7c36f60bcdfe48f19ac981261e7e1d5737fba9fa8f34a0526c1d138c34087531fe239494218591baf2f08caadfa0
|
|
7
|
+
data.tar.gz: fd7d1f6fb4c009270111837efbc283a1213a026f9d9c84dcf594719b7533f6ea32968c3290d188a0fa1938cac9b459f69d9f6bc86663417409c754ea193d210f
|
data/README.md
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# CapX
|
|
2
|
+
|
|
3
|
+
Generates SSH command using capistrano deploy configuration. \
|
|
4
|
+
SSH username and host are parsed from capistrano deploy configuration. \
|
|
5
|
+
\
|
|
6
|
+
capistrano deploy configuration:
|
|
7
|
+
|
|
8
|
+
server 'dev.example.com', user: 'deploy', roles: %w{web app db}, primary: true
|
|
9
|
+
generated SSH command:
|
|
10
|
+
|
|
11
|
+
$ ssh deploy@dev.example.com
|
|
12
|
+
|
|
13
|
+
## Installation
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
$ gem install capx
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
## Usage
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
This will add the following executable in your shell:
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
capx [stage] [ssh]
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
### Examples:
|
|
30
|
+
|
|
31
|
+
$ capx staging # show ssh command
|
|
32
|
+
$ capx production ssh # execute ssh command
|
data/bin/capx
CHANGED
|
@@ -6,15 +6,16 @@ $LOAD_PATH.unshift(File.dirname(File.realpath(__FILE__)) + '/../lib')
|
|
|
6
6
|
require 'capx'
|
|
7
7
|
|
|
8
8
|
def show_help
|
|
9
|
-
puts 'params: <stage> <switch>'
|
|
9
|
+
puts 'params: <stage> <switch> <user>'
|
|
10
10
|
puts 'example: capx staging ssh'
|
|
11
11
|
end
|
|
12
12
|
|
|
13
13
|
if ARGV[0]
|
|
14
14
|
stage = ARGV[0]
|
|
15
|
-
|
|
15
|
+
switch = ARGV[1]
|
|
16
|
+
user = ARGV[2]
|
|
16
17
|
|
|
17
|
-
runner = Capx::Runner.new(stage: stage,
|
|
18
|
+
runner = Capx::Runner.new(stage: stage, switch: switch, user: user)
|
|
18
19
|
runner.run
|
|
19
20
|
else
|
|
20
21
|
show_help
|
data/capx.gemspec
CHANGED
|
@@ -10,9 +10,9 @@ Gem::Specification.new do |spec|
|
|
|
10
10
|
spec.required_ruby_version = '>= 2.2.0'
|
|
11
11
|
spec.authors = ['Jan Kmet']
|
|
12
12
|
spec.email = ['jan.kmet@gmail.com']
|
|
13
|
-
spec.summary = 'SSH
|
|
13
|
+
spec.summary = 'Generates SSH command using capistrano deploy configuration.'
|
|
14
14
|
spec.description = <<-EOF
|
|
15
|
-
SSH
|
|
15
|
+
Generates SSH command using capistrano deploy configuration..
|
|
16
16
|
SSH username and host are parsed from capistrano deploy configuration
|
|
17
17
|
EOF
|
|
18
18
|
spec.homepage = 'https://github.com/jankmet/capx'
|
data/lib/capx/runner.rb
CHANGED
|
@@ -5,8 +5,8 @@ module Capx
|
|
|
5
5
|
def initialize(options)
|
|
6
6
|
@stage = options[:stage]
|
|
7
7
|
@switch = options[:switch]
|
|
8
|
+
@user = options[:user]
|
|
8
9
|
@server = nil
|
|
9
|
-
@user = nil
|
|
10
10
|
end
|
|
11
11
|
|
|
12
12
|
def run
|
|
@@ -15,14 +15,14 @@ module Capx
|
|
|
15
15
|
File.open(file).each do |line|
|
|
16
16
|
if match = PATTERN.match(line)
|
|
17
17
|
@server = match.captures[0]
|
|
18
|
-
@user = match.captures[1]
|
|
18
|
+
@user = match.captures[1] if @user.nil?
|
|
19
19
|
end
|
|
20
20
|
end
|
|
21
21
|
|
|
22
22
|
if @server.nil? || @user.nil?
|
|
23
23
|
puts "capistrano server/user not found"
|
|
24
24
|
else
|
|
25
|
-
if
|
|
25
|
+
if @switch == 'ssh'
|
|
26
26
|
# call ssh
|
|
27
27
|
cmd = "ssh #{@user}@#{@server}"
|
|
28
28
|
puts "executing #{cmd}"
|
data/lib/capx/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: capx
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0.
|
|
4
|
+
version: 0.0.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Jan Kmet
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2018-07-
|
|
11
|
+
date: 2018-07-09 00:00:00.000000000 Z
|
|
12
12
|
dependencies: []
|
|
13
13
|
description: |2
|
|
14
|
-
SSH
|
|
14
|
+
Generates SSH command using capistrano deploy configuration..
|
|
15
15
|
SSH username and host are parsed from capistrano deploy configuration
|
|
16
16
|
email:
|
|
17
17
|
- jan.kmet@gmail.com
|
|
@@ -22,6 +22,7 @@ extra_rdoc_files: []
|
|
|
22
22
|
files:
|
|
23
23
|
- ".gitignore"
|
|
24
24
|
- LICENSE
|
|
25
|
+
- README.md
|
|
25
26
|
- bin/capx
|
|
26
27
|
- capx.gemspec
|
|
27
28
|
- lib/capx.rb
|
|
@@ -50,5 +51,5 @@ rubyforge_project:
|
|
|
50
51
|
rubygems_version: 2.7.6
|
|
51
52
|
signing_key:
|
|
52
53
|
specification_version: 4
|
|
53
|
-
summary: SSH
|
|
54
|
+
summary: Generates SSH command using capistrano deploy configuration.
|
|
54
55
|
test_files: []
|