bard 1.0.5 → 1.0.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/features/bard_check.feature +1 -1
- data/features/bard_push.feature +1 -1
- data/lib/bard/cli/provision.rb +2 -2
- data/lib/bard/cli/setup.rb +33 -22
- data/lib/bard/config.rb +5 -3
- data/lib/bard/provision/data.rb +6 -6
- data/lib/bard/provision/http.rb +2 -0
- data/lib/bard/provision/masterkey.rb +2 -0
- data/lib/bard/provision/mysql.rb +1 -1
- data/lib/bard/provision/repo.rb +2 -0
- data/lib/bard/provision/ssh.rb +1 -1
- data/lib/bard/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 62659c90d5cd7cf39ef14edf5b0146338d0571fff437df85040d4cdcb0d82ff0
|
4
|
+
data.tar.gz: e3ac33d2ca9513a925060561a3a40608236346ee87a2beaca6524f8922da1bdd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9b50ddaeba02751089df9469427a663ebd36481115c01a1e72e808f96d9a869fd929cbf20df185668536b91e1c838090c82b41a1b05b0af990ebd31a328c3b3c
|
7
|
+
data.tar.gz: 638a531d23991f1fd01e284eaf1951994da92ab6ad695d1c9a53d10e814c7be91c5c3c487a90dd9b45d3443000f7e029198451140876d4674e68e162bc29420e
|
data/features/bard_check.feature
CHANGED
@@ -17,7 +17,7 @@ Feature: Bard can check its environment for missing dependencies and potential p
|
|
17
17
|
And the database is missing
|
18
18
|
When I type "bard check"
|
19
19
|
Then I should see the fatal error "missing database"
|
20
|
-
|
20
|
+
|
21
21
|
Scenario: Bard check detects pending migrations
|
22
22
|
Given a shared rails project
|
23
23
|
And a commit with a new migration
|
data/features/bard_push.feature
CHANGED
@@ -42,7 +42,7 @@ Feature: bard push
|
|
42
42
|
Then on staging, there should be one new submodule
|
43
43
|
And the submodule branch should match the submodule origin branch
|
44
44
|
And on staging, the submodule working directory should be clean
|
45
|
-
|
45
|
+
|
46
46
|
Scenario: Pushing a change that includes a submodule update
|
47
47
|
Given a submodule
|
48
48
|
And a commit with a submodule update
|
data/lib/bard/cli/provision.rb
CHANGED
@@ -4,8 +4,8 @@ module Bard::CLI::Provision
|
|
4
4
|
def self.included mod
|
5
5
|
mod.class_eval do
|
6
6
|
|
7
|
-
desc "provision [ssh_url]", "takes an ssh url to a raw ubuntu 22.04 install, and readies it in the shape of :production"
|
8
|
-
def provision ssh_url
|
7
|
+
desc "provision [ssh_url]", "takes an optional ssh url to a raw ubuntu 22.04 install, and readies it in the shape of :production"
|
8
|
+
def provision ssh_url=config[:production].ssh
|
9
9
|
Bard::Provision.call(config, ssh_url.dup) # dup unfreezes the string for later mutation
|
10
10
|
end
|
11
11
|
|
data/lib/bard/cli/setup.rb
CHANGED
@@ -6,39 +6,50 @@ module Bard::CLI::Setup
|
|
6
6
|
|
7
7
|
desc "setup", "installs app in nginx"
|
8
8
|
def setup
|
9
|
-
|
10
|
-
|
11
|
-
server_name = case ENV["RAILS_ENV"]
|
12
|
-
when "production"
|
13
|
-
(config[:production].ping.map do |str|
|
14
|
-
"*.#{URI.parse(str).host}"
|
15
|
-
end + ["_"]).join(" ")
|
16
|
-
when "staging" then "#{project_name}.botandrose.com"
|
17
|
-
else "#{project_name}.localhost"
|
18
|
-
end
|
19
|
-
|
20
|
-
system "sudo tee #{path} >/dev/null <<-EOF
|
21
|
-
server {
|
22
|
-
listen 80;
|
23
|
-
server_name #{server_name};
|
9
|
+
system "sudo tee /etc/nginx/snippets/common.conf >/dev/null <<-EOF
|
10
|
+
listen 80;
|
24
11
|
|
25
|
-
|
26
|
-
passenger_enabled on;
|
12
|
+
passenger_enabled on;
|
27
13
|
|
28
|
-
|
14
|
+
location ~* \\.(ico|css|js|gif|jp?g|png|webp) {
|
29
15
|
access_log off;
|
30
16
|
if (\\$request_filename ~ \"-[0-9a-f]{32}\\.\") {
|
31
|
-
|
32
|
-
|
17
|
+
expires max;
|
18
|
+
add_header Cache-Control public;
|
33
19
|
}
|
34
|
-
|
35
|
-
|
20
|
+
}
|
21
|
+
|
22
|
+
gzip_static on;
|
23
|
+
EOF"
|
24
|
+
|
25
|
+
path = "/etc/nginx/sites-available/#{project_name}"
|
26
|
+
system "sudo tee #{path} >/dev/null <<-EOF
|
27
|
+
server {
|
28
|
+
include /etc/nginx/snippets/common.conf;
|
29
|
+
server_name #{nginx_server_name};
|
30
|
+
root #{Dir.pwd}/public;
|
36
31
|
}
|
37
32
|
EOF"
|
33
|
+
|
34
|
+
dest_path = path.sub("sites-available", "sites-enabled")
|
38
35
|
system "sudo ln -sf #{path} #{dest_path}" if !File.exist?(dest_path)
|
36
|
+
|
39
37
|
system "sudo service nginx restart"
|
40
38
|
end
|
41
39
|
|
40
|
+
private
|
41
|
+
|
42
|
+
def nginx_server_name
|
43
|
+
case ENV["RAILS_ENV"]
|
44
|
+
when "production"
|
45
|
+
(config[:production].ping.map do |str|
|
46
|
+
"*.#{URI.parse(str).host}"
|
47
|
+
end + ["_"]).join(" ")
|
48
|
+
when "staging" then "#{project_name}.botandrose.com"
|
49
|
+
else "#{project_name}.localhost"
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
42
53
|
end
|
43
54
|
end
|
44
55
|
end
|
data/lib/bard/config.rb
CHANGED
@@ -10,7 +10,7 @@ module Bard
|
|
10
10
|
:local,
|
11
11
|
false,
|
12
12
|
"./",
|
13
|
-
|
13
|
+
"#{project_name}.local",
|
14
14
|
),
|
15
15
|
gubs: Server.new(
|
16
16
|
project_name,
|
@@ -22,14 +22,16 @@ module Bard
|
|
22
22
|
ci: Server.new(
|
23
23
|
project_name,
|
24
24
|
:ci,
|
25
|
-
"jenkins@
|
25
|
+
"jenkins@staging.botandrose.com:22022",
|
26
26
|
"jobs/#{project_name}/workspace",
|
27
27
|
false,
|
28
28
|
),
|
29
29
|
staging: Server.new(
|
30
30
|
project_name,
|
31
31
|
:staging,
|
32
|
-
"www
|
32
|
+
"www@staging.botandrose.com:22022",
|
33
|
+
project_name,
|
34
|
+
"#{project_name}.botandrose.com",
|
33
35
|
),
|
34
36
|
}
|
35
37
|
if path && File.exist?(path)
|
data/lib/bard/provision/data.rb
CHANGED
@@ -4,14 +4,14 @@ class Bard::Provision::Data < Bard::Provision
|
|
4
4
|
def call
|
5
5
|
print "Data:"
|
6
6
|
|
7
|
-
|
8
|
-
|
7
|
+
print " Dumping #{server.key} database to file"
|
8
|
+
server.run! "bin/rake db:dump"
|
9
9
|
|
10
|
-
|
11
|
-
|
10
|
+
print " Transfering file from #{server.key},"
|
11
|
+
server.copy_file "db/data.sql.gz", to: provision_server, verbose: false
|
12
12
|
|
13
|
-
|
14
|
-
|
13
|
+
print " Loading file into database,"
|
14
|
+
provision_server.run! "bin/rake db:load"
|
15
15
|
|
16
16
|
config.data.each do |path|
|
17
17
|
print " Synchronizing files in #{path},"
|
data/lib/bard/provision/http.rb
CHANGED
data/lib/bard/provision/mysql.rb
CHANGED
data/lib/bard/provision/repo.rb
CHANGED
data/lib/bard/provision/ssh.rb
CHANGED
data/lib/bard/version.rb
CHANGED
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: 1.0.
|
4
|
+
version: 1.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Micah Geisel
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-08-
|
11
|
+
date: 2024-08-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|