Skip to content
This repository has been archived by the owner on Nov 19, 2019. It is now read-only.

Commit

Permalink
Rails 4 support
Browse files Browse the repository at this point in the history
  • Loading branch information
jasoncodes committed Feb 13, 2014
1 parent 3514bbf commit 19aa5ba
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 4 deletions.
4 changes: 4 additions & 0 deletions Appraisals
Expand Up @@ -5,3 +5,7 @@ end
appraise 'rails3_2' do
gem 'rails', '~> 3.2.0'
end

appraise 'rails4_0' do
gem 'rails', '~> 4.0.2'
end
2 changes: 1 addition & 1 deletion app/models/post.rb
Expand Up @@ -74,7 +74,7 @@ def date
delegate :year, :month, :day, :to => :date

def timestamp
date.to_time_in_current_zone
date.respond_to?(:in_time_zone) ? date.in_time_zone : date.to_time_in_current_zone
end
alias_method :last_modified, :timestamp

Expand Down
9 changes: 9 additions & 0 deletions gemfiles/rails4_0.gemfile
@@ -0,0 +1,9 @@
# This file was generated by Appraisal

source "http://rubygems.org"

gem "timecop", :require=>false
gem "generator_spec", :require=>false
gem "rails", "~> 4.0.2"

gemspec :path=>"../"
2 changes: 1 addition & 1 deletion lib/postmarkdown/routes.rb
Expand Up @@ -5,7 +5,7 @@ def postmarkdown(options = {})
options.reverse_merge!({ :as => :posts, :permalink_format => :day })

get "/#{options[:as]}(/:year(/:month(/:day)))" => 'posts#index', :as => :posts, :constraints => { :year => /\d{4}/, :month => /\d{2}/, :day => /\d{2}/}
get "/#{options[:as]}/feed" => 'posts#feed', :as => :posts_feed, :format => :xml
get "/#{options[:as]}/feed" => 'posts#feed', :as => :posts_feed, :defaults => {:format => :xml}
get "/#{options[:as]}/*id" => 'posts#show', :as => :post, :constraints => { :id => postmarkdown_permalink_regex(options) }

postmarkdown_feed_title(options[:as])
Expand Down
2 changes: 1 addition & 1 deletion postmarkdown.gemspec
Expand Up @@ -21,7 +21,7 @@ Gem::Specification.new do |s|
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
s.require_paths = ['lib', 'public']

s.add_dependency 'rails', '~> 3.1'
s.add_dependency 'rails', ['>= 3.1', '< 5.0']
s.add_dependency 'haml', ['>= 3.1', '< 5']
s.add_dependency 'gravtastic'
s.add_dependency 'nokogiri'
Expand Down
5 changes: 4 additions & 1 deletion spec/internal/config/environments/test.rb
@@ -1,8 +1,11 @@
Rails.application.class.configure do
config.cache_classes = true
config.whiny_nils = true
config.whiny_nils = true if Rails::VERSION::MAJOR < 4
config.secret_key_base = 'abc123' if Rails::VERSION::MAJOR >= 4
config.eager_load = false
config.consider_all_requests_local = true
config.action_controller.perform_caching = false
config.action_dispatch.show_exceptions = false
config.active_support.deprecation = :stderr
config.i18n.enforce_available_locales = true if I18n.respond_to? :enforce_available_locales
end

0 comments on commit 19aa5ba

Please sign in to comment.