Class: Guard::Shopifytheme
- Inherits:
-
Plugin
- Object
- Plugin
- Guard::Shopifytheme
- Defined in:
- lib/guard/shopifytheme.rb
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Shopifytheme
constructor
VERSION = “0.0.1”.
-
#run_on_changes(paths) ⇒ Object
Default behaviour on file(s) changes that the Guard plugin watches.
-
#run_on_removals(paths) ⇒ Object
Called on file(s) removals that the Guard plugin watches.
-
#start ⇒ Object
Called once when Guard starts.
Constructor Details
#initialize(options = {}) ⇒ Shopifytheme
VERSION = “0.0.1”
11 12 13 |
# File 'lib/guard/shopifytheme.rb', line 11 def initialize( = {}) super end |
Instance Method Details
#run_on_changes(paths) ⇒ Object
Default behaviour on file(s) changes that the Guard plugin watches.
70 71 72 73 74 |
# File 'lib/guard/shopifytheme.rb', line 70 def run_on_changes(paths) paths.each do |path| system "theme upload #{path}" end end |
#run_on_removals(paths) ⇒ Object
Called on file(s) removals that the Guard plugin watches.
100 101 102 103 104 |
# File 'lib/guard/shopifytheme.rb', line 100 def run_on_removals(paths) paths.each do |path| system "theme remove #{path}" end end |
#start ⇒ Object
Called once when Guard starts. Please override initialize method to init stuff.
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/guard/shopifytheme.rb', line 20 def start if File.exist? 'config.yml' Notifier.notify "Watching for changes to Shopify Theme" else data = <<-EOF --- :api_key: YOUR_API_KEY :password: YOUR_PASSWORD :store: YOURSHOP.myshopify.com :theme_id: 'YOUR_THEME_ID' :ignore_files: - README.md - CHANGELOG.md EOF File.open('./config.yml', "w") { |file| file.write data } Notifier.notify "Created config.yml. Remember to add your Shopify details to it." end end |