Skip to content

Commit

Permalink
Bookingsync application1 (#72)
Browse files Browse the repository at this point in the history
* update bookingsync_application

* drop rails 4 support, fix change log

* remove old rails gemfiles

* fix travis setup

* fix migrations
  • Loading branch information
Mandaryn committed Jul 3, 2017
1 parent 73826d6 commit a3c498c
Show file tree
Hide file tree
Showing 52 changed files with 551 additions and 687 deletions.
3 changes: 1 addition & 2 deletions .travis.yml
Expand Up @@ -8,9 +8,8 @@ before_install:
rvm:
- 2.3.3
gemfile:
- gemfiles/rails_4.1.gemfile
- gemfiles/rails_4.2.gemfile
- gemfiles/rails_5.0.gemfile
- gemfiles/rails_5.1.gemfile
script:
- RAILS_ENV=test bundle exec rake db:migrate
- bundle exec rspec spec/
13 changes: 4 additions & 9 deletions Appraisals
@@ -1,12 +1,7 @@
appraise 'rails-4.1' do
gem 'rails', '~> 4.1.0'
end

appraise 'rails-4.2' do
gem 'rails', '~> 4.2.0'
end

appraise 'rails-5.0' do
gem 'rails', '~> 5.0.0'
gem 'rails-controller-testing'
end

appraise 'rails-5.1' do
gem 'rails', '~> 5.1.0'
end
2 changes: 2 additions & 0 deletions CHANGELOG.md
@@ -1,6 +1,8 @@
### master

* Update appraisal gemfiles
* [BREAKING CHANGE] update bookingsync_application dependency to be > 1.0
* [BREAKING CHANGE] drop support for rails < 5
* Fix N+1 query by including rentals on rentals#index
* Speed up javascript search on rentals index page

Expand Down
108 changes: 58 additions & 50 deletions Gemfile.lock
Expand Up @@ -2,7 +2,7 @@ PATH
remote: .
specs:
bookingsync_portal (0.9.0)
bookingsync_application (~> 0.5.0)
bookingsync_application (>= 1, < 3)
bootstrap-bookingsync-sass (~> 1.0.0)
coffee-rails
font-awesome-sass
Expand Down Expand Up @@ -67,32 +67,33 @@ GEM
thor (>= 0.14.0)
arel (7.1.4)
ast (2.3.0)
autoprefixer-rails (6.6.0)
autoprefixer-rails (7.1.1.2)
execjs
bookingsync-api (0.1.3)
bookingsync-api (0.1.5)
addressable
faraday (~> 0.9)
hashie
bookingsync-engine (1.1.0)
net-http-persistent (~> 2)
bookingsync-engine (3.0.0)
bookingsync-api (>= 0.0.28)
omniauth-bookingsync (~> 0.4.0)
rails (>= 4.0.0)
bookingsync_application (0.5.0)
bookingsync-engine (~> 1.1.0)
omniauth-bookingsync (~> 0.5.0)
rails (>= 5.0.0)
bookingsync_application (2.0.0)
bookingsync-engine (~> 3.0.0)
dotenv-rails
jsonapi-resources (~> 0.1)
rails (>= 4.1)
rails (>= 5.0, < 5.2)
synced
bootstrap-bookingsync-sass (1.0.0)
bootstrap-bookingsync-sass (1.0.4)
bootstrap-sass (>= 3.3.5)
bootstrap-sass (3.3.7)
autoprefixer-rails (>= 5.2.1)
sass (>= 3.3.4)
builder (3.2.2)
coderay (1.1.1)
coffee-rails (4.2.1)
coffee-rails (4.2.2)
coffee-script (>= 2.2.0)
railties (>= 4.0.0, < 5.2.x)
railties (>= 4.0.0)
coffee-script (2.4.1)
coffee-script-source
execjs
Expand All @@ -101,44 +102,44 @@ GEM
crack (0.4.3)
safe_yaml (~> 1.0.0)
diff-lcs (1.2.5)
dotenv (2.1.1)
dotenv-rails (2.1.1)
dotenv (= 2.1.1)
railties (>= 4.0, < 5.1)
dotenv (2.2.1)
dotenv-rails (2.2.1)
dotenv (= 2.2.1)
railties (>= 3.2, < 5.2)
erubis (2.7.0)
execjs (2.7.0)
factory_girl (4.8.0)
activesupport (>= 3.0.0)
factory_girl_rails (4.8.0)
factory_girl (~> 4.8.0)
railties (>= 3.0.0)
faraday (0.9.2)
faraday (0.11.0)
multipart-post (>= 1.2, < 3)
font-awesome-sass (4.7.0)
sass (>= 3.2)
globalid (0.3.7)
activesupport (>= 4.1.0)
handlebars_assets (0.23.1)
globalid (0.4.0)
activesupport (>= 4.2.0)
handlebars_assets (0.23.2)
execjs (~> 2.0)
multi_json (~> 1.0)
sprockets (>= 2.0.0)
tilt (>= 1.2)
hashdiff (0.3.1)
hashie (3.4.6)
hashie (3.5.5)
i18n (0.7.0)
jquery-rails (4.2.1)
jquery-rails (4.3.1)
rails-dom-testing (>= 1, < 3)
railties (>= 4.2.0)
thor (>= 0.14, < 2.0)
jquery-ui-rails (6.0.1)
railties (>= 3.2.16)
jsonapi-resources (0.8.1)
jsonapi-resources (0.9.0)
activerecord (>= 4.1)
concurrent-ruby
rails (>= 4.0)
railties (>= 4.1)
jwt (1.5.6)
loofah (2.0.3)
nokogiri (>= 1.5.9)
mail (2.6.4)
mail (2.6.6)
mime-types (>= 1.16, < 4)
message_bus (2.0.2)
rack (>= 1.1.3)
Expand All @@ -151,23 +152,24 @@ GEM
multi_json (1.12.1)
multi_xml (0.6.0)
multipart-post (2.0.0)
net-http-persistent (2.9.4)
nio4r (1.2.1)
nokogiri (1.6.8.1)
mini_portile2 (~> 2.1.0)
oauth2 (1.2.0)
faraday (>= 0.8, < 0.10)
oauth2 (1.3.1)
faraday (>= 0.8, < 0.12)
jwt (~> 1.0)
multi_json (~> 1.3)
multi_xml (~> 0.5)
rack (>= 1.2, < 3)
omniauth (1.3.1)
hashie (>= 1.2, < 4)
rack (>= 1.0, < 3)
omniauth-bookingsync (0.4.0)
oauth2 (~> 1.2.0)
omniauth (~> 1.1)
omniauth-oauth2 (< 1.4)
omniauth-oauth2 (1.3.1)
omniauth (1.6.1)
hashie (>= 3.4.6, < 3.6.0)
rack (>= 1.6.2, < 3)
omniauth-bookingsync (0.5.0)
oauth2 (~> 1.3.0)
omniauth (~> 1.6)
omniauth-oauth2 (<= 1.4)
omniauth-oauth2 (1.4.0)
oauth2 (~> 1.0)
omniauth (~> 1.2)
parser (2.3.3.1)
Expand Down Expand Up @@ -195,6 +197,10 @@ GEM
bundler (>= 1.3.0, < 2.0)
railties (= 5.0.1)
sprockets-rails (>= 2.0.0)
rails-controller-testing (1.0.2)
actionpack (~> 5.x, >= 5.0.1)
actionview (~> 5.x, >= 5.0.1)
activesupport (~> 5.x)
rails-dom-testing (2.0.1)
activesupport (>= 4.2.0, < 6.0)
nokogiri (~> 1.6.0)
Expand All @@ -208,9 +214,10 @@ GEM
thor (>= 0.18.1, < 2.0)
rainbow (2.1.0)
rake (12.0.0)
redis (3.3.2)
responders (2.3.0)
railties (>= 4.2.0, < 5.1)
redis (3.3.3)
responders (2.4.0)
actionpack (>= 4.2.0, < 5.3)
railties (>= 4.2.0, < 5.3)
rspec-core (3.5.4)
rspec-support (~> 3.5.0)
rspec-expectations (3.5.0)
Expand All @@ -236,7 +243,7 @@ GEM
unicode-display_width (~> 1.0, >= 1.0.1)
ruby-progressbar (1.8.1)
safe_yaml (1.0.4)
sass (3.4.23)
sass (3.4.24)
sass-rails (5.0.6)
railties (>= 4.0.0, < 6)
sass (~> 3.1)
Expand All @@ -249,9 +256,9 @@ GEM
shoulda-context (1.2.2)
shoulda-matchers (2.8.0)
activesupport (>= 3.0.0)
simple_form (3.3.1)
actionpack (> 4, < 5.1)
activemodel (> 4, < 5.1)
simple_form (3.5.0)
actionpack (> 4, < 5.2)
activemodel (> 4, < 5.2)
slop (3.6.0)
sprockets (3.7.1)
concurrent-ruby (~> 1.0)
Expand All @@ -261,27 +268,27 @@ GEM
activesupport (>= 4.0)
sprockets (>= 3.0.0)
sqlite3 (1.3.12)
synced (1.4.0)
bookingsync-api (>= 0.1.3)
synced (1.6.0)
bookingsync-api (>= 0.1.4)
hashie
rails (>= 4.0.0)
thor (0.19.4)
thread_safe (0.3.5)
tilt (2.0.5)
tilt (2.0.7)
turbolinks (5.0.1)
turbolinks-source (~> 5)
turbolinks-source (5.0.0)
turbolinks-source (5.0.3)
tzinfo (1.2.2)
thread_safe (~> 0.1)
uglifier (3.0.4)
uglifier (3.2.0)
execjs (>= 0.3.0, < 3)
unicode-display_width (1.1.2)
vcr (3.0.3)
webmock (2.3.1)
addressable (>= 2.3.6)
crack (>= 0.3.2)
hashdiff
websocket-driver (0.6.4)
websocket-driver (0.6.5)
websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.2)

