bard 1.3.9 → 1.4.0
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/bard.gemspec +1 -0
- data/lib/bard/cli/new.rb +4 -1
- data/lib/bard/cli/new_rails_template.rb +81 -7
- data/lib/bard/git.rb +3 -1
- data/lib/bard/github.rb +41 -0
- data/lib/bard/github_pages.rb +1 -3
- data/lib/bard/version.rb +1 -1
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cb512a4a019bd8b6c275c56d5f18107756dbd9f9792747e96b13435c5fb67257
|
4
|
+
data.tar.gz: 54f9674d14d7ec28ec98024fdde5c33b3869808e144beb9c49f19b6ac8c0f526
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4df00ef514149aa70765c4998c62c5bbbbe21e4e40990979fe7fcf99005ee20b362ec6f8bc2dc78112afd8b0e25a7e5874d2761f14ba89488da0ced2a2c87c89
|
7
|
+
data.tar.gz: 1c32f9fd761e8723798d0d87b2b748a0d5befc716555907561fc0924b921fe8d1ca280f3ee48377c47e35129b6fbd9eb29b7262c9e13c1923ac72ef6b478dce3
|
data/bard.gemspec
CHANGED
@@ -20,6 +20,7 @@ Gem::Specification.new do |spec|
|
|
20
20
|
spec.add_dependency "thor", ">= 0.19.0"
|
21
21
|
spec.add_dependency "rvm"
|
22
22
|
spec.add_dependency "term-ansicolor", ">= 1.0.3"
|
23
|
+
spec.add_dependency "rbnacl"
|
23
24
|
|
24
25
|
spec.add_development_dependency "byebug"
|
25
26
|
spec.add_development_dependency "rspec"
|
data/lib/bard/cli/new.rb
CHANGED
@@ -40,7 +40,8 @@ class Bard::CLI::New < Bard::CLI::Command
|
|
40
40
|
end
|
41
41
|
|
42
42
|
def push_to_github
|
43
|
-
Bard::Github.new(project_name)
|
43
|
+
api = Bard::Github.new(project_name)
|
44
|
+
api.create_repo
|
44
45
|
run! <<~BASH
|
45
46
|
cd ../#{project_name}
|
46
47
|
git init -b master
|
@@ -49,6 +50,8 @@ class Bard::CLI::New < Bard::CLI::Command
|
|
49
50
|
git remote add origin git@github.com:botandrosedesign/#{project_name}
|
50
51
|
git push -u origin master
|
51
52
|
BASH
|
53
|
+
api.add_master_key File.read("../#{project_name}/config/master.key")
|
54
|
+
api.add_master_branch_protection
|
52
55
|
end
|
53
56
|
|
54
57
|
def stage
|
@@ -21,6 +21,9 @@ file ".gitignore", <<~GITIGNORE
|
|
21
21
|
# Ignore master key for decrypting credentials and more.
|
22
22
|
/config/master.key
|
23
23
|
|
24
|
+
# ignore coverage reports
|
25
|
+
/coverage
|
26
|
+
|
24
27
|
# Ignore database dumps
|
25
28
|
/db/data.*
|
26
29
|
|
@@ -39,24 +42,25 @@ file "Gemfile", <<~RUBY
|
|
39
42
|
|
40
43
|
gem "bootsnap", require: false
|
41
44
|
gem "rails", "~>8.0.0"
|
45
|
+
gem "solid_cache"
|
46
|
+
gem "solid_queue"
|
47
|
+
gem "solid_cable"
|
42
48
|
gem "bard-rails"
|
43
49
|
gem "sqlite3"
|
50
|
+
gem "image_processing"
|
51
|
+
gem "puma"
|
52
|
+
gem "exception_notification"
|
44
53
|
|
54
|
+
# css
|
45
55
|
gem "sprockets-rails"
|
46
56
|
gem "dartsass-sprockets"
|
47
57
|
gem "bard-sass"
|
48
58
|
|
59
|
+
# js
|
49
60
|
gem "importmap-rails"
|
50
61
|
gem "turbo-rails"
|
51
62
|
gem "stimulus-rails"
|
52
63
|
|
53
|
-
gem "solid_cache"
|
54
|
-
gem "solid_queue"
|
55
|
-
gem "solid_cable"
|
56
|
-
|
57
|
-
gem "image_processing"
|
58
|
-
gem "puma"
|
59
|
-
|
60
64
|
group :development do
|
61
65
|
gem "web-console"
|
62
66
|
end
|
@@ -83,6 +87,64 @@ file "Gemfile", <<~RUBY
|
|
83
87
|
end
|
84
88
|
RUBY
|
85
89
|
|
90
|
+
file "config/initializers/exception_notification.rb", <<~RUBY
|
91
|
+
require "exception_notification/rails"
|
92
|
+
|
93
|
+
ExceptionNotification.configure do |config|
|
94
|
+
config.ignored_exceptions = []
|
95
|
+
|
96
|
+
# Adds a condition to decide when an exception must be ignored or not.
|
97
|
+
# The ignore_if method can be invoked multiple times to add extra conditions.
|
98
|
+
config.ignore_if do |exception, options|
|
99
|
+
not Rails.env.production?
|
100
|
+
end
|
101
|
+
|
102
|
+
config.ignore_if do |exception, options|
|
103
|
+
%w[
|
104
|
+
ActiveRecord::RecordNotFound
|
105
|
+
AbstractController::ActionNotFound
|
106
|
+
ActionController::RoutingError
|
107
|
+
ActionController::InvalidAuthenticityToken
|
108
|
+
ActionView::MissingTemplate
|
109
|
+
ActionController::BadRequest
|
110
|
+
ActionDispatch::Http::Parameters::ParseError
|
111
|
+
ActionDispatch::Http::MimeNegotiation::InvalidType
|
112
|
+
].include?(exception.class.to_s)
|
113
|
+
end
|
114
|
+
|
115
|
+
config.add_notifier :email, {
|
116
|
+
email_prefix: "[\#{File.basename(Dir.pwd)}] ",
|
117
|
+
exception_recipients: "micah@botandrose.com",
|
118
|
+
smtp_settings: Rails.application.credentials.exception_notification_smtp_settings,
|
119
|
+
}
|
120
|
+
end
|
121
|
+
|
122
|
+
if defined?(Rake::Application)
|
123
|
+
Rake::Application.prepend Module.new {
|
124
|
+
def display_error_message error
|
125
|
+
ExceptionNotifier.notify_exception(error)
|
126
|
+
super
|
127
|
+
end
|
128
|
+
|
129
|
+
def invoke_task task_name
|
130
|
+
super
|
131
|
+
rescue RuntimeError => exception
|
132
|
+
if exception.message.starts_with?("Don't know how to build task")
|
133
|
+
ExceptionNotifier.notify_exception(exception)
|
134
|
+
end
|
135
|
+
raise exception
|
136
|
+
end
|
137
|
+
}
|
138
|
+
end
|
139
|
+
|
140
|
+
ActionController::Live.prepend Module.new {
|
141
|
+
def log_error exception
|
142
|
+
ExceptionNotifier.notify_exception exception, env: request.env
|
143
|
+
super
|
144
|
+
end
|
145
|
+
}
|
146
|
+
RUBY
|
147
|
+
|
86
148
|
file "app/assets/config/manifest.js", <<~RUBY
|
87
149
|
//= link_tree ../images
|
88
150
|
//= link_directory ../stylesheets .css
|
@@ -110,6 +172,18 @@ insert_into_file "config/database.yml", <<~YAML, after: "database: storage/test.
|
|
110
172
|
database: storage/staging.sqlite3
|
111
173
|
YAML
|
112
174
|
|
175
|
+
insert_into_file "config/database.yml", <<-YAML, after: "# database: path/to/persistent/storage/production.sqlite3"
|
176
|
+
|
177
|
+
cable:
|
178
|
+
<<: *default
|
179
|
+
# database: path/to/persistent/storage/production_cable.sqlite3
|
180
|
+
migrations_paths: db/cable_migrate
|
181
|
+
queue:
|
182
|
+
<<: *default
|
183
|
+
# database: path/to/persistent/storage/production_queue.sqlite3
|
184
|
+
migrations_paths: db/queue_migrate
|
185
|
+
YAML
|
186
|
+
|
113
187
|
gsub_file "config/environments/production.rb", / (config\.logger.+STDOUT.*)$/, ' # \1'
|
114
188
|
|
115
189
|
after_bundle do
|
data/lib/bard/git.rb
CHANGED
data/lib/bard/github.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
require "net/http"
|
2
2
|
require "json"
|
3
3
|
require "base64"
|
4
|
+
require "rbnacl"
|
4
5
|
|
5
6
|
module Bard
|
6
7
|
class Github < Struct.new(:project_name)
|
@@ -19,6 +20,14 @@ module Bard
|
|
19
20
|
end
|
20
21
|
end
|
21
22
|
|
23
|
+
def put path, params={}
|
24
|
+
request(path) do |uri|
|
25
|
+
Net::HTTP::Put.new(uri).tap do |r|
|
26
|
+
r.body = JSON.dump(params)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
22
31
|
def delete path, params={}
|
23
32
|
request(path) do |uri|
|
24
33
|
Net::HTTP::Delete.new(uri).tap do |r|
|
@@ -36,6 +45,38 @@ module Bard
|
|
36
45
|
post("keys", title:, key:)
|
37
46
|
end
|
38
47
|
|
48
|
+
def add_master_key master_key
|
49
|
+
response = get("actions/secrets/public-key")
|
50
|
+
public_key, public_key_id = response.values_at("key", "key_id")
|
51
|
+
|
52
|
+
def encrypt_secret(encoded_public_key, secret)
|
53
|
+
decoded_key = Base64.decode64(encoded_public_key)
|
54
|
+
public_key = RbNaCl::PublicKey.new(decoded_key)
|
55
|
+
box = RbNaCl::Boxes::Sealed.from_public_key(public_key)
|
56
|
+
encrypted_secret = box.encrypt(secret)
|
57
|
+
Base64.strict_encode64(encrypted_secret)
|
58
|
+
end
|
59
|
+
|
60
|
+
encrypted_master_key = encrypt_secret(public_key, master_key)
|
61
|
+
|
62
|
+
put("actions/secrets/RAILS_MASTER_KEY", {
|
63
|
+
encrypted_value: encrypted_master_key,
|
64
|
+
key_id: public_key_id,
|
65
|
+
})
|
66
|
+
end
|
67
|
+
|
68
|
+
def add_master_branch_protection
|
69
|
+
put("branches/master/protection", {
|
70
|
+
required_status_checks: {
|
71
|
+
strict: false,
|
72
|
+
contexts: [],
|
73
|
+
},
|
74
|
+
enforce_admins: nil,
|
75
|
+
required_pull_request_reviews: nil,
|
76
|
+
restrictions: nil,
|
77
|
+
})
|
78
|
+
end
|
79
|
+
|
39
80
|
def create_repo
|
40
81
|
post("https://api.github.com/orgs/botandrosedesign/repos", {
|
41
82
|
name: project_name,
|
data/lib/bard/github_pages.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.
|
4
|
+
version: 1.4.0
|
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-
|
11
|
+
date: 2025-01-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -52,6 +52,20 @@ dependencies:
|
|
52
52
|
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: 1.0.3
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rbnacl
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
55
69
|
- !ruby/object:Gem::Dependency
|
56
70
|
name: byebug
|
57
71
|
requirement: !ruby/object:Gem::Requirement
|