Rakefile in rake_git-0.1.0.pre.7 vs Rakefile in rake_git-0.1.0.pre.8
- old
+ new
@@ -1,16 +1,17 @@
# frozen_string_literal: true
-require 'yaml'
require 'rake_circle_ci'
+require 'rake_git'
require 'rake_git_crypt'
require 'rake_github'
-require 'rake_ssh'
require 'rake_gpg'
-require 'securerandom'
+require 'rake_ssh'
require 'rspec/core/rake_task'
require 'rubocop/rake_task'
+require 'securerandom'
+require 'yaml'
task default: %i[
library:fix
test:unit
]
@@ -28,23 +29,33 @@
config/gpg
config/secrets/ci/gpg.public
]
)
+namespace :git do
+ RakeGit.define_commit_task(
+ argument_names: [:message]
+ ) do |t, args|
+ t.message = args.message
+ end
+end
+
namespace :encryption do
namespace :directory do
desc 'Ensure CI secrets directory exists.'
task :ensure do
FileUtils.mkdir_p('config/secrets/ci')
end
end
namespace :passphrase do
- desc 'Generate encryption passphrase used by CI.'
+ desc 'Generate encryption passphrase for CI GPG key'
task generate: ['directory:ensure'] do
- File.write('config/secrets/ci/encryption.passphrase',
- SecureRandom.base64(36))
+ File.write(
+ 'config/secrets/ci/encryption.passphrase',
+ SecureRandom.base64(36)
+ )
end
end
end
namespace :keys do
@@ -65,10 +76,20 @@
)
end
end
namespace :secrets do
+ namespace :directory do
+ desc 'Ensure secrets directory exists and is set up correctly'
+ task :ensure do
+ FileUtils.mkdir_p('config/secrets')
+ unless File.exist?('config/secrets/.unlocked')
+ File.write('config/secrets/.unlocked', 'true')
+ end
+ end
+ end
+
desc 'Generate all generatable secrets.'
task generate: %w[
encryption:passphrase:generate
keys:deploy:generate
keys:gpg:generate
@@ -82,17 +103,9 @@
rm_rf 'config/secrets'
end
desc 'Rotate all secrets.'
task rotate: [:'git_crypt:reinstall']
-end
-
-namespace :git do
- desc 'Commit all changes'
- task :commit, [:message] do |_, args|
- sh('git', 'add', '-A')
- sh('git', 'commit', '-m', args.message)
- end
end
RuboCop::RakeTask.new
namespace :library do