Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/assets/builds/**/*
!/assets/builds/.keep
/coverage/*
!/coverage/.last_run.json
/log
Expand Down
4 changes: 2 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,10 @@ gem 'faraday-retry'
gem 'haml'
gem 'octokit'
gem 'omniauth-github'
gem 'propshaft'
gem 'puma'
gem 'rake'
gem 'sinatra', require: 'sinatra/base'
gem 'sprockets'
gem 'sprockets-sass_embedded'
gem 'tilt'

group :test do
Expand All @@ -33,6 +32,7 @@ group :development do
gem 'ed25519', require: false
gem 'haml_lint', require: false
gem 'irb'
gem 'listen'
gem 'railties', require: false
gem 'rdoc', require: false
gem 'rubocop', require: false
Expand Down
65 changes: 25 additions & 40 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -79,18 +79,10 @@ GEM
net-http (~> 0.5)
faraday-retry (2.4.0)
faraday (~> 2.0)
google-protobuf (4.34.1-arm64-darwin)
bigdecimal
rake (~> 13.3)
google-protobuf (4.34.1-x86-linux-gnu)
bigdecimal
rake (~> 13.3)
google-protobuf (4.34.1-x86_64-darwin)
bigdecimal
rake (~> 13.3)
google-protobuf (4.34.1-x86_64-linux-gnu)
bigdecimal
rake (~> 13.3)
ffi (1.17.4-arm64-darwin)
ffi (1.17.4-x86-linux-gnu)
ffi (1.17.4-x86_64-darwin)
ffi (1.17.4-x86_64-linux-gnu)
haml (7.2.0)
temple (>= 0.8.2)
thor
Expand All @@ -114,6 +106,10 @@ GEM
jwt (2.7.1)
language_server-protocol (3.17.0.5)
lint_roller (1.1.0)
listen (3.10.0)
logger
rb-fsevent (~> 0.10, >= 0.10.3)
rb-inotify (~> 0.9, >= 0.9.10)
logger (1.7.0)
loofah (2.25.1)
crass (~> 1.0.2)
Expand Down Expand Up @@ -172,6 +168,10 @@ GEM
prettyprint
prettyprint (0.2.0)
prism (1.9.0)
propshaft (1.3.2)
actionpack (>= 7.0.0)
activesupport (>= 7.0.0)
rack
psych (5.3.1)
date
stringio
Expand Down Expand Up @@ -209,6 +209,9 @@ GEM
zeitwerk (~> 2.6)
rainbow (3.1.1)
rake (13.4.2)
rb-fsevent (0.11.2)
rb-inotify (0.11.1)
ffi (~> 1.0)
rdoc (7.2.0)
erb
psych (>= 4.0.0)
Expand Down Expand Up @@ -254,15 +257,6 @@ GEM
rubocop (~> 1.81)
ruby-progressbar (1.13.0)
ruby2_keywords (0.0.5)
sass-embedded (1.98.0)
google-protobuf (~> 4.31)
rake (>= 13)
sass-embedded (1.98.0-arm64-darwin)
google-protobuf (~> 4.31)
sass-embedded (1.98.0-x86_64-darwin)
google-protobuf (~> 4.31)
sass-embedded (1.98.0-x86_64-linux-gnu)
google-protobuf (~> 4.31)
sawyer (0.9.2)
addressable (>= 2.3.5)
faraday (>= 0.17.3, < 3)
Expand All @@ -283,13 +277,6 @@ GEM
snaky_hash (2.0.1)
hashie
version_gem (~> 1.1, >= 1.1.1)
sprockets (4.2.2)
concurrent-ruby (~> 1.0)
logger
rack (>= 2.2.4, < 4)
sprockets-sass_embedded (0.4.1)
sass-embedded (>= 1.54.6)
sprockets (>= 4.2.2)
sshkit (1.25.0)
base64
logger
Expand Down Expand Up @@ -336,8 +323,10 @@ DEPENDENCIES
haml
haml_lint
irb
listen
octokit
omniauth-github
propshaft
puma
rack-test
railties
Expand All @@ -350,8 +339,6 @@ DEPENDENCIES
rubocop-rspec
simplecov
sinatra
sprockets
sprockets-sass_embedded
tilt

CHECKSUMS
Expand Down Expand Up @@ -388,10 +375,10 @@ CHECKSUMS
faraday (2.14.1) sha256=a43cceedc1e39d188f4d2cdd360a8aaa6a11da0c407052e426ba8d3fb42ef61c
faraday-net_http (3.4.2) sha256=f147758260d3526939bf57ecf911682f94926a3666502e24c69992765875906c
faraday-retry (2.4.0) sha256=7b79c48fb7e56526faf247b12d94a680071ff40c9fda7cf1ec1549439ad11ebe
google-protobuf (4.34.1-arm64-darwin) sha256=2745061f973119e6e7f3c81a0c77025d291a3caa6585a2cd24a25bbc7bedb267
google-protobuf (4.34.1-x86-linux-gnu) sha256=b6da7891fe96b13038e5435d8ac8b8a84d78a468147a48a377fe8da40aba1c88
google-protobuf (4.34.1-x86_64-darwin) sha256=4dc498376e218871613589c4d872400d42ad9ae0c700bdb2606fe1c77a593075
google-protobuf (4.34.1-x86_64-linux-gnu) sha256=87088c9fd8e47b5b40ca498fc1195add6149e941ff7e81c532a5b0b8876d4cc9
ffi (1.17.4-arm64-darwin) sha256=19071aaf1419251b0a46852abf960e77330a3b334d13a4ab51d58b31a937001b
ffi (1.17.4-x86-linux-gnu) sha256=38e150df5f4ca555e25beca4090823ae09657bceded154e3c52f8631c1ed72cf
ffi (1.17.4-x86_64-darwin) sha256=aa70390523cf3235096cf64962b709b4cfbd5c082a2cb2ae714eb0fe2ccda496
ffi (1.17.4-x86_64-linux-gnu) sha256=9d3db14c2eae074b382fa9c083fe95aec6e0a1451da249eab096c34002bc752d
haml (7.2.0) sha256=87fd2b71f7feab1724337b090a7d767f5ab2d42f08c974f3ead673f18cfcd55a
haml_lint (0.73.0) sha256=df91d20093ed7c11c4b331d19544e4147b6260f3566cdc919165bb891206d7bd
hashie (5.0.0) sha256=9d6c4e51f2a36d4616cbc8a322d619a162d8f42815a792596039fc95595603da
Expand All @@ -402,6 +389,7 @@ CHECKSUMS
jwt (2.7.1) sha256=07357cd2f180739b2f8184eda969e252d850ac996ed0a23f616e8ff0a90ae19b
language_server-protocol (3.17.0.5) sha256=fd1e39a51a28bf3eec959379985a72e296e9f9acfce46f6a79d31ca8760803cc
lint_roller (1.1.0) sha256=2c0c845b632a7d172cb849cc90c1bce937a28c5c8ccccb50dfd46a485003cc87
listen (3.10.0) sha256=c6e182db62143aeccc2e1960033bebe7445309c7272061979bb098d03760c9d2
logger (1.7.0) sha256=196edec7cc44b66cfb40f9755ce11b392f21f7967696af15d274dde7edff0203
loofah (2.25.1) sha256=d436c73dbd0c1147b16c4a41db097942d217303e1f7728704b37e4df9f6d2e04
mini_portile2 (2.8.9) sha256=0cd7c7f824e010c072e33f68bc02d85a00aeb6fce05bb4819c03dfd3c140c289
Expand All @@ -428,6 +416,7 @@ CHECKSUMS
pp (0.6.3) sha256=2951d514450b93ccfeb1df7d021cae0da16e0a7f95ee1e2273719669d0ab9df6
prettyprint (0.2.0) sha256=2bc9e15581a94742064a3cc8b0fb9d45aae3d03a1baa6ef80922627a0766f193
prism (1.9.0) sha256=7b530c6a9f92c24300014919c9dcbc055bf4cdf51ec30aed099b06cd6674ef85
propshaft (1.3.2) sha256=1d56a3e56a92c21bfc29caf07406b5386b00d4c47ddf357cf989a5a234b1389e
psych (5.3.1) sha256=eb7a57cef10c9d70173ff74e739d843ac3b2c019a003de48447b2963d81b1974
public_suffix (7.0.5) sha256=1a8bb08f1bbea19228d3bed6e5ed908d1cb4f7c2726d18bd9cadf60bc676f623
puma (8.0.1) sha256=7b94e50c07655718c1fb8ae41a11fc06c7d61293208b3aa608ff71a46d3ad37c
Expand All @@ -442,6 +431,8 @@ CHECKSUMS
railties (8.1.3) sha256=913eb0e0cb520aac687ffd74916bd726d48fa21f47833c6292576ef6a286de22
rainbow (3.1.1) sha256=039491aa3a89f42efa1d6dec2fc4e62ede96eb6acd95e52f1ad581182b79bc6a
rake (13.4.2) sha256=cb825b2bd5f1f8e91ca37bddb4b9aaf345551b4731da62949be002fa89283701
rb-fsevent (0.11.2) sha256=43900b972e7301d6570f64b850a5aa67833ee7d87b458ee92805d56b7318aefe
rb-inotify (0.11.1) sha256=a0a700441239b0ff18eb65e3866236cd78613d6b9f78fea1f9ac47a85e47be6e
rdoc (7.2.0) sha256=8650f76cd4009c3b54955eb5d7e3a075c60a57276766ebf36f9085e8c9f23192
regexp_parser (2.12.0) sha256=35a916a1d63190ab5c9009457136ae5f3c0c7512d60291d0d1378ba18ce08ebb
reline (0.6.3) sha256=1198b04973565b36ec0f11542ab3f5cfeeec34823f4e54cebde90968092b1835
Expand All @@ -457,19 +448,13 @@ CHECKSUMS
rubocop-rspec (3.9.0) sha256=8fa70a3619408237d789aeecfb9beef40576acc855173e60939d63332fdb55e2
ruby-progressbar (1.13.0) sha256=80fc9c47a9b640d6834e0dc7b3c94c9df37f08cb072b7761e4a71e22cff29b33
ruby2_keywords (0.0.5) sha256=ffd13740c573b7301cf7a2e61fc857b2a8e3d3aff32545d6f8300d8bae10e3ef
sass-embedded (1.98.0) sha256=397dcd0071170f079eb97562a035fa113358af10e3ff759a57bc7eef763e9f94
sass-embedded (1.98.0-arm64-darwin) sha256=fed4ee6de2f30b14e7a678ca648730aa78acc86be7a555e16ba3fdbc5e6aca69
sass-embedded (1.98.0-x86_64-darwin) sha256=a0b5b64f0157e2f1d713ac5ea75474c8507c464f0923090094471c33d4244484
sass-embedded (1.98.0-x86_64-linux-gnu) sha256=36b72021e00cfdd91ccb9eb490cff6addc376424cf9c2786f01392c8d0f0d4a0
sawyer (0.9.2) sha256=fa3a72d62a4525517b18857ddb78926aab3424de0129be6772a8e2ba240e7aca
securerandom (0.4.1) sha256=cc5193d414a4341b6e225f0cb4446aceca8e50d5e1888743fac16987638ea0b1
simplecov (0.22.0) sha256=fe2622c7834ff23b98066bb0a854284b2729a569ac659f82621fc22ef36213a5
simplecov-html (0.12.3) sha256=4b1aad33259ffba8b29c6876c12db70e5750cb9df829486e4c6e5da4fa0aa07b
simplecov_json_formatter (0.1.4) sha256=529418fbe8de1713ac2b2d612aa3daa56d316975d307244399fa4838c601b428
sinatra (4.2.1) sha256=b7aeb9b11d046b552972ade834f1f9be98b185fa8444480688e3627625377080
snaky_hash (2.0.1) sha256=1ac87ec157fcfe7a460e821e0cd48ae1e6f5e3e082ab520f03f31a9259dbdc31
sprockets (4.2.2) sha256=761e5a49f1c288704763f73139763564c845a8f856d52fba013458f8af1b59b1
sprockets-sass_embedded (0.4.1) sha256=09b0a03b086328cb816217c29c573e0ffb56f5b26bd2c2b62ca9330b90bd1623
sshkit (1.25.0) sha256=c8c6543cdb60f91f1d277306d585dd11b6a064cb44eab0972827e4311ff96744
stringio (3.2.0) sha256=c37cb2e58b4ffbd33fe5cd948c05934af997b36e0b6ca6fdf43afa234cf222e1
sysexits (1.2.0) sha256=598241c4ae57baa403c125182dfdcc0d1ac4c0fb606dd47fbed57e4aaf795662
Expand Down
67 changes: 54 additions & 13 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,61 @@

require_relative 'config/environment'

require 'application_assets'
require 'rake/sprocketstask'
require 'asset_assembly'

Rake::SprocketsTask.new do |sprockets|
sprockets.environment = ApplicationAssets.new
sprockets.output = File.join(__dir__, "public#{ApplicationAssets::ASSET_ROOT}")
sprockets.assets = %w[manifest.js]
namespace :assets do
desc 'Precompile application assets'
task precompile: :'css:build' do
AssetAssembly.new.processor.process
end

desc 'Delete precompiled assets'
task :clobber do
rm_rf AssetAssembly.new.config.output_path
end
end

# Aliases for capistrano-rails to invoke
# rubocop:disable Rake/Desc
namespace :assets do
task(:precompile) { Rake::Task['assets'].invoke }
task(:clean) { Rake::Task['clean_assets'].invoke }
task(:clobber) { Rake::Task['clobber_assets'].invoke }
namespace :credentials do
desc 'Outputs the credentials stored in `ARGV[1]` (used by diff helper)'
task :diff do
credentials = ActiveSupport::EncryptedConfiguration.new(
config_path: File.expand_path(ARGV[1], __dir__),
key_path: CREDENTIALS.key_path,
env_key: CREDENTIALS.env_key,
raise_if_missing_key: false
)
begin
puts credentials.read.presence || credentials.content_path.read
rescue ActiveSupport::MessageEncryptor::InvalidMessage
puts credentials.content_path.read
end
end

desc 'Edit the credentials file using the system editor'
task :edit do
require 'rails/command/helpers/editor'
include Rails::Command::Helpers::Editor

using_system_editor { CREDENTIALS.change { |tempfile| system_editor(tempfile) } }
end

desc 'Show the credentials stored in the credentials file'
task :show do
puts CREDENTIALS.read.presence || 'No decryptable credentials found'
end
end

namespace :css do
desc 'Install CSS dependencies'
task :install do
system('npm install')
end

desc 'Build CSS'
task build: :install do
system('npm run build:css')
end
end
# rubocop:enable Rake/Desc

namespace :credentials do
desc 'Outputs the credentials stored in `ARGV[1]` (used by diff helper)'
Expand Down Expand Up @@ -79,6 +117,9 @@ unless ENV.fetch('RACK_ENV', 'development') == 'production'
hl.quiet = false
end

desc 'Prepare for testing'
task 'test:prepare' => 'css:build'

RSpec::Core::RakeTask.new(:spec) do |rspec|
next unless ENV['CI']

Expand Down
File renamed without changes.
3 changes: 0 additions & 3 deletions assets/config/manifest.js

This file was deleted.

1 change: 0 additions & 1 deletion assets/javascripts/application.js

This file was deleted.

4 changes: 1 addition & 3 deletions config.ru
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

require_relative 'config/environment'

require 'application_assets'
require 'dev_training_application'

map(ApplicationAssets::ASSET_ROOT) { run ApplicationAssets.new } if ENV.fetch('RACK_ENV', 'development') != 'production'
map('/') { run DevTrainingApplication }
run DevTrainingApplication
5 changes: 5 additions & 0 deletions config/puma.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# frozen_string_literal: true

require_relative 'environment'

plugin :tmp_restart
4 changes: 2 additions & 2 deletions coverage/.last_run.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"result": {
"line": 98.13,
"branch": 85.71
"line": 98.69,
"branch": 60.0
}
}
31 changes: 0 additions & 31 deletions lib/application_assets.rb

This file was deleted.

29 changes: 29 additions & 0 deletions lib/asset_assembly.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# frozen_string_literal: true

##
# Preconfigured instance of Propshaft::Assembly.
class AssetAssembly < Propshaft::Assembly
def initialize
super(config)
end

# rubocop:disable Metrics/AbcSize, Metrics/MethodLength
def config
ActiveSupport::OrderedOptions.new.tap do |c|
root_path = Pathname(__dir__).join('../')
c.paths = [root_path.join('assets/builds').expand_path]
c.output_path = root_path.join('public/assets').expand_path
c.manifest_path = root_path.join('public/assets/.manifest.json').expand_path
c.prefix = '/assets'
c.version = '1'
c.compilers = [
['text/css', Propshaft::Compiler::CssAssetUrls],
['text/css', Propshaft::Compiler::SourceMappingUrls],
]
c.file_watcher = ENV['RACK_ENV'] == 'development' ? ActiveSupport::EventedFileUpdateChecker : nil
c.sweep_cache = ENV['RACK_ENV'] == 'development'
c.integrity_hash_algorithm = 'sha256'
end
end
# rubocop:enable Metrics/AbcSize, Metrics/MethodLength
end
Loading