module Locomotive::Wagon

Constants

DEFAULT_PLATFORM_URL
SiteFinder
VERSION

Public Class Methods

authenticate(url, email, password, shell) click to toggle source

Authenticate an user to the Hosting platform. If the user does not exist, then create an account for her/him. At the end, store the API key in the ~/.netrc file

@param [ String ] email The email of the user @param [ String ] password The password of the user @param [ Object ] shell Used to ask for/prompt information

# File lib/locomotive/wagon.rb, line 17
def self.authenticate(url, email, password, shell)
  require_relative 'wagon/commands/authenticate_command'
  Locomotive::Wagon::AuthenticateCommand.authenticate(url, email, password, shell)
end
clone(name, path, options, shell) click to toggle source

Clone a site from a remote LocomotiveCMS engine.

@param [ String ] name Name of the site (arbitrary) @param [ String ] path The root path where the site will be cloned @param [ Hash ] connection_info The host, email and password needed to access the remote engine @param [ Hash ] options The options for the API reader

# File lib/locomotive/wagon.rb, line 108
def self.clone(name, path, options, shell)
  require_relative 'wagon/commands/clone_command'
  Locomotive::Wagon::CloneCommand.clone(name, path, options, shell)
end
delete(env, path, resource, slug, shell) click to toggle source

Delete one or all remote resource(s)

@param [ String ] env The environment we use to deploy the site to @param [ String ] path The path of the site @param [ String ] resource The resource from which we want to delete an entry or all entries @param [ String ] slug The slug of the resource to delete

# File lib/locomotive/wagon.rb, line 119
def self.delete(env, path, resource, slug, shell)
  require_relative 'wagon/commands/delete_command'
  Locomotive::Wagon::DeleteCommand.delete(env, path, resource, slug, shell)
end
generate(name, args, options = {}) click to toggle source

Generate components for the LocomotiveCMS site such as content types, snippets, pages.

@param [ Symbol ] name The name of the generator @param [ Array ] *args The arguments for the generator @param [ Hash ] options The options for the generator

# File lib/locomotive/wagon.rb, line 59
def self.generate(name, args, options = {})
  require_relative 'wagon/commands/generate_command'
  Locomotive::Wagon::GenerateCommand.generate(name, args, options)
end
init(generator_klass, args, options = {}) click to toggle source

Create a site from a site generator.

@param [ Object ] generator The wrapping class of the generator itself @param [ Array ] args [name of the site, destination path of the site] @param [ Hash ] options General options (ex: –force-color)

# File lib/locomotive/wagon.rb, line 28
def self.init(generator_klass, args, options = {})
  require_relative 'wagon/commands/init_command'
  Locomotive::Wagon::InitCommand.generate(generator_klass, args, options)
end
pull(env, path, options = {}, shell) click to toggle source

Pull a site from a remote LocomotiveCMS engine described by the config/deploy.yml file of the site and for a specific environment.

@param [ String ] path The path of the site @param [ Hash ] connection_info The information to get connected to the remote site @param [ Hash ] options The options passed to the pull process

# File lib/locomotive/wagon.rb, line 84
def self.pull(env, path, options = {}, shell)
  require_relative 'wagon/commands/pull_command'
  Locomotive::Wagon::PullCommand.pull(env, path, options, shell)
end
push(env, path, options = {}, shell) click to toggle source

Push a site to a remote LocomotiveCMS engine described by the config/deploy.yml file of the site and for a specific environment.

@param [ String ] env The environment we deploy the site to @param [ String ] path The path of the site @param [ Object ] shell The Thor shell used to ask for information if needed @param [ Hash ] options The options passed to the push process

# File lib/locomotive/wagon.rb, line 72
def self.push(env, path, options = {}, shell)
  require_relative 'wagon/commands/push_command'
  Locomotive::Wagon::PushCommand.push(env, path, options, shell)
end
require_misc_gems() click to toggle source
# File lib/locomotive/wagon.rb, line 124
def self.require_misc_gems
  return if ENV['WAGON_GEMFILE'].nil?

  # at this point, we are sure that in a bundle exec contact
  begin
    require 'bundler'
    ::Bundler.require(:misc)
  rescue Exception => e
    puts "Warning: cant' require the Gemfile misc group, reason: #{e.message}"
    # Bundler is not defined or there is an issue
    # with one of the gems in the misc group
  end
end
serve(path, options, shell) click to toggle source

Start the thin server which serves the LocomotiveCMS site from the system.

@param [ String ] path The path of the site @param [ Hash ] options The options for the thin server (host, port)

# File lib/locomotive/wagon.rb, line 38
def self.serve(path, options, shell)
  require_relative 'wagon/commands/serve_command'
  Locomotive::Wagon::ServeCommand.start(path, options, shell)
end
stop(path, force = false, shell) click to toggle source

Stop the thin server.

@param [ String ] path The path of the site @param [ Hash ] force If true, block the current thread for 2s

# File lib/locomotive/wagon.rb, line 48
def self.stop(path, force = false, shell)
  require_relative 'wagon/commands/serve_command'
  Locomotive::Wagon::ServeCommand.stop(path, force, shell)
end
sync(env, path, options = {}, shell) click to toggle source

Synchronize the local content with the one from a remote Locomotive engine. by the config/deploy.yml file of the site and for a specific environment.

@param [ String ] path The path of the site @param [ Hash ] connection_info The information to get connected to the remote site @param [ Hash ] options The options passed to the pull process

# File lib/locomotive/wagon.rb, line 96
def self.sync(env, path, options = {}, shell)
  require_relative 'wagon/commands/sync_command'
  Locomotive::Wagon::SyncCommand.sync(env, path, options, shell)
end