Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
b132f51
enable development on platforms other than macOS
glaszig Mar 17, 2017
49061f5
gitignore gemfiles/*.lock
glaszig Mar 17, 2017
49e63e5
rails 3.2 needs test-unit explicitly because it was removed from
glaszig Mar 17, 2017
efa5ce7
updated appraisal gemfiles
glaszig Mar 17, 2017
d28f172
updated schema dump
glaszig Mar 17, 2017
36b5b40
setup code climate according to docs
glaszig Mar 17, 2017
fc129a3
suppress stdout of `system` during tests
glaszig Mar 17, 2017
a234fc9
make config class compatible with rails < 4
glaszig Mar 17, 2017
cdf25dd
upgraded rspec-rails since newer rake versions changed.
glaszig Mar 17, 2017
7c099c4
allow acts-as-taggable-on version to be resolved
glaszig Mar 17, 2017
1bb4d58
added rails 5.1.0.beta1 appraisal
glaszig Mar 18, 2017
86d308b
adjusted dummy app for rails 5.1
glaszig Mar 18, 2017
966e78e
rails 5.1 controller tests need keyword arguments
glaszig Mar 18, 2017
a1d6cad
rails 5.1 controller tests are now integration tests which is why
glaszig Mar 18, 2017
c24b487
travis: test on current ruby; 2.2.0 won't work with newer rails anyway
glaszig Mar 18, 2017
7a99299
rake spec somehow does not work but rspec does.
glaszig Mar 18, 2017
8de8204
travis: added rails 5.1.0.beta1 gemfile
glaszig Mar 18, 2017
b60fae4
rails 5.1 needs versioned migrations
glaszig Mar 18, 2017
0f6f072
upgraded to rails 5.1.0.rc1
glaszig Mar 29, 2017
df3d495
made AR migrations compatible with rails <5
glaszig Mar 29, 2017
49ca89b
made controller tests compatible with rails < 5
glaszig Mar 29, 2017
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: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,5 @@ spec/dummy/db/migrate/*blogit*
spec/dummy/db/migrate/*acts_as_taggable_on_engine*
spec/dummy/db/schema.rb
spec/dummy/*.sqlite3

gemfiles/*.lock
coverage/
8 changes: 6 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
language: ruby

rvm:
- 2.2.0
- 2.4.0

addons:
code_climate:
Expand All @@ -13,6 +13,7 @@ env:
- DB=postgresql

gemfile:
- gemfiles/rails_5.1.gemfile
- gemfiles/rails_4.2.gemfile
- gemfiles/rails_4.1.gemfile
- gemfiles/rails_4.0.gemfile
Expand All @@ -33,4 +34,7 @@ before_script:
script:
- bundle exec rake db:create RAILS_ENV=test
- bundle exec rake db:migrate RAILS_ENV=test
- bundle exec rake spec
- bundle exec rspec

after_success:
- bundle exec codeclimate-test-reporter
7 changes: 7 additions & 0 deletions Appraisals
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@
# gem "sass-rails", "~> 5.0.0"
# end

appraise "rails-5.1" do
gem "rails", "~> 5.1.0.rc1"
gem "sass-rails", github: "rails/sass-rails"
gem "rails-controller-testing"
end

appraise "rails-4.2" do
gem "rails", "~> 4.2.0"
gem "sass-rails", "~> 5.0.0"
Expand All @@ -23,4 +29,5 @@ appraise "rails-3.2" do
gem "rails", "~> 3.2.0"
gem 'strong_parameters'
gem "sass-rails", "~> 3.2.0"
gem 'test-unit', '~> 3.0'
end
11 changes: 10 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,17 @@ if rails_version[0] == '3'
end

gem 'rake'
case RUBY_PLATFORM
when /darwin/
gem 'rb-fsevent', '~> 0.9.1'
gem 'growl'
when /linux/
gem 'rb-inotify'
end

# Removing this seems to break the Travis-CI flow.
# The rake task "app:acts_as_taggable_on_engine:install:migrations" doesn't work
# without it here
gem 'acts-as-taggable-on', "~> 3.5.0"
gem 'acts-as-taggable-on'
gem 'simplecov'
gem 'codeclimate-test-reporter', '~> 1.0.0'
8 changes: 2 additions & 6 deletions blogit.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@ Gem::Specification.new do |s|
s.add_dependency "albino", ">=1.3.3"
s.add_dependency "kaminari"
s.add_dependency "jquery-rails"
s.add_dependency "acts-as-taggable-on", "~> 3.5.0"

s.add_dependency "acts-as-taggable-on"

s.add_development_dependency "appraisal"
s.add_development_dependency 'thor'
Expand All @@ -40,17 +39,14 @@ Gem::Specification.new do |s|
s.add_development_dependency "pg"

# Testing
s.add_development_dependency "codeclimate-test-reporter"
s.add_development_dependency "spring", ">=1.3.6"
s.add_development_dependency 'spring-commands-rspec'
s.add_development_dependency "wwtd"

s.add_development_dependency "autoprefixer-rails"
s.add_development_dependency "rspec-rails", '~> 3.3.0'
s.add_development_dependency "rspec-rails"
s.add_development_dependency "rspec-collection_matchers"
s.add_development_dependency "rb-fsevent", "~> 0.9.1" # OS X
s.add_development_dependency "guard-rspec"
s.add_development_dependency "growl"
s.add_development_dependency "factory_girl"
s.add_development_dependency "mocha"
s.add_development_dependency "sass"
Expand Down
2 changes: 1 addition & 1 deletion db/migrate/20110814091434_create_blogit_posts.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class CreateBlogitPosts < ActiveRecord::Migration
class CreateBlogitPosts < ActiveRecord::Migration[4.2]
def change
create_table :blogit_posts do |t|
t.with_options(null: false) do |r|
Expand Down
2 changes: 1 addition & 1 deletion db/migrate/20110814093229_create_blogit_comments.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class CreateBlogitComments < ActiveRecord::Migration
class CreateBlogitComments < ActiveRecord::Migration[4.2]
def change
create_table :blogit_comments do |t|
t.string :name, null: false
Expand Down
2 changes: 1 addition & 1 deletion db/migrate/20150618184415_add_description_to_posts.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class AddDescriptionToPosts < ActiveRecord::Migration
class AddDescriptionToPosts < ActiveRecord::Migration[4.2]
def change
add_column :blogit_posts, :description, :text
end
Expand Down
7 changes: 6 additions & 1 deletion gemfiles/rails_3.2.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,14 @@

source "http://rubygems.org"

gem "rake"
gem "rails", "~> 3.2.0"
gem "rake"
gem "rb-inotify"
gem "acts-as-taggable-on"
gem "simplecov"
gem "codeclimate-test-reporter", "~> 1.0.0"
gem "strong_parameters"
gem "sass-rails", "~> 3.2.0"
gem "test-unit", "~> 3.0"

gemspec :path => "../"
6 changes: 5 additions & 1 deletion gemfiles/rails_4.0.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,12 @@

source "http://rubygems.org"

gem "rake"
gem "rails", "~> 4.0.0"
gem "rake"
gem "rb-inotify"
gem "acts-as-taggable-on"
gem "simplecov"
gem "codeclimate-test-reporter", "~> 1.0.0"
gem "sass-rails", "~> 5.0.0"

gemspec :path => "../"
6 changes: 5 additions & 1 deletion gemfiles/rails_4.1.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,12 @@

source "http://rubygems.org"

gem "rake"
gem "rails", "~> 4.1.0"
gem "rake"
gem "rb-inotify"
gem "acts-as-taggable-on"
gem "simplecov"
gem "codeclimate-test-reporter", "~> 1.0.0"
gem "sass-rails", "~> 5.0.0"

gemspec :path => "../"
6 changes: 5 additions & 1 deletion gemfiles/rails_4.2.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,12 @@

source "http://rubygems.org"

gem "rake"
gem "rails", "~> 4.2.0"
gem "rake"
gem "rb-inotify"
gem "acts-as-taggable-on"
gem "simplecov"
gem "codeclimate-test-reporter", "~> 1.0.0"
gem "sass-rails", "~> 5.0.0"

gemspec :path => "../"
14 changes: 14 additions & 0 deletions gemfiles/rails_5.1.gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# This file was generated by Appraisal

source "http://rubygems.org"

gem "rake"
gem "rb-inotify"
gem "acts-as-taggable-on"
gem "simplecov"
gem "codeclimate-test-reporter", "~> 1.0.0"
gem "rails", "~> 5.1.0.rc1"
gem "sass-rails", :github => "rails/sass-rails"
gem "rails-controller-testing"

gemspec :path => "../"
9 changes: 9 additions & 0 deletions lib/blogit/compatibility.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module Blogit
module Compatibility
module Migration
def [] *args
self
end
end
end
end
42 changes: 28 additions & 14 deletions lib/blogit/configuration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ class Configuration
# How do you want to handle comments for your blog?
# Valid options are :active_record, :disquss, or :no for none.
# (default: :active_record)
config_accessor(:include_comments) { :active_record }
config_accessor(:include_comments)
config.include_comments = :active_record

##
# When using :disqus comments, what is the shortname of your forum?
Expand All @@ -40,7 +41,8 @@ class Configuration

##
# Load a javascript-based share bar on each blog post?. (default: true)
config_accessor(:include_share_bar) { true }
config_accessor(:include_share_bar)
config.include_share_bar = true

##
# Twitter username used in the share bar. (default: nil)
Expand All @@ -49,64 +51,75 @@ class Configuration
##
# The name of the controller method we'll call to return the current blogger.
# (default: :current_user)
config_accessor(:current_blogger_method) { :current_user }
config_accessor(:current_blogger_method)
config.current_blogger_method = :current_user

##
# What method do we call on blogger to return their display name? (default: :username)
config_accessor(:blogger_display_name_method) { :username }
config_accessor(:blogger_display_name_method)
config.blogger_display_name_method = :username

##
# Which DateTime::FORMATS format do we use to display blog and comment publish time
# (default: :short)
config_accessor(:datetime_format) { :short }
config_accessor(:datetime_format)
config.datetime_format = :short

##
# Number of {Blogit::Post posts} to show per page. This is a configuration for {https://github.com/amatsuda/kaminari Kaminari} (default: 5)
#
# Returns an Integer
config_accessor(:posts_per_page) { 5 }
config_accessor(:posts_per_page)
config.posts_per_page = 5

##
# If set to true, the comments form will POST and DELETE to the comments
# controller using AJAX calls.
#
# Returns true or false
config_accessor(:ajax_comments) { true }
config_accessor(:ajax_comments)
config.ajax_comments = true

##
# The default format for parsing the blog content.
#
# Defaults to :markdown
config_accessor(:default_parser) { :markdown }
config_accessor(:default_parser)
config.default_parser = :markdown

##
# Should text within "```" or "`" be highlighted as code?
# Defaults to true
# @note - At the moment this only works when default_parser is :markdown
config_accessor(:highlight_code_syntax) { true }
config_accessor(:highlight_code_syntax)
config.highlight_code_syntax = true

##
# The renderer used for code highlighting
# Defaults to :albino
config_accessor(:syntax_highlighter) { :albino }
config_accessor(:syntax_highlighter)
config.syntax_highlighter = :albino

##
# When using redcarpet as content parser, pass these options as defaults
#
# Defaults to {REDCARPET_OPTIONS}
config_accessor(:redcarpet_options) { REDCARPET_OPTIONS }
config_accessor(:redcarpet_options)
config.redcarpet_options = REDCARPET_OPTIONS

##
# List of states that will be visible to the public
#
# Defaults to ACTIVE_STATES
config_accessor(:active_states) { ACTIVE_STATES }
config_accessor(:active_states)
config.active_states = ACTIVE_STATES

##
# List of states that will hide the posts from the public.
#
# Defaults to HIDDEN_STATES
config_accessor(:hidden_states) { HIDDEN_STATES }
config_accessor(:hidden_states)
config.hidden_states = HIDDEN_STATES

##
# The title of the RSS feed for the blog posts
Expand All @@ -130,7 +143,8 @@ class Configuration
# and RSS feed.
#
# Defaults to true
config_accessor(:show_post_description) { true }
config_accessor(:show_post_description)
config.show_post_description = true


def default_parser_class
Expand Down
11 changes: 10 additions & 1 deletion lib/blogit/engine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,16 @@ class Engine < Rails::Engine
::ActiveRecord::Base.send(:include, Blogit::Blogs)
::ActiveRecord::Base.send(:include, Validators)
end


end

initializer 'blogit.active_record' do
ActiveSupport.on_load :active_record do
unless ActiveRecord::Migration.respond_to? :[]
require "blogit/compatibility"
ActiveRecord::Migration.extend Blogit::Compatibility::Migration
end
end
end
end
end
4 changes: 2 additions & 2 deletions spec/controllers/blogit/comments_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@


def do_post(format = :html)
post :create, post_id: blog_post.id,
comment: comment_attributes, format: format
post :create, params: { post_id: blog_post.id,
comment: comment_attributes, format: format }
end

subject { do_post(:js) }
Expand Down
6 changes: 3 additions & 3 deletions spec/controllers/blogit/posts_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
let(:posts) { [] }

def do_get(page=nil)
get :index, page: page
get :index, params: { page: page }
end

it 'sets posts to Blogit::Post.for_index' do
Expand Down Expand Up @@ -57,7 +57,7 @@ def do_get(page=nil)
let(:posts) { [] }

def do_get(page=nil)
get :index, page: page.to_s, format: :xml
get :index, params: { page: page.to_s, format: :xml }
end

it "loads all posts in reverse date order" do
Expand All @@ -76,7 +76,7 @@ def do_get(page=nil)
end

def do_get
get :show, :id => 1
get :show, params: { id: 1 }
end

it "finds blog post by id" do
Expand Down
3 changes: 3 additions & 0 deletions spec/dummy/app/assets/config/manifest.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
//= link_tree ../images
//= link_directory ../javascripts .js
//= link_directory ../stylesheets .css
1 change: 1 addition & 0 deletions spec/dummy/config/environments/development.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
# every request. This slows down response time but is perfect for development
# since you don't have to restart the web server when you make code changes.
config.cache_classes = false
config.eager_load = false

if Rails.version =~ /\A3/
# Log error messages when you accidentally call methods on nil.
Expand Down
1 change: 1 addition & 0 deletions spec/dummy/config/environments/test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
# your test database is "scratch space" for the test suite and is wiped
# and recreated between test runs. Don't rely on the data there!
config.cache_classes = true
config.eager_load = false

# Configure static asset server for tests with Cache-Control for performance
if Rails.version >= "4.2.0"
Expand Down
Loading