Skip to content

Commit

Permalink
Merge pull request #388 from cbdr/semaphore-build-fixes
Browse files Browse the repository at this point in the history
Spec Fixes + Rails 5 Rough Edges
  • Loading branch information
Alex Tharp authored Nov 22, 2016
2 parents 3eaa623 + be92af2 commit f91181e
Show file tree
Hide file tree
Showing 74 changed files with 407 additions and 450 deletions.
5 changes: 3 additions & 2 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ S3_HOST_ALIAS=
#
SMTP_ADDRESS=
SMTP_PORT=587
SMTP_SENDER_DOMAIN=cbcortex.com
SMTP_SENDER_ADDRESS=noreply@cbcortex.com
SMTP_SENDER_DOMAIN=cortexcms.org
SMTP_SENDER_ADDRESS=noreply@cortexcms.org
SMTP_USERNAME=
SMTP_PASSWORD=
SMTP_STARTTLS=true
Expand Down Expand Up @@ -68,6 +68,7 @@ DATABASE_POOL=5
#
REDIS_NAMESPACE=cortex_dev
CACHE_URL=redis://localhost:6379/0/cache
SESSION_STORE_URL=redis://localhost:6379/0/cache

#
# Search
Expand Down
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
*.sassc
.sass-cache
capybara-*.html
.rspec
.powrc
/public/system
/coverage/
Expand Down
2 changes: 2 additions & 0 deletions .rspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
--color
--require spec_helper
28 changes: 15 additions & 13 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ gem 'rails', '~> 5.0.0'
# Cortex-specific
gem 'cortex-exceptions', '~> 0.0.4'
gem 'cortex-plugins-core', '= 0.4.6'
gem 'cortex-plugins-demo', git: 'git://github.com/cortex-cms/cortex-plugins-demo'
gem 'cortex-plugins-demo', git: 'https://github.com/cortex-cms/cortex-plugins-demo.git'

# API
gem 'grape', '~> 0.17'
Expand All @@ -29,14 +29,14 @@ gem 'rolify', '~> 5.1'
gem 'pundit', '~> 1.1'

# Data
gem 'rails-observers', git: 'git://github.com/rails/rails-observers'
gem 'awesome_nested_set', '~> 3.1'
gem 'rails-observers', git: 'https://github.com/rails/rails-observers.git'
gem 'awesome_nested_set', git: 'https://github.com/cortex-cms/awesome_nested_set.git'
gem 'paperclip', '~> 5.1.0'
gem 'paperclip-optimizer', '~> 2.0'
gem 'image_optim_pack', '~> 0.3.0'
gem 'acts-as-taggable-on', '~> 4.0'
gem 'bcrypt', '~> 3.1.11'
gem 'grape-kaminari', git: 'git://github.com/toastercup/grape-kaminari', branch: 'set-only-pagination-headers'
gem 'grape-kaminari', git: 'https://github.com/toastercup/grape-kaminari.git', branch: 'set-only-pagination-headers'
gem 'elasticsearch-model', '~> 0.1'
gem 'elasticsearch-rails', '~> 0.1'
gem 'paranoia', '~> 2.2'
Expand Down Expand Up @@ -81,12 +81,10 @@ gem 'bootscale', require: false

# View
gem 'haml', '~> 4.1.0.beta'
gem 'cells', git: 'git://github.com/samstickland/cells', branch: 'collection_fix' # remove explicit 'cells' dependency when collection_fix is merged in. See: https://github.com/apotonick/cells/pull/415
gem 'cells', git: 'https://github.com/samstickland/cells.git', branch: 'collection_fix' # remove explicit 'cells' dependency when collection_fix is merged in. See: https://github.com/apotonick/cells/pull/415
gem 'cells-rails', '~> 0.0.6'
gem 'cells-haml', '~> 0.0.10'
gem 'breadcrumbs_on_rails', '~> 3.0.1'
gem 'jquery-ui-rails', '~> 5.0.5'
gem 'bootstrap-tagsinput-rails', '~> 0.4.2'

# Style
gem 'sass-rails', '~> 5.0'
Expand All @@ -95,11 +93,13 @@ gem 'font-awesome-sass', '~> 4.7.0'
gem 'material_design_lite-sass', '~> 1.2.1'

