Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
27 changes: 18 additions & 9 deletions merb-core/lib/merb-core/config.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
require "optparse"

# fix issue with Templater and Ruby >= 2.5
# issue produced by extlib gem required by templater
# extlib add to_hash method to Array class
# Ruby >= 2.5 use it by unrecognized cause and destroy parameter when OptionParser.parse!() called
# so, solution is remove to_hash from Array because no code from Templater use this method
class Array
remove_method :to_hash
end

module Merb

class Config
Expand Down Expand Up @@ -56,7 +65,7 @@ def use
yield @configuration
nil
end

# Detects whether the provided key is in the config.
#
# ==== Parameters
Expand Down Expand Up @@ -156,10 +165,10 @@ def to_yaml
def setup(settings = {})
# Merge new settings with any existing configuration settings
settings = @configuration.merge(settings) unless @configuration.nil?

# Merge new settings with default settings
config = defaults.merge(settings)

unless config[:reload_classes]
config[:fork_for_class_load] = false
end
Expand All @@ -168,11 +177,11 @@ def setup(settings = {})
unless config.key?(:reap_workers_quickly)
config[:reap_workers_quickly] = dev_mode & !config[:cluster]
end

unless config.key?(:bind_fail_fatal)
config[:bind_fail_fatal] = dev_mode
end

# Set mutex to dispatcher
::Merb::Dispatcher.use_mutex = config[:use_mutex]

Expand All @@ -195,7 +204,7 @@ def parse_args(argv = ARGV)

# Environment variables always win
options[:environment] = ENV["MERB_ENV"] if ENV["MERB_ENV"]

# Build a parser for the command line arguments
opts = OptionParser.new do |opts|
opts.version = Merb::VERSION
Expand Down Expand Up @@ -225,13 +234,13 @@ def parse_args(argv = ARGV)
"background.") do |daemon|
options[:daemonize] = true
end

opts.on("-N", "--no-daemonize", "This will allow you to run a " \
"cluster in console mode") do |no_daemon|
options[:daemonize] = false
end

opts.on("-c", "--cluster-nodes NUM_MERBS", Integer,
opts.on("-c", "--cluster-nodes NUM_MERBS", Integer,
"Number of merb daemons to run.") do |nodes|
options[:daemonize] = true unless options.key?(:daemonize)
options[:cluster] = nodes
Expand Down Expand Up @@ -352,7 +361,7 @@ def parse_args(argv = ARGV)
port = "main" if port == "all"
options[:port] = port
end

opts.on("--fast-deploy", "Reload the code, but not your" \
"init.rb or gems") do
options[:action] = :fast_deploy
Expand Down
6 changes: 3 additions & 3 deletions merb-core/lib/merb-core/gem_ext/erubis.rb
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,9 @@ def convert_input(src, input)
rest = pos == 0 ? input : input[pos..-1] # ruby1.9
add_text(src, rest)
end

end

class MEruby < Erubis::Eruby
include PercentLineEnhancer
include StringBufferEnhancer
Expand All @@ -78,7 +78,7 @@ class MEruby < Erubis::Eruby
# binding.
#
# :api: private
def self.load_yaml_file(file, binding = binding)
def self.load_yaml_file(file, binding = binding())
YAML::load(Erubis::MEruby.new(IO.read(File.expand_path(file))).result(binding))
end
end
2 changes: 1 addition & 1 deletion merb-helpers/lib/merb-helpers/form/builder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,7 @@ def error_messages_for(obj, error_class, build_li, header, before)

header_message = header % [errors.size, errors.size == 1 ? "" : "s"]
markup = %Q{<div class='#{error_class}'>#{header_message}<ul>}
errors.each {|err| markup << (build_li % err.join(" "))}
errors.full_messages.each { |err| markup << (build_li % err) }
markup << %Q{</ul></div>}
end

Expand Down
Empty file modified merb-slices/bin/slice
100644 → 100755
Empty file.