list site templates + generate site
did
committed Mar 31, 2015
commit 916d1ac984053111c4047193922c2aab0594d82f
Showing 4
changed files with
35 additions
and 7 deletions
locomotive/wagon.rb b/lib/locomotive/wagon.rb
+4
-5
| @@ | @@ -1,3 +1,5 @@ |
| + | require_relative 'wagon/exceptions' |
| + | |
| module Locomotive | |
| module Wagon | |
| @@ | @@ -55,11 +57,8 @@ module Locomotive |
| # @param [ Hash ] options General options (ex: --force-color) | |
| # | |
| def self.init(generator_klass, args, options = {}) | |
| - | args, opts = Thor::Options.split(args) |
| - | |
| - | generator = generator_klass.new(args, opts, {}) |
| - | generator.force_color_if_asked(options) |
| - | generator.invoke_all |
| + | require_relative 'wagon/commands/init_command' |
| + | Locomotive::Wagon::InitCommand.generate(generator_klass, args, options) |
| end | |
| # Start the thin server which serves the LocomotiveCMS site from the system. | |
locomotive/wagon/commands/init_command.rb b/lib/locomotive/wagon/commands/init_command.rb
+19
-0
| @@ | @@ -0,0 +1,19 @@ |
| + | module Locomotive::Wagon |
| + | |
| + | class InitCommand < Struct.new(:generator_klass, :args, :options) |
| + | |
| + | def self.generate(klass, args, options) |
| + | new(klass, args, options).generate |
| + | end |
| + | |
| + | def generate |
| + | args, opts = Thor::Options.split(self.args) |
| + | |
| + | generator = generator_klass.new(args, opts, {}) |
| + | generator.force_color_if_asked(options) |
| + | generator.invoke_all |
| + | end |
| + | |
| + | end |
| + | |
| + | end |
locomotive/wagon/exceptions.rb b/lib/locomotive/wagon/exceptions.rb
+10
-0
| @@ | @@ -0,0 +1,10 @@ |
| + | require 'locomotive/common/exception' |
| + | |
| + | module Locomotive |
| + | module Wagon |
| + | |
| + | class GeneratorException < Locomotive::Common::DefaultException |
| + | end |
| + | |
| + | end |
| + | end |
locomotive/wagon/generators/site/unzip.rb b/lib/locomotive/wagon/generators/site/unzip.rb
+2
-2
| @@ | @@ -1,5 +1,5 @@ |
| require 'open-uri' | |
| - | require 'zip/zipfilesystem' |
| + | require 'zip' |
| module Locomotive | |
| module Wagon | |
| @@ | @@ -86,4 +86,4 @@ module Locomotive |
| end | |
| end | |
| end | |
| - | end |
| \ No newline at end of file | |
| + | end |