Skip to content

Commit

Permalink
Merge pull request #517 from nanoc/remove-1.8.x-support
Browse files Browse the repository at this point in the history
Remove support for Ruby 1.8.x
  • Loading branch information
denisdefreyne committed Jan 4, 2015
2 parents d5ad239 + 6867626 commit bfd9fa4
Show file tree
Hide file tree
Showing 138 changed files with 704 additions and 1,151 deletions.
19 changes: 0 additions & 19 deletions .rubocop.yml
Expand Up @@ -21,12 +21,6 @@ ClassAndModuleChildren:

# ----- DISABLED (hard) -----

# Ruby 1.8 compatibility is required.
#
# Re-enable in nanoc 4.x.
HashSyntax:
Enabled: false

# Hash parameters should not have braces, but this cop is unable to distinguish
# between has parameters and methods that take a hash as a param.
BracesAroundHashParameters:
Expand All @@ -36,25 +30,12 @@ BracesAroundHashParameters:
Eval:
Enabled: false

# The new Ruby 1.9 lambda literal syntax cannot be used, because Ruby 1.8
# compatibility is required.
#
# Re-enable in nanoc 4.x.
Lambda:
Enabled: false

# Only used for deprecated code that is gone in nanoc 4.x anyway.
#
# Re-enable in nanoc 4.x.
ClassVars:
Enabled: false

# This is only possible in Ruby 1.9.x and up.
#
# Re-enable in nanoc 4.x.
SymbolProc:
Enabled: false

# We use filenames such as “create-site.rb” that translate to method names.
FileName:
Enabled: false
Expand Down
2 changes: 0 additions & 2 deletions .travis.yml
Expand Up @@ -3,7 +3,6 @@ rvm:
- 2.1.1
- 2.0.0
- 1.9.3
- 1.8.7
- rbx-2.2.6
before_install: gem install bundler
matrix:
Expand All @@ -16,7 +15,6 @@ matrix:
- rvm: jruby-1.7.11
env: ""
- rvm: rbx-2.2.6
- rvm: 1.8.7
notifications:
irc:
channels:
Expand Down
27 changes: 12 additions & 15 deletions Gemfile
Expand Up @@ -3,43 +3,40 @@ source 'https://rubygems.org'
gemspec

# FIXME: we may be missing some mswin dependencies here
all_rubies = Bundler::Dependency::PLATFORM_MAP.keys
ruby_19_plus = [:ruby_19, :ruby_20, :ruby_21, :ruby_22, :jruby] & all_rubies
ruby_19_plus_without_jruby = [:ruby_19, :ruby_20, :ruby_21, :ruby_22] & all_rubies

gem 'adsf'
gem 'bluecloth', :platforms => :ruby
gem 'bluecloth', platforms: :ruby
gem 'builder'
gem 'coderay'
gem 'compass'
gem 'coffee-script'
gem 'coveralls', :require => false
gem 'coveralls', require: false
gem 'erubis'
gem 'fog', :platforms => ruby_19_plus
gem 'fog'
gem 'haml'
gem 'handlebars', :platforms => ruby_19_plus_without_jruby
gem 'handlebars', platforms: :ruby
gem 'kramdown'
gem 'less', '~> 2.0', :platforms => :ruby
gem 'listen', :platforms => ruby_19_plus
gem 'less', '~> 2.0', platforms: :ruby
gem 'listen'
gem 'markaby'
gem 'maruku'
gem 'mime-types', :platforms => ruby_19_plus
gem 'mime-types'
gem 'minitest', '~> 4.0'
gem 'mocha'
gem 'mustache'
gem 'nokogiri', '~> 1.6'
gem 'pandoc-ruby'
gem 'pry'
gem 'pygments.rb', :platforms => [:ruby, :mswin]
gem 'pygments.rb', platforms: [:ruby, :mswin]
gem 'rack'
gem 'rake'
gem 'rainpress'
gem 'rdiscount', :platforms => [:ruby, :mswin]
gem 'rdiscount', platforms: [:ruby, :mswin]
gem 'rdoc'
gem 'redcarpet', :platforms => ruby_19_plus_without_jruby + [:mswin]
gem 'redcarpet', platforms: [:ruby, :mswin]
gem 'RedCloth'
gem 'rouge'
gem 'rubocop', :platforms => ruby_19_plus
gem 'rubocop'
gem 'rubypants'
gem 'sass', '~> 3.2.2'
gem 'slim'
Expand All @@ -48,5 +45,5 @@ gem 'uglifier'
gem 'vcr'
gem 'w3c_validators'
gem 'webmock'
gem 'yuicompressor', :platforms => ruby_19_plus
gem 'yuicompressor'
gem 'yard'
2 changes: 1 addition & 1 deletion Rakefile
Expand Up @@ -11,4 +11,4 @@ require 'nanoc'
Dir.glob('tasks/**/*.rake').each { |r| Rake.application.add_import r }

# Set default task
task :default => :test
task default: :test
1 change: 0 additions & 1 deletion lib/nanoc/base.rb
Expand Up @@ -2,7 +2,6 @@

module Nanoc
require 'nanoc/base/core_ext'
require 'nanoc/base/ordered_hash'

# Load helper classes
autoload 'Context', 'nanoc/base/context'
Expand Down
54 changes: 27 additions & 27 deletions lib/nanoc/base/compilation/compiler.rb
Expand Up @@ -123,7 +123,7 @@ def load
route_reps

# Load auxiliary stores
stores.each { |s| s.load }
stores.each(&:load)

@loaded = true
rescue => e
Expand All @@ -142,7 +142,7 @@ def unload
return if @unloading
@unloading = true

stores.each { |s| s.unload }
stores.each(&:unload)

@stack = []

Expand Down Expand Up @@ -173,7 +173,7 @@ def store
end

# Store
stores.each { |s| s.store }
stores.each(&:store)
end

# Returns the dependency tracker for this site, creating it first if it
Expand Down Expand Up @@ -218,7 +218,7 @@ def build_reps
raise Nanoc::Errors::NoMatchingCompilationRuleFound.new(item) if matching_rules.empty?

# Create reps
rep_names = matching_rules.map { |r| r.rep_name }.uniq
rep_names = matching_rules.map(&:rep_name).uniq
rep_names.each do |rep_name|
item.reps << ItemRep.new(item, rep_name)
end
Expand All @@ -236,7 +236,7 @@ def route_reps

rules.each_pair do |snapshot, rule|
# Get basic path by applying matching rule
basic_path = rule.apply_to(rep, :compiler => self)
basic_path = rule.apply_to(rep, compiler: self)
next if basic_path.nil?
if basic_path !~ %r{^/}
raise "The path returned for the #{rep.inspect} item representation, “#{basic_path}”, does not start with a slash. Please ensure that all routing rules return a path that starts with a slash."
Expand Down Expand Up @@ -268,28 +268,28 @@ def route_reps
# @api private
def assigns_for(rep)
if rep.binary?
content_or_filename_assigns = { :filename => rep.temporary_filenames[:last] }
content_or_filename_assigns = { filename: rep.temporary_filenames[:last] }
else
content_or_filename_assigns = { :content => rep.content[:last] }
content_or_filename_assigns = { content: rep.content[:last] }
end

content_or_filename_assigns.merge({
:item => rep.item,
:rep => rep,
:item_rep => rep,
:items => site.items,
:layouts => site.layouts,
:config => site.config,
:site => site
item: rep.item,
rep: rep,
item_rep: rep,
items: site.items,
layouts: site.layouts,
config: site.config,
site: site
})
end

# @return [Nanoc::OutdatednessChecker] The outdatedness checker
def outdatedness_checker
Nanoc::OutdatednessChecker.new(
:site => @site,
:checksum_store => checksum_store,
:dependency_tracker => dependency_tracker)
site: @site,
checksum_store: checksum_store,
dependency_tracker: dependency_tracker)
end
memoize :outdatedness_checker

Expand All @@ -303,7 +303,7 @@ def items

# @return [Array<Nanoc::ItemRep>] The site’s item representations
def reps
items.map { |i| i.reps }.flatten
items.map(&:reps).flatten
end
memoize :reps

Expand Down Expand Up @@ -381,8 +381,8 @@ def compile_rep(rep)
else
# Recalculate content
rep.snapshot(:raw)
rep.snapshot(:pre, :final => false)
rules_collection.compilation_rule_for(rep).apply_to(rep, :compiler => self)
rep.snapshot(:pre, final: false)
rules_collection.compilation_rule_for(rep).apply_to(rep, compiler: self)
rep.snapshot(:post) if rep.has_snapshot?(:post)
rep.snapshot(:last)
end
Expand Down Expand Up @@ -417,10 +417,10 @@ def forget_dependencies_if_outdated(items)
# Returns a preprocessor context, creating one if none exists yet.
def preprocessor_context
Nanoc::Context.new({
:site => @site,
:config => @site.config,
:items => @site.items,
:layouts => @site.layouts
site: @site,
config: @site.config,
items: @site.items,
layouts: @site.layouts
})
end
memoize :preprocessor_context
Expand All @@ -433,19 +433,19 @@ def compiled_content_cache

# @return [ChecksumStore] The checksum store
def checksum_store
Nanoc::ChecksumStore.new(:site => @site)
Nanoc::ChecksumStore.new(site: @site)
end
memoize :checksum_store

# @return [RuleMemoryStore] The rule memory store
def rule_memory_store
Nanoc::RuleMemoryStore.new(:site => @site)
Nanoc::RuleMemoryStore.new(site: @site)
end
memoize :rule_memory_store

# @return [RuleMemoryCalculator] The rule memory calculator
def rule_memory_calculator
Nanoc::RuleMemoryCalculator.new(:rules_collection => rules_collection)
Nanoc::RuleMemoryCalculator.new(rules_collection: rules_collection)
end
memoize :rule_memory_calculator