Expand All @@ -293,6 +300,7 @@ DEPENDENCIES
bookingsync_portal!
factory_girl_rails
pry-rails
rails-controller-testing
rspec-rails
rubocop
shoulda
Expand All @@ -301,4 +309,4 @@ DEPENDENCIES
webmock

BUNDLED WITH
1.13.6
1.15.0
4 changes: 2 additions & 2 deletions app/controllers/bookingsync_portal/admin/base_controller.rb
@@ -1,12 +1,12 @@
require 'bookingsync_application/admin/common_base_controller'
require 'bookingsync_application/controllers/common_base'

module BookingsyncPortal
module Admin
class BaseController < ApplicationController
helper BookingsyncPortal::Admin::ApplicationHelper
layout 'bookingsync_portal/admin'
respond_to :html
include BookingsyncApplication::Admin::CommonBaseController
include BookingsyncApplication::Controllers::CommonBase

before_action :enforce_remote_account!

Expand Down
Expand Up @@ -10,7 +10,7 @@ def new
def create
BookingsyncPortal::Write::EnsureSourceExists.new(current_account).call
@remote_account = scope.create(params_remote_account)
respond_with @remote_account, location: admin_rentals_url
respond_with @remote_account, location: admin_rentals_path
end

private
Expand Down
2 changes: 1 addition & 1 deletion app/models/bookingsync_portal/connection.rb
Expand Up @@ -14,7 +14,7 @@ class BookingsyncPortal::Connection < ActiveRecord::Base

