mirror of
https://github.com/mperham/sidekiq.git
synced 2022-11-09 13:52:34 -05:00
Remove sprockets, sass, and compass dependencies.
Static assets are now served up my Sinatra.
This commit is contained in:
parent
67eb1bfba7
commit
a239f5882e
4 changed files with 8 additions and 70 deletions
3
Gemfile
3
Gemfile
|
@ -3,7 +3,6 @@ gemspec
|
|||
|
||||
gem 'celluloid', "~> 0.12.0"
|
||||
gem 'slim'
|
||||
gem 'sass'
|
||||
gem 'rails', '3.2.8'
|
||||
gem 'sqlite3'
|
||||
|
||||
|
@ -12,7 +11,5 @@ group :test do
|
|||
end
|
||||
|
||||
group :development do
|
||||
gem 'sprockets-sass'
|
||||
gem 'compass'
|
||||
gem 'shotgun'
|
||||
end
|
||||
|
|
|
@ -1,74 +1,17 @@
|
|||
require 'sinatra/base'
|
||||
require 'slim'
|
||||
require 'sprockets'
|
||||
require 'sprockets-sass'
|
||||
require 'sass'
|
||||
require 'compass'
|
||||
require 'sidekiq/paginator'
|
||||
|
||||
module Sidekiq
|
||||
class SprocketsMiddleware
|
||||
def initialize(app, options={})
|
||||
@app = app
|
||||
@root = options[:root]
|
||||
path = options[:path] || 'assets'
|
||||
@matcher = /^\/#{path}\/*/
|
||||
@environment = ::Sprockets::Environment.new(@root)
|
||||
@environment.append_path 'assets/javascripts'
|
||||
@environment.append_path 'assets/javascripts/vendor'
|
||||
@environment.append_path 'assets/stylesheets'
|
||||
@environment.append_path 'assets/images'
|
||||
|
||||
Compass.configuration do |config|
|
||||
|
||||
config.project_path = "#{@root}/assets"
|
||||
|
||||
config.images_dir = 'images'
|
||||
config.sass_dir = 'stylesheets'
|
||||
config.css_dir = 'stylesheets'
|
||||
config.javascripts_dir = 'javascripts'
|
||||
config.fonts_dir = 'stylesheets/fonts'
|
||||
|
||||
config.http_images_path = '/assets'
|
||||
config.http_generated_images_path = '/assets'
|
||||
config.http_javascripts_path = '/assets'
|
||||
config.http_stylesheets_path = '/assets'
|
||||
|
||||
# You can select your preferred output style here (can be overridden via the command line):
|
||||
output_style = :compressed
|
||||
|
||||
# To enable relative paths to assets via compass helper functions. Uncomment:
|
||||
relative_assets = true
|
||||
|
||||
# To disable debugging comments that display the original location of your selectors. Uncomment:
|
||||
line_comments = false
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
def call(env)
|
||||
# Solve the problem of people requesting /sidekiq when they need to request /sidekiq/ so
|
||||
# that relative links in templates resolve correctly.
|
||||
return [301, { 'Location' => "#{env['SCRIPT_NAME']}/", 'Content-Type' => 'text/html' }, ['redirecting']] if env['SCRIPT_NAME'] == env['REQUEST_PATH']
|
||||
|
||||
return @app.call(env) unless @matcher =~ env["PATH_INFO"]
|
||||
env['PATH_INFO'].sub!(@matcher,'')
|
||||
@environment.call(env)
|
||||
end
|
||||
end
|
||||
|
||||
class Web < Sinatra::Base
|
||||
include Sidekiq::Paginator
|
||||
|
||||
dir = File.expand_path(File.dirname(__FILE__) + "/../../web")
|
||||
set :public_folder, "#{dir}/assets"
|
||||
set :views, "#{dir}/views"
|
||||
set :root, "#{dir}/public"
|
||||
set :slim, :pretty => true
|
||||
|
||||
use SprocketsMiddleware, :root => dir
|
||||
|
||||
|
||||
helpers do
|
||||
|
||||
def reset_worker_list
|
||||
|
@ -294,3 +237,4 @@ module Sidekiq
|
|||
end
|
||||
|
||||
end
|
||||
|
||||
|
|
|
@ -19,9 +19,6 @@ Gem::Specification.new do |gem|
|
|||
gem.add_dependency 'connection_pool', '~> 0.9.2'
|
||||
gem.add_dependency 'celluloid', '~> 0.12.0'
|
||||
gem.add_dependency 'multi_json', '~> 1'
|
||||
gem.add_dependency 'sprockets-sass'
|
||||
gem.add_dependency 'sass', '~> 3.2'
|
||||
gem.add_dependency 'compass'
|
||||
gem.add_development_dependency 'minitest', '~> 3'
|
||||
gem.add_development_dependency 'sinatra'
|
||||
gem.add_development_dependency 'slim'
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
doctype html
|
||||
html
|
||||
head
|
||||
link href='#{{root_path}}assets/bootstrap.css' media='screen' rel='stylesheet' type='text/css'
|
||||
link href='#{{root_path}}assets/application.css' media='screen' rel='stylesheet' type='text/css'
|
||||
link href='#{{root_path}}stylesheets/bootstrap.css' media='screen' rel='stylesheet' type='text/css'
|
||||
link href='#{{root_path}}stylesheets/application.css' media='screen' rel='stylesheet' type='text/css'
|
||||
title= Sidekiq::NAME
|
||||
body.admin
|
||||
.navbar.navbar-fixed-top
|
||||
|
@ -38,7 +38,7 @@ html
|
|||
.span10
|
||||
== yield
|
||||
|
||||
script type="text/javascript" src="#{{root_path}}assets/vendor/jquery.js"
|
||||
script type="text/javascript" src="#{{root_path}}assets/vendor/jquery.timeago.js"
|
||||
script type="text/javascript" src="#{{root_path}}assets/vendor/bootstrap.js"
|
||||
script type="text/javascript" src="#{{root_path}}assets/application.js"
|
||||
script type="text/javascript" src="#{{root_path}}javascripts/vendor/jquery.js"
|
||||
script type="text/javascript" src="#{{root_path}}javascripts/vendor/jquery.timeago.js"
|
||||
script type="text/javascript" src="#{{root_path}}javascripts/vendor/bootstrap.js"
|
||||
script type="text/javascript" src="#{{root_path}}javascripts/application.js"
|
||||
|
|
Loading…
Add table
Reference in a new issue