Expand Down
6 changes: 3 additions & 3 deletions lib/nanoc/base/compilation/compiler_dsl.rb
Expand Up @@ -120,7 +120,7 @@ def route(identifier, params = {}, &block)
snapshot_name = params[:snapshot] || :last

# Create rule
rule = Rule.new(identifier_to_regex(identifier), rep_name, block, :snapshot_name => snapshot_name)
rule = Rule.new(identifier_to_regex(identifier), rep_name, block, snapshot_name: snapshot_name)
@rules_collection.add_item_routing_rule(rule)
end

Expand Down Expand Up @@ -197,7 +197,7 @@ def passthrough(identifier, params = {})
# data source.
item[:extension].nil? || (item[:content_filename].nil? && item.identifier =~ %r{#{item[:extension]}/$}) ? item.identifier.chop : item.identifier.chop + '.' + item[:extension]
end
routing_rule = Rule.new(identifier_to_regex(identifier), rep_name, routing_block, :snapshot_name => :last)
routing_rule = Rule.new(identifier_to_regex(identifier), rep_name, routing_block, snapshot_name: :last)
@rules_collection.add_item_routing_rule(routing_rule)
end

Expand Down Expand Up @@ -228,7 +228,7 @@ def ignore(identifier, params = {})
compilation_rule = Rule.new(identifier_to_regex(identifier), rep_name, proc {})
@rules_collection.add_item_compilation_rule(compilation_rule)

routing_rule = Rule.new(identifier_to_regex(identifier), rep_name, proc {}, :snapshot_name => :last)
routing_rule = Rule.new(identifier_to_regex(identifier), rep_name, proc {}, snapshot_name: :last)
@rules_collection.add_item_routing_rule(routing_rule)
end

Expand Down
4 changes: 2 additions & 2 deletions lib/nanoc/base/compilation/dependency_tracker.rb
Expand Up @@ -174,8 +174,8 @@ def unload

def data
{
:edges => @graph.edges,
:vertices => @graph.vertices.map { |obj| obj && obj.reference }
edges: @graph.edges,
vertices: @graph.vertices.map { |obj| obj && obj.reference }
}
end

Expand Down
2 changes: 1 addition & 1 deletion lib/nanoc/base/compilation/rule.rb
Expand Up @@ -65,7 +65,7 @@ def apply_to(rep, params = {})
raise ArgumentError, 'Required :compiler option is missing'
end
rep = Nanoc::ItemRepProxy.new(rep, compiler) unless rep.proxy?
Nanoc::RuleContext.new(:rep => rep, :compiler => compiler).instance_eval(&@block)
Nanoc::RuleContext.new(rep: rep, compiler: compiler).instance_eval(&@block)
end
end
end
14 changes: 7 additions & 7 deletions lib/nanoc/base/compilation/rule_context.rb
Expand Up @@ -33,13 +33,13 @@ def initialize(params = {})
end

super({
:rep => rep,
:item_rep => rep,
:item => rep.item,
:site => compiler.site,
:config => compiler.site.config,
:items => compiler.site.items,
:layouts => compiler.site.layouts
rep: rep,
item_rep: rep,
item: rep.item,
site: compiler.site,
config: compiler.site.config,
items: compiler.site.items,
layouts: compiler.site.layouts
})
end

Expand Down
10 changes: 5 additions & 5 deletions lib/nanoc/base/compilation/rules_collection.rb
Expand Up @@ -39,8 +39,8 @@ def initialize(compiler)

@item_compilation_rules = []
@item_routing_rules = []
@layout_filter_mapping = OrderedHash.new
@preprocessors = OrderedHash.new
@layout_filter_mapping = {}
@preprocessors = {}
end

# Add the given rule to the list of item compilation rules.
Expand Down Expand Up @@ -99,8 +99,8 @@ def parse(rules_filename)
def unload
@item_compilation_rules = []
@item_routing_rules = []
@layout_filter_mapping = OrderedHash.new
@preprocessors = OrderedHash.new
@layout_filter_mapping = {}
@preprocessors = {}
end

# Finds the first matching compilation rule for the given item
Expand Down Expand Up @@ -190,7 +190,7 @@ def inspect
# @return [Array] The rule memory for the given item representation
def new_rule_memory_for_rep(rep)
recording_proxy = rep.to_recording_proxy
compilation_rule_for(rep).apply_to(recording_proxy, :compiler => @compiler)
compilation_rule_for(rep).apply_to(recording_proxy, compiler: @compiler)
recording_proxy.rule_memory << [:write, rep.path]
make_rule_memory_serializable(recording_proxy.rule_memory)
end
Expand Down
1 change: 0 additions & 1 deletion lib/nanoc/base/core_ext.rb
@@ -1,7 +1,6 @@
# encoding: utf-8

require 'nanoc/base/core_ext/array'
require 'nanoc/base/core_ext/date'
require 'nanoc/base/core_ext/hash'
require 'nanoc/base/core_ext/pathname'
require 'nanoc/base/core_ext/string'

0 comments on commit bfd9fa4

Please sign in to comment.