Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ language: ruby
sudo: false
cache: bundler
rvm:
- 1.9.3
- 2.0.0
- 2.1
- 2.2.0
branches:
only:
- master
Expand All @@ -13,7 +13,6 @@ script: 'bundle exec rspec'
env:
- DB=mysql
- DB=postgresql
- RAILS_VERSION=4.0.12
notifications:
irc:
on_success: change
Expand Down
4 changes: 0 additions & 4 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@ source 'http://rubygems.org'

gemspec

if ENV['RAILS_VERSION']
gem 'rails', "~> #{ENV['RAILS_VERSION']}"
end

gem 'sqlite3' if ENV['DB'].nil? || ENV['DB'] == 'sqlite'
gem 'mysql2' if ENV['DB'] == 'mysql'
gem 'pg' if ENV['DB'] == 'postgresql'
Expand Down
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,9 @@ Read more about Alchemy on the [website](http://alchemy-cms.com) and in the [gui

## Rails Version

**This version of Alchemy CMS runs with Rails 4 (including 4.1)**

**Rails 4.2 support is coming soon. Watch [this pull request](https://github.com/AlchemyCMS/alchemy_cms/pull/655).**
**This version of Alchemy CMS runs with Rails 4.2**

* For a Rails 4.0/4.1 compatible version use the [`3.1-stable` branch](https://github.com/AlchemyCMS/alchemy_cms/tree/3.1-stable).
* For a Rails 3.2 compatible version use the [`2.8-stable` branch](https://github.com/AlchemyCMS/alchemy_cms/tree/2.8-stable).
* For a Rails 3.1 compatible version use the [`2.1-stable` branch](https://github.com/AlchemyCMS/alchemy_cms/tree/2.1-stable).
* For a Rails 3.0 compatible version use the [`2.0-stable` branch](https://github.com/AlchemyCMS/alchemy_cms/tree/2.0-stable).
Expand All @@ -43,7 +42,9 @@ Read more about Alchemy on the [website](http://alchemy-cms.com) and in the [gui

## Ruby Version

Alchemy runs with Ruby >= 1.9.3 (including Ruby 2.0 and 2.1).
Alchemy runs with Ruby >= 2.0.0.

For a Ruby 1.9.3 compatible version use the [`3.1-stable` branch](https://github.com/AlchemyCMS/alchemy_cms/tree/3.1-stable).

For a Ruby 1.8.7 compatible version use the [`2.3-stable` branch](https://github.com/AlchemyCMS/alchemy_cms/tree/2.3-stable).

Expand Down
11 changes: 6 additions & 5 deletions alchemy_cms.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Gem::Specification.new do |gem|
gem.summary = 'A powerful, userfriendly and flexible CMS for Rails 4'
gem.description = 'Alchemy is a powerful, userfriendly and flexible Rails 4 CMS.'
gem.requirements << 'ImageMagick (libmagick), v6.6 or greater.'
gem.required_ruby_version = '>= 1.9.3'
gem.required_ruby_version = '>= 2.0.0'
gem.license = 'BSD New'
gem.files = `git ls-files`.split("\n")
gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
Expand All @@ -26,16 +26,17 @@ Gem::Specification.new do |gem|
gem.add_runtime_dependency 'awesome_nested_set', ['~> 3.0.0']
gem.add_runtime_dependency 'cancancan', ['~> 1.9']
gem.add_runtime_dependency 'coffee-rails', ['~> 4.0']
gem.add_runtime_dependency 'compass-rails', ['~> 1.1']
gem.add_runtime_dependency 'compass-rails', ['>= 1.1.2']
gem.add_runtime_dependency 'dragonfly', ['~> 1.0.1']
gem.add_runtime_dependency 'jquery-rails', ['~> 3.1.0']
gem.add_runtime_dependency 'jquery-rails', ['~> 4.0.3']
gem.add_runtime_dependency 'jquery-ui-rails', ['~> 5.0.0']
gem.add_runtime_dependency 'kaminari', ['~> 0.15']
gem.add_runtime_dependency 'magiclabs-userstamp', ['~> 2.1.0']
gem.add_runtime_dependency 'non-stupid-digest-assets', ['~> 1.0.3']
gem.add_runtime_dependency 'rails', ['>= 4.0', '< 4.2']
gem.add_runtime_dependency 'rails', ['>= 4.2.0', '< 5.0']
gem.add_runtime_dependency 'request_store', ['~> 1.1.0']
gem.add_runtime_dependency 'sass-rails', ['~> 4.0']
gem.add_runtime_dependency 'responders', ['~> 2.0']
gem.add_runtime_dependency 'sass-rails', ['~> 5.0']
gem.add_runtime_dependency 'sassy-buttons', ['~> 0.2.6']
gem.add_runtime_dependency 'select2-rails', ['>= 3.5.9.1', '< 4.0']
gem.add_runtime_dependency 'simple_form', ['~> 3.0']
Expand Down
2 changes: 1 addition & 1 deletion app/assets/javascripts/alchemy/alchemy.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Alchemy CMS Sprockets Manifest
// ------------------------------
//= require jquery
//= require jquery2
//= require jquery_ujs
//= require turbolinks
//= require jquery-ui/datepicker
Expand Down
1 change: 1 addition & 0 deletions app/assets/stylesheets/alchemy/admin.css.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/* Alchemy CMS Sprockets Manifest
* -------------------------------
*= require select2
*= require_self
*/

Expand Down
2 changes: 0 additions & 2 deletions app/assets/stylesheets/alchemy/selects.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
//= require select2

select {
@extend %button-defaults;
height: 29px;
Expand Down
2 changes: 0 additions & 2 deletions app/controllers/alchemy/admin/pictures_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ module Admin
class PicturesController < Alchemy::Admin::BaseController
helper 'alchemy/admin/tags'

respond_to :html, :js

before_action :load_picture,
only: [:show, :edit, :update, :info, :destroy]

Expand Down
18 changes: 0 additions & 18 deletions app/controllers/alchemy/contents_controller.rb

This file was deleted.

6 changes: 0 additions & 6 deletions app/controllers/alchemy/elements_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ class ElementsController < Alchemy::BaseController
#
# * html
# * js (Tries to replace a given +container_id+ with the elements view partial content via jQuery.)
# * json (A JSON object that includes all contents and their ingredients)
#
def show
@page = @element.page
Expand All @@ -22,12 +21,7 @@ def show
respond_to do |format|
format.html
format.js { @container_id = params[:container_id] }
format.json do
ActiveSupport::Deprecation.warn("The Alchemy elements json API moved to `api` namespace. Please use `/api/elements` for json requests instead.")
render json: @element, serializer: LegacyElementSerializer
end
end
end

end
end
30 changes: 17 additions & 13 deletions app/controllers/alchemy/pages_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,6 @@ def show
render xml: {error: 'Not found'}, status: 404
end
end
format.json do
ActiveSupport::Deprecation.warn('The Alchemy pages json API moved to `api` namespace. Please use `/api/pages` for json requests instead.')
render json: @page
end
end
end
end
Expand Down Expand Up @@ -125,13 +121,14 @@ def redirect_to_public_child
end
end

def redirect_page(options={})
defaults = {
:lang => (multi_language? ? @page.language_code : nil),
:urlname => @page.urlname
}
options = defaults.merge(options)
redirect_to show_page_path(additional_params.merge(options)), :status => 301
# Redirects page to given url with 301 status while keeping all additional params

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line is too long. [85/80]

def redirect_page(options = {})
options = {
lang: (multi_language? ? @page.language_code : nil),
urlname: @page.urlname
}.merge(options)

redirect_to show_page_path(additional_params.merge(options)), status: 301
end

# Use the bare minimum to redirect to @page
Expand All @@ -145,9 +142,16 @@ def redirect_legacy_page(options={})
redirect_to show_page_path(options), :status => 301
end

# Returns url parameters that are not internal show page params.
#
# * action
# * controller
# * urlname
# * lang
#
def additional_params
params.each do |key, value|
params[key] = nil if ["action", "controller", "urlname", "lang"].include?(key)
params.symbolize_keys.delete_if do |key, _|
[:action, :controller, :urlname, :lang].include?(key)
end
end

Expand Down
2 changes: 1 addition & 1 deletion app/helpers/alchemy/admin/navigation_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ def url_options_for_navigation_entry(entry)
action: entry['action'],
only_path: true,
params: entry['params']
}
}.delete_if { |_k, v| v.nil? }
end

# Retrieves the current Alchemy module from controller and index action.
Expand Down
2 changes: 1 addition & 1 deletion bin/alchemy
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env ruby
# encoding: UTF-8
gem 'rails', '~> 4.1.0'
gem 'rails', '~> 4.2.0'

require 'rails/version'
require "thor"
Expand Down
1 change: 0 additions & 1 deletion config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@

resources :messages, :only => [:index, :new, :create]
resources :elements, :only => :show
resources :contents, :only => :show

namespace :api, defaults: {format: 'json'} do
resources :contents, only: [:index, :show]
Expand Down
1 change: 1 addition & 0 deletions lib/alchemy/engine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
require 'kaminari'
require 'non-stupid-digest-assets'
require 'request_store'
require 'responders'

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.

require 'sass-rails'
require 'sassy-buttons'
require 'simple_form'
Expand Down
1 change: 0 additions & 1 deletion spec/controllers/admin/contents_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ module Alchemy
expect(Element).to receive(:find).and_return(element)
end


describe '#create' do
let(:element) { build_stubbed(:element, name: 'headline') }

Expand Down
22 changes: 0 additions & 22 deletions spec/controllers/contents_controller_spec.rb

This file was deleted.

9 changes: 0 additions & 9 deletions spec/controllers/elements_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,6 @@ module Alchemy
expect(response.status).to eq(200)
end
end

context "requested for json format" do
it "should render json response but warns about deprecation" do
expect(ActiveSupport::Deprecation).to receive(:warn)
get :show, id: element.id, format: :json
expect(response.status).to eq(200)
expect(response.content_type).to eq('application/json')
end
end
end
end
end
9 changes: 0 additions & 9 deletions spec/controllers/pages_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,6 @@ module Alchemy
end
end

context "requested for json format" do
it "should render json response but warns about deprecation" do
expect(ActiveSupport::Deprecation).to receive(:warn)
get :show, urlname: default_language_root.urlname, format: :json
expect(response.status).to eq(200)
expect(response.content_type).to eq('application/json')
end
end

describe "Layout rendering" do
context "with ajax request" do
it "should not render a layout" do
Expand Down
2 changes: 1 addition & 1 deletion spec/dummy/Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@

require File.expand_path('../config/application', __FILE__)

Dummy::Application.load_tasks
Rails.application.load_tasks
8 changes: 5 additions & 3 deletions spec/dummy/app/assets/stylesheets/application.css
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
* or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
*
* You're free to add application-wide styles to this file and they'll appear at the top of the
* compiled file, but it's generally better to create a new file per style scope.
* You're free to add application-wide styles to this file and they'll appear at the bottom of the
* compiled file so the styles you add here take precedence over styles defined in any styles
* defined in the other CSS/SCSS files in this directory. It is generally better to create a new
* file per style scope.
*
*= require_self
*= require_tree .
*= require_self
*/
12 changes: 11 additions & 1 deletion spec/dummy/config/application.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
require File.expand_path('../boot', __FILE__)

require 'rails/all'
# Pick the frameworks you want:
require "active_record/railtie"
require "action_controller/railtie"
require "action_mailer/railtie"
require "action_view/railtie"
require "sprockets/railtie"
# require "rails/test_unit/railtie"

Bundler.require(*Rails.groups)
require "alchemy_cms"
Expand All @@ -18,5 +24,9 @@ class Application < Rails::Application
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
# config.i18n.default_locale = :de

# Do not swallow errors in after_commit/after_rollback callbacks.
config.active_record.raise_in_transactional_callbacks = true
end
end

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 trailing blank lines detected.

2 changes: 1 addition & 1 deletion spec/dummy/config/boot.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Set up gems listed in the Gemfile.
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../../../Gemfile', __FILE__)

require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE'])
require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE'])

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.

$LOAD_PATH.unshift File.expand_path('../../../../lib', __FILE__)
2 changes: 1 addition & 1 deletion spec/dummy/config/environment.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
require File.expand_path('../application', __FILE__)

# Initialize the Rails application.
Dummy::Application.initialize!
Rails.application.initialize!
16 changes: 14 additions & 2 deletions spec/dummy/config/environments/development.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Dummy::Application.configure do
Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.

# In the development environment your application's code is reloaded on
Expand All @@ -19,11 +19,23 @@
# Print deprecation notices to the Rails logger.
config.active_support.deprecation = :log

# Raise an error on page load if there are pending migrations
# Raise an error on page load if there are pending migrations.
config.active_record.migration_error = :page_load

# Debug mode disables concatenation and preprocessing of assets.
# This option may cause significant delays in view rendering with a large
# number of complex assets.
config.assets.debug = true

# Asset digests allow you to set far-future HTTP expiration dates on all assets,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line is too long. [82/80]

# yet still be able to expire them through the digest params.
config.assets.digest = true

# Adds additional error checking when serving assets at runtime.
# Checks for improperly declared sprockets dependencies.
# Raises helpful error messages.
config.assets.raise_runtime_errors = true

# Raises error for missing translations
# config.action_view.raise_on_missing_translations = true
end
Loading