bard 1.3.7 → 1.3.8

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e4edcfe1ca8845bccdbd65dc00ec5c281f02f1b36a40286351c8e92dba12bb9d
4
- data.tar.gz: 6a73de3b560b24f081b2387a4beaf86c0191b3029b705714c7d5fafbd587ae64
3
+ metadata.gz: ea4935b4438e88255e247667738c3cbda39e10d9eff5d45b2320ddb4e67b9ed7
4
+ data.tar.gz: 9c1056031159a162b53754c6ffbd5d1503458fd6830305ada0c999dc00719a07
5
5
  SHA512:
6
- metadata.gz: 3c670827f4eb2c1f2449e243f10a5b97f18e1dd04bee02383754934e13721661fed30421e38a3a3cd2d0a59e963735e5925251038fa401224e3c45707b4d55e9
7
- data.tar.gz: 1d2ecd107434dc76a334fe34559fddcf4f74c1786459723cd74d1cc86caee8094f3288e614f1e10b820b7d1a9b98cbda6ad0a22dc0f19dcdeccc0a374528f0aa
6
+ metadata.gz: 72e4f854810fa2d248a46e50b60c0524e53cd2082cc7d62826acf28fad50660168323a1092030d8fe81db8ff586f4ce9b814ef8400b75d2700074e792426133f
7
+ data.tar.gz: 195647d9dadee0966500ab3828404282f83ccaa612978495b20408a01d9b37b48e25d9a896deecbf640bea7128630c480196fb76090b0301253de6a688ea99c0
@@ -7,8 +7,14 @@ class Bard::CLI::Command < SimpleDelegator
7
7
  @description = description
8
8
  end
9
9
 
10
+ def self.option *args, **kwargs
11
+ @option_args = args
12
+ @option_kwargs = kwargs
13
+ end
14
+
10
15
  def self.setup cli
11
16
  cli.desc @command, @description
17
+ cli.option *@option_args, **@option_kwargs if @option_args || @option_kwargs
12
18
  # put in local variables so next block can capture it
13
19
  command_class = self
14
20
  method = @method
@@ -110,6 +110,8 @@ insert_into_file "config/database.yml", <<~YAML, after: "database: storage/test.
110
110
  database: storage/staging.sqlite3
111
111
  YAML
112
112
 
113
+ gsub_file "config/environments/production.rb", / (config\.logger.+STDOUT.*)$/, ' # \1'
114
+
113
115
  after_bundle do
114
116
  run "bard install"
115
117
  run "bin/setup"
@@ -2,9 +2,32 @@ require "bard/cli/command"
2
2
  require "bard/provision"
3
3
 
4
4
  class Bard::CLI::Provision < Bard::CLI::Command
5
- desc "provision [ssh_url]", "takes an optional ssh url to a raw ubuntu 22.04 install, and readies it in the shape of :production"
5
+ STEPS = %w[
6
+ SSH
7
+ User
8
+ AuthorizedKeys
9
+ Apt
10
+ MySQL
11
+ Repo
12
+ MasterKey
13
+ RVM
14
+ App
15
+ Passenger
16
+ Data
17
+ HTTP
18
+ LogRotation
19
+ Swapfile
20
+ Deploy
21
+ ]
22
+
23
+ desc "provision [ssh_url] --steps=all", "takes an optional ssh url to a raw ubuntu 22.04 install, and readies it in the shape of :production"
24
+ option :steps, type: :array, default: STEPS
6
25
  def provision ssh_url=config[:production].ssh
7
- Bard::Provision.call(config, ssh_url.dup) # dup unfreezes the string for later mutation
26
+ options[:steps].each do |step|
27
+ require "bard/provision/#{step.downcase}"
28
+ # dup unfreezes the string for later mutation
29
+ Bard::Provision.const_get(step).call(config, ssh_url.dup)
30
+ end
8
31
  end
9
32
  end
10
33
 
@@ -0,0 +1,21 @@
1
+ # setup swapfile
2
+
3
+ class Bard::Provision::Swapfile < Bard::Provision
4
+ def call
5
+ print "Swapfile:"
6
+
7
+ provision_server.run! <<~BASH
8
+ if [ ! -f /swapfile ]; then
9
+ sudo fallocate -l $(grep MemTotal /proc/meminfo | awk '{print $2}')K /swapfile
10
+ fi
11
+ sudo chmod 600 /swapfile
12
+ sudo swapon --show | grep -q '/swapfile' || sudo mkswap /swapfile
13
+ sudo swapon --show | grep -q '/swapfile' || sudo swapon /swapfile
14
+ grep -q '/swapfile none swap sw 0 0' /etc/fstab || echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab
15
+ BASH
16
+
17
+ puts " ✓"
18
+ end
19
+ end
20
+
21
+
@@ -2,13 +2,6 @@ module Bard
2
2
  class Provision < Struct.new(:config, :ssh_url)
3
3
  def self.call(...) = new(...).call
4
4
 
5
- def call
6
- %w[SSH User AuthorizedKeys Apt MySQL Repo MasterKey RVM App Passenger Data HTTP LogRotation Deploy].each do |step|
7
- require "bard/provision/#{step.downcase}"
8
- self.class.const_get(step).call(*values)
9
- end
10
- end
11
-
12
5
  private
13
6
 
14
7
  def server
data/lib/bard/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  module Bard
2
- VERSION = "1.3.7"
2
+ VERSION = "1.3.8"
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.3.7
4
+ version: 1.3.8
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-01-13 00:00:00.000000000 Z
11
+ date: 2025-01-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -176,6 +176,7 @@ files:
176
176
  - lib/bard/provision/repo.rb
177
177
  - lib/bard/provision/rvm.rb
178
178
  - lib/bard/provision/ssh.rb
179
+ - lib/bard/provision/swapfile.rb
179
180
  - lib/bard/provision/user.rb
180
181
  - lib/bard/server.rb
181
182
  - lib/bard/version.rb