Top Level Namespace
Defined Under Namespace
Modules: Weeblybundler
Instance Method Summary collapse
- #handleApp(path) ⇒ Object
- #handleTheme(path, publish = false) ⇒ Object
- #watch(type, path, publish = false) ⇒ Object
Instance Method Details
#handleApp(path) ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/weeblybundler/cli.rb', line 18 def handleApp( path ) client_id = ENV['WEEBLY_CLIENT_ID'] secret = ENV['WEEBLY_SECRET'] domain = ENV['WEEBLY_DOMAIN'] || 'https://www.weebly.com' bundle = Weeblybundler::Bundle.new('app', path, domain, {'client_id' => client_id, 'secret' => secret, 'domain' => domain}) if bundle.is_valid? response = bundle.sync('/platform/app') begin ap JSON.parse(response.body) rescue ap "There was a problem uploading your element to #{domain}/platform/app" ap response.body bundle.cleanup end else ap bundle.errors end end |
#handleTheme(path, publish = false) ⇒ Object
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/weeblybundler/cli.rb', line 39 def handleTheme( path, publish = false ) domain = ENV['WEEBLY_DOMAIN'] || 'https://www.weebly.com' site_id = ENV['WEEBLY_SITE_ID'] token = ENV['WEEBLY_TOKEN'] email = ENV['WEEBLY_EMAIL'] bundle = Weeblybundler::Bundle.new('theme', path, domain, {'domain' => domain, 'site_id' => site_id, 'token' => token, 'email' => email}) if bundle.is_valid? response = bundle.sync('/platform/theme', publish) begin ap JSON.parse(response) rescue ap "There was a problem uploading your element to #{domain}/platform/theme" ap response.body bundle.cleanup end else ap bundle.errors end end |
#watch(type, path, publish = false) ⇒ Object
7 8 9 10 11 12 13 14 15 16 |
# File 'lib/weeblybundler/cli.rb', line 7 def watch( type, path, publish = false ) puts 'Watching for ' + type + ' changes...' FileWatcher.new(path, interval: 0.1).watch() do |filename| if type === "app" handleApp(path) elsif type === 'theme' handleTheme(path, publish) end end end |