Skip to content

Commit

Permalink
Getting assets updated
Browse files Browse the repository at this point in the history
  • Loading branch information
danielmorrison committed Sep 28, 2021
1 parent 57bdd3c commit a3b1b0d
Show file tree
Hide file tree
Showing 20 changed files with 310 additions and 86 deletions.
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,8 @@

# Ignore application configuration
/config/application.yml

/app/assets/builds/*
!/app/assets/builds/.keep

/node_modules
8 changes: 3 additions & 5 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,9 @@ gem "honeybadger"
gem "particlerb"
gem "puma"

gem "autoprefixer-rails"
gem "coffee-rails"
gem "jquery-rails"
gem "sassc-rails"
gem "uglifier"
gem "jsbundling-rails"
# gem "coffee-rails"
gem "cssbundling-rails"

group :production do
gem "lograge"
Expand Down
41 changes: 8 additions & 33 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -61,24 +61,16 @@ GEM
tzinfo (~> 2.0)
ansi (1.5.0)
ast (2.4.2)
autoprefixer-rails (10.3.3.0)
execjs (~> 2)
bootsnap (1.9.1)
msgpack (~> 1.0)
builder (3.2.4)
byebug (11.1.3)
coffee-rails (5.0.0)
coffee-script (>= 2.2.0)
railties (>= 5.2.0)
coffee-script (2.4.1)
coffee-script-source
execjs
coffee-script-source (1.12.2)
concurrent-ruby (1.1.9)
crass (1.0.6)
cssbundling-rails (0.2.2)
railties (>= 6.0.0)
diff-lcs (1.4.4)
erubi (1.10.0)
execjs (2.8.1)
factory_bot (6.2.0)
activesupport (>= 5.0.0)
factory_bot_rails (6.2.0)
Expand All @@ -105,18 +97,15 @@ GEM
faraday-rack (1.0.0)
faraday_middleware (1.1.0)
faraday (~> 1.0)
ffi (1.15.4)
figaro (1.2.0)
thor (>= 0.14.0, < 2)
globalid (0.5.2)
activesupport (>= 5.0)
honeybadger (4.9.0)
i18n (1.8.10)
concurrent-ruby (~> 1.0)
jquery-rails (4.4.0)
rails-dom-testing (>= 1, < 3)
railties (>= 4.2.0)
thor (>= 0.14, < 2.0)
jsbundling-rails (0.1.7)
railties (>= 6.0.0)
json (2.5.1)
lograge (0.11.2)
actionpack (>= 4)
Expand All @@ -136,7 +125,7 @@ GEM
msgpack (1.4.2)
multipart-post (2.1.1)
nio4r (2.5.8)
nokogiri (1.12.4)
nokogiri (1.12.5)
mini_portile2 (~> 2.6.1)
racc (~> 1.4)
parallel (1.21.0)
Expand Down Expand Up @@ -218,21 +207,13 @@ GEM
rubocop-ast (>= 1.9.1, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 1.4.0, < 3.0)
rubocop-ast (1.11.0)
rubocop-ast (1.12.0)
parser (>= 3.0.1.1)
rubocop-performance (1.11.5)
rubocop (>= 1.7.0, < 2.0)
rubocop-ast (>= 0.4.0)
ruby-progressbar (1.11.0)
ruby2_keywords (0.0.5)
sassc (2.4.0)
ffi (~> 1.9)
sassc-rails (2.1.2)
railties (>= 4.0.0)
sassc (>= 2.0)
sprockets (> 3.0)
sprockets-rails
tilt
sprockets (4.0.2)
concurrent-ruby (~> 1.0)
rack (> 1, < 3)
Expand All @@ -247,11 +228,8 @@ GEM
ansi
json
thor (1.1.0)
tilt (2.0.10)
tzinfo (2.0.4)
concurrent-ruby (~> 1.0)
uglifier (4.2.0)
execjs (>= 0.3.0, < 3)
unicode-display_width (2.1.0)
websocket-driver (0.7.5)
websocket-extensions (>= 0.1.0)
Expand All @@ -262,24 +240,21 @@ PLATFORMS
ruby

DEPENDENCIES
autoprefixer-rails
bootsnap
byebug
coffee-rails
cssbundling-rails
factory_bot_rails
figaro
honeybadger
jquery-rails
jsbundling-rails
lograge
particlerb
pg
puma
rails (~> 7.0.0.alpha2)
rspec-ontap
rspec-rails
sassc-rails
standard
uglifier

RUBY VERSION
ruby 3.0.2p107
Expand Down
3 changes: 2 additions & 1 deletion Procfile
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
web: bundle exec puma -t 1:32 -b tcp://0.0.0.0:$PORT
web: bundle exec puma -t 1:32 -b tcp://0.0.0.0:$PORT
release: rake db:migrate css:build
3 changes: 3 additions & 0 deletions Procfile.dev
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
web: bin/rails server -p 3000
css: yarn build:css --watch
js: yarn build --watch
2 changes: 1 addition & 1 deletion Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ require File.expand_path("../config/application", __FILE__)

Buildlight::Application.load_tasks

task default: [:standard, :spec]
task default: [:standard, "css:build", :spec]
Empty file added app/assets/builds/.keep
Empty file.
4 changes: 2 additions & 2 deletions app/assets/config/manifest.js
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
//= link_directory ../javascripts .js
//= link_directory ../stylesheets .css
//= link_tree ../builds
//= link_tree ../../javascript .js
2 changes: 2 additions & 0 deletions app/assets/javascripts/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,5 @@
// GO AFTER THE REQUIRES BELOW.
//
//= require cable
import "@rails/actionable"
import "cable"
5 changes: 2 additions & 3 deletions app/assets/javascripts/cable.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
// Action Cable provides the framework to deal with WebSockets in Rails.
// You can generate new channels where WebSocket features live using the rails generate channel command.
//
//= require action_cable
//= require_self
//= require_tree ./channels
import "@rails/actioncable"
import "channels"

(function() {
this.App || (this.App = {});
Expand Down
31 changes: 0 additions & 31 deletions app/assets/javascripts/channels/colors.coffee

This file was deleted.

46 changes: 46 additions & 0 deletions app/assets/javascripts/channels/colors.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
(function() {
var id, ids, _i, _len;

App.setColors = function(data) {
var count, favicon, message, redCount;
redCount = +data.colors.red;
favicon = redCount ? "/favicon-failing" : "/favicon-passing";
if (redCount > 0) {
document.body.setAttribute("data-failing", "");
document.body.removeAttribute("data-passing");
count = document.getElementById("failing-count");
if (redCount === 1) {
message = "" + redCount + " project is";
} else {
message = "" + redCount + " projects are";
}
count.innerHTML = message;
} else {
document.body.removeAttribute("data-failing");
document.body.setAttribute("data-passing", "");
}
if (data.colors.yellow) {
document.body.setAttribute("data-building", "");
favicon += "-building";
} else {
document.body.removeAttribute("data-building");
}
return document.getElementById("favicon").setAttribute("href", favicon + ".ico");
};

ids = document.location.pathname.match(/^\/([^\/\?]*)/)[1].split(",");

for (_i = 0, _len = ids.length; _i < _len; _i++) {
id = ids[_i];
if (id === "") {
id = "*";
}
App.colors = App.cable.subscriptions.create({
channel: "ColorsChannel",
id: id
}, {
received: App.setColors
});
}

}).call(this);
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Entry point for your Sass build
@charset "utf-8";

@import "base/base";
Expand Down
1 change: 1 addition & 0 deletions app/javascript/application.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
// Configure your import map in config/importmap.rb. Read more: https://github.com/rails/importmap-rails
8 changes: 2 additions & 6 deletions app/views/api/red/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,11 @@
</ul>
<% else %>
<div>
<% 5.times do %>
<%= image_tag "https://github.global.ssl.fastly.net/images/icons/emoji/tada.png?v5" %>
<% end %>
<%= "🎉" * 5 %>
</div>
<h1>You have no failing projects.</h1>
<div>
<% 5.times do %>
<%= image_tag "https://github.global.ssl.fastly.net/images/icons/emoji/tada.png?v5" %>
<% end %>
<%= "🎉" * 5 %>
</div>
<% end %>
</div>
3 changes: 1 addition & 2 deletions app/views/colors/index.html.erb
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
<div class="messages">
<div class="message message--passing">
<p>
Hooray! All projects are passing.
<%= image_tag "https://github.global.ssl.fastly.net/images/icons/emoji/tada.png?v5", alt: "tada emoji", class: "emoji" %>
Hooray! All projects are passing. 🎉
</p>
</div>
<div class="message message--failure">
Expand Down
4 changes: 2 additions & 2 deletions app/views/layouts/application.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>[i] Buildlight</title>
<%= color_favicon_link_tag(@colors) %>
<%= stylesheet_link_tag "application", :media => "all" %>
<%= csrf_meta_tags %>
<%= action_cable_meta_tag %>
<%= stylesheet_link_tag "application", :media => "all" %>
<%= javascript_include_tag "application", "data-turbo-track": "reload", defer: true %>
</head>

<body<%= color_attrs_for_body(@colors) %>>
<%= yield %>
<%= javascript_include_tag "application" %>
</body>
</html>
3 changes: 3 additions & 0 deletions bin/dev
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/usr/bin/env bash

foreman start -f Procfile.dev
12 changes: 12 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"name": "app",
"private": "true",
"dependencies": {
"esbuild": "^0.13.2",
"sass": "^1.42.1"
},
"scripts": {
"build:css": "sass ./app/assets/stylesheets/application.sass.scss ./app/assets/builds/application.css --no-source-map --load-path=node_modules",
"build": "esbuild app/javascript/*.* --bundle --outdir=app/assets/builds"
}
}
Loading

0 comments on commit a3b1b0d

Please sign in to comment.