Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
SRCT
schedules
Commits
47b4bf82
Commit
47b4bf82
authored
Dec 14, 2018
by
Zac Wood
Browse files
Compile assets correctly, serve them with Rails for now
parent
5b36225f
Pipeline
#3477
failed with stages
in 1 minute and 53 seconds
Changes
6
Pipelines
2
Show whitespace changes
Inline
Side-by-side
schedules/Dockerfile
View file @
47b4bf82
FROM
ruby:2.5
FROM
starefossen/ruby-node:latest
RUN
mkdir
/api
WORKDIR
/api
...
...
@@ -10,5 +10,6 @@ ENV RAILS_ENV production
RUN
bundle
install
RUN
export
SECRET_KEY_BASE
=
$(
rails secret
)
RUN
rake assets:precompile
RUN
rails db:migrate
RUN
rails db:seed
schedules/Gemfile
View file @
47b4bf82
...
...
@@ -16,6 +16,8 @@ gem 'sass-rails', '~> 5.0'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem
'jbuilder'
,
'~> 2.5'
gem
'uglifier'
# Use Redis adapter to run Action Cable in production
# gem 'redis', '~> 4.0'
# Use ActiveModel has_secure_password
...
...
schedules/Gemfile.lock
View file @
47b4bf82
...
...
@@ -60,6 +60,7 @@ GEM
concurrent-ruby (1.1.3)
crass (1.0.4)
erubi (1.7.1)
execjs (2.7.0)
ffi (1.9.25)
globalid (0.4.1)
activesupport (>= 4.2.0)
...
...
@@ -187,6 +188,8 @@ GEM
tilt (2.0.9)
tzinfo (1.2.5)
thread_safe (~> 0.1)
uglifier (4.1.20)
execjs (>= 0.3.0, < 3)
unicode-display_width (1.4.0)
web-console (3.7.0)
actionview (>= 5.0)
...
...
@@ -226,6 +229,7 @@ DEPENDENCIES
spring-watcher-listen (~> 2.0.0)
sqlite3
tzinfo-data
uglifier
web-console (>= 3.3.0)
BUNDLED WITH
...
...
schedules/app/controllers/search_controller.rb
View file @
47b4bf82
class
SearchController
<
ApplicationController
def
index
re
sults
=
SearchHelper
::
GenericItem
.
fetchall
(
String
.
new
(
params
[
:query
]),
semester:
@semester
).
group_by
(
&
:type
)
re
direct_to
home_url
unless
params
[
:query
].
length
>
1
#
results =
s
earch
(params[:query]
)
results
=
S
earch
Helper
::
GenericItem
.
fetchall
(
String
.
new
(
params
[
:query
]),
semester:
@semester
).
group_by
(
&
:type
)
@instructors
=
results
[
:instructor
]
&
.
map
(
&
:data
)
@courses
=
results
[
:course
]
&
.
map
(
&
:data
)
end
# cases
# math 113 - [a-zA-Z]{3,} [1-9]{3}
end
schedules/config/environments/production.rb
View file @
47b4bf82
...
...
@@ -25,10 +25,11 @@ Rails.application.configure do
# Disable serving static files from the `/public` folder by default since
# Apache or NGINX already handles this.
config
.
public_file_server
.
enabled
=
ENV
[
'RAILS_SERVE_STATIC_FILES'
].
present?
# config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present?
config
.
public_file_server
.
enabled
=
true
# Compress JavaScripts and CSS.
config
.
assets
.
js_compressor
=
:u
glifier
config
.
assets
.
js_compressor
=
U
glifier
.
new
(
harmony:
true
)
# config.assets.css_compressor = :sass
# Do not fallback to assets pipeline if a precompiled asset is missed.
...
...
schedules/config/routes.rb
View file @
47b4bf82
# Registers all routes for the app.
Rails
.
application
.
routes
.
draw
do
get
'/'
,
to:
'home#index'
,
as:
'home'
get
'search'
,
to:
'search#index'
get
'sessions/update'
,
as:
'update_session'
get
'sessions/cart'
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment