refactoring the wagon.rb file: extract each action in its own class (command)

did committed Mar 31, 2015
commit d092252a91df1a1929201a91071f838ff30fbc8d
Showing 45 changed files with 526 additions and 3262 deletions
Gemfile +2 -2
@@ @@ -13,9 +13,9 @@ gem 'rb-fsevent', '~> 0.9.1'
gem 'therubyracer'
- gem 'locomotivecms_steam', github: 'locomotivecms/steam', ref: 'ed2af0a', require: false
+ gem 'locomotivecms_steam', github: 'locomotivecms/steam', ref: 'b2de77e', require: false
gem 'locomotivecms_coal', github: 'locomotivecms/coal', ref: '6ae10e3684', require: false
- gem 'locomotivecms_common', github: 'locomotivecms/common', ref: '4327a33', require: false
+ gem 'locomotivecms_common', github: 'locomotivecms/common', ref: '1895573', require: false
# gem 'locomotivecms_steam', path: '../in_progress/steam', require: false
# gem 'locomotivecms_common', path: '../in_progress/common', require: false
README.md +1 -5
@@ @@ -1,10 +1,6 @@
# LocomotiveCMS::Wagon
- [![Gem Version](https://badge.fury.io/rb/locomotivecms_wagon.svg)](http://badge.fury.io/rb/locomotivecms_wagon)
- [![Code Climate](https://codeclimate.com/github/locomotivecms/wagon.png)](https://codeclimate.com/github/locomotivecms/wagon)
- [![Dependency Status](https://gemnasium.com/locomotivecms/wagon.png)](https://gemnasium.com/locomotivecms/wagon)
- [![Build Status](https://travis-ci.org/locomotivecms/wagon.svg?branch=master)](https://travis-ci.org/locomotivecms/wagon)
- [![Coverage Status](https://coveralls.io/repos/locomotivecms/wagon/badge.png)](https://coveralls.io/r/locomotivecms/wagon)
+ [![Gem Version](https://badge.fury.io/rb/locomotivecms_wagon.svg)](http://badge.fury.io/rb/locomotivecms_wagon) [![Code Climate](https://codeclimate.com/github/locomotivecms/wagon.png)](https://codeclimate.com/github/locomotivecms/wagon) [![Dependency Status](https://gemnasium.com/locomotivecms/wagon.png)](https://gemnasium.com/locomotivecms/wagon) [![Build Status](https://travis-ci.org/locomotivecms/wagon.svg?branch=master)](https://travis-ci.org/locomotivecms/wagon) [![Coverage Status](https://coveralls.io/repos/locomotivecms/wagon/badge.png)](https://coveralls.io/r/locomotivecms/wagon)
Wagon is the official site generator for the LocomotiveCMS engine powered by all the efficient and modern HTML development tools (Haml, SASS, Compass, Less).
locomotive/wagon.rb b/lib/locomotive/wagon.rb +9 -120
@@ @@ -68,27 +68,18 @@ module Locomotive
# @param [ Hash ] options The options for the thin server (host, port)
#
def self.serve(path, options)
- self.require_steam(path)
-
- server = self.build_server(options)
- use_listen = !options[:disable_listen]
-
- self.stop(path, true) if options[:force]
-
- use_listen = self.daemonize(path, server, use_listen) if options[:daemonize]
-
- self.listen(path) if use_listen
-
- server.start
+ require_relative 'wagon/commands/serve_command'
+ Locomotive::Wagon::ServeCommand.start(path, options)
end
+ # Stop the thin server.
+ #
+ # @param [ String ] path The path of the site
+ # @param [ Hash ] force If true, block the current thread for 2s
+ #
def self.stop(path, force = false)
- pid_file = File.join(File.expand_path(path), 'log', 'server.pid')
- pid = File.read(pid_file).to_i
- Process.kill('TERM', pid)
-
- # make sure we wait enough for the server process to stop
- sleep(2) if force
+ require_relative 'wagon/commands/serve_command'
+ Locomotive::Wagon::ServeCommand.stop(path, force)
end
# Generate components for the LocomotiveCMS site such as content types, snippets, pages.
@@ @@ -195,110 +186,8 @@ module Locomotive
Locomotive::Mounter::EngineApi.delete('/current_site.json')
end
- def self.require_steam(path, require_misc = true)
- require 'locomotive/steam'
-
- configure_logger(path)
-
- Locomotive::Steam.configure do |config|
- config.mode = :test
- config.adapter = { name: :filesystem, path: path }
- config.asset_path = File.expand_path(File.join(path, 'public'))
- end
-
- if require_misc
- require 'bundler'
- Bundler.require 'misc'
- end
- end
-
- # # Load the Locomotive::Mounter lib and set it up (logger, ...etc).
- # # If the second parameter is set to true, then the method builds
- # # an instance of the reader from the path passed in first parameter.
- # #
- # # @param [ String ] path The path to the local site
- # # @param [ Boolean ] get_reader Tell if it builds an instance of the reader.
- # # @param [ Boolean ] require_misc Tell if it requires the gems inside the misc bundler group
- # #
- # # @param [ Object ] An instance of the reader is the get_reader parameter has been set.
- # #
- # def self.require_mounter(path, get_reader = false, require_misc = true)
- # Locomotive::Wagon::Logger.setup(path, false)
-
- # require 'locomotive/mounter'
-
- # Locomotive::Mounter.logger = Locomotive::Wagon::Logger.instance.logger
-
- # if require_misc
- # require 'bundler'
- # Bundler.require 'misc'
- # end
-
- # if get_reader
- # begin
- # reader = Locomotive::Mounter::Reader::FileSystem.instance
- # reader.run!(path: path)
- # reader
- # rescue Exception => e
- # raise Locomotive::Wagon::MounterException.new "Unable to read the local LocomotiveCMS site. Please check the logs.", e
- # end
- # end
- # end
-
protected
- def self.build_server(options)
- # TODO: new feature -> pick the right Rack handler (Thin, Puma, ...etc)
- require 'locomotive/steam/server'
- require 'thin'
-
- app = Locomotive::Steam::Server.to_app
-
- Thin::Server.new(options[:host], options[:port], { signals: true }, app).tap do |server|
- server.threaded = true
- end
- end
-
- def self.daemonize_server(server, path, use_listen)
- # very important to get the parent pid in order to differenciate the sub process from the parent one
- parent_pid = Process.pid
-
- # The Daemons gem closes all file descriptors when it daemonizes the process. So any logfiles that were opened before the Daemons block will be closed inside the forked process.
- # So, close the current logger and set it up again when daemonized.
- # Locomotive::Wagon::Logger.close
- Locomotive::Common::Logger.close
-
- server.log_file = File.join(File.expand_path(path), 'log', 'server.log')
- server.pid_file = File.join(File.expand_path(path), 'log', 'server.pid')
- server.daemonize
-
- # use_listen = Process.pid != parent_pid && !options[:disable_listen] # TO BE REMOVED
-
- if Process.pid != parent_pid
- # A "new logger" inside the daemon.
- configure_logger(path)
-
- use_listen
- end
- end
-
- def self.listen(path)
- require 'locomotive/wagon/listen'
- require 'locomotive/steam/adapters/filesystem/simple_cache_store'
-
- cache = Locomotive::Steam::Adapters::Filesystem::SimpleCacheStore.new
-
- Locomotive::Wagon::Listen.start(path, cache)
- end
-
- def self.configure_logger(path)
- Locomotive::Common.reset
- Locomotive::Common.configure do |config|
- notifier_file = File.expand_path(File.join(path, 'log', 'wagon.log'))
- config.notifier = Locomotive::Common::Logger.setup(notifier_file)
- end
- end
-
def self.validate_resources(resources, writers_or_readers)
return if resources.nil?
locomotive/wagon/commands/serve_command.rb b/lib/locomotive/wagon/commands/serve_command.rb +126 -0
@@ @@ -0,0 +1,126 @@
+ module Locomotive::Wagon
+
+ class ServeCommand < Struct.new(:path, :options)
+
+ attr_reader :use_listen
+
+ def initialize(path, options)
+ super(path, options || {})
+
+ @use_listen = !options[:disable_listen]
+ end
+
+ def self.start(path, options = {})
+ new(path, options).start
+ end
+
+ def self.stop(path, force = false)
+ new(path).stop(force)
+ end
+
+ def start
+ # make sure the Thin server is not running
+ stop(true) if options[:force]
+
+ # Steam is our rendering engine
+ require_steam
+
+ daemonize if options[:daemonize]
+
+ # if a page, a content type or any resources of the site is getting modified,
+ # then the cache of Steam will be notified.
+ listen if use_listen
+
+ # let's start!
+ server.start
+ end
+
+ def stop(force = false)
+ pid = File.read(server_pid_file).to_i
+ Process.kill('TERM', pid)
+
+ # make sure we wait enough for the server process to stop
+ sleep(2) if force
+ end
+
+ private
+
+ def require_steam
+ require 'locomotive/steam'
+ require 'bundler'
+ Bundler.require 'misc'
+
+ configure_logger
+
+ Locomotive::Steam.configure do |config|
+ config.mode = :test
+ config.adapter = { name: :filesystem, path: path }
+ config.asset_path = File.expand_path(File.join(path, 'public'))
+ end
+ end
+
+ def daemonize
+ # very important to get the parent pid in order to differenciate the sub process from the parent one
+ parent_pid = Process.pid
+
+ # The Daemons gem closes all file descriptors when it daemonizes the process. So any logfiles that were opened before the Daemons block will be closed inside the forked process.
+ # So, close the current logger and set it up again when daemonized.
+ Locomotive::Common::Logger.close
+
+ server.log_file = server_log_file
+ server.pid_file = server_pid_file
+ server.daemonize
+
+ use_listen = use_listen && Process.pid != parent_pid
+
+ # A "new logger" inside the daemon.
+ configure_logger if Process.pid != parent_pid
+ end
+
+ def listen
+ require_relative '../tools/listen'
+ require 'locomotive/steam/adapters/filesystem/simple_cache_store'
+
+ cache = Locomotive::Steam::Adapters::Filesystem::SimpleCacheStore.new
+
+ Locomotive::Wagon::Listen.start(path, cache)
+ end
+
+ def server
+ @server ||= build_server
+ end
+
+ def build_server
+ # TODO: new feature -> pick the right Rack handler (Thin, Puma, ...etc)
+ require 'locomotive/steam/server'
+ require 'thin'
+
+ app = Locomotive::Steam::Server.to_app
+
+ Thin::Server.new(options[:host], options[:port], { signals: true }, app).tap do |server|
+ server.threaded = true
+ end
+ end
+
+ def configure_logger
+ Locomotive::Common.reset
+ Locomotive::Common.configure do |config|
+ config.notifier = Locomotive::Common::Logger.setup(log_file)
+ end
+ end
+
+ def server_pid_file
+ File.join(File.expand_path(path), 'log', 'server.pid')
+ end
+
+ def server_log_file
+ File.join(File.expand_path(path), 'log', 'server.log')
+ end
+
+ def log_file
+ File.expand_path(File.join(path, 'log', 'wagon.log'))
+ end
+
+ end
+
+ end
locomotive/wagon/listen.rb b/lib/locomotive/wagon/listen.rb +0 -74
@@ @@ -1,74 +0,0 @@
- require 'listen'
-
- module Locomotive::Wagon
-
- class Listen < Struct.new(:path, :cache)
-
- def self.start(path, cache)
- new(path, cache).tap { |instance| instance.apply_definitions }
- end
-
- def apply_definitions
- self.definitions.each do |definition|
- self.apply(definition)
- end
- end
-
- protected
-
- def definitions
- [
- ['config', /\.yml/, [:site, :content_types, :pages, :snippets, :content_entries, :translations]],
- ['app/views', %r{(pages|snippets)/(.+\.liquid).*}, [:pages, :snippets]],
- ['app/content_types', /\.yml/, [:content_types, :content_entries]],
- ['data', /\.yml/, :content_entries],
- ['public', %r{((stylesheets|javascripts)/(.+\.(css|js))).*}, []]
- ]
- end
-
- def apply(definition)
- # reloader = Proc.new do |modified, added, removed|
- # resources =
- # names = resources.map { |n| "\"#{n}\"" }.join(', ')
-
- # unless resources.empty?
- # Locomotive::Common::Logger.info "service=listen resources=#{names} timestamp=#{Time.now}"
-
- # begin
- # reader.reload(resources)
- # rescue Exception => e
- # Locomotive::Common::DefaultException.new('Unable to reload', e)
- # end
- # end
- # end
-
- reloader = build_reloader([*definition.last])
- filter = definition[1]
- _path = File.expand_path(File.join(self.path, definition.first))
-
- listener = ::Listen.to(_path, only: filter, &reloader)
-
- # non blocking listener
- listener.start
- end
-
- def build_reloader(resources)
- Proc.new do |modified, added, removed|
- resources.each do |resource|
- Locomotive::Common::Logger.info "service=listen action=reload resource=#{resource} timestamp=#{Time.now}"
- cache.delete(resource)
- end
- end
- end
-
- # def relative_path(path)
- # path.sub(site_path, '')
- # end
-
- # def site_path
- # self.adapter.site_path
- # end
-
- end
-
- end
locomotive/wagon/misc.rb b/lib/locomotive/wagon/misc.rb +0 -9
@@ @@ -1,9 +0,0 @@
- # require 'locomotive/wagon/misc/core_ext.rb'
- # require 'locomotive/wagon/misc/will_paginate.rb'
- # require 'locomotive/wagon/misc/httparty.rb'
- # require 'locomotive/wagon/misc/dragonfly.rb'
- require 'locomotive/wagon/misc/i18n.rb'
- # require 'locomotive/wagon/misc/mounter.rb'
- # require 'locomotive/wagon/misc/markdown.rb'
- # require 'locomotive/wagon/misc/haml.rb'
- # require 'locomotive/wagon/misc/better_errors.rb'
locomotive/wagon/misc/better_errors.rb b/lib/locomotive/wagon/misc/better_errors.rb +0 -70
@@ @@ -1,70 +0,0 @@
- require 'ostruct'
-
- module BetterErrors
- class MiddlewareWrapper
-
- def initialize(app)
- @@middleware ||= BetterErrors::Middleware.new(app)
- @@middleware.instance_variable_set(:@app, app)
- end
-
- def call(env)
- env['action_dispatch.request.parameters'] = Rack::Request.new(env).params
-
- @@middleware.call(env)
- end
-
- end
-
- module FrameWithLiquidContext
-
- extend ActiveSupport::Concern
-
- included do
-
- attr_accessor :liquid_context
-
- alias_method_chain :local_variables, :liquid_context
-
- class << self
-
- alias_method_chain :from_exception, :liquid_context
-
- end
- end
-
- def local_variables_with_liquid_context
- if self.liquid_context
- scope = self.liquid_context.scopes.last.clone
-
- scope.delete_if { |k, _| %w(models contents params session).include?(k) }.tap do |_scope|
- _scope['site'] = _scope['site'].send(:_source).to_hash
- _scope['page'] = _scope['page'].to_hash.delete_if { |k, _| %w(template).include?(k) }
- end
- else
- self.local_variables_without_liquid_context
- end
- rescue Exception => e
- puts "[BetterError] Fatal error: #{e.message}".red
- puts e.backtrace.join("\n")
- {}
- end
-
- module ClassMethods
-
- def from_exception_with_liquid_context(exception)
- from_exception_without_liquid_context(exception).tap do |list|
- if exception.respond_to?(:liquid_context)
- list.first.liquid_context = exception.liquid_context
- end
- end
- end
-
- end
- end
-
- class StackFrame
- include FrameWithLiquidContext
- end
-
- end
\ No newline at end of file
locomotive/wagon/misc/core_ext.rb b/lib/locomotive/wagon/misc/core_ext.rb +0 -62
@@ @@ -1,62 +0,0 @@
- # unless Hash.instance_methods.include?(:underscore_keys)
- # class Hash
-
- # def underscore_keys
- # new_hash = {}
-
- # self.each_pair do |key, value|
- # if value.respond_to?(:collect!) # Array
- # value.collect do |item|
- # if item.respond_to?(:each_pair) # Hash item within
- # item.underscore_keys
- # else
- # item
- # end
- # end
- # elsif value.respond_to?(:each_pair) # Hash
- # value = value.underscore_keys
- # end
-
- # new_key = key.is_a?(String) ? key.underscore : key # only String keys
-
- # new_hash[new_key] = value
- # end
-
- # self.replace(new_hash)
- # end
-
- # end
- # end
-
- # unless String.instance_methods.include?(:to_bool)
- # class String
- # def to_bool
- # return true if self == true || self =~ (/(true|t|yes|y|1)$/i)
- # return false if self == false || self.blank? || self =~ (/(false|f|no|n|0)$/i)
- # raise ArgumentError.new("invalid value for Boolean: \"#{self}\"")
- # end
- # end
-
- # class TrueClass
- # def to_bool; self; end
- # end
-
- # class FalseClass
- # def to_bool; self; end
- # end
- # end
-
- # unless Array.instance_methods.include?(:contains?)
- # class Array
- # def contains?(other); (self & other) == other; end
- # end
- # end
-
- # unless Integer.instance_methods.include?(:to_datetime)
- # class Integer
- # def to_datetime
- # Time.at(self).to_datetime
- # end
- # end
- # end
-
locomotive/wagon/misc/deployment_connection.rb b/lib/locomotive/wagon/misc/deployment_connection.rb +0 -120
@@ @@ -1,120 +0,0 @@
- require 'locomotive/wagon/misc/hosting_api'
- require 'active_support/core_ext/hash'
- require 'netrc'
- require 'erb'
-
- module Locomotive
- module Wagon
-
- class DeploymentConnection
-
- # Create a connection for the deployment
- # from the path of a Wagon site.
- #
- # @param [ String ] path Path to a Wagon site
- #
- def initialize(path, shell = nil)
- @path = path
- @shell = shell
- end
-
- # Retrieve information connection from the
- # config/deploy.yml file and for a specific environment.
- # If the env is hosting and does not have an entry in that file,
- # then it looks for an api key in the ~/.netrc file, assuming
- # that the user authenticates himself previously thanks to the
- # auth wagon command.
- #
- # @param [ String ] env The target environment to deploy the site.
- #
- def get_information(env)
- connection_info = read_from_yaml_file(env)
-
- # is the user owns a hosting account, then use his credentials
- # to create a new site.
- if connection_info.nil? && env == 'hosting'
- connection_info = read_from_hosting
- end
-
- if connection_info.nil?
- raise "No #{env.to_s} environment found in the config/deploy.yml file"
- end
-
- connection_info = connection_info.with_indifferent_access
-
- if connection_info[:ssl] && !connection_info[:host].start_with?('https')
- connection_info[:host] = 'https://' + connection_info[:host]
- end
-
- connection_info
- end
-
- private
-
- def deploy_file
- File.join(@path, 'config', 'deploy.yml')
- end
-
- def read_from_yaml_file(env)
- # pre-processing: erb code to parse and render?
- parsed_deploy_file = ERB.new(File.open(deploy_file).read).result
-
- # finally, get the hash from the YAML file
- environments = YAML::load(parsed_deploy_file)
- (environments.is_a?(Hash) ? environments : {})[env.to_s]
- rescue Exception => e
- raise "Unable to read the config/deploy.yml file (#{e.message})"
- end
-
- def read_from_hosting
- hosting_api = new_hosting_api
-
- # create the site (READ the site.yml file to get the information)
- site = hosting_api.create_site(site_attributes)
-
- if site.success?
- # now we've got the subdomain, build the target host
- host = [site['subdomain'], hosting_api.domain_with_port].join('.')
-
- # return the connection information
- { 'host' => host, 'api_key' => hosting_api.api_key }.tap do |hash|
- # add ssl only if it is asked
- hash['ssl'] = true if hosting_api.ssl?
-
- # insert a new entry for hosting env in the current deploy.yml
- File.open(deploy_file, 'a+') do |f|
- f.write({ 'hosting' => hash }.to_yaml.sub(/^---/, ''))
- end
- end
- else
- raise "We were unable to create a new site on the hosting, reason(s): #{site.error_messages.join(', ')}"
- end
- end
-
- def new_hosting_api
- Locomotive::HostingAPI.new.tap do |hosting_api|
- netrc = Netrc.read
- email, api_key = netrc[hosting_api.domain_with_port]
-
- # get a new auth token for further API calls
- hosting_api.authenticate(api_key: api_key)
- end
- end
-
- def config_file
- File.join(@path, 'config', 'site.yml')
- end
-
- def site_attributes
- YAML::load(File.read(config_file)).tap do |attributes|
- # ask for the subdomain
- if attributes['subdomain'].blank? && @shell
- attributes['subdomain'] = @shell.ask("Please, what's your subdomain? (leave it blank for a random one)")
- end
- end
- end
-
- end
-
- end
- end
locomotive/wagon/misc/dragonfly.rb b/lib/locomotive/wagon/misc/dragonfly.rb +0 -78
@@ @@ -1,78 +0,0 @@
- # module Locomotive
- # module Wagon
- # class Dragonfly
-
- # attr_accessor :path, :enabled
-
- # def enabled?
- # !!self.enabled
- # end
-
- # def resize_url(source, resize_string)
- # _source = (case source
- # when String then source
- # when Hash then source['url'] || source[:url]
- # else
- # source.try(:url)
- # end)
-
- # if _source.blank?
- # Locomotive::Wagon::Logger.error "Unable to resize on the fly: #{source.inspect}"
- # return
- # end
-
- # return _source unless self.enabled?
-
- # if _source =~ /^http/
- # file = self.class.app.fetch_url(_source)
- # else
- # file = self.class.app.fetch_file(File.join(self.path, 'public', _source))
- # end
-
- # file.process(:thumb, resize_string).url
- # end
-
- # def self.app
- # ::Dragonfly[:images]
- # end
-
-
- # def self.instance
- # @@instance ||= new
- # end
-
- # def self.setup!(path)
- # self.instance.path = path
- # self.instance.enabled = false
-
- # begin
- # require 'rack/cache'
- # require 'dragonfly'
-
- # ## initialize Dragonfly ##
- # app = ::Dragonfly[:images].configure_with(:imagemagick)
-
- # ## configure it ##
- # ::Dragonfly[:images].configure do |c|
- # convert = `which convert`.strip.presence || '/usr/bin/env convert'
- # c.convert_command = convert
- # c.identify_command = convert
-
- # c.allow_fetch_url = true
- # c.allow_fetch_file = true
-
- # c.url_format = '/images/dynamic/:job/:basename.:format'
- # end
-
- # self.instance.enabled = true
- # rescue Exception => e
- # Locomotive::Wagon::Logger.warn %{
- # [Dragonfly] !disabled!
- # [Dragonfly] If you want to take full benefits of all the features in the LocomotiveWagon, we recommend you to install ImageMagick and RMagick. Check out the documentation here: http://doc.locomotivecms.com/editor/installation.
- # }
- # end
- # end
-
- # end
- # end
- # end
locomotive/wagon/misc/haml.rb b/lib/locomotive/wagon/misc/haml.rb +0 -15
@@ @@ -1,15 +0,0 @@
- # module Haml::Filters
-
- # remove_filter("Markdown") #remove the existing Markdown filter
-
- # module Markdown # the contents of this are as before, but without the lazy_require call
-
- # include Haml::Filters::Base
-
- # def render text
- # Locomotive::Wagon::Markdown.render text
- # end
-
- # end
-
- # end
locomotive/wagon/misc/hosting_api.rb b/lib/locomotive/wagon/misc/hosting_api.rb +0 -117
@@ @@ -1,117 +0,0 @@
- require 'httparty'
-
- module Locomotive
- class HostingAPI
-
- include HTTParty
-
- base_uri ENV['HOSTING_URL'] || 'http://www.locomotivehosting.com'
- # base_uri ENV['HOSTING_URL'] || 'http://www.locomotivehosting.fr'
- # base_uri ENV['HOSTING_URL'] || 'http://www.locomotivehosting.dev:3000'
-
- def initialize(credentials = nil)
- authenticate(credentials) if credentials
- end
-
- def self.host
- URI(base_uri).host
- end
-
- def base_uri; self.class.base_uri; end
- def host; self.class.host; end
- def port; URI(self.class.base_uri).port; end
-
- def domain
- host.split('.')[1..-1].join('.') # TLD length of 2
- end
-
- def domain_with_port
- if port != 80
- self.domain + ":#{port}"
- else
- self.domain
- end
- end
-
- def ssl?
- URI(self.class.base_uri).scheme == 'https'
- end
-
- def authenticate(credentials)
- response = self.class.post('/locomotive/api/tokens.json', { body: credentials })
-
- if response.success?
- @auth_token = response['token']
- end
- end
-
- def authenticated?
- !!@auth_token
- end
-
- def api_key
- @api_key ||= api_key!
- end
-
- def api_key!
- return false unless authenticated?
-
- my_account['api_key']
- end
-
- def my_account
- self.class.get('/locomotive/api/my_account.json', { query: { auth_token: @auth_token }})
- end
-
- def create_account(attributes)
- attributes[:password_confirmation] = attributes[:password]
-
- _response = self.class.post('/locomotive/api/my_account.json', { body: { account: attributes }})
-
- Response.new(_response.parsed_response).tap do |response|
- response.success = _response.success?
- end
- end
-
- def create_site(attributes)
- _response = self.class.post('/locomotive/api/sites.json', { body: { auth_token: @auth_token, site: attributes }})
-
- Response.new(_response.parsed_response).tap do |response|
- response.success = _response.success?
- end
- end
-
- class Response < Hash
-
- attr_writer :success
-
- def initialize(attributes = {})
- replace(attributes)
- end
-
- def success?
- !!@success
- end
-
- def errors
- return nil if success?
-
- @errors ||= if self['error']
- [[nil, [self['error']]]]
- elsif self['errors']
- self['errors']
- else
- self.to_a
- end.delete_if { |attribute, errors| errors.empty? }
- end
-
- def error_messages
- return nil if success? || errors.nil?
-
- errors.to_a.map { |attribute, messages| messages.map { |message| [attribute, message].compact.join(' ') } }.flatten
- end
-
- end
-
- end
- end
locomotive/wagon/misc/httparty.rb b/lib/locomotive/wagon/misc/httparty.rb +0 -48
@@ @@ -1,48 +0,0 @@
- # require 'uri'
-
- # module Locomotive
- # module Wagon
- # module Httparty
- # class Webservice
-
- # include ::HTTParty
-
- # def self.consume(url, options = {})
- # url = ::HTTParty.normalize_base_uri(url)
-
- # uri = URI.parse(url)
- # options[:base_uri] = "#{uri.scheme}://#{uri.host}"
- # options[:base_uri] += ":#{uri.port}" if uri.port != 80
- # path = uri.request_uri
-
- # options.delete(:format) if options[:format] == 'default'
- # options[:format] = options[:format].gsub(/[\'\"]/, '').to_sym if options.has_key?(:format)
- # options[:headers] = { 'User-Agent' => 'LocomotiveCMS' } if options[:with_user_agent]
-
- # username, password = options.delete(:username), options.delete(:password)
- # options[:basic_auth] = { username: username, password: password } if username
-
- # path ||= '/'
-
- # # Locomotive::Wagon::Logger.debug "[WebService] consuming #{path}, #{options.inspect}"
-
- # response = self.get(path, options)
-
- # if response.code == 200
- # _response = response.parsed_response
- # if _response.respond_to?(:underscore_keys)
- # _response.underscore_keys
- # else
- # _response.collect(&:underscore_keys)
- # end
- # else
- # Locomotive::Wagon::Logger.error "[WebService] consumed #{path}, #{options.inspect}, response = #{response.inspect}"
- # nil
- # end
-
- # end
-
- # end
- # end
- # end
- # end
locomotive/wagon/misc/i18n.rb b/lib/locomotive/wagon/misc/i18n.rb +0 -2
@@ @@ -1,2 +0,0 @@
- # I18n.load_path = Dir[File.join(File.dirname(__FILE__), "/../../../../locales/*.yml")]
- # I18n.backend.reload!
locomotive/wagon/misc/livereload.rb b/lib/locomotive/wagon/misc/livereload.rb +0 -43
@@ @@ -1,43 +0,0 @@
- # Stub Guard
- module Guard
- class Plugin
- def initialize(options = {})
- end
- end
-
- module UI
- class << self
- def method_missing(meth, *args)
- Locomotive::Common::Logger.send(meth, *args)
- end
- end
- end
- end
-
- require 'guard/livereload'
- require 'locomotive/wagon/misc/tcp_port'
-
- module Locomotive
- module Wagon
-
- class LiveReload
-
- extend Forwardable
-
- def_delegators :@livereload, :start, :stop, :run_on_modifications
-
- attr_reader :port
-
- def initialize(options = {})
- tcp_port = Locomotive::Wagon::TcpPort.new(options[:host], 35729)
- @port = tcp_port.first
-
- Locomotive::Common::Logger.debug "service=liveReload action=start port=#{@port}"
-
- @livereload = Guard::LiveReload.new(options.merge(port: @port))
- end
-
- end
-
- end
- end
locomotive/wagon/misc/markdown.rb b/lib/locomotive/wagon/misc/markdown.rb +0 -27
@@ @@ -1,27 +0,0 @@
- # require 'redcarpet'
-
- # module Locomotive
- # module Wagon
- # module Markdown
-
- # def self.render(text)
- # self.parser.render(text)
- # end
-
- # def self.parser
- # @@markdown ||= Redcarpet::Markdown.new Redcarpet::Render::HTML, {
- # autolink: true,
- # fenced_code: true,
- # generate_toc: true,
- # gh_blockcode: true,
- # hard_wrap: true,
- # no_intraemphasis: true,
- # strikethrough: true,
- # tables: true,
- # xhtml: true
- # }
- # end
-
- # end
- # end
- # end
locomotive/wagon/misc/mounter.rb b/lib/locomotive/wagon/misc/mounter.rb +0 -32
@@ @@ -1,32 +0,0 @@
- # module Locomotive
- # module Mounter
- # module Models
- # class Page
-
- # def render(context)
- # self.parse(context).render(context)
- # end
-
- # protected
-
- # def parse(context)
- # options = {
- # page: self,
- # mounting_point: context.registers[:mounting_point],
- # error_mode: :strict,
- # count_lines: true
- # }
-
- # begin
- # template = ::Liquid::Template.parse(self.source, options)
- # rescue ::Liquid::SyntaxError => e
- # # do it again on the raw source instead so that the error line matches
- # # the source file.
- # ::Liquid::Template.parse(self.template.raw_source, options)
- # end
- # end
-
- # end
- # end
- # end
- # end
locomotive/wagon/misc/tcp_port.rb b/lib/locomotive/wagon/misc/tcp_port.rb +0 -42
@@ @@ -1,42 +0,0 @@
- require 'socket'
-
- module Locomotive
- module Wagon
-
- class TcpPort
-
- MAX_ATTEMPTS = 1000
-
- def initialize(host, from)
- @host = host
- @from = from
- end
-
- def first
- current = @from.to_i
- max = current + MAX_ATTEMPTS
- while open_port(@host, current)
- current += 1
- raise "No available ports from #{@from}" if current >= max
- end
- current.to_s
- end
-
- private
-
- def open_port(host, port)
- sock = Socket.new(:INET, :STREAM)
- raw = Socket.sockaddr_in(port, host)
- sock.connect(raw)
- sock.close if sock
- true
- rescue Errno::ECONNREFUSED
- false
- rescue Errno::ETIMEDOUT
- false
- end
-
- end
-
- end
- end
\ No newline at end of file
locomotive/wagon/misc/thor.rb b/lib/locomotive/wagon/misc/thor.rb +0 -15
@@ @@ -1,15 +0,0 @@
- require 'thor/shell/color'
-
- class Thor
- module Shell
- class ForceColor < ::Thor::Shell::Color
-
- protected
-
- def can_display_colors?
- true
- end
-
- end
- end
- end
\ No newline at end of file
locomotive/wagon/misc/will_paginate.rb b/lib/locomotive/wagon/misc/will_paginate.rb +0 -16
@@ @@ -1,16 +0,0 @@
- # require 'will_paginate'
- # require 'will_paginate/collection'
-
- # Array.class_eval do
- # def paginate(options = {})
- # raise ArgumentError, "parameter hash expected (got #{options.inspect})" unless Hash === options
-
- # WillPaginate::Collection.create(
- # options[:page] || 1,
- # options[:per_page] || 30,
- # options[:total_entries] || self.length
- # ) { |pager|
- # pager.replace self[pager.offset, pager.per_page].to_a
- # }
- # end
- # end
locomotive/wagon/standalone_server.rb b/lib/locomotive/wagon/standalone_server.rb +0 -28
@@ @@ -1,28 +0,0 @@
- # $:.unshift(File.expand_path(File.dirname(__FILE__) + '/../..'))
-
- # require 'locomotive/wagon/logger'
- # require 'locomotive/wagon/version'
- # require 'locomotive/wagon/exceptions'
- # require 'locomotive/wagon/server'
- # require 'locomotive/mounter'
-
- # module Locomotive
- # module Wagon
- # class StandaloneServer < Server
-
- # def initialize(path)
- # Locomotive::Wagon::Logger.setup(path, false)
-
- # # get the reader
- # reader = Locomotive::Mounter::Reader::FileSystem.instance
- # reader.run!(path: path)
- # reader
-
- # Bundler.require 'misc'
-
- # # run the rack app
- # super(reader, disable_listen: true)
- # end
- # end
- # end
- # end
locomotive/wagon/tools/deployment_connection.rb b/lib/locomotive/wagon/tools/deployment_connection.rb +120 -0
@@ @@ -0,0 +1,120 @@
+ require 'locomotive/wagon/misc/hosting_api'
+ require 'active_support/core_ext/hash'
+ require 'netrc'
+ require 'erb'
+
+ module Locomotive
+ module Wagon
+
+ class DeploymentConnection
+
+ # Create a connection for the deployment
+ # from the path of a Wagon site.
+ #
+ # @param [ String ] path Path to a Wagon site
+ #
+ def initialize(path, shell = nil)
+ @path = path
+ @shell = shell
+ end
+
+ # Retrieve information connection from the
+ # config/deploy.yml file and for a specific environment.
+ # If the env is hosting and does not have an entry in that file,
+ # then it looks for an api key in the ~/.netrc file, assuming
+ # that the user authenticates himself previously thanks to the
+ # auth wagon command.
+ #
+ # @param [ String ] env The target environment to deploy the site.
+ #
+ def get_information(env)
+ connection_info = read_from_yaml_file(env)
+
+ # is the user owns a hosting account, then use his credentials
+ # to create a new site.
+ if connection_info.nil? && env == 'hosting'
+ connection_info = read_from_hosting
+ end
+
+ if connection_info.nil?
+ raise "No #{env.to_s} environment found in the config/deploy.yml file"
+ end
+
+ connection_info = connection_info.with_indifferent_access
+
+ if connection_info[:ssl] && !connection_info[:host].start_with?('https')
+ connection_info[:host] = 'https://' + connection_info[:host]
+ end
+
+ connection_info
+ end
+
+ private
+
+ def deploy_file
+ File.join(@path, 'config', 'deploy.yml')
+ end
+
+ def read_from_yaml_file(env)
+ # pre-processing: erb code to parse and render?
+ parsed_deploy_file = ERB.new(File.open(deploy_file).read).result
+
+ # finally, get the hash from the YAML file
+ environments = YAML::load(parsed_deploy_file)
+ (environments.is_a?(Hash) ? environments : {})[env.to_s]
+ rescue Exception => e
+ raise "Unable to read the config/deploy.yml file (#{e.message})"
+ end
+
+ def read_from_hosting
+ hosting_api = new_hosting_api
+
+ # create the site (READ the site.yml file to get the information)
+ site = hosting_api.create_site(site_attributes)
+
+ if site.success?
+ # now we've got the subdomain, build the target host
+ host = [site['subdomain'], hosting_api.domain_with_port].join('.')
+
+ # return the connection information
+ { 'host' => host, 'api_key' => hosting_api.api_key }.tap do |hash|
+ # add ssl only if it is asked
+ hash['ssl'] = true if hosting_api.ssl?
+
+ # insert a new entry for hosting env in the current deploy.yml
+ File.open(deploy_file, 'a+') do |f|
+ f.write({ 'hosting' => hash }.to_yaml.sub(/^---/, ''))
+ end
+ end
+ else
+ raise "We were unable to create a new site on the hosting, reason(s): #{site.error_messages.join(', ')}"
+ end
+ end
+
+ def new_hosting_api
+ Locomotive::HostingAPI.new.tap do |hosting_api|
+ netrc = Netrc.read
+ email, api_key = netrc[hosting_api.domain_with_port]
+
+ # get a new auth token for further API calls
+ hosting_api.authenticate(api_key: api_key)
+ end
+ end
+
+ def config_file
+ File.join(@path, 'config', 'site.yml')
+ end
+
+ def site_attributes
+ YAML::load(File.read(config_file)).tap do |attributes|
+ # ask for the subdomain
+ if attributes['subdomain'].blank? && @shell
+ attributes['subdomain'] = @shell.ask("Please, what's your subdomain? (leave it blank for a random one)")
+ end
+ end
+ end
+
+ end
+
+ end
+ end
locomotive/wagon/tools/hosting_api.rb b/lib/locomotive/wagon/tools/hosting_api.rb +117 -0
@@ @@ -0,0 +1,117 @@
+ require 'httparty'
+
+ module Locomotive
+ class HostingAPI
+
+ include HTTParty
+
+ base_uri ENV['HOSTING_URL'] || 'http://www.locomotivehosting.com'
+ # base_uri ENV['HOSTING_URL'] || 'http://www.locomotivehosting.fr'
+ # base_uri ENV['HOSTING_URL'] || 'http://www.locomotivehosting.dev:3000'
+
+ def initialize(credentials = nil)
+ authenticate(credentials) if credentials
+ end
+
+ def self.host
+ URI(base_uri).host
+ end
+
+ def base_uri; self.class.base_uri; end
+ def host; self.class.host; end
+ def port; URI(self.class.base_uri).port; end
+
+ def domain
+ host.split('.')[1..-1].join('.') # TLD length of 2
+ end
+
+ def domain_with_port
+ if port != 80
+ self.domain + ":#{port}"
+ else
+ self.domain
+ end
+ end
+
+ def ssl?
+ URI(self.class.base_uri).scheme == 'https'
+ end
+
+ def authenticate(credentials)
+ response = self.class.post('/locomotive/api/tokens.json', { body: credentials })
+
+ if response.success?
+ @auth_token = response['token']
+ end
+ end
+
+ def authenticated?
+ !!@auth_token
+ end
+
+ def api_key
+ @api_key ||= api_key!
+ end
+
+ def api_key!
+ return false unless authenticated?
+
+ my_account['api_key']
+ end
+
+ def my_account
+ self.class.get('/locomotive/api/my_account.json', { query: { auth_token: @auth_token }})
+ end
+
+ def create_account(attributes)
+ attributes[:password_confirmation] = attributes[:password]
+
+ _response = self.class.post('/locomotive/api/my_account.json', { body: { account: attributes }})
+
+ Response.new(_response.parsed_response).tap do |response|
+ response.success = _response.success?
+ end
+ end
+
+ def create_site(attributes)
+ _response = self.class.post('/locomotive/api/sites.json', { body: { auth_token: @auth_token, site: attributes }})
+
+ Response.new(_response.parsed_response).tap do |response|
+ response.success = _response.success?
+ end
+ end
+
+ class Response < Hash
+
+ attr_writer :success
+
+ def initialize(attributes = {})
+ replace(attributes)
+ end
+
+ def success?
+ !!@success
+ end
+
+ def errors
+ return nil if success?
+
+ @errors ||= if self['error']
+ [[nil, [self['error']]]]
+ elsif self['errors']
+ self['errors']
+ else
+ self.to_a
+ end.delete_if { |attribute, errors| errors.empty? }
+ end
+
+ def error_messages
+ return nil if success? || errors.nil?
+
+ errors.to_a.map { |attribute, messages| messages.map { |message| [attribute, message].compact.join(' ') } }.flatten
+ end
+
+ end
+
+ end
+ end
locomotive/wagon/tools/listen.rb b/lib/locomotive/wagon/tools/listen.rb +51 -0
@@ @@ -0,0 +1,51 @@
+ require 'listen'
+
+ module Locomotive::Wagon
+
+ class Listen < Struct.new(:path, :cache)
+
+ def self.start(path, cache)
+ new(path, cache).tap { |instance| instance.apply_definitions }
+ end
+
+ def apply_definitions
+ self.definitions.each do |definition|
+ self.apply(definition)
+ end
+ end
+
+ protected
+
+ def definitions
+ [
+ ['config', /\.yml/, [:site, :content_types, :pages, :snippets, :content_entries, :translations]],
+ ['app/views', %r{(pages|snippets)/(.+\.liquid).*}, [:pages, :snippets]],
+ ['app/content_types', /\.yml/, [:content_types, :content_entries]],
+ ['data', /\.yml/, :content_entries],
+ ['public', %r{((stylesheets|javascripts)/(.+\.(css|js))).*}, []]
+ ]
+ end
+
+ def apply(definition)
+ reloader = build_reloader([*definition.last])
+ filter = definition[1]
+ _path = File.expand_path(File.join(self.path, definition.first))
+
+ listener = ::Listen.to(_path, only: filter, &reloader)
+
+ # non blocking listener
+ listener.start
+ end
+
+ def build_reloader(resources)
+ Proc.new do |modified, added, removed|
+ resources.each do |resource|
+ Locomotive::Common::Logger.info "service=listen action=reload resource=#{resource} timestamp=#{Time.now}"
+ cache.delete(resource)
+ end
+ end
+ end
+
+ end
+
+ end
locomotive/wagon/tools/livereload.rb b/lib/locomotive/wagon/tools/livereload.rb +43 -0
@@ @@ -0,0 +1,43 @@
+ # Stub Guard
+ module Guard
+ class Plugin
+ def initialize(options = {})
+ end
+ end
+
+ module UI
+ class << self
+ def method_missing(meth, *args)
+ Locomotive::Common::Logger.send(meth, *args)
+ end
+ end
+ end
+ end
+
+ require 'guard/livereload'
+ require 'locomotive/wagon/misc/tcp_port'
+
+ module Locomotive
+ module Wagon
+
+ class LiveReload
+
+ extend Forwardable
+
+ def_delegators :@livereload, :start, :stop, :run_on_modifications
+
+ attr_reader :port
+
+ def initialize(options = {})
+ tcp_port = Locomotive::Wagon::TcpPort.new(options[:host], 35729)
+ @port = tcp_port.first
+
+ Locomotive::Common::Logger.debug "service=liveReload action=start port=#{@port}"
+
+ @livereload = Guard::LiveReload.new(options.merge(port: @port))
+ end
+
+ end
+
+ end
+ end
locomotive/wagon/tools/tcp_port.rb b/lib/locomotive/wagon/tools/tcp_port.rb +42 -0
@@ @@ -0,0 +1,42 @@
+ require 'socket'
+
+ module Locomotive
+ module Wagon
+
+ class TcpPort
+
+ MAX_ATTEMPTS = 1000
+
+ def initialize(host, from)
+ @host = host
+ @from = from
+ end
+
+ def first
+ current = @from.to_i
+ max = current + MAX_ATTEMPTS
+ while open_port(@host, current)
+ current += 1
+ raise "No available ports from #{@from}" if current >= max
+ end
+ current.to_s
+ end
+
+ private
+
+ def open_port(host, port)
+ sock = Socket.new(:INET, :STREAM)
+ raw = Socket.sockaddr_in(port, host)
+ sock.connect(raw)
+ sock.close if sock
+ true
+ rescue Errno::ECONNREFUSED
+ false
+ rescue Errno::ETIMEDOUT
+ false
+ end
+
+ end
+
+ end
+ end
\ No newline at end of file
locomotive/wagon/tools/thor.rb b/lib/locomotive/wagon/tools/thor.rb +15 -0
@@ @@ -0,0 +1,15 @@
+ require 'thor/shell/color'
+
+ class Thor
+ module Shell
+ class ForceColor < ::Thor::Shell::Color
+
+ protected
+
+ def can_display_colors?
+ true
+ end
+
+ end
+ end
+ end
\ No newline at end of file
locales/de.yml +0 -157
@@ @@ -1,157 +0,0 @@
- de:
- locomotive:
- locales:
- en: Englisch
- de: Deutsch
- fr: Französisch
- pl: Polnisch
- pt-BR: "Bras. Portugiesisch"
- it: Italienisch
- nl: Niederländisch
- nb: Norwegisch
- es: Spanisch
- ru: Russisch
- et: Estnisch
-
- errors:
- messages:
- blank: "leer"
-
- pagination:
- previous: "&laquo; Zurück"
- next: "Vor &raquo;"
-
- date:
- formats:
- default: "%d.%m.%Y"
- short: "%e %b"
- long: "%e %B %Y"
- long_ordinal: "%e %B %Y"
- only_day: "%e"
-
- day_names: [Sonntag, Montag, Dienstag, Mittwoch, Donnerstag, Freitag, Samstag]
- abbr_day_names: [So, Mo, Di, Mi, Do, Fr, Sa]
- month_names: [~, Januar, Februar, März, April, Mai, Juni, Juli, August, September, Oktober, November, Dezember]
- abbr_month_names: [~, Jan., Feb., Mär., Apr., Mai, Juni, Juli, Aug., Sept., Okt., Nov., Dez.]
- order: [ day, month, year ]
-
- pagination:
- previous: "&laquo; Zurück"
- next: "Vor &raquo;"
-
- time:
- formats:
- default: "%d %B %Y %H:%M"
- time: "%H:%M"
- short: "%d %b %H:%M"
- long: "%A %d %B %Y %H:%M:%S %Z"
- long_ordinal: "%A %d %B %Y %H:%M:%S %Z"
- only_second: "%S"
- am: 'vormittags'
- pm: 'nachmittags'
-
- datetime:
- distance_in_words:
- half_a_minute: 'eine halbe Minute'
- less_than_x_seconds:
- one: 'weniger als eine Sekunde'
- other: 'weniger als %{count} Sekunden'
- x_seconds:
- one: 'eine Sekunde'
- other: '%{count} Sekunden'
- less_than_x_minutes:
- one: 'weniger als eine Minute'
- other: 'weniger als %{count} Minuten'
- x_minutes:
- one: 'eine Minute'
- other: '%{count} Minuten'
- about_x_hours:
- one: 'etwa eine Stunde'
- other: 'etwa %{count} Stunden'
- x_days:
- one: 'ein Tag'
- other: '%{count} Tage'
- about_x_months:
- one: 'etwa ein Monat'
- other: 'etwa %{count} Monate'
- x_months:
- one: 'ein Monat'
- other: '%{count} Monate'
- almost_x_years:
- one: 'fast ein Jahr'
- other: 'fast %{count} Jahre'
- about_x_years:
- one: 'etwa ein Jahr'
- other: 'etwa %{count} Jahre'
- over_x_years:
- one: 'mehr als ein Jahr'
- other: 'mehr als %{count} Jahre'
- prompts:
- second: "Sekunden"
- minute: "Minuten"
- hour: "Stunden"
- day: "Tag"
- month: "Monat"
- year: "Jahr"
-
- number:
- format:
- precision: 2
- separator: ','
- delimiter: '.'
- significant: false
- strip_insignificant_zeros: false
- currency:
- format:
- unit: '€'
- format: '%n%u'
- separator: ","
- delimiter: ""
- precision: 2
- significant: false
- strip_insignificant_zeros: false
- percentage:
- format:
- delimiter: ""
- precision:
- format:
- delimiter: ""
- human:
- format:
- delimiter: ""
- precision: 1
- significant: true
- strip_insignificant_zeros: true
- storage_units:
- # Storage units output formatting.
- # %u is the storage unit, %n is the number (default: 2 MB)
- format: "%n %u"
- units:
- byte:
- one: "Byte"
- other: "Bytes"
- kb: "KB"
- mb: "MB"
- gb: "GB"
- tb: "TB"
- decimal_units:
- format: "%n %u"
- units:
- unit: ""
- thousand: Tausend
- million: Millionen
- billion:
- one: Milliarde
- others: Milliarden
- trillion: Billionen
- quadrillion:
- one: Billiarde
- others: Billiarden
-
- support:
- array:
- sentence_connector: 'und'
- skip_last_comma: true
- words_connector: ", "
- two_words_connector: " und "
- last_word_connector: " und "
\ No newline at end of file
locales/en.yml +0 -189
@@ @@ -1,189 +0,0 @@
- en:
- locomotive:
- locales:
- en: English
- de: German
- fr: French
- pl: Polish
- pt-BR: "Brazilian Portuguese"
- it: Italian
- nl: Dutch
- nb: Norwegian
- es: Spanish
- ru: Russian
- et: Estonian
-
- errors:
- syntax:
- editable_text: "Syntax Error in 'editable_text' - Valid syntax: editable_text [slug], [options]"
- editable_file: "Syntax Error in 'editable_file' - Valid syntax: editable_file [slug], [options]"
- editable_control: "Syntax Error in 'editable_control' - Valid syntax: editable_control [slug], [options]"
- consume: "Syntax Error in 'consume' - Valid syntax: consume <var> from [url] [, username: value, password: value]"
- google_analytics: "Syntax Error in 'google_analytics' - Valid syntax: google_analytics [account_id]"
- link_to: "Syntax Error in 'link_to' - Valid syntax: link_to [page_handle], locale: es (locale is optional)"
- locale_switcher: "Syntax Error in 'locale_switcher' - Valid syntax: locale_switcher [options]"
- nav: "Syntax Error in 'nav' - Valid syntax: nav [site|parent|page|<path to a page>] [options]>"
- paginate: "Syntax Error in 'paginate' - Valid syntax: paginate <collection> by <number>"
- session_assign: "Syntax Error in 'session_assign' - Valid syntax: session_assign [var] = [source]"
- messages:
- blank: "can't not be blank"
-
- pagination:
- previous: "&laquo; Previous"
- next: "Next &raquo;"
-
- date:
- abbr_day_names:
- - Sun
- - Mon
- - Tue
- - Wed
- - Thu
- - Fri
- - Sat
- abbr_month_names:
- -
- - Jan
- - Feb
- - Mar
- - Apr
- - May
- - Jun
- - Jul
- - Aug
- - Sep
- - Oct
- - Nov
- - Dec
- day_names:
- - Sunday
- - Monday
- - Tuesday
- - Wednesday
- - Thursday
- - Friday
- - Saturday
- formats:
- default: ! '%Y-%m-%d'
- long: ! '%B %d, %Y'
- short: ! '%b %d'
- month_names:
- -
- - January
- - February
- - March
- - April
- - May
- - June
- - July
- - August
- - September
- - October
- - November
- - December
- order:
- - :year
- - :month
- - :day
- datetime:
- distance_in_words:
- about_x_hours:
- one: about 1 hour
- other: about %{count} hours
- about_x_months:
- one: about 1 month
- other: about %{count} months
- about_x_years:
- one: about 1 year
- other: about %{count} years
- almost_x_years:
- one: almost 1 year
- other: almost %{count} years
- half_a_minute: half a minute
- less_than_x_minutes:
- one: less than a minute
- other: less than %{count} minutes
- less_than_x_seconds:
- one: less than 1 second
- other: less than %{count} seconds
- over_x_years:
- one: over 1 year
- other: over %{count} years
- x_days:
- one: 1 day
- other: ! '%{count} days'
- x_minutes:
- one: 1 minute
- other: ! '%{count} minutes'
- x_months:
- one: 1 month
- other: ! '%{count} months'
- x_seconds:
- one: 1 second
- other: ! '%{count} seconds'
- prompts:
- day: Day
- hour: Hour
- minute: Minute
- month: Month
- second: Seconds
- year: Year
- number:
- currency:
- format:
- delimiter: ! ','
- format: ! '%u%n'
- precision: 2
- separator: .
- significant: false
- strip_insignificant_zeros: false
- unit: $
- format:
- delimiter: ! ','
- precision: 3
- separator: .
- significant: false
- strip_insignificant_zeros: false
- human:
- decimal_units:
- format: ! '%n %u'
- units:
- billion: Billion
- million: Million
- quadrillion: Quadrillion
- thousand: Thousand
- trillion: Trillion
- unit: ''
- format:
- delimiter: ''
- precision: 3
- significant: true
- strip_insignificant_zeros: true
- storage_units:
- format: ! '%n %u'
- units:
- byte:
- one: Byte
- other: Bytes
- gb: GB
- kb: KB
- mb: MB
- tb: TB
- percentage:
- format:
- delimiter: ''
- precision:
- format:
- delimiter: ''
- support:
- array:
- last_word_connector: ! ', and '
- two_words_connector: ! ' and '
- words_connector: ! ', '
- time:
- am: am
- formats:
- default: ! '%a, %d %b %Y %H:%M:%S %z'
- long: ! '%B %d, %Y %H:%M'
- short: ! '%d %b %H:%M'
- pm: pm
\ No newline at end of file
locales/es.yml +0 -133
@@ @@ -1,133 +0,0 @@
- es:
- locomotive:
- locales:
- en: Inglés
- de: Alemán
- fr: Francés
- pl: polaco
- pt-BR: "Portugués (Brasil)"
- it: Italiano
- nl: holandés
- nb: Noruego
- es: Español
- ru: Ruso
- et: Estonio
-
- errors:
- messages:
- blank: "no puede estar en blanco"
-
- pagination:
- previous: "&laquo; Anterior"
- next: "Siguiente &raquo;"
-
- date:
- formats:
- default: "%d/%m/%Y"
- short: "%e-%b"
- long: "%e-%B-%Y"
- long_ordinal: "%e de %B de %Y"
- only_day: "%e"
-
- day_names: [Domingo, Lunes, Martes, Miércoles, Jueves, Viernes, Sábado]
- abbr_day_names: [Dom, Lun, Mar, Mie, Jue, Vie, Sab]
- month_names: [~, Enero, Febrero, Marzo, Abril, Mayo, Junio, Julio, Agosto, Septiembre, Octubre, Noviembre, Diciembre]
- abbr_month_names: [~, Ene, Feb, Mar, Abr, May, Jun, Jul, Ago, Sep, Oct, Nov, Dic]
- order: [ year, month, day ]
-
- time:
- formats:
- default: "%A, %d de %B de %Y %H:%M:%S %z"
- time: "%H:%M"
- short: "%d de %b %H:%M"
- long: "%d de %B de %Y %H:%M"
- long_ordinal: "%A %d %B %Y %H:%M:%S %Z"
- only_second: "%S"
- am: "am"
- pm: "pm"
-
-
- datetime:
- distance_in_words:
- half_a_minute: "medio minuto"
- less_than_x_seconds:
- one: "menos de 1 segundo"
- other: "menos de %{count} segundos"
- x_seconds:
- one: "1 segundo"
- other: "%{count} segundos"
- less_than_x_minutes:
- one: "menos de 1 minuto"
- other: "menos de %{count} minutos"
- x_minutes:
- one: "1 minuto"
- other: "%{count} minutos"
- about_x_hours:
- one: "alrededor de 1 hora"
- other: "alrededor de %{count} horas"
- x_days:
- one: "1 día"
- other: "%{count} días"
- about_x_months:
- one: "alrededor de 1 mes"
- other: "alrededor de %{count} meses"
- x_months:
- one: "1 mes"
- other: "%{count} meses"
- about_x_years:
- one: "alrededor de 1 año"
- other: "alrededor de %{count} años"
- over_x_years:
- one: "más de 1 año"
- other: "más de %{count} años"
- almost_x_years:
- one: "casi 1 año"
- other: "casi %{count} años"
- prompts:
- year: "Año"
- month: "Mes"
- day: "Día"
- hour: "Hora"
- minute: "Minuto"
- second: "Segundo"
-
- number:
- format:
- separator: ","
- delimiter: "."
- precision: 3
- currency:
- format:
- format: "%n %u"
- unit: "€"
- separator: ","
- delimiter: "."
- precision: 2
- percentage:
- format:
- delimiter: ""
- precision:
- format:
- delimiter: ""
- human:
- format:
- delimiter: ""
- precision: 1
- storage_units:
- format: "%n %u"
- units:
- byte:
- one: "Byte"
- other: "Bytes"
- kb: "KB"
- mb: "MB"
- gb: "GB"
- tb: "TB"
-
- support:
- array:
- sentence_connector: 'y'
- skip_last_comma: true
- words_connector: ", "
- two_words_connector: " y "
- last_word_connector: " y "
\ No newline at end of file
locales/et.yml +0 -154
@@ @@ -1,154 +0,0 @@
- et:
- locomotive:
- locales:
- en: Inglise
- de: Saksa
- fr: Prantsuse
- pl: Poola
- pt-BR: "Brasiilia Portugali"
- it: Itaalia
- nl: Hollandi
- nb: Norra
- es: Hispaania
- ru: Vene
- et: Eesti
-
- errors:
- messages:
- blank: "tühi"
-
- pagination:
- previous: "&laquo; Eelmine"
- next: "Järgmine &raquo;"
-
- date:
- formats:
- default: "%d.%m.%Y"
- short: "%e %b"
- long: "%e %B %Y"
- long_ordinal: "%e %B %Y"
- only_day: "%e"
-
- day_names: [Pühapäev, Esmaspäev, Teisipäev, Kolmapäev, Neljapäev, Reede, Laupäev]
- abbr_day_names: [Pü, Es, Te, Ko, Ne, Re, La]
- month_names: [~, Jaanuar, Veebruar, Märts, Aprill, Mai, Juuni, Juuli, August, September, Oktoober, November, Detsember]
- abbr_month_names: [~, Jaan., Veeb., Mär., Apr., Mai, Jun, Jul, Aug., Sept., Okt., Nov., Dez.]
- order: [ day, month, year ]
-
- time:
- formats:
- default: "%d %B %Y %H:%M"
- time: "%H:%M"
- short: "%d %b %H:%M"
- long: "%A %d %B %Y %H:%M:%S %Z"
- long_ordinal: "%A %d %B %Y %H:%M:%S %Z"
- only_second: "%S"
- am: 'ennelõunat'
- pm: 'pealelõunat'
-
- datetime:
- distance_in_words:
- half_a_minute: 'pool minutit'
- less_than_x_seconds:
- one: 'vähem kui 1 sekund'
- other: 'vähem kui %{count} sekundit'
- x_seconds:
- one: 'üks sekund'
- other: '%{count} sekundit'
- less_than_x_minutes:
- one: 'vähem kui üks minut'
- other: 'vähem kui %{count} minutit'
- x_minutes:
- one: 'üks minut'
- other: '%{count} minutit'
- about_x_hours:
- one: 'umber üks tund'
- other: 'umbes %{count} tundi'
- x_days:
- one: 'üks päev'
- other: '%{count} päeva'
- about_x_months:
- one: 'umbes üks kuu'
- other: 'umbes %{count} kuud'
- x_months:
- one: 'üks kuu'
- other: '%{count} kuud'
- almost_x_years:
- one: 'peaaegu üks aasta'
- other: 'peaaegu %{count} aastat'
- about_x_years:
- one: 'umbes üks aasta'
- other: 'umbes %{count} aastat'
- over_x_years:
- one: 'üle ühe aasta'
- other: 'üle %{count} aasta'
- prompts:
- second: "Sekundit"
- minute: "Minutit"
- hour: "Tundi"
- day: "Päeva"
- month: "Kuud"
- year: "Aastat"
-
- number:
- format:
- precision: 2
- separator: ' '
- delimiter: '.'
- significant: false
- strip_insignificant_zeros: false
- currency:
- format:
- unit: '€'
- format: '%n%u'
- separator: ","
- delimiter: ""
- precision: 2
- significant: false
- strip_insignificant_zeros: false
- percentage:
- format:
- delimiter: ""
- precision:
- format:
- delimiter: ""
- human:
- format:
- delimiter: ""
- precision: 1
- significant: true
- strip_insignificant_zeros: true
- storage_units:
- # Storage units output formatting.
- # %u is the storage unit, %n is the number (default: 2 MB)
- format: "%n %u"
- units:
- byte:
- one: "Bait"
- other: "Baiti"
- kb: "KB"
- mb: "MB"
- gb: "GB"
- tb: "TB"
- decimal_units:
- format: "%n %u"
- units:
- unit: ""
- thousand: Tuhat
- million: Miljon
- billion:
- one: Miljard
- others: Miljardit
- trillion: Triljon
- quadrillion:
- one: Kvadriljon
- others: Kvadriljonit
-
- support:
- array:
- sentence_connector: 'ja'
- skip_last_comma: true
- words_connector: ", "
- two_words_connector: " ja "
- last_word_connector: " ja "
-
locales/fr.yml +0 -148
@@ @@ -1,148 +0,0 @@
- fr:
- locomotive:
- locales:
- en: Anglais
- de: Allemand
- fr: Français
- pl: Polonais
- pt-BR: "Portugais"
- it: "Italien"
- nl: "Hollandais"
- nb: "Norvégien"
- es: Espagnol
- ru: Russe
- et: Estonien
- ja: Japonais
-
- errors:
- messages:
- blank: "doit être rempli(e)"
-
- pagination:
- previous: "&laquo; Précédent"
- next: "Suivant &raquo;"
- date:
- formats:
- default: "%d/%m/%Y"
- short: "%e %b"
- long: "%e %B %Y"
- long_ordinal: "%e %B %Y"
- only_day: "%e"
-
- day_names: [dimanche, lundi, mardi, mercredi, jeudi, vendredi, samedi]
- abbr_day_names: [dim, lun, mar, mer, jeu, ven, sam]
- # month_names: [~, janvier, février, mars, avril, mai, juin, juillet, août, septembre, octobre, novembre, décembre]
- # abbr_month_names: [~, jan., fév., mar., avr., mai, juin, juil., août, sept., oct., nov., déc.]
- month_names:
- - ~
- - janvier
- - février
- - mars
- - avril
- - mai
- - juin
- - juillet
- - août
- - septembre
- - octobre
- - novembre
- - décembre
- abbr_month_names:
- - ~
- - jan.
- - fév.
- - mar.
- - avr.
- - mai
- - juin
- - juil.
- - août
- - sept.
- - oct.
- - nov.
- - déc.
- order: [day, month, year]
-
- time:
- formats:
- default: "%d %B %Y %H:%M"
- time: "%H:%M"
- short: "%d %b %H:%M"
- long: "%A %d %B %Y %H:%M:%S %Z"
- long_ordinal: "%A %d %B %Y %H:%M:%S %Z"
- only_second: "%S"
- am: 'am'
- pm: 'pm'
-
- datetime:
- distance_in_words:
- half_a_minute: "une demi-minute"
- less_than_x_seconds:
- zero: "moins d'une seconde"
- one: "moins de 1 seconde"
- other: "moins de %{count} secondes"
- x_seconds:
- one: "1 seconde"
- other: "%{count} secondes"
- less_than_x_minutes:
- zero: "moins d'une minute"
- one: "moins de 1 minute"
- other: "moins de %{count} minutes"
- x_minutes:
- one: "1 minute"
- other: "%{count} minutes"
- about_x_hours:
- one: "environ une heure"
- other: "environ %{count} heures"
- x_days:
- one: "1 jour"
- other: "%{count} jours"
- about_x_months:
- one: "environ un mois"
- other: "environ %{count} mois"
- x_months:
- one: "1 mois"
- other: "%{count} mois"
- about_x_years:
- one: "environ un an"
- other: "environ %{count} ans"
- over_x_years:
- one: "plus d'un an"
- other: "plus de %{count} ans"
- prompts:
- year: "Année"
- month: "Mois"
- day: "Jour"
- hour: "Heure"
- minute: "Minute"
- second: "Seconde"
-
- number:
- format:
- precision: 3
- separator: ','
- delimiter: ' '
- currency:
- format:
- unit: '€'
- precision: 2
- format: '%n %u'
- human:
- format:
- precision: 2
- storage_units:
- format: '%n %u'
- units:
- byte: 'Octet'
- kb: 'ko'
- mb: 'Mo'
- gb: 'Go'
- tb: 'To'
-
- support:
- array:
- sentence_connector: 'et'
- skip_last_comma: true
- words_connector: ", "
- two_words_connector: " et "
- last_word_connector: " et "
\ No newline at end of file
locales/it.yml +0 -155
@@ @@ -1,155 +0,0 @@
- it:
- locomotive:
- locales:
- en: Inglese
- de: Tedesco
- fr: Francese
- pl: Polacco
- pt-BR: "Portoghese Brasiliano"
- it: Italiano
- nl: Olandese
- nb: Norvegese
- es: Spagnolo
- ru: Russo
- et: Estone
-
- errors:
- messages:
- blank: "non può essere lasciato in bianco"
-
- pagination:
- previous: "&laquo; Precedente"
- next: "Successiva &raquo;"
-
- date:
- formats:
- default: "%d/%m/%Y"
- short: "%d %b"
- long: "%d %B %Y"
- long_ordinal: "%d %B %Y"
- only_day: "%e"
-
- day_names: [Domenica, Lunedì, Martedì, Mercoledì, Giovedì, Venerdì, Sabato]
- abbr_day_names: [Dom, Lun, Mar, Mer, Gio, Ven, Sab]
- month_names: [~, Gennaio, Febbraio, Marzo, Aprile, Maggio, Giugno, Luglio, Agosto, Settembre, Ottobre, Novembre, Dicembre]
- abbr_month_names: [~, Gen, Feb, Mar, Apr, Mag, Giu, Lug, Ago, Set, Ott, Nov, Dic]
- order: [day, month, year]
-
- time:
- formats:
- default: "%a %d %b %Y, %H:%M:%S %z"
- time: "%H:%M"
- short: "%d %b %H:%M"
- long: "%d %B %Y %H:%M"
- long_ordinal: "%d %B %Y %H:%M"
- only_second: "%S"
- am: 'am'
- pm: 'pm'
-
- datetime:
- distance_in_words:
- half_a_minute: "mezzo minuto"
- less_than_x_seconds:
- one: "meno di un secondo"
- other: "meno di %{count} secondi"
- x_seconds:
- one: "1 secondo"
- other: "%{count} secondi"
- less_than_x_minutes:
- one: "meno di un minuto"
- other: "meno di %{count} minuti"
- x_minutes:
- one: "1 minuto"
- other: "%{count} minuti"
- about_x_hours:
- one: "circa un'ora"
- other: "circa %{count} ore"
- x_days:
- one: "1 giorno"
- other: "%{count} giorni"
- about_x_months:
- one: "circa un mese"
- other: "circa %{count} mesi"
- x_months:
- one: "1 mese"
- other: "%{count} mesi"
- about_x_years:
- one: "circa un anno"
- other: "circa %{count} anni"
- over_x_years:
- one: "oltre un anno"
- other: "oltre %{count} anni"
- almost_x_years:
- one: "circa 1 anno"
- other: "circa %{count} anni"
- prompts:
- year: "Anno"
- month: "Mese"
- day: "Giorno"
- hour: "Ora"
- minute: "Minuto"
- second: "Secondi"
-
- number:
- format:
- delimiter: ""
- precision: 2
- significant: false
- strip_insignificant_zeros: false
- separator: "."
-
- currency:
- format:
- format: "%n %u"
- unit: "€"
- separator: "."
- delimiter: ","
- precision: 2
- significant: false
- strip_insignificant_zeros: false
-
- percentage:
- format:
- delimiter: ""
- # precision:
-
- precision:
- format:
- # separator:
- delimiter: ""
- # precision:
-
- human:
- format:
- # separator:
- delimiter: ""
- precision: 1
- significant: true
- strip_insignificant_zeros: true
- storage_units:
- format: "%n %u"
- units:
- byte:
- one: "Byte"
- other: "Byte"
- kb: "Kb"
- mb: "Mb"
- gb: "Gb"
- tb: "Tb"
- decimal_units:
- format: "%n %u"
- units:
- unit: ""
- thousand: "Mila"
- million: "Milioni"
- billion: "Miliardi"
- trillion: "Bilioni"
- quadrillion: "Biliardi"
-
- support:
- array:
- sentence_connector: 'e'
- skip_last_comma: true
- words_connector: ", "
- two_words_connector: " e "
- last_word_connector: " e "
\ No newline at end of file
locales/nb.yml +0 -191
@@ @@ -1,191 +0,0 @@
- nb:
- locomotive:
- locales:
- en: Engelsk
- de: Tysk
- fr: Fransk
- pl: Polsk
- pt-BR: "Brazilian Portuguese"
- it: Italiensk
- nl: Nederlandsk
- nb: Norsk
- es: Spansk
- ru: Russisk
- et: Estisk
-
- date:
- formats:
- default: "%d.%m.%Y"
-
- errors:
- messages:
- blank: "kan ikke være blank"
-
- pagination:
- previous: "&laquo; Previous"
- next: "Next &raquo;"
- support:
- array:
- words_connector: ", "
- two_words_connector: " og "
- last_word_connector: " og "
- select:
- prompt: "Velg"
- date:
- formats:
- default: "%d.%m.%Y"
- short: "%e. %b"
- long: "%e. %B %Y"
- day_names:
- - søndag
- - mandag
- - tirsdag
- - onsdag
- - torsdag
- - fredag
- - lørdag
- abbr_day_names:
- - søn
- - man
- - tir
- - ons
- - tor
- - fre
- - lør
- month_names:
- - ~
- - januar
- - februar
- - mars
- - april
- - mai
- - juni
- - juli
- - august
- - september
- - oktober
- - november
- - desember
- abbr_month_names:
- - ~
- - jan
- - feb
- - mar
- - apr
- - mai
- - jun
- - jul
- - aug
- - sep
- - okt
- - nov
- - des
- order:
- - :day
- - :month
- - :year
- time:
- formats:
- default: "%A, %e. %B %Y, %H:%M"
- short: "%e. %B, %H:%M"
- long: "%A, %e. %B %Y, %H:%M"
- am: ""
- pm: ""
- datetime:
- distance_in_words:
- half_a_minute: "et halvt minutt"
- less_than_x_seconds:
- one: "mindre enn 1 sekund"
- other: "mindre enn %{count} sekunder"
- x_seconds:
- one: "1 sekund"
- other: "%{count} sekunder"
- less_than_x_minutes:
- one: "mindre enn 1 minutt"
- other: "mindre enn %{count} minutter"
- x_minutes:
- one: "1 minutt"
- other: "%{count} minutter"
- about_x_hours:
- one: "rundt 1 time"
- other: "rundt %{count} timer"
- x_days:
- one: "1 dag"
- other: "%{count} dager"
- about_x_months:
- one: "rundt 1 måned"
- other: "rundt %{count} måneder"
- x_months:
- one: "1 måned"
- other: "%{count} måneder"
- about_x_years:
- one: "rundt 1 år"
- other: "rundt %{count} år"
- over_x_years:
- one: "over 1 år"
- other: "over %{count} år"
- almost_x_years:
- one: "nesten 1 år"
- other: "nesten %{count} år"
- prompts:
- year: "År"
- month: "Måned"
- day: "Dag"
- hour: "Time"
- minute: "Minutt"
- second: "Sekund"
- number:
- format: &number_format
- precision: 2
- separator: ","
- delimiter: " "
- significant: false
- strip_insignificant_zeros: true
- currency:
- format:
- unit: "kr"
- format: "%n %u"
- <<: *number_format
- precision:
- format:
- delimiter: ""
- human:
- format:
- precision: 1
- separator: ","
- delimiter: " "
- significant: false
- strip_insignificant_zeros: true
- storage_units:
- # Storage units output formatting.
- # %u is the storage unit, %n is the number (default: 2 MB)
- format: "%n %u"
- units:
- byte:
- one: "Byte"
- other: "Bytes"
- kb: "kB"
- mb: "MB"
- gb: "GB"
- tb: "TB"
- decimal_units:
- format: "%n %u"
- units:
- unit: ""
- thousand: "tusen"
- million:
- one: "million"
- other: "millioner"
- billion:
- one: "milliard"
- other: "milliarder"
- trillion:
- one: "billion"
- other: "billioner"
- quadrillion:
- one: "billiard"
- other: "billiarder"
-
- percentage:
- format:
- delimiter: ""
\ No newline at end of file
locales/nl.yml +0 -160
@@ @@ -1,160 +0,0 @@
- nl:
- locomotive:
- locales:
- en: Engels
- de: Duits
- fr: Frans
- pt-BR: "Braziliaans Portugees"
- it: Italiaans
- nl: Nederlands
- nb: Noors
- ru: Russisch
- et: Estlands
-
- errors:
- messages:
- blank: "kan ikke være blank"
-
- number:
- format:
- separator: ","
- precision: 2
- delimiter: .
- human:
- storage_units:
- format: "%n %u"
- units:
- kb: KB
- tb: TB
- gb: GB
- byte:
- one: Byte
- other: Bytes
- mb: MB
- currency:
- format:
- format: "%u %n"
- unit: !binary |
- 4oKs
-
- separator: .
- precision: 2
- delimiter: .
-
- time:
- am: "'s ochtends"
- formats:
- default: "%a %d %b %Y %H:%M:%S %Z"
- time: "%H:%M"
- short: "%d %b %H:%M"
- only_second: "%S"
- datetime:
- formats:
- default: "%d-%m-%YT%H:%M:%S%Z"
- long: "%d %B %Y %H:%M"
- pm: "'s middages"
- date:
- month_names:
- -
- - Januari
- - Februari
- - Maart
- - April
- - Mei
- - Juni
- - Juli
- - Augustus
- - September
- - Oktober
- - November
- - December
- abbr_day_names:
- - Zon
- - Maa
- - Din
- - Woe
- - Don
- - Vri
- - Zat
- order:
- - :day
- - :month
- - :year
- formats:
- only_day: "%e"
- default: "%d/%m/%Y"
- short: "%e %b"
- long: "%e %B %Y"
- day_names:
- - Zondag
- - Maandag
- - Dinsdag
- - Woensdag
- - Donderdag
- - Vrijdag
- - Zaterdag
- abbr_month_names:
- -
- - Jan
- - Feb
- - Mar
- - Apr
- - Mei
- - Jun
- - Jul
- - Aug
- - Sep
- - Okt
- - Nov
- - Dec
- support:
- array:
- words_connector: ","
- last_word_connector: ", en"
- two_words_connector: en
- datetime:
- format:
- default: "%Y-%m-%dT%H:%M:%S%Z"
- prompts:
- minute: Minuut
- second: Seconden
- month: Maand
- hour: Uur
- day: Dag
- year: Jaar
- distance_in_words:
- less_than_x_minutes:
- one: "minder dan \xC3\xA9\xC3\xA9n minuut"
- other: minder dan {{count}} minuten
- x_days:
- one: 1 dag
- other: "{{count}} dagen"
- x_seconds:
- one: 1 seconde
- other: "{{count}} seconden"
- about_x_hours:
- one: "ongeveer \xC3\xA9\xC3\xA9n uur"
- other: ongeveer {{count}} uur
- less_than_x_seconds:
- one: "minder dan \xC3\xA9\xC3\xA9n seconde"
- other: minder dan {{count}} seconden
- x_months:
- one: 1 maand
- other: "{{count}} maanden"
- x_minutes:
- one: 1 minuut
- other: "{{count}} minuten"
- about_x_years:
- one: "ongeveer \xC3\xA9\xC3\xA9n jaar"
- other: ongeveer {{count}} jaren
- about_x_months:
- one: "ongeveer \xC3\xA9\xC3\xA9n maand"
- other: ongeveer {{count}} maanden
- over_x_years:
- one: "langer dan \xC3\xA9\xC3\xA9n jaar"
- other: langer {{count}} jaar
- half_a_minute: halve minuut
-
- pagination:
- previous: "&laquo; Vorige"
- next: "Volgende &raquo;"
\ No newline at end of file
locales/pl.yml +0 -203
@@ @@ -1,203 +0,0 @@
- pl:
- locomotive:
- locales:
- en: angielski
- de: niemiecki
- fr: francuski
- pl: polski
- pt-BR: "portugalski (brazylijski)"
- it: włoski
- nl: niderlandzki
- nb: norweski
- es: hiszpański
- ru: rosyjski
- et: estoński
-
- errors:
- messages:
- blank: "nie może być puste"
-
- date:
- formats:
- default: "%d-%m-%Y"
- short: "%d %b"
- long: "%B %d, %Y"
- long_ordinal: "%B %d, %Y"
- only_day: "%e"
- day_names:
- - niedziela
- - poniedziałek
- - wtorek
- - środa
- - czwartek
- - piątek
- - sobota
- abbr_day_names:
- - nie
- - pon
- - wto
- - śro
- - czw
- - pia
- - sob
- month_names:
- - ~
- - styczeń
- - luty
- - marzec
- - kwiecień
- - maj
- - czerwiec
- - lipiec
- - sierpień
- - wrzesień
- - październik
- - listopad
- - grudzień
- abbr_month_names:
- - ~
- - sty
- - lut
- - mar
- - kwi
- - maj
- - cze
- - lip
- - sie
- - wrz
- - paź
- - lis
- - gru
- order:
- - :day
- - :month
- - :year
-
- pagination:
- previous: "&laquo; Poprzednia"
- next: "Następna &raquo;"
-
- time:
- formats:
- default: "%a, %d %b %Y %H:%M:%S %z"
- short: "%d %b %H:%M"
- long: "%B %d, %Y %H:%M"
- am: "przed południem"
- pm: "po południu"
-
- support:
- array:
- words_connector: ", "
- two_words_connector: " i "
- last_word_connector: " oraz "
-
- select:
- prompt: "Wybierz"
-
- number:
- format:
- separator: ","
- delimiter: " "
- precision: 3
- significant: false
- strip_insignificant_zeros: false
-
- currency:
- format:
- format: "%u %n"
- unit: "PLN"
- separator: ","
- delimiter: " "
- precision: 2
- significant: false
- strip_insignificant_zeros: true
-
- percentage:
- format:
- delimiter: ""
-
- precision:
- format:
- delimiter: ""
-
- human:
- format:
- delimiter: ""
- precision: 3
- significant: true
- strip_insignificant_zeros: true
- storage_units:
- format: "%n %u"
- units:
- byte:
- one: "bajt"
- other: "bajty"
- kb: "KB"
- mb: "MB"
- gb: "GB"
- tb: "TB"
- decimal_units:
- format: "%n %u"
- units:
- unit: ""
- thousand: Tysiąc
- million: Milion
- billion: Miliard
- trillion: Bilion
- quadrillion: Biliard
-
- datetime:
- distance_in_words:
- half_a_minute: "pół minuty"
- less_than_x_seconds:
- one: "mniej niż sekundę"
- few: "mniej niż %{count} sekundy"
- other: "mniej niż %{count} sekund"
- x_seconds:
- one: "1 sekunda"
- few: "%{count} sekundy"
- other: "%{count} sekund"
- less_than_x_minutes:
- one: "mniej niż minutę"
- few: "mniej niż %{count} minuty"
- other: "mniej niż %{count} minut"
- x_minutes:
- one: "1 minuta"
- few: "%{count} minuty"
- other: "%{count} minut"
- about_x_hours:
- one: "około godziny"
- few: "około %{count} godziny"
- other: "około %{count} godzin"
- x_days:
- one: "1 dzień"
- few: "%{count} dni"
- other: "%{count} dni"
- about_x_months:
- one: "około miesiąca"
- few: "około %{count} miesiące"
- other: "około %{count} miesięcy"
- x_months:
- one: "1 miesiąc"
- few: "%{count} miesiące"
- other: "%{count} miesięcy"
- about_x_years:
- one: "około rok"
- few: "około %{count} lata"
- other: "około %{count} lat"
- over_x_years:
- one: "ponad rok"
- few: "ponad %{count} lata"
- other: "ponad %{count} lat"
- almost_x_years:
- one: "prawie rok"
- few: "prawie %{count} lata"
- other: "prawie %{count} lat"
- prompts:
- year: "Rok"
- month: "Miesiąc"
- day: "Dzień"
- hour: "Godzina"
- minute: "Minuta"
- second: "Sekundy"
-
locales/pt-BR.yml +0 -139
@@ @@ -1,139 +0,0 @@
- pt-BR:
- locomotive:
- locales:
- en: Inglês
- de: Alemão
- fr: Francês
- pl: Polonês
- pt-BR: "Português do Brasil"
- it: Italiano
- nl: Holandês
- nb: Norueguês
- es: Espanhol
- ru: Russo
- et: Estoniano
-
- errors:
- messages:
- blank: "não pode ficar em branco"
-
- date:
- formats:
- default: "%d/%m/%Y"
-
- pagination:
- previous: "&laquo; Anterior"
- next: "Próximo &raquo;"
-
- date:
- formats:
- default: "%d/%m/%Y"
- short: "%e %b"
- long: "%e %B %Y"
- long_ordinal: "%e %B %Y"
- only_day: "%e"
-
- day_names: [Domingo, Segunda, Terça, Quarta, Quinta, Sexta, Sábado]
- abbr_day_names: [Dom, Seg, Ter, Qua, Qui, Sex, Sáb]
-
- month_names: [~, Janeiro, Fevereiro, Março, Abril, Maio, Junho, Julho, Agosto, Setembro, Outubro, Novembro, Dezembro]
- abbr_month_names: [~, Jan, Fev, Mar, Abr, Mai, Jun, Jul, Ago, Set, Out, Nov, Dez]
- order: [day, month, year]
-
-
- time:
- formats:
- default: "%d %B %Y %H:%M"
- time: "%H:%M"
- short: "%d %b %H:%M"
- long: "%A %d %B %Y %H:%M:%S %Z"
- long_ordinal: "%A %d %B %Y %H:%M:%S %Z"
- only_second: "%S"
- am: 'am'
- pm: 'pm'
-
- datetime:
- distance_in_words:
- half_a_minute: 'meio minuto'
- less_than_x_seconds:
- one: 'menos de 1 segundo'
- other: 'menos de %{count} segundos'
-
- x_seconds:
- one: '1 segundo'
- other: '%{count} segundos'
-
- less_than_x_minutes:
- one: 'menos de um minuto'
- other: 'menos de %{count} minutos'
-
- x_minutes:
- one: '1 minuto'
- other: '%{count} minutos'
-
- about_x_hours:
- one: 'aproximadamente 1 hora'
- other: 'aproximadamente %{count} horas'
-
- x_days:
- one: '1 dia'
- other: '%{count} dias'
-
- about_x_months:
- one: 'aproximadamente 1 mês'
- other: 'aproximadamente %{count} meses'
-
- x_months:
- one: '1 mês'
- other: '%{count} meses'
-
- about_x_years:
- one: 'aproximadamente 1 ano'
- other: 'aproximadamente %{count} anos'
-
- over_x_years:
- one: 'mais de 1 ano'
- other: 'mais de %{count} anos'
-
- almost_x_years:
- one: 'quase 1 ano'
- other: 'quase %{count} anos'
-
- prompts:
- year: "Ano"
- month: "Mês"
- day: "Dia"
- hour: "Hora"
- minute: "Minuto"
- second: "Segundos"
-
-
- number:
- format:
- precision: 3
- separator: ','
- delimiter: '. '
- currency:
- format:
- unit: 'R$'
- precision: 2
- format: '%n %u'
- human:
- format:
- precision: 2
- storage_units:
- format: '%n %u'
- units:
- byte: 'Byte'
- kb: 'Kb'
- mb: 'Mb'
- gb: 'Gb'
- tb: 'Tb'
-
- support:
- array:
- sentence_connector: ' e '
- skip_last_comma: true
- words_connector: ", "
- two_words_connector: " e "
- last_word_connector: " e "
locales/ru.yml +0 -224
@@ @@ -1,224 +0,0 @@
- ru:
- locomotive:
- locales:
- en: Английский
- de: Немецкий
- fr: Французский
- pl: Польский
- pt-BR: "Браз. - Португальский"
- it: Итальянский
- nl: Голландский
- nb: Норвежский
- es: Испанский
- ru: Русский
- et: Эстонский
-
- errors:
- messages:
- blank: "can not be blank"
-
- pagination:
- previous: "&laquo; Предыдущая"
- next: "Следующая &raquo;"
-
- date:
- formats:
- # Форматы указываются в виде, поддерживаемом strftime.
- # По умолчанию используется default.
- # Можно добавлять собственные форматы
- #
- #
- # Use the strftime parameters for formats.
- # When no format has been given, it uses default.
- # You can provide other formats here if you like!
- default: "%d.%m.%Y"
- short: "%d %b"
- long: "%d %B %Y"
-
- # Названия дней недели -- контекстные и отдельностоящие
- day_names: [воскресенье, понедельник, вторник, среда, четверг, пятница, суббота]
- standalone_day_names: [Воскресенье, Понедельник, Вторник, Среда, Четверг, Пятница, Суббота]
- abbr_day_names: [Вс, Пн, Вт, Ср, Чт, Пт, Сб]
-
- # Названия месяцев -- сокращенные и полные, плюс отдельностоящие.
- # Не забудьте nil в начале массиве (~)
- #
- #
- # Don't forget the nil at the beginning; there's no such thing as a 0th month
- month_names: [~, января, февраля, марта, апреля, мая, июня, июля, августа, сентября, октября, ноября, декабря]
- standalone_month_names: [~, Январь, Февраль, Март, Апрель, Май, Июнь, Июль, Август, Сентябрь, Октябрь, Ноябрь, Декабрь]
- abbr_month_names: [~, янв., февр., марта, апр., мая, июня, июля, авг., сент., окт., нояб., дек.]
- standalone_abbr_month_names: [~, янв., февр., март, апр., май, июнь, июль, авг., сент., окт., нояб., дек.]
-
- # Порядок компонентов даты для хелперов
- #
- #
- # Used in date_select and datime_select.
- order:
- - :day
- - :month
- - :year
-
- time:
- # Форматы времени
- formats:
- default: "%a, %d %b %Y, %H:%M:%S %z"
- short: "%d %b, %H:%M"
- long: "%d %B %Y, %H:%M"
-
- # am/pm решено перевести как "утра/вечера" :)
- am: "утра"
- pm: "вечера"
-
- number:
- # Используется в number_with_delimiter()
- # Также является установками по умолчанию для 'currency', 'percentage', 'precision', 'human'
- #
- # Used in number_with_delimiter()
- # These are also the defaults for 'currency', 'percentage', 'precision', and 'human'
- format:
- # Sets the separator between the units, for more precision (e.g. 1.0 / 2.0 == 0.5)
- separator: "."
- # Delimets thousands (e.g. 1,000,000 is a million) (always in groups of three)
- delimiter: " "
- # Number of decimals, behind the separator (the number 1 with a precision of 2 gives: 1.00)
- precision: 3
-
- # Used in number_to_currency()
- currency:
- format:
- # Формат отображения валюты и обозначение самой валюты
- #
- #
- # Where is the currency sign? %u is the currency unit, %n the number (default: $5.00)
- format: "%n %u"
- unit: "руб."
- # These three are to override number.format and are optional
- separator: "."
- delimiter: " "
- precision: 2
-
- # Used in number_to_percentage()
- percentage:
- format:
- # These three are to override number.format and are optional
- # separator:
- delimiter: ""
-
- # Used in number_to_precision()
- precision:
- format:
- # These three are to override number.format and are optional
- # separator:
- delimiter: ""
- # precision:
-
- # Used in number_to_human_size()
- human:
- format:
- # These three are to override number.format and are optional
- # separator:
- delimiter: ""
- precision: 1
-
- # Rails 2.2
- # storage_units: [байт, КБ, МБ, ГБ, ТБ]
-
- # Rails 2.3
- storage_units:
- # Storage units output formatting.
- # %u is the storage unit, %n is the number (default: 2 MB)
- format: "%n %u"
- units:
- byte:
- one: "байт"
- few: "байта"
- many: "байт"
- other: "байта"
- kb: "КБ"
- mb: "МБ"
- gb: "ГБ"
- tb: "ТБ"
-
- # Используется в хелперах distance_of_time_in_words(), distance_of_time_in_words_to_now(), time_ago_in_words()
- #
- #
- # Used in distance_of_time_in_words(), distance_of_time_in_words_to_now(), time_ago_in_words()
- datetime:
- distance_in_words:
- half_a_minute: "меньше минуты"
- less_than_x_seconds:
- one: "меньше %{count} секунды"
- few: "меньше %{count} секунд"
- many: "меньше %{count} секунд"
- other: "меньше %{count} секунды"
- x_seconds:
- one: "%{count} секунда"
- few: "%{count} секунды"
- many: "%{count} секунд"
- other: "%{count} секунды"
- less_than_x_minutes:
- one: "меньше %{count} минуты"
- few: "меньше %{count} минут"
- many: "меньше %{count} минут"
- other: "меньше %{count} минуты"
- x_minutes:
- one: "%{count} минуту"
- few: "%{count} минуты"
- many: "%{count} минут"
- other: "%{count} минуты"
- about_x_hours:
- one: "около %{count} часа"
- few: "около %{count} часов"
- many: "около %{count} часов"
- other: "около %{count} часа"
- x_days:
- one: "%{count} день"
- few: "%{count} дня"
- many: "%{count} дней"
- other: "%{count} дня"
- about_x_months:
- one: "около %{count} месяца"
- few: "около %{count} месяцев"
- many: "около %{count} месяцев"
- other: "около %{count} месяца"
- x_months:
- one: "%{count} месяц"
- few: "%{count} месяца"
- many: "%{count} месяцев"
- other: "%{count} месяца"
- about_x_years:
- one: "около %{count} года"
- few: "около %{count} лет"
- many: "около %{count} лет"
- other: "около %{count} лет"
- over_x_years:
- one: "больше %{count} года"
- few: "больше %{count} лет"
- many: "больше %{count} лет"
- other: "больше %{count} лет"
- almost_x_years:
- one: "почти %{count} год"
- few: "почти %{count} года"
- many: "почти %{count} лет"
- other: "почти %{count} лет"
- prompts:
- year: "Год"
- month: "Месяц"
- day: "День"
- hour: "Часов"
- minute: "Минут"
- second: "Секунд"
-
-
- # Used in array.to_sentence.
- support:
- array:
- # Rails 2.2
- sentence_connector: "и"
- skip_last_comma: true
-
- # Rails 2.3
- words_connector: ", "
- two_words_connector: " и "
- last_word_connector: " и "
locomotivecms_wagon.gemspec +0 -1
@@ @@ -20,7 +20,6 @@ Gem::Specification.new do |gem|
gem.add_dependency 'thor', '~> 0.19.1'
gem.add_dependency 'thin', '~> 1.6.3'
- gem.add_dependency 'better_errors', '~> 2.1.1'
gem.add_dependency 'rubyzip', '~> 1.1.7'
gem.add_dependency 'netrc', '~> 0.10.3'
spec/integration/server/basic_spec.rb +0 -169
@@ @@ -1,169 +0,0 @@
- # encoding: utf-8
-
- require File.dirname(__FILE__) + '/../integration_helper'
- require 'locomotive/wagon/server'
- require 'rack/test'
-
- describe Locomotive::Wagon::Server do
-
- include Rack::Test::Methods
-
- def app
- run_server
- end
-
- it 'shows the index page' do
- get '/index'
- last_response.body.should =~ /Upcoming events/
- end
-
- it 'shows the 404 page' do
- get '/void'
- last_response.status.should eq(404)
- last_response.body.should =~ /page not found/
- end
-
- it 'shows the 404 page with 200 status code when its called explicitly' do
- get '/404'
- last_response.status.should eq(200)
- last_response.body.should =~ /page not found/
- end
-
- it 'shows content' do
- get '/about-us/jane-doe'
- last_response.body.should =~ /Lorem ipsum dolor sit amet/
- end
-
- it 'shows a content type template ' do
- get '/songs/song-number-1'
- last_response.body.should =~ /Song #1/
- last_response.body.should =~ /Sample website | Song #1/
- end
-
- it 'renders a page under a templatized one' do
- get '/songs/song-number-1/band'
- last_response.body.should =~ /Song #1/
- last_response.body.should =~ /Leader: Eddie/
- end
-
- it 'translates strings' do
- get '/en'
- last_response.body.should =~ /Powered by/
- get '/fr'
- last_response.body.should =~ /Propulsé par/
- get '/nb'
- last_response.body.should_not =~ /Powered by/
- end
-
- it 'provides translation in scopes' do
- get '/'
- last_response.body.should =~ /scoped_translation=.French./
- end
-
- it 'translates a page with link_to tags inside' do
- get '/fr/notre-musique'
- last_response.body.should =~ /<h3><a href="\/fr\/songs\/song-number-8">Song #8<\/a><\/h3>/
- last_response.body.should =~ /Propulsé par/
- end
-
- it 'returns all the pages' do
- get '/all'
- last_response.body.should =~ /Home page/
- last_response.body.should =~ /<li>Home page<\/li>/
- last_response.body.should =~ /<li>John-doe<\/li>/
- last_response.body.should =~ /<li>Songs<\/li>/
- last_response.body.should =~ /<li>A song template<\/li>/
- end
-
- describe 'snippets' do
-
- it 'includes a basic snippet' do
- get '/'
- last_response.body.should =~ /All photos are licensed under Creative Commons\./
- end
-
- it 'includes a snippet whose name is composed of dash' do
- get '/'
- last_response.body.should =~ /<p>A complicated one name indeed.<\/p>/
- end
-
- end
-
- describe 'nav' do
-
- subject { get '/all'; last_response.body }
-
- it { should_not match(/<nav id="nav">/) }
-
- it { should match(/<li id="about-us-link" class="link first"><a href="\/about-us">About Us<\/a><\/li>/) }
-
- it { should match(/<li id="music-link" class="link"><a href="\/music">Music<\/a><\/li>/) }
-
- it { should match(/<li id="store-link" class="link"><a href="\/store">Store<\/a><\/li>/) }
-
- it { should match(/<li id="contact-link" class="link last"><a href="\/contact">Contact Us<\/a><\/li>/) }
-
- it { should_not match(/<li id="events-link" class="link"><a href="\/events">Events<\/a><\/li>/) }
-
- describe 'with wrapper' do
-
- subject { get '/tags/nav'; last_response.body }
-
- it { should match(/<nav id="nav">/) }
-
- end
-
- describe 'very deep' do
-
- subject { get '/tags/nav_in_deep'; last_response.body }
-
- it { should match(/<li id=\"john-doe-link\" class=\"link first last\">/) }
-
- end
-
- end
-
- describe 'contents with_scope' do
- subject { get '/grunge_bands'; last_response.body }
-
- it { should match(/Layne/)}
- it { should_not match(/Peter/) }
- end
-
- describe "pages with_scope" do
- subject { get '/unlisted_pages'; last_response.body }
- it { subject.should match(/Page to test the nav tag/)}
- it { should_not match(/About Us/)}
- end
-
- describe 'theme assets' do
-
- subject { get '/all'; last_response.body }
-
- it { should match(/<link href="\/stylesheets\/application.css" media="screen" rel="stylesheet" type="text\/css" \/>/) }
-
- it { should match(/<script src="\/javascripts\/application.js" type='text\/javascript'><\/script>/) }
-
- it { should match(/<link rel="alternate" type="application\/atom\+xml" title="A title" href="\/foo\/bar" \/>/) }
-
- end
-
- describe 'session' do
-
- subject { get '/contest'; last_response.body }
-
- it { should match(/Your code is: HELLO WORLD/) }
- it { should_not match(/You've already participated to that contest ! Come back later./) }
-
- describe 'assign tag' do
-
- subject { 2.times { get '/contest' }; last_response.body }
-
- it { should_not match(/Your code is: HELLO WORLD/) }
- it { should match(/You've already participated to that contest ! Come back later./) }
-
- end
-
- end
-
- end
\ No newline at end of file
spec/integration/server/contact_form_spec.rb +0 -111
@@ @@ -1,111 +0,0 @@
- # encoding: utf-8
-
- require File.dirname(__FILE__) + '/../integration_helper'
- require 'locomotive/wagon/server'
- require 'rack/test'
-
- describe 'ContactForm' do
-
- include Rack::Test::Methods
-
- def app
- run_server
- end
-
- it 'renders the form' do
- get '/contact'
- last_response.body.should =~ /\/entry_submissions\/messages.json/
- end
-
- describe '#submit' do
-
- let(:params) { {
- 'entry' => { 'name' => 'John', 'email' => 'j@doe.net', 'message' => 'Bla bla' },
- 'success_callback' => '/events',
- 'error_callback' => '/contact' } }
- let(:response) { post_contact_form(params, false) }
- let(:status) { response.status }
-
- describe 'with json request' do
-
- let(:response) { post_contact_form(params, true) }
- let(:entry) { JSON.parse(response.body) }
-
- context 'when not valid' do
-
- let(:params) { {} }
-
- it 'returns an error status' do
- response.status.should == 422
- end
-
- describe 'errors' do
-
- subject { entry['errors'] }
-
- it { should have_key_with_value('name', "can't not be blank") }
-
- it { should have_key_with_value('email', "can't not be blank") }
-
- it { should have_key_with_value('message', "can't not be blank") }
-
- end
-
- end
-
- context 'when valid' do
-
- it 'returns a success status' do
- response.status.should == 200
- end
-
- end
-
- end
-
- describe 'with html request' do
-
- context 'when not valid' do
-
- let(:params) { { 'error_callback' => '/contact' } }
-
- it 'returns a success status' do
- response.status.should == 200
- end
-
- it 'displays errors' do
- response.body.to_s.should =~ /can't not be blank/
- end
-
- end
-
- context 'when valid' do
-
- let(:response) { post_contact_form(params, false, true) }
-
- it 'returns a success status' do
- response.status.should == 200
- end
-
- it 'displays a success message' do
- response.body.should =~ /Thank you John/
- end
-
- end
-
- end
-
- end
-
- def post_contact_form(params, json = false, follow_redirect = false)
- url = '/entry_submissions/messages'
- url += '.json' if json
- params = params.symbolize_keys if json
- post url, params
- if follow_redirect
- follow_redirect!
- end
- last_response
- end
-
- end
spec/integration/server/liquid_spec.rb +0 -98
@@ @@ -1,98 +0,0 @@
- # encoding: utf-8
-
- require File.dirname(__FILE__) + '/../integration_helper'
- require 'locomotive/wagon/server'
- require 'rack/test'
-
- describe Locomotive::Wagon::Server do
-
- include Rack::Test::Methods
-
- def app
- run_server
- end
-
- it "converts {{ page.templatized? }} => true on templatized page" do
- get '/songs/song-number-1'
- last_response.body.should =~ /templatized=.true./
- end
-
- it "converts {{ page.templatized? }} => false on regular page" do
- get '/index'
- last_response.body.should =~ /templatized=.false./
- end
-
- it "converts {{ page.listed? }} => true on listed page" do
- get '/music'
- last_response.body.should =~ /listed=.true./
- end
-
- it "provides an access to page's content_type collection" do
- get '/songs/song-number-1'
- last_response.body.should =~ /content_type_size=.8./
- end
-
- it "provides count alias on collections" do
- get '/songs/song-number-1'
- last_response.body.should =~ /content_type_count=.8./
- end
-
- describe '.link_to' do
-
- it "writes a link to a page" do
- get '/events'
- last_response.body.should =~ /Discover: <a href="\/music">Music<\/a>/
- end
-
- it "writes a localized a link" do
- get '/events'
- last_response.body.should =~ /Plus à notre sujet: <a href="\/fr\/a-notre-sujet">Qui sommes nous \?<\/a>/
- end
-
- it "writes a link to a page with a custom label" do
- get '/events'
- last_response.body.should =~ /More about us: <a href="\/about-us">Who are we \?<\/a>/
- end
-
- it "writes a link to a templatized page" do
- get '/events'
- last_response.body.should =~ /<a href="\/songs\/song-number-1">Song #1<\/a>/
- end
-
- it "writes a link to a templatized page with a different handle" do
- get '/events'
- last_response.body.should =~ /<a href="\/songs\/song-number-8">Song #8<\/a>/
- end
-
- end
-
- describe 'scope & assigns' do
-
- it "evaluates collection when called all inside of scope" do
- get '/music'
- last_response.body.should =~ /<p class=.scoped_song.>Song #3/
- last_response.body.should =~ /<p class=.scoped_song_link.>\s+<a href=.\/songs\/song-number-3.>Song #3/m
- end
-
- it "size of evaluated unscoped collection equal to unevaluated one" do
- get '/music'
- last_response.body.should =~ /class=.collection_equality.>8=8/
- end
-
- end
-
- describe 'html helpers' do
- it 'bypass url for css resource' do
- get '/'
- last_response.body.should =~ /<link href=("|')http:\/\/fonts\.googleapis\.com\/css\?family=Open\+Sans:400,700("|')/
- end
- end
-
- describe 'fetch_page' do
- it 'returns the title of a page' do
- get '/all'
- last_response.body.should =~ %r(<p>Single page: Music</p>)
- end
- end
-
- end
\ No newline at end of file
spec/integration/server/new_contact_form_spec.rb +0 -67
@@ @@ -1,67 +0,0 @@
- # encoding: utf-8
-
- require File.dirname(__FILE__) + '/../integration_helper'
- require 'locomotive/wagon/server'
- require 'rack/test'
-
- describe 'NewContactForm' do
-
- include Rack::Test::Methods
-
- def app
- run_server
- end
-
- it 'renders the form' do
- get '/events'
- last_response.body.should =~ %r(<form method="POST" enctype="multipart/form-data" id="contactform">)
- end
-
- describe '#submit' do
-
- let(:params) { {
- 'content_type_slug' => 'messages',
- 'entry' => { 'name' => 'John', 'email' => 'j@doe.net', 'message' => 'Bla bla' } } }
- let(:response) { post_contact_form(params) }
- let(:status) { response.status }
-
- context 'when not valid' do
-
- let(:params) { { 'content_type_slug' => 'messages' } }
-
- it 'returns a success status' do
- response.status.should == 200
- end
-
- it 'displays errors' do
- response.body.to_s.should =~ /can't not be blank/
- end
-
- end
-
- context 'when valid' do
-
- let(:response) { post_contact_form(params, true) }
-
- it 'returns a success status' do
- response.status.should == 200
- end
-
- it 'displays a success message' do
- response.body.should =~ /Thank you John/
- end
-
- end
-
- end
-
- def post_contact_form(params, follow_redirect = false)
- url = '/events'
- post url, params
-
- follow_redirect! if follow_redirect
-
- last_response
- end
-
- end
spec/integration/server/with_scope_spec.rb +0 -30
@@ @@ -1,30 +0,0 @@
- # encoding: utf-8
-
- require File.dirname(__FILE__) + '/../integration_helper'
- require 'locomotive/wagon/server'
- require 'rack/test'
-
- describe 'Complex with_scope conditions' do
-
- include Rack::Test::Methods
-
- def app
- run_server
- end
-
- it 'returns the right number of events' do
- get '/filtered'
- last_response.body.should =~ /events=1./
- end
-
- it 'returns the right number of bands' do
- get '/filtered'
- last_response.body.should =~ /bands=2./
- end
-
- it 'returns the first band in the right order' do
- get '/filtered'
- last_response.body.should =~ /first event=Browne's Market/
- end
-
- end
\ No newline at end of file
spec/support/helpers.rb +0 -8
@@ @@ -33,14 +33,6 @@ module Spec
FileUtils.rm_rf(path)
end
- def run_server
- path = 'spec/fixtures/default'
- Locomotive::Wagon::Logger.setup(path, false)
- reader = Locomotive::Mounter::Reader::FileSystem.instance
- reader.run!(path: path)
- Locomotive::Wagon::Server.new(reader, disable_listen: true)
- end
-
def open_in_browser
path = File.join(File.dirname(__FILE__), '..', 'tmp', "wagon-#{Time.new.strftime("%Y%m%d%H%M%S")}#{rand(10**10)}.html")
FileUtils.mkdir_p(File.dirname(path))