Class: Squarespace::Sync::Cli
- Inherits:
-
Thor
- Object
- Thor
- Squarespace::Sync::Cli
- Includes:
- Thor::Actions
- Defined in:
- lib/squarespace/sync/cli.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.source_root ⇒ Object
50 51 52 |
# File 'lib/squarespace/sync/cli.rb', line 50 def self.source_root File.dirname(__FILE__) end |
Instance Method Details
#pull(file = nil) ⇒ Object
39 40 41 42 43 44 45 46 47 48 |
# File 'lib/squarespace/sync/cli.rb', line 39 def pull(file=nil) Connection.new do |sftp, , instance| if file local_file = File.join(Squarespace::Sync.local_path, file) instance.pull_file( sftp, File.join([:directory], file), local_file ) else instance.pull_tree( sftp, [:directory] ) end end end |
#push(file = nil) ⇒ Object
27 28 29 30 31 32 33 34 35 36 |
# File 'lib/squarespace/sync/cli.rb', line 27 def push(file=nil) Connection.new do |sftp, , instance| if file local_file = File.join(Squarespace::Sync.local_path, file) instance.push_file( sftp, local_file, File.join([:directory], file) ) else instance.push_tree( sftp, [:directory] ) end end end |
#setup ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/squarespace/sync/cli.rb', line 12 def setup output_file = File.join(Squarespace::Sync.local_path, "squarespace.yaml") template_file = "squarespace.tt" = { host: "dev.squarespace.com", username: "[email protected]", password: "\"\"", directory: "your-site", port: 2030, ignore: %w{.gitignore Gemfile Gemfile.lock} } template( template_file, output_file, ) end |
#version ⇒ Object
7 8 9 |
# File 'lib/squarespace/sync/cli.rb', line 7 def version say Squarespace::Sync::VERSION end |