Merge branch 'master' into rails_3_1

Conflicts:
	Gemfile
	Gemfile.lock
	config/boot.rb
This commit is contained in:
Mario Visic 2011-11-27 20:33:45 +11:00
commit 9f56eecd56
15 changed files with 54 additions and 47 deletions

View File

@ -46,8 +46,8 @@ gem 'rubyzip'
gem 'actionmailer-with-request', '~> 0.3.0', :require => 'actionmailer_with_request' gem 'actionmailer-with-request', '~> 0.3.0', :require => 'actionmailer_with_request'
gem 'httparty', '~> 0.8.1' gem 'httparty', '~> 0.8.1'
gem 'delayed_job', '~> 2.1.1' gem 'delayed_job', '~> 3.0.0.pre4'
gem 'delayed_job_mongoid', '~> 1.0.4' gem 'delayed_job_mongoid', '~> 1.0.6'
gem 'SystemTimer', :platforms => :ruby_18 gem 'SystemTimer', :platforms => :ruby_18
# The rest of the dependencies are for use when in the locomotive dev environment # The rest of the dependencies are for use when in the locomotive dev environment

View File

@ -128,13 +128,13 @@ GEM
capybara (>= 1.1.1) capybara (>= 1.1.1)
cucumber (>= 1.1.1) cucumber (>= 1.1.1)
nokogiri (>= 1.5.0) nokogiri (>= 1.5.0)
daemons (1.1.4) daemons (1.0.10)
database_cleaner (0.7.0) database_cleaner (0.7.0)
delayed_job (2.1.4) delayed_job (3.0.0.pre4)
activesupport (~> 3.0) activesupport (~> 3.0)
daemons daemons (= 1.0.10)
delayed_job_mongoid (1.0.4) delayed_job_mongoid (1.0.6)
delayed_job (~> 2.1.1) delayed_job (= 3.0.0.pre4)
mongoid (>= 2.0) mongoid (>= 2.0)
diff-lcs (1.1.3) diff-lcs (1.1.3)
dragonfly (0.9.8) dragonfly (0.9.8)
@ -324,8 +324,8 @@ DEPENDENCIES
cucumber-rails cucumber-rails
custom_fields! custom_fields!
database_cleaner database_cleaner
delayed_job (~> 2.1.1) delayed_job (~> 3.0.0.pre4)
delayed_job_mongoid (~> 1.0.4) delayed_job_mongoid (~> 1.0.6)
devise! devise!
dragonfly (~> 0.9.8) dragonfly (~> 0.9.8)
factory_girl_rails (~> 1.1) factory_girl_rails (~> 1.1)

View File

