the clone command can now take an api key
did
committed May 31, 2013
commit f4d446626766917e8e4cca6f0b60f748711e9dfa
Showing 7
changed files with
28 additions
and 12 deletions
Gemfile
+1
-1
| @@ | @@ -4,6 +4,6 @@ source 'https://rubygems.org' |
| gemspec | |
| # Development | |
| - | # gem 'locomotivecms_mounter', path: '../gems/mounter', require: false |
| + | gem 'locomotivecms_mounter', path: '../gems/mounter', require: false |
| gem 'rb-fsevent', '~> 0.9.1' | |
| \ No newline at end of file | |
generators/blank/config/deploy.yml
+4
-1
| @@ | @@ -2,11 +2,14 @@ development: |
| host: dev.example.com | |
| email: john@doe.net | |
| password: apassword | |
| + | # api_key: <your api key here> |
| staging: | |
| host: staging.example.com | |
| email: john@doe.net | |
| password: apassword | |
| + | # api_key: <your api key here> |
| production: | |
| host: www.example.com | |
| email: john@doe.net | |
| - | password: apassword |
| \ No newline at end of file | |
| + | password: apassword |
| + | # api_key: <your api key here> |
| \ No newline at end of file | |
generators/bootstrap/config/deploy.yml
+4
-1
| @@ | @@ -2,11 +2,14 @@ development: |
| host: dev.example.com | |
| email: john@doe.net | |
| password: apassword | |
| + | # api_key: <your api key here> |
| staging: | |
| host: staging.example.com | |
| email: john@doe.net | |
| password: apassword | |
| + | # api_key: <your api key here> |
| production: | |
| host: www.example.com | |
| email: john@doe.net | |
| - | password: apassword |
| \ No newline at end of file | |
| + | password: apassword |
| + | # api_key: <your api key here> |
| \ No newline at end of file | |
generators/cloned/config/deploy.yml.tt
+5
-1
| @@ | @@ -1,4 +1,8 @@ |
| production: | |
| host: <%= config[:host] %> | |
| + | <% if config[:email] -%> |
| email: <%= config[:email] %> | |
| - | password: <%= config[:password] %> |
| \ No newline at end of file | |
| + | password: <%= config[:password] %> |
| + | <% elsif config[:api_key] -%> |
| + | api_key: <%= config[:api_key] -%> |
| + | <% end -%> |
| \ No newline at end of file | |
generators/foundation/config/deploy.yml
+4
-1
| @@ | @@ -2,11 +2,14 @@ development: |
| host: dev.example.com | |
| email: john@doe.net | |
| password: apassword | |
| + | # api_key: <your api key here> |
| staging: | |
| host: staging.example.com | |
| email: john@doe.net | |
| password: apassword | |
| + | # api_key: <your api key here> |
| production: | |
| host: www.example.com | |
| email: john@doe.net | |
| - | password: apassword |
| \ No newline at end of file | |
| + | password: apassword |
| + | # api_key: <your api key here> |
| \ No newline at end of file | |
locomotive/wagon.rb b/lib/locomotive/wagon.rb
+3
-3
| @@ | @@ -115,7 +115,7 @@ module Locomotive |
| # generate an almost blank site | |
| require 'locomotive/wagon/generators/site' | |
| generator = Locomotive::Wagon::Generators::Site::Cloned | |
| - | generator.start [name, path, connection_info] |
| + | generator.start [name, path, connection_info.symbolize_keys] |
| # pull the remote site | |
| self.pull(target_path, options.merge(connection_info).with_indifferent_access, { disable_misc: true }) | |
| @@ | @@ -162,11 +162,11 @@ module Locomotive |
| end | |
| end | |
| end | |
| - | |
| + | |
| protected | |
| def self.validate_resources(resources, writers_or_readers) | |
| return if resources.nil? | |
| - | valid_resources = writers_or_readers.map { |thing| thing.to_s.demodulize.gsub(/Writer$|Reader$/, '').underscore } |
| + | valid_resources = writers_or_readers.map { |thing| thing.to_s.demodulize.gsub(/Writer$|Reader$/, '').underscore } |
| resources.each do |resource| | |
| raise ArgumentError, "'#{resource}' resource not recognized. Valid resources are #{valid_resources.join(', ')}." unless valid_resources.include?(resource) | |
| end | |
locomotive/wagon/cli.rb b/lib/locomotive/wagon/cli.rb
+7
-4
| @@ | @@ -135,11 +135,14 @@ module Locomotive |
| end | |
| end | |
| - | desc 'clone NAME HOST EMAIL PASSWORD [PATH]', 'Clone a remote LocomotiveCMS site' |
| - | method_option :verbose, aliases: '-v', type: 'boolean', default: false, desc: 'display the full error stack trace if an error occurs' |
| - | def clone(name, host, email, password, path = '.') |
| + | desc 'clone NAME HOST [PATH]', 'Clone a remote LocomotiveCMS site' |
| + | method_option :verbose, aliases: '-v', type: 'boolean', default: false, desc: 'display the full error stack trace if an error occurs' |
| + | method_option :email, aliases: '-e', desc: 'email of an administrator account' |
| + | method_option :password, aliases: '-p', desc: 'password of an administrator account' |
| + | method_option :api_key, aliases: '-a', desc: 'api key of an administrator account' |
| + | def clone(name, host, path = '.') |
| begin | |
| - | if Locomotive::Wagon.clone(name, path, host: host, email: email, password: password) |
| + | if Locomotive::Wagon.clone(name, path, { host: host }.merge(options)) |
| self.print_next_instructions_when_site_created(name, path) | |
| end | |
| rescue Exception => e | |