def notify_via_message_bus
MessageBus.publish "/account-#{rental.account_id}", { refresh_from:
BookingsyncPortal::Routes.admin_rental_path(rental, format: :js)
BookingsyncPortal::Engine.routes.url_helpers.admin_rental_path(rental, format: :js)
}
end

Expand Down
2 changes: 1 addition & 1 deletion app/views/bookingsync_portal/admin/help/index.html.erb
@@ -1,6 +1,6 @@
<article>
<header>
<%= link_to icon("times", t('.close')), admin_root_url, class: "pull-right" %>
<%= link_to icon("times", t('.close')), admin_root_path, class: "pull-right" %>
<h1><%=t '.title' %></h1>
</header>
<%= render 'help' %>
Expand Down
Expand Up @@ -13,7 +13,7 @@
<small><%= remote_rental.display_name %></small>
</h4>
<div class="status">
<%= link_to bookingsync_portal.admin_connection_path(rental.connection),
<%= link_to BookingsyncPortal::Engine.routes.url_helpers.admin_connection_path(rental.connection),
class: ["btn", "btn-xs", "remove-connection", rental.remote_rental.synchronized? ? "btn-success" : "btn-warning"],
data: { disable_with: t('.disconnecting_rental') }, method: :delete, remote: true do %>
<% unless rental.remote_rental.synchronized? %>
Expand Down
4 changes: 2 additions & 2 deletions app/views/bookingsync_portal/admin/rentals/index.html.erb
@@ -1,6 +1,6 @@
<%- content_for :navbar_right do -%>
<ul class="nav navbar-nav">
<li><%= link_to icon("life-ring", t('.help')), admin_help_url %></li>
<li><%= link_to icon("life-ring", t('.help')), admin_help_path %></li>
</ul>
<%- end -%>
<div class="rentals-container row">
Expand All @@ -17,7 +17,7 @@
</div>
<div class="col-xs-6">
<div class="remote-rentals-list rentals-list"
data-connect-url="<%= bookingsync_portal.admin_connections_url %>">
data-connect-url="<%= BookingsyncPortal::Engine.routes.url_helpers.admin_connections_path %>">
<div class="rentals-list-header">
<legend class="text-center">
<%= image_tag("#{BookingsyncPortal.portal_name.parameterize}.png",
Expand Down
2 changes: 1 addition & 1 deletion app/views/bookingsync_portal/admin/rentals/show.js.erb
@@ -1,7 +1,7 @@
$("#<%= dom_id @rental %>").replaceWith(
<%- if @rental.connected? %>
"<%=j render 'connected_rental', rental: @rental, remote_rental: @rental.remote_rental,
disconnect_url: bookingsync_portal.admin_connection_url(@rental.connection) %>");
disconnect_url: BookingsyncPortal::Engine.routes.url_helpers.admin_connection_path(@rental.connection) %>");
<%- else %>
"<%=j render 'rental', rental: @rental %>");
<%- end %>
2 changes: 1 addition & 1 deletion app/views/layouts/bookingsync_portal/_menu.html.erb
Expand Up @@ -13,7 +13,7 @@
</button>
<%- end -%>
<div>
<%= link_to icon("globe", BookingsyncPortal.portal_name), admin_root_url,
<%= link_to icon("globe", BookingsyncPortal.portal_name), admin_root_path,
class: "navbar-brand h1",
data: { toggle: "dropdown" } %>
</a>
Expand Down
3 changes: 2 additions & 1 deletion bookingsync_portal.gemspec
Expand Up @@ -19,7 +19,7 @@ Gem::Specification.new do |s|
s.add_dependency 'rails'
s.add_dependency 'sprockets-rails'
s.add_dependency 'responders'
s.add_dependency 'bookingsync_application', '~> 0.5.0'
s.add_dependency 'bookingsync_application', ['>= 1', '< 3']
s.add_dependency 'redis'
# FIXME: Will no longer be needed once UI moved to Ember
s.add_dependency 'jquery-rails'
Expand All @@ -43,4 +43,5 @@ Gem::Specification.new do |s|
s.add_development_dependency 'sqlite3'
s.add_development_dependency 'rubocop'
s.add_development_dependency 'pry-rails'
s.add_development_dependency 'rails-controller-testing'
end
2 changes: 1 addition & 1 deletion db/migrate/20150222172825_create_accounts.rb
@@ -1,4 +1,4 @@
class CreateAccounts < ActiveRecord::Migration
class CreateAccounts < ActiveRecord::Migration[4.2]
def change
create_table :accounts do |t|
t.string :provider
Expand Down
2 changes: 1 addition & 1 deletion db/migrate/20150222173413_create_rentals.rb
@@ -1,4 +1,4 @@
class CreateRentals < ActiveRecord::Migration
class CreateRentals < ActiveRecord::Migration[4.2]
def change
create_table :rentals do |t|
t.belongs_to :account, index: true
Expand Down
2 changes: 1 addition & 1 deletion db/migrate/20150222173711_create_remote_accounts.rb
@@ -1,4 +1,4 @@
class CreateRemoteAccounts < ActiveRecord::Migration
class CreateRemoteAccounts < ActiveRecord::Migration[4.2]
def change
create_table :remote_accounts do |t|
t.belongs_to :account, index: true
Expand Down

0 comments on commit a3c498c

Please sign in to comment.