@ -1,5 +1,8 @@
h1. Locomotive CMS h1. Locomotive CMS
"!https://secure.travis-ci.org/locomotivecms/engine.png!":http://travis-ci.org/locomotivecms/engine
Locomotive is a simple but powerful CMS based on liquid templates and mongodb database. At my company ("NoCoffee":http://www.nocoffee.fr), we use it for our clients when they request a simple website. Locomotive is a simple but powerful CMS based on liquid templates and mongodb database. At my company ("NoCoffee":http://www.nocoffee.fr), we use it for our clients when they request a simple website.
If we have to give only 5 main features to describe our application, there will be: If we have to give only 5 main features to describe our application, there will be:
@ -32,6 +35,12 @@ h2. Installation
See the "official website":http://www.locomotivecms.com See the "official website":http://www.locomotivecms.com
h2. Community
* Get help or discuss locomotive CMS at the "LocomotiveCMS Discussion Forums":http://locomotive.vanillaforums.com/
* Join us on IRC "#locomotivecms at irc.freenode.net!":http://webchat.freenode.net/
* "Follow us on twitter":http://twitter.com/locomotiveapp
h2. Team h2. Team
* Developers: "Didier Lafforgue":http://www.nocoffee.fr, "Jacques Crocker":http://www.railsjedi.com, "Mario Visic":http://www.mariovisic.com * Developers: "Didier Lafforgue":http://www.nocoffee.fr, "Jacques Crocker":http://www.railsjedi.com, "Mario Visic":http://www.mariovisic.com

View File

@ -7,18 +7,18 @@ end
Given /^I am an authenticated "([^"]*)"$/ do |role| Given /^I am an authenticated "([^"]*)"$/ do |role|
@member = Site.first.memberships.where(:role => role.downcase).first || FactoryGirl.create(role.downcase.to_sym, :site => Site.first) @member = Site.first.memberships.where(:role => role.downcase).first || FactoryGirl.create(role.downcase.to_sym, :site => Site.first)
Given %{I go to login} step %{I go to login}
And %{I fill in "Email" with "#{@member.account.email}"} step %{I fill in "Email" with "#{@member.account.email}"}
And %{I fill in "Password" with "easyone"} step %{I fill in "Password" with "easyone"}
And %{I press "Log in"} step %{I press "Log in"}
end end
Given /^I am an authenticated user$/ do Given /^I am an authenticated user$/ do
Given %{I am an authenticated "admin"} step %{I am an authenticated "admin"}
end end
Then /^I should see the access denied message$/ do Then /^I should see the access denied message$/ do
Then %{I should see "You are not authorized to access this page"} step %{I should see "You are not authorized to access this page"}
end end
Then /^I am redirected to "([^\"]*)"$/ do |url| Then /^I am redirected to "([^\"]*)"$/ do |url|

View File

@ -7,7 +7,7 @@ Then /^I should see the role dropdown on the "([^"]*)" without the "([^"]*)" opt
end end
Then /^I should see the role dropdown on myself$/ do Then /^I should see the role dropdown on myself$/ do
Then %{I should see the role dropdown on the "#{@member.role}"} step %{I should see the role dropdown on the "#{@member.role}"}
end end
Then /^I should not see the role dropdown on the "([^"]*)"$/ do |user| Then /^I should not see the role dropdown on the "([^"]*)"$/ do |user|
@ -15,7 +15,7 @@ Then /^I should not see the role dropdown on the "([^"]*)"$/ do |user|
end end
Then /^I should not see the role dropdown on myself$/ do Then /^I should not see the role dropdown on myself$/ do
Then %{I should not see the role dropdown on the "#{@member.role}"} step %{I should not see the role dropdown on the "#{@member.role}"}
end end
Then /^I should not see any role dropdowns$/ do Then /^I should not see any role dropdowns$/ do
@ -31,7 +31,7 @@ Then /^I should not see delete on the "([^"]*)"$/ do |role|
end end
Then /^I should not see delete on myself$/ do Then /^I should not see delete on myself$/ do
Then %{I should not see delete on the "#{@member.role}"} step %{I should not see delete on the "#{@member.role}"}
end end
Then /^I should not see any delete buttons$/ do Then /^I should not see any delete buttons$/ do
@ -39,5 +39,5 @@ Then /^I should not see any delete buttons$/ do
end end
When /^I select the "([^"]*)" role for the "author" user/ do |role| When /^I select the "([^"]*)" role for the "author" user/ do |role|
Given %{I select "#{role}" from "site[memberships_attributes][2][role]"} step %{I select "#{role}" from "site[memberships_attributes][2][role]"}
end end

View File

@ -19,7 +19,7 @@ end
Then /^I should be able to view a paginaed list of a has many association$/ do Then /^I should be able to view a paginaed list of a has many association$/ do
# Create models # Create models
Given %{I have an "Articles" model which has many "Comments"} step %{I have an "Articles" model which has many "Comments"}
# Create contents # Create contents
article = @parent_model.contents.create!(:slug => 'parent', :body => 'Parent') article = @parent_model.contents.create!(:slug => 'parent', :body => 'Parent')

View File

@ -14,7 +14,7 @@ Given /^I have the site: "([^"]*)" set up(?: with #{capture_fields})?$/ do |site
end end
Given /^I have a site set up$/ do Given /^I have a site set up$/ do
Given %{I have the site: "test site" set up} step %{I have the site: "test site" set up}
end end
Given /^I have a designer and an author$/ do Given /^I have a designer and an author$/ do

View File

