diff --git a/Gemfile b/Gemfile index fa4f1da6..87e26e87 100644 --- a/Gemfile +++ b/Gemfile @@ -2,7 +2,7 @@ ruby '1.9.3' rescue nil source :rubygems -gem 'unicorn' +gem 'puma' gem 'rack-ssl', '~> 1.3' gem 'rack-cache' diff --git a/Gemfile.lock b/Gemfile.lock index d9a565b4..28e6ef92 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -43,15 +43,15 @@ GEM guard (1.4.0) listen (>= 0.4.2) thor (>= 0.14.6) - kgio (2.7.4) listen (0.5.3) multi_json (1.3.6) + puma (1.6.3) + rack (~> 1.2) rack (1.4.1) rack-cache (1.2) rack (>= 0.4) rack-ssl (1.3.2) rack - raindrops (0.10.0) rake (0.9.2.2) rb-fsevent (0.9.2) rerun (0.7.1) @@ -62,10 +62,6 @@ GEM uglifier (1.3.0) execjs (>= 0.3.0) multi_json (~> 1.0, >= 1.0.2) - unicorn (4.4.0) - kgio (~> 2.6) - rack - raindrops (~> 0.7) PLATFORMS ruby @@ -76,6 +72,7 @@ DEPENDENCIES debugger foreman guard + puma rack-cache rack-ssl (~> 1.3) rake (~> 0.9.2) @@ -85,4 +82,3 @@ DEPENDENCIES rerun tilt uglifier - unicorn diff --git a/Procfile b/Procfile index 33c2caf6..8ead007d 100644 --- a/Procfile +++ b/Procfile @@ -1,3 +1,3 @@ -web: script/server +web: bundle exec rackup -s puma -p $PORT assets: rerun -x -p 'assets/**/*' 'bundle exec rakep' #specs: rerun -x -p 'public/**/*' './run_jasmine.coffee public/spec.html' diff --git a/assets/scripts/app/routes.coffee b/assets/scripts/app/routes.coffee index bf7b0ad7..234da0d1 100644 --- a/assets/scripts/app/routes.coffee +++ b/assets/scripts/app/routes.coffee @@ -148,12 +148,6 @@ Travis.Router = Ember.Router.extend needsAuth: (path) -> path.indexOf('/profile') == 0 - afterSignIn: -> - path = sessionStorage.getItem('travis.after_signin_path') - sessionStorage.removeItem('travis.after_signin_path') - @transitionTo('root') - @route(path || '/') - afterSignOut: -> @authorize('/') @@ -174,6 +168,7 @@ Travis.Router = Ember.Router.extend root: Ember.Route.extend route: '/' loading: Ember.State.extend() + afterSignIn: (-> ) auth: Ember.Route.extend route: '/auth' @@ -183,9 +178,13 @@ Travis.Router = Ember.Router.extend router.get('authLayoutController').connectOutlet('top', 'top') router.get('authLayoutController').connectOutlet('main', 'signin') + afterSignIn: (router) -> + path = sessionStorage.getItem('travis.after_signin_path') + sessionStorage.removeItem('travis.after_signin_path') + router.route(path || '/') + stats: Ember.Route.extend route: '/stats' - afterSignIn: (-> ) connectOutlets: (router) -> router.get('applicationController').connectOutlet 'statsLayout' $('body').attr('id', 'stats') @@ -194,7 +193,6 @@ Travis.Router = Ember.Router.extend profile: Ember.Route.extend initialState: 'index' - afterSignIn: (-> ) route: '/profile' connectOutlets: (router) -> @@ -261,7 +259,6 @@ Travis.Router = Ember.Router.extend home: Ember.Route.extend route: '/' - afterSignIn: (-> ) connectOutlets: (router) -> router.get('applicationController').connectOutlet 'homeLayout' $('body').attr('id', 'home') diff --git a/assets/scripts/app/templates/auth/signin.hbs b/assets/scripts/app/templates/auth/signin.hbs index 17b32579..a5609048 100644 --- a/assets/scripts/app/templates/auth/signin.hbs +++ b/assets/scripts/app/templates/auth/signin.hbs @@ -9,5 +9,3 @@ Please sign in with GitHub.