# JavaScript
gem 'gon', '~> 6.1.0'
gem 'turbolinks', '~> 5.0.1'
gem 'jquery-turbolinks', '~> 2.1'
gem 'jquery-rails', '~> 4.2.1'
gem 'jquery-turbolinks', '~> 2.1'
gem 'jquery-ui-rails', '~> 5.0.5'
gem 'ng-rails-csrf', '~> 0.1.0'
gem 'gon', '~> 6.1.0'
gem 'bootstrap-tagsinput-rails', '~> 0.4.2'

group :tasks do
# Parsing
Expand All @@ -108,7 +108,7 @@ end

group :test, :development do
# Environment
gem 'dotenv'
gem 'dotenv-rails', :require => 'dotenv/rails-now'

# Cache/Sidekiq
gem 'redis-namespace'
Expand All @@ -129,12 +129,15 @@ end

group :test do
# Rspec
gem 'rspec', '~> 3.5'
gem 'rspec-rails', '~> 3.5'
gem 'json_spec', '~> 1.1'
gem 'rspec-sidekiq', '~> 2.2'
gem 'shoulda-matchers', '~> 3.1'

# Coverage
gem 'simplecov', '~> 0.12', require: false
gem 'codeclimate-test-reporter', '~> 0.6', require: false

# Capybara for feature testing, Poltergeist for PhantomJS
gem 'capybara'
gem 'poltergeist'
Expand All @@ -152,8 +155,7 @@ group :test do
gem 'guard-jasmine', '~> 2.1'
gem 'jasmine-core', '~> 2.5'

# Etc
gem 'codeclimate-test-reporter', '~> 0.6', require: false
# Data
gem 'elasticsearch-extensions', '~> 0.0.22'
end

Expand Down
28 changes: 18 additions & 10 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
GIT
remote: git://github.com/cortex-cms/cortex-plugins-demo
remote: https://github.com/cortex-cms/awesome_nested_set.git
revision: d3bad27fa959788e403becc411f6db9d1aac1dfb
specs:
awesome_nested_set (3.1.2)
activerecord (>= 4.0.0, < 5.1)

GIT
remote: https://github.com/cortex-cms/cortex-plugins-demo.git
revision: 676926ab244a125a14e8ec6628ef0e46a3ad784b
specs:
cortex-plugins-demo (1.4.2)
Expand All @@ -9,14 +16,14 @@ GIT
rails (>= 4)

GIT
remote: git://github.com/rails/rails-observers
remote: https://github.com/rails/rails-observers.git
revision: 3fe157d6cbb5b5e767ded248009fc59443d63fa1
specs:
rails-observers (0.1.3.alpha)
activemodel (>= 4.0, < 5.1)

GIT
remote: git://github.com/samstickland/cells
remote: https://github.com/samstickland/cells.git
revision: e5634e25b472d41913030eb82463b015f429f2ca
branch: collection_fix
specs:
Expand All @@ -25,7 +32,7 @@ GIT
uber (>= 0.0.9)

GIT
remote: git://github.com/toastercup/grape-kaminari
remote: https://github.com/toastercup/grape-kaminari.git
revision: 8d3f48e04c35cd6b85d4707a5b7f7356d305bf8c
branch: set-only-pagination-headers
specs:
Expand Down Expand Up @@ -87,8 +94,6 @@ GEM
attr_required (1.0.1)
autoprefixer-rails (6.5.3)
execjs
awesome_nested_set (3.1.1)
activerecord (>= 4.0.0, < 5.1)
aws-sdk (2.6.19)
aws-sdk-resources (= 2.6.19)
aws-sdk-core (2.6.19)
Expand Down Expand Up @@ -170,6 +175,9 @@ GEM
doorkeeper (4.2.0)
railties (>= 4.2)
dotenv (2.1.1)
dotenv-rails (2.1.1)
dotenv (= 2.1.1)
railties (>= 4.0, < 5.1)
elasticsearch (5.0.0)
elasticsearch-api (= 5.0.0)
elasticsearch-transport (= 5.0.0)
Expand Down Expand Up @@ -695,7 +703,7 @@ DEPENDENCIES
acts-as-taggable-on (~> 4.0)
addressable (~> 2.5.0)
angular-rails-templates (~> 1.0.2)
awesome_nested_set (~> 3.1)
awesome_nested_set!
aws-sdk (~> 2.6)
bcrypt (~> 3.1.11)
better_errors
Expand All @@ -717,7 +725,7 @@ DEPENDENCIES
database_cleaner (~> 1.5)
devise (~> 4.2.0)
doorkeeper (~> 4.2)
dotenv
dotenv-rails
elasticsearch-extensions (~> 0.0.22)
elasticsearch-model (~> 0.1)
elasticsearch-rails (~> 0.1)
Expand Down Expand Up @@ -776,14 +784,14 @@ DEPENDENCIES
redis-namespace
redis-rails (~> 5.0)
rolify (~> 5.1)
rspec (~> 3.5)
rspec-rails (~> 3.5)
rspec-sidekiq (~> 2.2)
rubyzip (~> 1.2.0)
sass-rails (~> 5.0)
shoulda-matchers (~> 3.1)
sidekiq (~> 4.2.5)
sidekiq-failures (~> 0.4.5)
simplecov (~> 0.12)
sinatra (~> 2.0.0.beta)
six (~> 0.2.0)
sprockets (= 3.7.0)
Expand All @@ -799,4 +807,4 @@ RUBY VERSION
ruby 2.3.1p112

