diff --git a/lib/nesta/commands/plugin/create.rb b/lib/nesta/commands/plugin/create.rb index 6d1bf9b8..f8238f9c 100644 --- a/lib/nesta/commands/plugin/create.rb +++ b/lib/nesta/commands/plugin/create.rb @@ -35,11 +35,11 @@ def nested_module_definition_with_version indent_levels << indent_level end - ''.tap do |code| - lines.each_with_index do |line, i| - code << ' ' * (indent_levels[i] + 2) + line - end + code = [] + lines.each_with_index do |line, i| + code << ' ' * (indent_levels[i] + 2) + line end + code.join("\n") end def make_directories diff --git a/lib/nesta/config_file.rb b/lib/nesta/config_file.rb index 99f06505..145ddb47 100644 --- a/lib/nesta/config_file.rb +++ b/lib/nesta/config_file.rb @@ -10,7 +10,7 @@ def set_value(key, value) configured = false File.open(self.class.path, 'r+') do |file| - output = '' + output = [] file.each_line do |line| if configured output << line @@ -21,7 +21,7 @@ def set_value(key, value) end output << "#{replacement}\n" unless configured file.pos = 0 - file.print(output) + file.print(output.join("\n")) file.truncate(file.pos) end end diff --git a/lib/nesta/helpers.rb b/lib/nesta/helpers.rb index c0511a54..4ee671b7 100644 --- a/lib/nesta/helpers.rb +++ b/lib/nesta/helpers.rb @@ -90,7 +90,7 @@ def articles_heading # path_to(page.abspath, uri: true) # def path_to(page_path, options = {}) - host = '' + host = [] if options[:uri] host << "http#{'s' if request.ssl?}://" if (request.env.include?("HTTP_X_FORWARDED_HOST") or @@ -100,7 +100,7 @@ def path_to(page_path, options = {}) host << request.host end end - uri_parts = [host] + uri_parts = [host.join('')] uri_parts << request.script_name.to_s if request.script_name uri_parts << page_path File.join(uri_parts) diff --git a/lib/nesta/models/menu.rb b/lib/nesta/models/menu.rb index 20a1994d..b554e77c 100644 --- a/lib/nesta/models/menu.rb +++ b/lib/nesta/models/menu.rb @@ -16,7 +16,7 @@ def self.top_level end def self.for_path(path) - path.sub!(Regexp.new('^/'), '') + path = path.sub(Regexp.new('^/'), '') if path.empty? full_menu else