{{/if}} - - diff --git a/assets/styles/auth.sass b/assets/styles/auth.sass index ccec8f42..8935ad4e 100644 --- a/assets/styles/auth.sass +++ b/assets/styles/auth.sass @@ -3,6 +3,7 @@ #auth #page display: block + min-height: 500px #main top: 200px diff --git a/config/unicorn.rb b/config/unicorn.rb deleted file mode 100644 index 74f758e7..00000000 --- a/config/unicorn.rb +++ /dev/null @@ -1,4 +0,0 @@ -# http://michaelvanrooijen.com/articles/2011/06/01-more-concurrency-on-a-single-heroku-dyno-with-the-new-celadon-cedar-stack/ - -worker_processes 3 # amount of unicorn workers to spin up -timeout 30 # restarts workers that hang for 15 seconds diff --git a/lib/travis/web/app.rb b/lib/travis/web/app.rb index ff57e257..79ffd50a 100644 --- a/lib/travis/web/app.rb +++ b/lib/travis/web/app.rb @@ -17,6 +17,11 @@ class Travis::Web::App end end + def self.new(options = {}) + return super unless options[:environment] == 'development' + proc { |e| super.call(e) } # poor man's reloader + end + attr_reader :app, :router, :environment, :version, :last_modified, :age, :options, :root def initialize(options = {}) @@ -62,9 +67,8 @@ class Travis::Web::App end def each_file - Dir.chdir(root) do - Dir.glob('**/*') { |f| yield f if File.file? f } - end + pattern = File.join(root, '**/*') + Dir.glob(pattern) { |f| yield f if File.file? f } end def prefix?(file) @@ -72,19 +76,20 @@ class Travis::Web::App end def index?(file) - file == "index.html" + file.end_with? 'index.html' end def route_for(file) + file = file.sub("#{root}/", '') file = File.join(version, file) if prefix? file file = "" if index? file "/#{file}" end def cache_control(file) - case file - when 'index.html' then "public, must-revalidate" - when 'version' then "no-cache" + case route_for(file) + when '/' then "public, must-revalidate" + when 'version' then "no-cache" else "public, max-age=#{age}" end end @@ -105,8 +110,10 @@ class Travis::Web::App def builder builder = Rack::Builder.new - builder.use Rack::SSL if environment == 'production' - builder.use Rack::Cache + if environment == 'production' + builder.use Rack::SSL + builder.use Rack::Cache + end builder.use Rack::Deflater builder.use Rack::Head builder.use Rack::ConditionalGet diff --git a/public/scripts/app.js b/public/scripts/app.js index 66e7ad66..32d51138 100644 --- a/public/scripts/app.js +++ b/public/scripts/app.js @@ -29619,4 +29619,4 @@ var _require=function(){function c(a,c){document.addEventListener?a.addEventList ++g&&setTimeout(c,0)})}}(); (function(){!window.WebSocket&&window.MozWebSocket&&(window.WebSocket=window.MozWebSocket);if(window.WebSocket)Pusher.Transport=window.WebSocket,Pusher.TransportType="native";var c=(document.location.protocol=="http:"?Pusher.cdn_http:Pusher.cdn_https)+Pusher.VERSION,a=[];window.JSON||a.push(c+"/json2"+Pusher.dependency_suffix+".js");if(!window.WebSocket)window.WEB_SOCKET_DISABLE_AUTO_INITIALIZATION=!0,a.push(c+"/flashfallback"+Pusher.dependency_suffix+".js");var b=function(){return window.WebSocket?function(){Pusher.ready()}: function(){window.WebSocket?(Pusher.Transport=window.WebSocket,Pusher.TransportType="flash",window.WEB_SOCKET_SWF_LOCATION=c+"/WebSocketMain.swf",WebSocket.__addTask(function(){Pusher.ready()}),WebSocket.__initialize()):(Pusher.Transport=null,Pusher.TransportType="none",Pusher.ready())}}(),e=function(a){var b=function(){document.body?a():setTimeout(b,0)};b()},g=function(){e(b)};a.length>0?_require(a,g):g()})(); -;minispade.register('app', "(function() {(function() {\nminispade.require('auth');\nminispade.require('controllers');\nminispade.require('helpers');\nminispade.require('models');\nminispade.require('pusher');\nminispade.require('routes');\nminispade.require('slider');\nminispade.require('store');\nminispade.require('tailing');\nminispade.require('templates');\nminispade.require('views');\nminispade.require('config/locales');\nminispade.require('data/sponsors');\n\n Travis.reopen({\n App: Em.Application.extend({\n autoinit: false,\n currentUserBinding: 'auth.user',\n authStateBinding: 'auth.state',\n init: function() {\n this._super.apply(this, arguments);\n this.store = Travis.Store.create();\n this.store.loadMany(Travis.Sponsor, Travis.SPONSORS);\n this.set('auth', Travis.Auth.create({\n app: this,\n endpoint: Travis.config.api_endpoint\n }));\n this.slider = new Travis.Slider();\n this.pusher = new Travis.Pusher(Travis.config.pusher_key);\n return this.tailing = new Travis.Tailing();\n },\n signIn: function() {\n return this.get('auth').signIn();\n },\n autoSignIn: function() {\n return this.get('auth').autoSignIn();\n },\n signOut: function() {\n this.get('auth').signOut();\n return this.get('router').send('afterSignOut');\n },\n receive: function() {\n return this.store.receive.apply(this.store, arguments);\n },\n toggleSidebar: function() {\n var element;\n $('body').toggleClass('maximized');\n element = $('');\n $('#top .profile').append(element);\n Em.run.later((function() {\n return element.remove();\n }), 10);\n element = $('');\n $('#repo').append(element);\n return Em.run.later((function() {\n return element.remove();\n }), 10);\n }\n })\n });\n\n}).call(this);\n\n})();\n//@ sourceURL=app");minispade.register('auth', "(function() {(function() {\n\n this.Travis.Auth = Ember.Object.extend({\n iframe: $('