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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0e45ecd5905bd4d3b0dcb23787a81fb9262100eacf50bcef98f59bf494df7d97
4
- data.tar.gz: 00502aa110525a2973d26ba4d3382f57da572a929a8e7b77544e6829b761c94f
3
+ metadata.gz: 62659c90d5cd7cf39ef14edf5b0146338d0571fff437df85040d4cdcb0d82ff0
4
+ data.tar.gz: e3ac33d2ca9513a925060561a3a40608236346ee87a2beaca6524f8922da1bdd
5
5
  SHA512:
6
- metadata.gz: 4e549338c287902159c084c7675459e3423d1e9d0c22d371db05a677e8880cf6dbbb4398576beca62cea6e94c9b21ac71e57121d84ae6c3b61c80a6da5c18321
7
- data.tar.gz: 402a1c103e185fa685d4fcce477ffbd0fd3f25a8ae0be9b99045ac7c22258d7886537f7e19841c03252933de819bd4d7ecbe323d95278bcaab713140501cc53d
6
+ metadata.gz: 9b50ddaeba02751089df9469427a663ebd36481115c01a1e72e808f96d9a869fd929cbf20df185668536b91e1c838090c82b41a1b05b0af990ebd31a328c3b3c
7
+ data.tar.gz: 638a531d23991f1fd01e284eaf1951994da92ab6ad695d1c9a53d10e814c7be91c5c3c487a90dd9b45d3443000f7e029198451140876d4674e68e162bc29420e
@@ -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
@@ -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
@@ -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
 
@@ -6,39 +6,50 @@ module Bard::CLI::Setup
6
6
 
7
7
  desc "setup", "installs app in nginx"
8
8
  def setup
9
- path = "/etc/nginx/sites-available/#{project_name}"
10
- dest_path = path.sub("sites-available", "sites-enabled")
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
- root #{Dir.pwd}/public;
26
- passenger_enabled on;
12
+ passenger_enabled on;
27
13
 
28
- location ~* \\.(ico|css|js|gif|jp?g|png|webp) {
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
- expires max;
32
- add_header Cache-Control public;
17
+ expires max;
18
+ add_header Cache-Control public;
33
19
  }
34
- }
35
- gzip_static on;
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
- false,
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@ci.botandrose.com:22022",
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@#{project_name}.botandrose.com:22022",
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)
@@ -4,14 +4,14 @@ class Bard::Provision::Data < Bard::Provision
4
4
  def call
5
5
  print "Data:"
6
6
 
7
- # print " Dumping #{server.key} database to file"
8
- # server.run! "bin/rake db:dump"
7
+ print " Dumping #{server.key} database to file"
8
+ server.run! "bin/rake db:dump"
9
9
 
10
- # print " Transfering file from #{server.key},"
11
- # server.copy_file "db/data.sql.gz", to: provision_server, verbose: false
10
+ print " Transfering file from #{server.key},"
11
+ server.copy_file "db/data.sql.gz", to: provision_server, verbose: false
12
12
 
13
- # print " Loading file into database,"
14
- # provision_server.run! "bin/rake db:load"
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},"
@@ -1,3 +1,5 @@
1
+ require "uri"
2
+
1
3
  # test for existence
2
4
 
3
5
  class Bard::Provision::HTTP < Bard::Provision
@@ -1,3 +1,5 @@
1
+ require "bard/copy"
2
+
1
3
  # copy master key if missing
2
4
 
3
5
  class Bard::Provision::MasterKey < Bard::Provision
@@ -15,7 +15,7 @@ class Bard::Provision::MySQL < Bard::Provision
15
15
  end
16
16
 
17
17
  def mysql_responding?
18
- provision_server.run "sudo service mysql status | cat", quiet: true
18
+ provision_server.run "sudo service mysql status | cat", home: true, quiet: true
19
19
  end
20
20
  end
21
21
 
@@ -1,3 +1,5 @@
1
+ require "bard/github"
2
+
1
3
  # generate and install ssh public key into deploy keys
2
4
  # add repo to known hosts
3
5
  # clone repo
@@ -27,7 +27,7 @@ class Bard::Provision::SSH < Bard::Provision
27
27
  ssh_url << ":#{target_port}"
28
28
  puts " ✓"
29
29
  end
30
-
30
+
31
31
  private
32
32
 
33
33
  def target_port
data/lib/bard/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  module Bard
2
- VERSION = "1.0.5"
2
+ VERSION = "1.0.7"
3
3
  end
4
4
 
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.5
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-25 00:00:00.000000000 Z
11
+ date: 2024-08-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor