Merge pull request #85 from ZeusWPI/production

Production
This commit is contained in:
benji 2016-02-02 18:55:06 +01:00
commit 913abe24fd
13 changed files with 44 additions and 49 deletions

View file

@ -51,7 +51,6 @@ end
group :development, :test do
gem 'factory_girl_rails'
gem 'faker', '1.4.2'
gem 'pry-rails'
end
# Airbrake

View file

@ -36,7 +36,7 @@ GEM
minitest (~> 5.1)
thread_safe (~> 0.3, >= 0.3.4)
tzinfo (~> 1.1)
airbrake (4.3.4)
airbrake (4.3.5)
builder
multi_json
annotate (2.7.0)
@ -60,10 +60,10 @@ GEM
sshkit (~> 1.2)
capistrano-passenger (0.2.0)
capistrano (~> 3.0)
capistrano-rails (1.1.5)
capistrano-rails (1.1.6)
capistrano (~> 3.1)
capistrano-bundler (~> 1.1)
capistrano-rbenv (2.0.3)
capistrano-rbenv (2.0.4)
capistrano (~> 3.1)
sshkit (~> 1.3)
capistrano-rvm (0.1.2)
@ -76,7 +76,6 @@ GEM
climate_control (>= 0.0.3, < 1.0)
codeclimate-test-reporter (0.4.8)
simplecov (>= 0.7.1, < 1.0.0)
coderay (1.1.0)
coffee-rails (4.1.1)
coffee-script (>= 2.2.0)
railties (>= 4.0.0, < 5.1.x)
@ -97,7 +96,7 @@ GEM
delayed_job_active_record (4.1.0)
activerecord (>= 3.0, < 5)
delayed_job (>= 3.0, < 5)
devise (3.5.3)
devise (3.5.6)
bcrypt (~> 3.0)
orm_adapter (~> 0.1)
railties (>= 3.2.6, < 5)
@ -106,7 +105,7 @@ GEM
warden (~> 1.2.3)
diff-lcs (1.2.5)
docile (1.1.5)
domain_name (0.5.25)
domain_name (0.5.20160128)
unf (>= 0.0.5, < 1.0.0)
erubis (2.7.0)
execjs (2.6.0)
@ -147,21 +146,20 @@ GEM
i18n (0.7.0)
identicon (0.0.5)
chunky_png
jquery-rails (4.0.5)
jquery-rails (4.1.0)
rails-dom-testing (~> 1.0)
railties (>= 4.2.0)
thor (>= 0.14, < 2.0)
json (1.8.3)
jwt (1.5.2)
jwt (1.5.1)
loofah (2.0.3)
nokogiri (>= 1.5.9)
mail (2.6.3)
mime-types (>= 1.16, < 3)
method_source (0.8.2)
mime-types (2.99)
mimemagic (0.3.0)
mini_portile2 (2.0.0)
minitest (5.8.3)
minitest (5.8.4)
multi_json (1.11.2)
multi_xml (0.5.5)
multipart-post (2.0.0)
@ -171,16 +169,16 @@ GEM
net-ssh (>= 2.6.5)
net-ssh (3.0.2)
netrc (0.11.0)
nokogiri (1.6.7.1)
nokogiri (1.6.7.2)
mini_portile2 (~> 2.0.0.rc2)
nokogiri (1.6.7.1-x64-mingw32)
nokogiri (1.6.7.2-x64-mingw32)
mini_portile2 (~> 2.0.0.rc2)
oauth2 (1.0.0)
oauth2 (1.1.0)
faraday (>= 0.8, < 0.10)
jwt (~> 1.0)
jwt (~> 1.0, < 1.5.2)
multi_json (~> 1.3)
multi_xml (~> 0.5)
rack (~> 1.2)
rack (>= 1.2, < 3)
omniauth (1.3.1)
hashie (>= 1.2, < 4)
rack (>= 1.0, < 3)
@ -188,18 +186,12 @@ GEM
oauth2 (~> 1.0)
omniauth (~> 1.2)
orm_adapter (0.5.0)
paperclip (4.3.2)
paperclip (4.3.3)
activemodel (>= 3.2.0)
activesupport (>= 3.2.0)
cocaine (~> 0.5.5)
mime-types
mimemagic (= 0.3.0)
pry (0.10.3)
coderay (~> 1.1.0)
method_source (~> 0.8.1)
slop (~> 3.4)
pry-rails (0.3.4)
pry (>= 0.9.10)
rack (1.6.4)
rack-test (0.6.3)
rack (>= 1.0)
@ -220,14 +212,14 @@ GEM
activesupport (>= 4.2.0.beta, < 5.0)
nokogiri (~> 1.6.0)
rails-deprecated_sanitizer (>= 1.0.1)
rails-html-sanitizer (1.0.2)
rails-html-sanitizer (1.0.3)
loofah (~> 2.0)
railties (4.2.4)
actionpack (= 4.2.4)
activesupport (= 4.2.4)
rake (>= 0.8.7)
thor (>= 0.18.1, < 2.0)
rake (10.4.2)
rake (10.5.0)
rdoc (4.2.1)
json (~> 1.4)
responders (2.1.1)
@ -241,15 +233,15 @@ GEM
http-cookie (>= 1.0.2, < 2.0)
mime-types (>= 1.16, < 3.0)
netrc (~> 0.7)
rspec-core (3.4.1)
rspec-core (3.4.2)
rspec-support (~> 3.4.0)
rspec-expectations (3.4.0)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.4.0)
rspec-mocks (3.4.0)
rspec-mocks (3.4.1)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.4.0)
rspec-rails (3.4.0)
rspec-rails (3.4.1)
actionpack (>= 3.0, < 4.3)
activesupport (>= 3.0, < 4.3)
railties (>= 3.0, < 4.3)
@ -258,7 +250,7 @@ GEM
rspec-mocks (~> 3.4.0)
rspec-support (~> 3.4.0)
rspec-support (3.4.1)
ruby_parser (3.7.2)
ruby_parser (3.7.3)
sexp_processor (~> 4.1)
sass (3.2.19)
sass-rails (4.0.5)
@ -269,14 +261,13 @@ GEM
sdoc (0.4.1)
json (~> 1.7, >= 1.7.7)
rdoc (~> 4.0)
sexp_processor (4.6.0)
sexp_processor (4.6.1)
simplecov (0.11.1)
docile (~> 1.1.0)
json (~> 1.8)
simplecov-html (~> 0.10.0)
simplecov-html (0.10.0)
slop (3.6.0)
spring (1.6.1)
spring (1.6.2)
sprockets (2.12.4)
hike (~> 1.2)
multi_json (~> 1.0)
@ -308,7 +299,7 @@ GEM
unf_ext
unf_ext (0.0.7.1)
unf_ext (0.0.7.1-x64-mingw32)
warden (1.2.4)
warden (1.2.6)
rack (>= 1.0)
will_paginate (3.0.7)
@ -343,7 +334,6 @@ DEPENDENCIES
mysql2
omniauth-oauth2 (= 1.3.1)
paperclip
pry-rails
rails (= 4.2.4)
rspec-rails
sass-rails (~> 4.0.3)

View file

@ -1,6 +1,7 @@
class OrdersController < ApplicationController
load_resource :user
load_and_authorize_resource :order, through: :user, shallow: true
load_and_authorize_resource :order, through: :user, shallow: true, only: [:overview, :destroy]
load_and_authorize_resource :order, through: :user, only: [:new, :create]
def new
@products = Product.all.for_sale.order(:name)
@ -8,6 +9,7 @@ class OrdersController < ApplicationController
end
def create
@order.user = @user
if @order.save
flash[:success] = @order.flash_success
redirect_to root_path

View file

@ -19,6 +19,12 @@ TabApiJob = Struct.new(:order_id) do
end
end
def headers
{
"Authorization" => "Token token=#{Rails.application.secrets.tab_api_key}"
}
end
def error(job, exception)
Airbrake.notify(exception)
end

View file

@ -15,6 +15,5 @@ class Barcode < ActiveRecord::Base
belongs_to :product
validates :product, presence: true
validates :code, presence: true, uniqueness: true
end

View file

@ -32,6 +32,7 @@
%li= link_to "Edit profile", edit_user_path(current_user)
%li
%p.navbar-text
Balance: #{euro_from_cents(current_user.balance)}
Balance:
= link_to euro_from_cents(current_user.balance), "https://zeus.ugent.be/tab/users/#{current_user.name}"
.visible-xs.navbar-form
= render 'layouts/session_button'

View file

@ -21,6 +21,6 @@ module Tab002
# config.i18n.default_locale = :de
config.active_record.raise_in_transactional_callbacks = true
config.active_job.queue_adapter = :delayed_job
config.call_api_after = 5.minutes
config.call_api_after = 5.seconds
end
end

View file

@ -40,4 +40,5 @@ Rails.application.configure do
config.action_mailer.default_url_options = { host: 'localhost', port: 3000 }
config.api_url = "http://localhost:3001"
Delayed::Worker.logger = Rails.logger
end

View file

@ -15,7 +15,7 @@ development:
omniauth_client_id: tomtest
omniauth_client_secret: blargh
access_token: "token"
tab_api_key: "HriaktSIhRaB5CJzD71uLQ=="
tab_api_key: "o6UIYc0r0cvsy0Ohaohqsw=="
koelkast_token: "token"
test:

View file

@ -0,0 +1,5 @@
class RemoveEncryptedPasswordFromUsersAgain < ActiveRecord::Migration
def change
remove_column :users, :encrypted_password, :string
end
end

View file

@ -11,7 +11,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 20151028223229) do
ActiveRecord::Schema.define(version: 20160202133903) do
create_table "barcodes", force: :cascade do |t|
t.integer "product_id"
@ -84,7 +84,6 @@ ActiveRecord::Schema.define(version: 20151028223229) do
t.integer "orders_count", default: 0
t.boolean "koelkast", default: false
t.string "name"
t.string "encrypted_password", default: "", null: false
t.boolean "private", default: false
end

View file

@ -2,7 +2,7 @@ unless Rails.env.production?
require 'factory_girl'
require 'faker'
task :sow => :environment do
FactoryGirl.create_list(:user, 20)
# FactoryGirl.create_list(:user, 20)
FactoryGirl.create_list(:product, 20)
end
end

View file

@ -34,12 +34,5 @@ describe Barcode do
expect(barcode).to_not be_valid
end
end
describe 'product' do
it 'should be present' do
@barcode.product = nil
expect(@barcode).to_not be_valid
end
end
end
end