Class: KajabiTheme::CLI
- Inherits:
-
Thor
- Object
- Thor
- KajabiTheme::CLI
- Includes:
- Thor::Actions
- Defined in:
- lib/kajabi_theme/cli.rb
Constant Summary collapse
- FOLDERS =
%w[config templates layouts sections snippets assets].freeze
- ACCOUNT_SETTINGS_URL =
"https://app.newkajabi.com/admin/settings/account"
Instance Attribute Summary collapse
-
#created_at ⇒ Object
readonly
Returns the value of attribute created_at.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#presigned_post ⇒ Object
readonly
Returns the value of attribute presigned_post.
-
#updated_at ⇒ Object
readonly
Returns the value of attribute updated_at.
Instance Method Summary collapse
Instance Attribute Details
#created_at ⇒ Object (readonly)
Returns the value of attribute created_at.
19 20 21 |
# File 'lib/kajabi_theme/cli.rb', line 19 def created_at @created_at end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
17 18 19 |
# File 'lib/kajabi_theme/cli.rb', line 17 def name @name end |
#presigned_post ⇒ Object (readonly)
Returns the value of attribute presigned_post.
20 21 22 |
# File 'lib/kajabi_theme/cli.rb', line 20 def presigned_post @presigned_post end |
#updated_at ⇒ Object (readonly)
Returns the value of attribute updated_at.
18 19 20 |
# File 'lib/kajabi_theme/cli.rb', line 18 def updated_at @updated_at end |
Instance Method Details
#configure ⇒ Object
44 45 46 47 48 49 50 51 52 |
# File 'lib/kajabi_theme/cli.rb', line 44 def configure theme_id = ask("Kajabi Theme ID:") api_key = ask("API Key (#{ACCOUNT_SETTINGS_URL}):") api_secret = ask("API Secret (#{ACCOUNT_SETTINGS_URL}):") create_file "config.yml" do { theme_id: theme_id, api_key: api_key, api_secret: api_secret }.to_yaml end end |
#sync(force = true) ⇒ Object
23 24 25 26 27 |
# File 'lib/kajabi_theme/cli.rb', line 23 def sync(force=true) refresh! (force ? files : changed_files).each {|f| send_file(f)} hydra.run end |
#watch ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/kajabi_theme/cli.rb', line 30 def watch refresh! sync(false) say "Watching for file changes..." FileWatcher.new(FOLDERS).watch do |filename| say "Change detected: #{filename}" send_file(filename) hydra.run end end |