bard 1.3.4 → 1.3.5

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: fa717f489274f4bb6340a42930201281ab1c012d368b9cbdee3263bac15ec62b
4
- data.tar.gz: 010036ea949f34ac503ec179ebbace96f95762b0bdd7e35674a0674b8c2dc924
3
+ metadata.gz: f60ca542176963e6e28f2668e7e586579623d3e484edfc4ff2bdded229d264fc
4
+ data.tar.gz: 80f70c58ac4ec8c9d3360450a93a243258404e56a8e5a1d91d97ae065e0ae28e
5
5
  SHA512:
6
- metadata.gz: 39bce499b49e7d9c33cf9147190a3b4ee986fe383b905d9c31e2fb9dfff79cdb819050943eb50615c230f96c7133e1b4816563afecb8cf0e4f4adc1854f46de6
7
- data.tar.gz: 7765e288e7184d9d124e4a2c8b55aeda92fd6ab35f99c8d35ec3e887ecdb7b60b6009f7726e5095bf21c1accf59d8a862175b6b9110dff46673088ee3b30edc0
6
+ metadata.gz: f3b82acca3f891fa76e03a53a54b2dddf108d8139ff0a630a229b51e2e17bc25ae0665fb04212546fc9cdf8e1c3ec1b1877d5bcf4677852cdd5407fcca37d0b9
7
+ data.tar.gz: 3a897074c8ba3e11f7b823ef2e762c00a7f46f761a38372a380eeb7f84d57743bbc93b19682f9b11501d0bdca22d59cc102ccef59a7f698b99646625a17fa703
@@ -9,10 +9,11 @@ class Bard::CLI::Command < SimpleDelegator
9
9
 
10
10
  def self.setup cli
11
11
  cli.desc @command, @description
12
-
13
- method = @method # put in local variable so next block can capture it
12
+ # put in local variables so next block can capture it
13
+ command_class = self
14
+ method = @method
14
15
  cli.define_method method do |*args|
15
- command = Bard::CLI::New.new(self)
16
+ command = command_class.new(self)
16
17
  command.send method, *args
17
18
  end
18
19
  end
@@ -2,6 +2,35 @@ ruby_version, project_name = (`rvm current name`.chomp).split("@")
2
2
 
3
3
  file ".ruby-version", ruby_version
4
4
  file ".ruby-gemset", project_name
5
+ file ".gitignore", <<~GITIGNORE
6
+ # See https://help.github.com/articles/ignoring-files for more about ignoring files.
7
+ #
8
+ # If you find yourself ignoring temporary files generated by your text editor
9
+ # or operating system, you probably want to add a global ignore instead:
10
+ # git config --global core.excludesfile '~/.gitignore_global'
11
+
12
+ # Ignore bundler config.
13
+ /.bundle
14
+
15
+ # Ignore all logfiles and tempfiles.
16
+ /log/*
17
+ /tmp/*
18
+ !/log/.keep
19
+ !/tmp/.keep
20
+
21
+ # Ignore master key for decrypting credentials and more.
22
+ /config/master.key
23
+
24
+ /config/database.yml
25
+ /db/*.sqlite3
26
+ /db/data.*
27
+
28
+ # Ignore Syncthing
29
+ .stfolder/
30
+
31
+ # Thank Apple!
32
+ .DS_Store
33
+ GITIGNORE
5
34
 
6
35
  file "Gemfile", <<~RUBY
7
36
  source "https://rubygems.org"
@@ -1,15 +1,10 @@
1
+ require "bard/cli/command"
1
2
  require "bard/provision"
2
3
 
3
- module Bard::CLI::Provision
4
- def self.included mod
5
- mod.class_eval do
6
-
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
- Bard::Provision.call(config, ssh_url.dup) # dup unfreezes the string for later mutation
10
- end
11
-
12
- end
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"
6
+ def provision ssh_url=config[:production].ssh
7
+ Bard::Provision.call(config, ssh_url.dup) # dup unfreezes the string for later mutation
13
8
  end
14
9
  end
15
10
 
data/lib/bard/cli.rb CHANGED
@@ -22,7 +22,6 @@ module Bard
22
22
  open: "Open",
23
23
  ssh: "SSH",
24
24
  install: "Install",
25
- provision: "Provision",
26
25
  ping: "Ping",
27
26
  hurt: "Hurt",
28
27
  vim: "Vim",
@@ -32,6 +31,7 @@ module Bard
32
31
  end
33
32
 
34
33
  {
34
+ provision: "Provision",
35
35
  new: "New",
36
36
  }.each do |command, klass|
37
37
  require "bard/cli/#{command}"
@@ -47,16 +47,14 @@ module Bard
47
47
  puts red("!!! ") + "Running command failed: #{yellow(e.message)}"
48
48
  exit 1
49
49
  end
50
- end
51
-
52
- private
53
50
 
54
- def config
55
- @config ||= Bard::Config.new(project_name, path: "bard.rb")
56
- end
51
+ def config
52
+ @config ||= Bard::Config.new(project_name, path: "bard.rb")
53
+ end
57
54
 
58
- def project_name
59
- @project_name ||= File.expand_path(".").split("/").last
55
+ def project_name
56
+ @project_name ||= File.expand_path(".").split("/").last
57
+ end
60
58
  end
61
59
  end
62
60
  end
@@ -5,10 +5,10 @@ class Bard::Provision::AuthorizedKeys < Bard::Provision
5
5
  print "Authorized Keys:"
6
6
 
7
7
  KEYS.each do |search_text, full_key|
8
- provision_server.run! <<~BASH #, quiet: true
9
- file=~/.ssh/authorized_keys
10
- if ! grep -F -q "#{search_text}" $file; then
11
- echo "#{full_key}" >> $file
8
+ file = "~/.ssh/authorized_keys"
9
+ provision_server.run! <<~BASH, home: true
10
+ if ! grep -F -q "#{search_text}" #{file}; then
11
+ echo "#{full_key}" >> #{file}
12
12
  fi
13
13
  BASH
14
14
  end
@@ -0,0 +1,10 @@
1
+ # run bard deploy
2
+
3
+ class Bard::Provision::Deploy < Bard::Provision
4
+ def call
5
+ print "Deploy:"
6
+ config[:local].run! "bard deploy"
7
+ puts " ✓"
8
+ end
9
+ end
10
+
@@ -3,7 +3,7 @@ module Bard
3
3
  def self.call(...) = new(...).call
4
4
 
5
5
  def call
6
- %w[SSH User AuthorizedKeys Apt MySQL Repo MasterKey RVM App Passenger Data HTTP LogRotation].each do |step|
6
+ %w[SSH User AuthorizedKeys Apt MySQL Repo MasterKey RVM App Passenger Data HTTP LogRotation Deploy].each do |step|
7
7
  require "bard/provision/#{step.downcase}"
8
8
  self.class.const_get(step).call(*values)
9
9
  end
data/lib/bard/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  module Bard
2
- VERSION = "1.3.4"
2
+ VERSION = "1.3.5"
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.4
4
+ version: 1.3.5
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-12-31 00:00:00.000000000 Z
11
+ date: 2025-01-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -167,6 +167,7 @@ files:
167
167
  - lib/bard/provision/apt.rb
168
168
  - lib/bard/provision/authorizedkeys.rb
169
169
  - lib/bard/provision/data.rb
170
+ - lib/bard/provision/deploy.rb
170
171
  - lib/bard/provision/http.rb
171
172
  - lib/bard/provision/logrotation.rb
172
173
  - lib/bard/provision/masterkey.rb