bard 1.4.4 → 1.4.6
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/lib/bard/cli/new.rb +7 -7
- data/lib/bard/cli/new_rails_template.rb +2 -0
- data/lib/bard/cli/provision.rb +2 -2
- data/lib/bard/github_pages.rb +8 -7
- data/lib/bard/provision/authorizedkeys.rb +2 -2
- data/lib/bard/provision/logrotation.rb +2 -2
- data/lib/bard/provision/mysql.rb +1 -1
- data/lib/bard/provision/swapfile.rb +2 -2
- 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: 45cfd2dba5d72da5661cef49002a9289ed15572ef14c7a55d4d47ecd2bf51b39
|
4
|
+
data.tar.gz: 5c731db865870f9beea50d63ec2af8461210fb0f5a0f6892554334990135273a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d3524e8700422a66bc5675851297a6382eb19c1eb715c94b73be009d077b5319c186f7ff82a9ed30155c80cfcba63ddc2d64bd7c5a1d520a40603130204a36bd
|
7
|
+
data.tar.gz: ae3462ce1eda70232b466cbb06790c062d217110bcd3aa8f7848f81431700fc10ec30ff99694ae3b1616957cb258d3907d0c610430b66dde739cf15c8f5aad0b
|
data/lib/bard/cli/new.rb
CHANGED
@@ -26,7 +26,7 @@ class Bard::CLI::New < Bard::CLI::Command
|
|
26
26
|
end
|
27
27
|
|
28
28
|
def create_project
|
29
|
-
run! <<~
|
29
|
+
run! <<~SH
|
30
30
|
env -i bash -lc '
|
31
31
|
export HOME=~
|
32
32
|
cd ..
|
@@ -36,34 +36,34 @@ class Bard::CLI::New < Bard::CLI::Command
|
|
36
36
|
gem list rails -i || gem install rails --no-document
|
37
37
|
rails new #{project_name} --skip-git --skip-kamal --skip-test -m #{template_path}
|
38
38
|
'
|
39
|
-
|
39
|
+
SH
|
40
40
|
end
|
41
41
|
|
42
42
|
def push_to_github
|
43
43
|
api = Bard::Github.new(project_name)
|
44
44
|
api.create_repo
|
45
|
-
run! <<~
|
45
|
+
run! <<~SH
|
46
46
|
cd ../#{project_name}
|
47
47
|
git init -b master
|
48
48
|
git add -A
|
49
49
|
git commit -m"initial commit."
|
50
50
|
git remote add origin git@github.com:botandrosedesign/#{project_name}
|
51
51
|
git push -u origin master
|
52
|
-
|
52
|
+
SH
|
53
53
|
api.add_master_key File.read("../#{project_name}/config/master.key")
|
54
54
|
api.add_master_branch_protection
|
55
55
|
api.patch(nil, allow_auto_merge: true)
|
56
56
|
end
|
57
57
|
|
58
58
|
def stage
|
59
|
-
run! <<~
|
59
|
+
run! <<~SH
|
60
60
|
cd ../#{project_name}
|
61
61
|
bard deploy --clone
|
62
|
-
|
62
|
+
SH
|
63
63
|
end
|
64
64
|
|
65
65
|
def ruby_version
|
66
|
-
|
66
|
+
"ruby-3.3.3"
|
67
67
|
end
|
68
68
|
|
69
69
|
def template_path
|
@@ -185,6 +185,8 @@ insert_into_file "config/database.yml", <<-YAML, after: "# database: path/to/per
|
|
185
185
|
migrations_paths: db/queue_migrate
|
186
186
|
YAML
|
187
187
|
|
188
|
+
gsub_file "config/database.yml", "path/to/persistent/", ""
|
189
|
+
|
188
190
|
gsub_file "config/environments/production.rb", / (config\.logger.+STDOUT.*)$/, ' # \1'
|
189
191
|
|
190
192
|
after_bundle do
|
data/lib/bard/cli/provision.rb
CHANGED
@@ -6,6 +6,7 @@ class Bard::CLI::Provision < Bard::CLI::Command
|
|
6
6
|
SSH
|
7
7
|
User
|
8
8
|
AuthorizedKeys
|
9
|
+
Swapfile
|
9
10
|
Apt
|
10
11
|
MySQL
|
11
12
|
Repo
|
@@ -13,10 +14,9 @@ class Bard::CLI::Provision < Bard::CLI::Command
|
|
13
14
|
RVM
|
14
15
|
App
|
15
16
|
Passenger
|
16
|
-
Data
|
17
17
|
HTTP
|
18
18
|
LogRotation
|
19
|
-
|
19
|
+
Data
|
20
20
|
Deploy
|
21
21
|
]
|
22
22
|
|
data/lib/bard/github_pages.rb
CHANGED
@@ -23,10 +23,10 @@ module Bard
|
|
23
23
|
|
24
24
|
def build_site
|
25
25
|
system "rm -rf #{@build_dir.sub(@sha, "*")}"
|
26
|
-
run! <<~
|
26
|
+
run! <<~SH
|
27
27
|
set -e
|
28
28
|
RAILS_ENV=production bundle exec rails s -p 3000 -d --pid tmp/pids/server.pid
|
29
|
-
bundle exec rake assets:clean assets:precompile
|
29
|
+
OUTPUT=$(bundle exec rake assets:clean assets:precompile 2>&1) || echo "$OUTPUT"
|
30
30
|
|
31
31
|
# Create the output directory and enter it
|
32
32
|
BUILD=#{@build_dir}
|
@@ -37,18 +37,19 @@ module Bard
|
|
37
37
|
|
38
38
|
# wait until server responds
|
39
39
|
echo waiting...
|
40
|
-
curl --retry 5 --retry-delay 2 http://localhost:3000
|
40
|
+
curl -s --retry 5 --retry-delay 2 http://localhost:3000 >/dev/null 2>&1
|
41
41
|
|
42
42
|
echo copying...
|
43
43
|
# Mirror the site to the build folder, ignoring links with query params
|
44
|
-
wget --reject-regex "(
|
44
|
+
bash -c 'set -o pipefail; wget -nv -r -l inf --no-remove-listing -FEnH --reject-regex "(\\.*)\\?(.*)" http://localhost:3000/ 2>&1 | grep -v -E "URL:|FINISHED|Total wall clock time:|Downloaded:"'
|
45
|
+
|
45
46
|
echo #{@domain} > CNAME
|
46
|
-
|
47
|
+
SH
|
47
48
|
ensure # cleanup
|
48
|
-
run! <<~
|
49
|
+
run! <<~SH
|
49
50
|
cat tmp/pids/server.pid | xargs -I {} kill {}
|
50
51
|
rm -rf public/assets
|
51
|
-
|
52
|
+
SH
|
52
53
|
end
|
53
54
|
|
54
55
|
def create_tree_from_build
|
@@ -6,11 +6,11 @@ class Bard::Provision::AuthorizedKeys < Bard::Provision
|
|
6
6
|
|
7
7
|
KEYS.each do |search_text, full_key|
|
8
8
|
file = "~/.ssh/authorized_keys"
|
9
|
-
provision_server.run! <<~
|
9
|
+
provision_server.run! <<~SH, home: true
|
10
10
|
if ! grep -F -q "#{search_text}" #{file}; then
|
11
11
|
echo "#{full_key}" >> #{file}
|
12
12
|
fi
|
13
|
-
|
13
|
+
SH
|
14
14
|
end
|
15
15
|
|
16
16
|
puts " ✓"
|
@@ -4,7 +4,7 @@ class Bard::Provision::LogRotation < Bard::Provision
|
|
4
4
|
def call
|
5
5
|
print "Log Rotation:"
|
6
6
|
|
7
|
-
provision_server.run! <<~
|
7
|
+
provision_server.run! <<~SH, quiet: true
|
8
8
|
file=/etc/logrotate.d/#{server.project_name}
|
9
9
|
if [ ! -f $file ]; then
|
10
10
|
sudo tee $file > /dev/null <<EOF
|
@@ -20,7 +20,7 @@ class Bard::Provision::LogRotation < Bard::Provision
|
|
20
20
|
}
|
21
21
|
EOF
|
22
22
|
fi
|
23
|
-
|
23
|
+
SH
|
24
24
|
|
25
25
|
puts " ✓"
|
26
26
|
end
|
data/lib/bard/provision/mysql.rb
CHANGED
@@ -8,7 +8,7 @@ class Bard::Provision::MySQL < Bard::Provision
|
|
8
8
|
provision_server.run! [
|
9
9
|
"sudo apt-get install -y mysql-server",
|
10
10
|
%(sudo mysql -uroot -e "ALTER USER \\"'\\"root\\"'\\"@\\"'\\"localhost\\"'\\" IDENTIFIED WITH mysql_native_password BY \\"'\\"\\"'\\", \\"'\\"root\\"'\\"@\\"'\\"localhost\\"'\\" PASSWORD EXPIRE NEVER; FLUSH PRIVILEGES;"),
|
11
|
-
%(mysql -uroot -e "UPDATE mysql.user SET password_lifetime = NULL WHERE user = 'root' AND host = 'localhost';"),
|
11
|
+
%(mysql -uroot -e "UPDATE mysql.user SET password_lifetime = NULL WHERE user = \\"'\\"root\\"'\\" AND host = \\"'\\"localhost\\"'\\";"),
|
12
12
|
].join("; "), home: true
|
13
13
|
end
|
14
14
|
|
@@ -4,7 +4,7 @@ class Bard::Provision::Swapfile < Bard::Provision
|
|
4
4
|
def call
|
5
5
|
print "Swapfile:"
|
6
6
|
|
7
|
-
provision_server.run! <<~
|
7
|
+
provision_server.run! <<~SH
|
8
8
|
if [ ! -f /swapfile ]; then
|
9
9
|
sudo fallocate -l $(grep MemTotal /proc/meminfo | awk '{print $2}')K /swapfile
|
10
10
|
fi
|
@@ -12,7 +12,7 @@ class Bard::Provision::Swapfile < Bard::Provision
|
|
12
12
|
sudo swapon --show | grep -q '/swapfile' || sudo mkswap /swapfile
|
13
13
|
sudo swapon --show | grep -q '/swapfile' || sudo swapon /swapfile
|
14
14
|
grep -q '/swapfile none swap sw 0 0' /etc/fstab || echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab
|
15
|
-
|
15
|
+
SH
|
16
16
|
|
17
17
|
puts " ✓"
|
18
18
|
end
|
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.4.
|
4
|
+
version: 1.4.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Micah Geisel
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-
|
11
|
+
date: 2025-08-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|