bard 0.44.1 → 0.46.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/bard/base.rb +9 -3
- data/lib/bard/config.rb +4 -2
- data/lib/bard/version.rb +1 -1
- data/lib/bard.rb +6 -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: 052770d2821e0c8ed3ad4b90a031bfb1cde2dc7b1c8b346b9ac3c0433db667fd
|
4
|
+
data.tar.gz: 5c42dcb089ff3488eb990f582986354acd974c0f68199f6a7a9cca01e91cb2ad
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '09cc31d6f12248a5995cc93e435d540f4379c08b77e166196db38e96d11e40f73170989c1e86aa6309d57f3504072edda6827bee2eb05c49887ab2448d3d2248'
|
7
|
+
data.tar.gz: b34c19977c459886d012248301bc0b35afa668d08f5c0eb8ed05a76378c21174edd6192c53406b8f8ebf06bf97723ce3765bba488caae7db2b89ec9a5866af6e
|
data/lib/bard/base.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
require "thor"
|
2
2
|
require "term/ansicolor"
|
3
3
|
require "open3"
|
4
|
+
require "uri"
|
4
5
|
|
5
6
|
class Bard::CLI < Thor
|
6
7
|
include Term::ANSIColor
|
@@ -28,8 +29,10 @@ class Bard::CLI < Thor
|
|
28
29
|
def ssh_command server, command, home: false
|
29
30
|
server = @config.servers[server.to_sym]
|
30
31
|
uri = URI.parse("ssh://#{server.ssh}")
|
32
|
+
ssh_key = server.ssh_key ? "-i #{server.ssh_key} " : ""
|
33
|
+
command = "#{server.env} #{command}" if server.env
|
31
34
|
command = "cd #{server.path} && #{command}" unless home
|
32
|
-
command = "ssh -tt #{"-p#{uri.port} " if uri.port}#{uri.user}@#{uri.host} '#{command}'"
|
35
|
+
command = "ssh -tt #{ssh_key}#{"-p#{uri.port} " if uri.port}#{uri.user}@#{uri.host} '#{command}'"
|
33
36
|
if server.gateway
|
34
37
|
uri = URI.parse("ssh://#{server.gateway}")
|
35
38
|
command = "ssh -tt #{" -p#{uri.port} " if uri.port}#{uri.user}@#{uri.host} \"#{command}\""
|
@@ -44,12 +47,14 @@ class Bard::CLI < Thor
|
|
44
47
|
port = uri.port ? "-p#{uri.port}" : ""
|
45
48
|
gateway = server.gateway ? "-oProxyCommand='ssh #{port} #{uri.user}@#{uri.host} -W %h:%p'" : ""
|
46
49
|
|
50
|
+
ssh_key = server.ssh_key ? "-i #{server.ssh_key}" : ""
|
51
|
+
|
47
52
|
uri = URI.parse("ssh://#{server.ssh}")
|
48
53
|
port = uri.port ? "-P#{uri.port}" : ""
|
49
54
|
from_and_to = [path, "#{uri.user}@#{uri.host}:#{server.path}/#{path}"]
|
50
55
|
|
51
56
|
from_and_to.reverse! if direction == :from
|
52
|
-
command = "scp #{gateway} #{port} #{from_and_to.join(" ")}"
|
57
|
+
command = "scp #{gateway} #{ssh_key} #{port} #{from_and_to.join(" ")}"
|
53
58
|
|
54
59
|
run_crucial command
|
55
60
|
end
|
@@ -61,9 +66,10 @@ class Bard::CLI < Thor
|
|
61
66
|
port = uri.port ? "-p#{uri.port}" : ""
|
62
67
|
gateway = server.gateway ? "-oProxyCommand=\"ssh #{port} #{uri.user}@#{uri.host} -W %h:%p\"" : ""
|
63
68
|
|
69
|
+
ssh_key = server.ssh_key ? "-i #{server.ssh_key}" : ""
|
64
70
|
uri = URI.parse("ssh://#{server.ssh}")
|
65
71
|
port = uri.port ? "-p#{uri.port}" : ""
|
66
|
-
ssh = "-e'ssh #{port} #{gateway}'"
|
72
|
+
ssh = "-e'ssh #{ssh_key} #{port} #{gateway}'"
|
67
73
|
|
68
74
|
dest_path = path.dup
|
69
75
|
dest_path = "./#{dest_path}"
|
data/lib/bard/config.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
require "uri"
|
2
|
+
|
1
3
|
class Bard::CLI < Thor
|
2
4
|
class Config
|
3
5
|
def initialize project_name, path
|
@@ -55,7 +57,7 @@ class Bard::CLI < Thor
|
|
55
57
|
instance_eval File.read(File.expand_path(path)) if File.exist?(path)
|
56
58
|
end
|
57
59
|
|
58
|
-
class Server < Struct.new(:project_name, :key, :ssh, :path, :ping, :gateway)
|
60
|
+
class Server < Struct.new(:project_name, :key, :ssh, :path, :ping, :gateway, :ssh_key, :env)
|
59
61
|
def self.setting *fields
|
60
62
|
fields.each do |field|
|
61
63
|
define_method field do |*args|
|
@@ -70,7 +72,7 @@ class Bard::CLI < Thor
|
|
70
72
|
end
|
71
73
|
end
|
72
74
|
|
73
|
-
setting :ssh, :path, :ping, :gateway
|
75
|
+
setting :ssh, :path, :ping, :gateway, :ssh_key, :env
|
74
76
|
|
75
77
|
def default_ping
|
76
78
|
uri = URI.parse("ssh://#{ssh}")
|
data/lib/bard/version.rb
CHANGED
data/lib/bard.rb
CHANGED
@@ -178,7 +178,7 @@ class Bard::CLI < Thor
|
|
178
178
|
|
179
179
|
command = "curl -sfL #{url} 2>&1 1>/dev/null"
|
180
180
|
unless system command
|
181
|
-
puts "#{server.to_s.capitalize} is down!"
|
181
|
+
puts "#{server.key.to_s.capitalize} is down!"
|
182
182
|
exit 1
|
183
183
|
end
|
184
184
|
end
|
@@ -197,5 +197,10 @@ class Bard::CLI < Thor
|
|
197
197
|
def download_ci_test_coverage
|
198
198
|
rsync :from, :ci, "coverage"
|
199
199
|
end
|
200
|
+
|
201
|
+
desc "vim", "open all files that have changed since master"
|
202
|
+
def vim
|
203
|
+
exec "vim -p `git diff master --name-only | grep -v sass$ | tac`"
|
204
|
+
end
|
200
205
|
end
|
201
206
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bard
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.46.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Micah Geisel
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-12-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -172,7 +172,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
172
172
|
- !ruby/object:Gem::Version
|
173
173
|
version: '0'
|
174
174
|
requirements: []
|
175
|
-
rubygems_version: 3.0.
|
175
|
+
rubygems_version: 3.0.8
|
176
176
|
signing_key:
|
177
177
|
specification_version: 4
|
178
178
|
summary: CLI to automate common development tasks.
|