BUNDLED WITH
1.12.5
1.13.6
2 changes: 1 addition & 1 deletion LICENSE.md
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@
same "printed page" as the copyright notice for easier
identification within third-party archives.

Copyright 2015 CareerBuilder, LLC
Copyright 2017 CareerBuilder, LLC

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ $ npm install -g bower && bundle exec rake bower:install:development
* Create databases:

```sh
bundle exec rake db:create:all
$ bundle exec rake db:create
```

* Initialize the schema:
Expand Down Expand Up @@ -172,7 +172,7 @@ $ bundle exec rails s
$ bundle exec sidekiq -q default -q mailers
```

The admin interface should now be accessible locally on port `3000`. To access Cortex as superadmin, login as `surgeon@cbcortex.com` with password `welcome1`.
The admin interface should now be accessible locally on port `3000`. To access Cortex as superadmin, login as `surgeon@cortexcms.org` with password `welcome1`.

### Deployment

Expand All @@ -197,7 +197,8 @@ This will configure various things, such as [dotenv](https://github.com/bkeepers
Initialize the test database:

```sh
$ bundle exec rake db:schema:load db:seed cortex:create_categories cortex:onet:fetch_and_provision cortex:core:db:reseed cortex:rebuild_indexes
$ bundle exec rake db:schema:load db:seed cortex:create_categories cortex:onet:fetch_and_provision cortex:core:db:reseed
$ bundle exec rake cortex:rebuild_indexes
```

To run Ruby and JS specs, utilize:
Expand Down
1 change: 0 additions & 1 deletion app/api/v1/resources/posts.rb
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,6 @@ class Posts < Grape::API

allowed_params = remove_params(::V1::Entities::Post.documentation.keys, :featured_media, :tile_media, :media, :industries, :categories, :is_published) + [:category_ids, :industry_ids, :author_id]


@post = ::Post.new(declared(params, {include_missing: false}, allowed_params))
post.user = params[:user] ? User.find(params[:user]) : current_user
post.save!
Expand Down
2 changes: 1 addition & 1 deletion app/assets/javascripts/application.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//= require jquery
//= require jquery3
// require jquery.turbolinks # temporarily disabled
//= require jquery_ujs
//= require underscore
Expand Down
2 changes: 2 additions & 0 deletions app/jobs/application_job.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
class ApplicationJob < ActiveJob::Base
end
2 changes: 1 addition & 1 deletion app/jobs/bulk_create_media_job.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require 'csv'
require 'zip'

class BulkCreateMediaJob < ActiveJob::Base
class BulkCreateMediaJob < ApplicationJob
queue_as :default

def perform(bulk_job, current_user)
Expand Down
2 changes: 1 addition & 1 deletion app/jobs/bulk_create_users_job.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require 'csv'

class BulkCreateUsersJob < ActiveJob::Base
class BulkCreateUsersJob < ApplicationJob
queue_as :default

def perform(bulk_job)
Expand Down
2 changes: 1 addition & 1 deletion app/jobs/cache_bust_webpage_job.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class CacheBustWebpageJob < ActiveJob::Base
class CacheBustWebpageJob < ApplicationJob
queue_as :default

def perform(url)
Expand Down
2 changes: 1 addition & 1 deletion app/jobs/publish_content_item_job.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class PublishContentItemJob < ActiveJob::Base
class PublishContentItemJob < ApplicationJob
queue_as :default

def perform(content_item)
Expand Down
2 changes: 1 addition & 1 deletion app/jobs/youtube_media_job.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class YoutubeMediaJob < ActiveJob::Base
class YoutubeMediaJob < ApplicationJob
queue_as :default

def perform(media)
Expand Down
2 changes: 1 addition & 1 deletion app/mailers/application_mailer.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class ApplicationMailer < ActionMailer::Base
default from: "from@example.com"
default from: 'Cortex CMS <noreply@cortexcms.org>'
layout 'mailer'
end
2 changes: 0 additions & 2 deletions app/mailers/password_reset_mailer.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
class PasswordResetMailer < ApplicationMailer
default from: "CB Cortex <noreply@cbcortex.com>"

# Subject can be set in your I18n file at config/locales/en.yml
# with the following lookup:
#
Expand Down
2 changes: 1 addition & 1 deletion app/models/application.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class Application < ActiveRecord::Base
class Application < ApplicationRecord
has_many :credentials, class_name: 'Doorkeeper::Application', as: :owner
belongs_to :tenant
validates_presence_of :tenant, :name
Expand Down
3 changes: 3 additions & 0 deletions app/models/application_record.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
class ApplicationRecord < ActiveRecord::Base
self.abstract_class = true
end
2 changes: 1 addition & 1 deletion app/models/author.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class Author < ActiveRecord::Base
class Author < ApplicationRecord
include HasGravatar
include HasFirstnameLastname

Expand Down
2 changes: 1 addition & 1 deletion app/models/bulk_job.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class BulkJob < ActiveRecord::Base
class BulkJob < ApplicationRecord
belongs_to :user

serialize :log
Expand Down
2 changes: 1 addition & 1 deletion app/models/category.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class Category < ActiveRecord::Base
class Category < ApplicationRecord
acts_as_nested_set
scope :job_phases, -> { where(depth: 0) }
scope :categories, -> { where(depth: 1) }
Expand Down
3 changes: 1 addition & 2 deletions app/models/concerns/find_by_tenant.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ module FindByTenant
extend ActiveSupport::Concern

included do
scope :find_by_tenant_id, ->(tenant_id) { joins(user: :tenant).where(users: { :'tenant_id' => tenant_id})}

scope :find_by_tenant_id, ->(tenant_id) { joins(user: :tenant).where(users: { :'tenant_id' => tenant_id })}
scope :find_by_user_tenant, ->(user) { joins(user: :tenant).where(users: { :'tenant_id' => user.tenant.id })}
end
end
2 changes: 1 addition & 1 deletion app/models/content_item.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class ContentItem < ActiveRecord::Base
class ContentItem < ApplicationRecord
include ActiveModel::Transitions
include Elasticsearch::Model
include Elasticsearch::Model::Callbacks
Expand Down
2 changes: 1 addition & 1 deletion app/models/content_type.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require 'elasticsearch/model/indexing'

class ContentType < ActiveRecord::Base
class ContentType < ApplicationRecord
include Elasticsearch::Model
include Elasticsearch::Model::Callbacks

Expand Down
2 changes: 1 addition & 1 deletion app/models/contentable_decorator.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class ContentableDecorator < ActiveRecord::Base
class ContentableDecorator < ApplicationRecord
belongs_to :decorator
belongs_to :contentable, polymorphic: true
end
2 changes: 1 addition & 1 deletion app/models/contract.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class Contract < ActiveRecord::Base
class Contract < ApplicationRecord
has_many :content_types
has_many :contentable_decorators, as: :contentable
has_many :decorators, through: :contentable_decorators
Expand Down
2 changes: 1 addition & 1 deletion app/models/decorator.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class Decorator < ActiveRecord::Base
class Decorator < ApplicationRecord
has_many :contentable_decorators

validates :name, :data, presence: true
Expand Down
2 changes: 1 addition & 1 deletion app/models/document.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class Document < ActiveRecord::Base
class Document < ApplicationRecord
acts_as_paranoid

belongs_to :user
Expand Down
Loading

0 comments on commit f91181e

Please sign in to comment.