Clean up whitespace, play with cane for testing style quality and code complexity

This commit is contained in:
Thomas Reynolds 2012-08-13 15:39:06 -07:00
parent 955c66a54f
commit 446aa6a4ba
133 changed files with 895 additions and 871 deletions

View file

@ -17,6 +17,7 @@ group :test do
gem "slim" gem "slim"
gem "coffee-filter", "~> 0.1.1" gem "coffee-filter", "~> 0.1.1"
gem "liquid", "~> 2.2" gem "liquid", "~> 2.2"
gem "cane"
platforms :ruby do platforms :ruby do
gem "therubyracer" gem "therubyracer"

View file

@ -87,5 +87,12 @@ task :test do
end end
end end
desc "Rune cane for all middleman gems"
task :cane do
GEM_PATHS.each do |g|
sh "cd #{File.join(ROOT, g)} && #{Gem.ruby} -S cane"
end
end
desc "Run tests for all middleman gems" desc "Run tests for all middleman gems"
task :default => :test task :default => :test

2
middleman-core/.cane Normal file
View file

@ -0,0 +1,2 @@
--exclusions-file .cane-exclusions.yml
--no-doc

View file

@ -0,0 +1,5 @@
style:
- lib/middleman-core/vendor/hooks-0.2.0/lib/hooks/inheritable_attribute.rb
- lib/middleman-core/vendor/hooks-0.2.0/test/hooks_test.rb
- lib/middleman-core/vendor/hooks-0.2.0/test/inheritable_attribute_test.rb
- lib/middleman-core/vendor/hooks-0.2.0/lib/hooks.rb

0
middleman-core/lib/middleman-core.rb Executable file → Normal file
View file

View file

View file

View file

View file

View file

2
middleman-more/.cane Normal file
View file

@ -0,0 +1,2 @@
--exclusions-file .cane-exclusions.yml
--no-doc

View file

@ -0,0 +1,3 @@
style:
- lib/middleman-more/extensions/minify_css/rainpress.rb
- lib/middleman-more/extensions/automatic_image_sizes/fastimage.rb

View file

@ -48,8 +48,8 @@ module Middleman
# Setup Optional Extensions # Setup Optional Extensions
### ###
# CacheBuster adds a query string to assets in dynamic templates to avoid # CacheBuster adds a query string to assets in dynamic templates to
# browser caches failing to update to your new content. # avoid browser caches failing to update to your new content.
Middleman::Extensions.register(:cache_buster) do Middleman::Extensions.register(:cache_buster) do
require "middleman-more/extensions/cache_buster" require "middleman-more/extensions/cache_buster"
Middleman::Extensions::CacheBuster Middleman::Extensions::CacheBuster

View file

@ -71,7 +71,7 @@ module Middleman
end end
# A Compass template for Tilt # A Compass Sass template for Tilt, adding our options in
class CompassSassTemplate < ::Middleman::Renderers::Sass::SassPlusCSSFilenameTemplate class CompassSassTemplate < ::Middleman::Renderers::Sass::SassPlusCSSFilenameTemplate
private private
def sass_options def sass_options
@ -79,6 +79,7 @@ module Middleman
end end
end end
# A Compass Scss template for Tilt, adding our options in
class CompassScssTemplate < ::Middleman::Renderers::Sass::ScssPlusCSSFilenameTemplate class CompassScssTemplate < ::Middleman::Renderers::Sass::ScssPlusCSSFilenameTemplate
private private
def sass_options def sass_options

View file

@ -22,6 +22,7 @@ module Middleman
alias :included :registered alias :included :registered
end end
# Central class for managing i18n extension
class Localizer class Localizer
attr_reader :app attr_reader :app
delegate :logger, :to => :app delegate :logger, :to => :app

View file

@ -20,6 +20,7 @@ module Middleman
alias :included :registered alias :included :registered
end end
# Central class for managing asset_hash extension
class AssetHashManager class AssetHashManager
def initialize(app, exts, ignore) def initialize(app, exts, ignore)
@app = app @app = app

View file

View file

View file

@ -21,6 +21,7 @@ module Middleman
alias :included :registered alias :included :registered
end end
# Central class for managing the directory indexes extension
class DirectoryIndexManager class DirectoryIndexManager
def initialize(app) def initialize(app)
@app = app @app = app

View file

View file

@ -35,8 +35,8 @@ module Middleman
if path.include?("//") if path.include?("//")
path path
else else
current_dir = Pathname('/' + current_resource.destination_path).dirname current_dir = Pathname('/' + current_resource.destination_path)
Pathname(path).relative_path_from(current_dir) Pathname(path).relative_path_from(current_dir.dirname)
end end
end end
end end