@ -19,12 +19,12 @@ World(WithinHelpers)
# Single-line step scoper # Single-line step scoper
When /^(.*) within (.*[^:])$/ do |step, parent| When /^(.*) within (.*[^:])$/ do |step, parent|
with_scope(parent) { When step } with_scope(parent) { step step }
end end
# Multi-line step scoper # Multi-line step scoper
When /^(.*) within (.*[^:]):$/ do |step, parent, table_or_string| When /^(.*) within (.*[^:]):$/ do |step, parent, table_or_string|
with_scope(parent) { When "#{step}:", table_or_string } with_scope(parent) { step "#{step}:", table_or_string }
end end
Given /^(?:|I )am on (.+)$/ do |page_name| Given /^(?:|I )am on (.+)$/ do |page_name|
@ -64,7 +64,7 @@ end
# #
When /^(?:|I )fill in the following:$/ do |fields| When /^(?:|I )fill in the following:$/ do |fields|
fields.rows_hash.each do |name, value| fields.rows_hash.each do |name, value|
When %{I fill in "#{name}" with "#{value}"} step %{I fill in "#{name}" with "#{value}"}
end end
end end
@ -194,4 +194,4 @@ end
Then /^show me the page$/ do Then /^show me the page$/ do
save_and_open_page save_and_open_page
end end

View File

@ -12,7 +12,6 @@ require 'cucumber/rails'
require 'cucumber/formatter/unicode' # Remove this line if you don't want Cucumber Unicode support require 'cucumber/formatter/unicode' # Remove this line if you don't want Cucumber Unicode support
require 'cucumber/rails/rspec' require 'cucumber/rails/rspec'
require 'cucumber/rails/world' require 'cucumber/rails/world'
require 'cucumber/web/tableish'
require 'capybara' require 'capybara'
require 'capybara/rails' require 'capybara/rails'
@ -68,4 +67,4 @@ ActionController::Base.allow_rescue = false
require File.expand_path(File.dirname(__FILE__) + '/../../spec/support/carrierwave') require File.expand_path(File.dirname(__FILE__) + '/../../spec/support/carrierwave')
require File.expand_path(File.dirname(__FILE__) + '/../../spec/support/locomotive') require File.expand_path(File.dirname(__FILE__) + '/../../spec/support/locomotive')
Locomotive.configure_for_test(true) Locomotive.configure_for_test(true)

View File

@ -163,7 +163,7 @@ module Locomotive
end end
def absolute_url(url) def absolute_url(url)
url.starts_with('/') ? url : "/#{url}" url.starts_with?('/') ? url : "/#{url}"
end end
end end

View File

@ -13,4 +13,4 @@ module Locomotive
end end
end end
end end

View File

@ -9,7 +9,7 @@ module Locomotive
def call(env) def call(env)
path = env['PATH_INFO'] path = env['PATH_INFO']
if !path.starts_with('/admin/') && (match = path.match(%r{(.+)/$})) if !path.starts_with?('/admin/') && (match = path.match(%r{(.+)/$}))
response = Rack::Response.new response = Rack::Response.new
response.redirect(match[1], 301) # moved permanently response.redirect(match[1], 301) # moved permanently
response.finish response.finish

View File

@ -55,8 +55,8 @@ Gem::Specification.new do |s|
s.add_dependency 'actionmailer-with-request' s.add_dependency 'actionmailer-with-request'
s.add_dependency 'httparty', '0.7.8' s.add_dependency 'httparty', '0.7.8'
s.add_dependency 'RedCloth', '4.2.8' s.add_dependency 'RedCloth', '4.2.8'
s.add_dependency 'delayed_job', '2.1.4' s.add_dependency 'delayed_job', '3.0.0.pre4'
s.add_dependency 'delayed_job_mongoid', '1.0.2' s.add_dependency 'delayed_job_mongoid', '1.0.6'
s.add_dependency 'rubyzip' s.add_dependency 'rubyzip'
s.add_dependency 'locomotive_jammit-s3' s.add_dependency 'locomotive_jammit-s3'

View File

@ -1,10 +1,20 @@
require 'rubygems' require 'rubygems'
gemfile = File.expand_path('../../../../Gemfile', __FILE__) gemfile = File.expand_path('../../../../Gemfile', __FILE__)
# Need to explicitly use syck for yaml. This fixes a problem with the current
# delayed job parsing of YAML
#
# FIXME: I don't expect end users to have to modify their config/boot.rb for an
# app using the locomotiveCMS gem. Perhaps we can remove this when a newer
# delayed job version is released?
#
require 'yaml'
YAML::ENGINE.yamler = 'syck'
if File.exist?(gemfile) if File.exist?(gemfile)
ENV['BUNDLE_GEMFILE'] = gemfile ENV['BUNDLE_GEMFILE'] = gemfile
require 'bundler' require 'bundler'
Bundler.setup Bundler.setup
end end
$:.unshift File.expand_path('../../../../lib', __FILE__) $:.unshift File.expand_path('../../../../lib', __FILE__)

View File

@ -1,7 +1,6 @@
require 'spec_helper' require 'spec_helper'
describe Locomotive::Liquid::Filters::Resize do describe Locomotive::Liquid::Filters::Resize do
before :each do before :each do
@site = FactoryGirl.create(:site) @site = FactoryGirl.create(:site)
@theme_asset = FactoryGirl.create(:theme_asset, :source => FixturedAsset.open('5k.png'), :site => @site) @theme_asset = FactoryGirl.create(:theme_asset, :source => FixturedAsset.open('5k.png'), :site => @site)
@ -10,13 +9,10 @@ describe Locomotive::Liquid::Filters::Resize do
@asset_url = @asset.source.url @asset_url = @asset.source.url
@asset_path = "/sites/#{@asset.site_id}/assets/#{@asset.id}/5k.png" @asset_path = "/sites/#{@asset.site_id}/assets/#{@asset.id}/5k.png"
@context = Liquid::Context.new( { }, { 'asset_url' => @asset_url, 'theme_asset' => @theme_asset.to_liquid }, { :site => @site }) @context = Liquid::Context.new( { }, { 'asset_url' => @asset_url, 'theme_asset' => @theme_asset.to_liquid }, { :site => @site })
@app = Locomotive::Dragonfly.app
end end
describe '#resize' do describe '#resize' do
context 'when an asset url string is given' do context 'when an asset url string is given' do
before :each do before :each do
@template = Liquid::Template.parse('{{ asset_url | resize: "40x30" }}') @template = Liquid::Template.parse('{{ asset_url | resize: "40x30" }}')
end end
@ -26,13 +22,11 @@ describe Locomotive::Liquid::Filters::Resize do
end end
it 'should use the path in the public folder to generate a location' do it 'should use the path in the public folder to generate a location' do
@template.render(@context).should == @app.fetch_file("public#{@asset_path}").thumb('40x30').url @template.render(@context).should == Locomotive::Dragonfly.resize_url(@asset_path, '40x30')
end end
end end
context 'when a theme asset is given' do context 'when a theme asset is given' do
before :each do before :each do
@template = Liquid::Template.parse("{{ theme_asset | resize: '300x400' }}") @template = Liquid::Template.parse("{{ theme_asset | resize: '300x400' }}")
end end
@ -42,13 +36,11 @@ describe Locomotive::Liquid::Filters::Resize do
end end
it 'should use the path of the theme asset to generate a location' do it 'should use the path of the theme asset to generate a location' do
@template.render(@context).should == @app.fetch_file("public#{@theme_asset_path}").thumb('300x400').url @template.render(@context).should == Locomotive::Dragonfly.resize_url(@theme_asset_path, '300x400')
end end
end end
context 'when no resize string is given' do context 'when no resize string is given' do
before :each do before :each do
@template = Liquid::Template.parse('{{ asset | resize: }}') @template = Liquid::Template.parse('{{ asset | resize: }}')
end end
@ -56,9 +48,6 @@ describe Locomotive::Liquid::Filters::Resize do
it 'should return a liquid error' do it 'should return a liquid error' do
@template.render(@context).should include 'Liquid error: wrong number of arguments' @template.render(@context).should include 'Liquid error: wrong number of arguments'
end end
end end
end end
end
end