weeblybundler 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 63ba5cddb9a5b6ff4671950d505d016cbc6b56b0
4
- data.tar.gz: d2636ccc1e227364d4e776472000af8019d77d62
3
+ metadata.gz: b054e4bc180a95f2f1a545d846b53ad6284488d1
4
+ data.tar.gz: a880832a9f91f4e072d637b0ca1972fd906b78a7
5
5
  SHA512:
6
- metadata.gz: f954a8995f25582a1de864a7dd99e449a9d42bc1029f5acb881b4ea8159fa0a2d3d9257831e3eed067db97c51e6e85b771304f844126a4eb6a321f7a009a0ad1
7
- data.tar.gz: 4fb11cf8218e5440b430347f6a979c207031e7e87655a75edbed937cfb60ddd36c2da1bcd4c9a231df01cf89fa55933c7c337ced759183fb5c0a22665d2de435
6
+ metadata.gz: 3f1be9ccf3f18d4b4351f3eb89573dbeb5cf5fb4e966619bbd6821b1e507d37907a37b3ad78f097e84e4da948bbf533f22f811381fa6ac3209130a42d43da94c
7
+ data.tar.gz: dd136907a20aa3366b9f87618ba6c83147598b66898c492bd6afb10073b94b88f8f921731f240e62ed183a59a20cb33277a24fdce5a3477fbb8e8a9927e1b3f6
data/README.md CHANGED
@@ -2,9 +2,11 @@
2
2
 
3
3
  WeeblyBundler is a CLI tool created to enable Weebly Platform Developers to rapidly deploy their apps and upload their themes.
4
4
 
5
- ## Installation
5
+ ## Installing via rubygems (Recommended)
6
6
 
7
- Please note, this process will be significantly easier once the gem is released on rubygems.
7
+ `gem install weeblybundler`
8
+
9
+ ## Installing via Source
8
10
 
9
11
  Download the source code
10
12
 
@@ -30,7 +32,7 @@ Good to go!
30
32
 
31
33
  ### Uploading Apps
32
34
 
33
- Before uploading apps, you must first set your client id and client secret as environment variables. You can find these values on your app's page in the developer-admin.
35
+ Before uploading apps, you must first set your client id and client secret as environment variables. You can find these values on your app's page in the developer-admin.
34
36
 
35
37
  `export WEEBLY_CLIENT_ID=client_id && export WEEBLY_SECRET=secret`
36
38
 
@@ -38,6 +40,12 @@ Now you can use the app command to sync your local changes to your app.
38
40
 
39
41
  `weeblybundle app /Path/To/Element/Directory`
40
42
 
43
+ To make things even easier, you can use the `--watch` flag to watch your app directory for changes. Whenever a file is added, updated, or deleted from your app directory, the changes will be automatically synced.
44
+
45
+ `weeblybundle app /Path/To/Element/Directory --watch`
46
+
47
+ Every time you sync your changes, the current version of your app will be updated. If you decide to change the app's version before syncing your changes, a new app version will appear in developer-admin, in addition to your old app version.
48
+
41
49
  Once you have installed your app to a site from the developer-admin, you can sync your app using weeblybundle and view your changes in the editor by refreshing the page.
42
50
 
43
51
  ### Uploading Themes
@@ -50,6 +58,10 @@ Then upload the theme by using:
50
58
 
51
59
  `weeblybundle theme /Path/To/Theme`
52
60
 
61
+ Similar to apps, you can use the `--watch` flag to watch your theme directory for changes. Whenever a file is added, updated, or deleted from your theme directory, the changes will be automatically synced.
62
+
63
+ `weeblybundle theme /Path/To/Theme --watch`
64
+
53
65
  You can then see your uploaded theme under Themes->Custom.
54
66
 
55
67
  Happy Bundling!
@@ -2,57 +2,84 @@ require 'thor'
2
2
  require 'weeblybundler/bundle'
3
3
  require "awesome_print"
4
4
  require "json"
5
+ require "filewatcher"
6
+
7
+ def watch( type, path, publish = false )
8
+ puts 'Watching for ' + type + ' changes...'
9
+ FileWatcher.new(path, interval: 0.1).watch() do |filename|
10
+ if type === "app"
11
+ handleApp(path)
12
+ elsif type === 'theme'
13
+ handleTheme(path, publish)
14
+ end
15
+ end
16
+ end
17
+
18
+ def handleApp( path )
19
+ client_id = ENV['WEEBLY_CLIENT_ID']
20
+ secret = ENV['WEEBLY_SECRET']
21
+ domain = ENV['WEEBLY_DOMAIN'] || 'https://www.weebly.com'
22
+
23
+ bundle = Weeblybundler::Bundle.new('app', path, domain, {'client_id' => client_id, 'secret' => secret, 'domain' => domain})
24
+
25
+ if bundle.is_valid?
26
+ response = bundle.sync('/platform/app')
27
+ begin
28
+ ap JSON.parse(response.body)
29
+ rescue
30
+ ap "There was a problem uploading your element to #{domain}/platform/app"
31
+ ap response.body
32
+ bundle.cleanup
33
+ end
34
+ else
35
+ ap bundle.errors
36
+ end
37
+ end
38
+
39
+ def handleTheme( path, publish = false )
40
+ domain = ENV['WEEBLY_DOMAIN'] || 'https://www.weebly.com'
41
+ site_id = ENV['WEEBLY_SITE_ID']
42
+ token = ENV['WEEBLY_TOKEN']
43
+ email = ENV['WEEBLY_EMAIL']
44
+
45
+ bundle = Weeblybundler::Bundle.new('theme', path, domain, {'domain' => domain, 'site_id' => site_id, 'token' => token, 'email' => email})
46
+
47
+ if bundle.is_valid?
48
+ response = bundle.sync('/platform/theme', publish)
49
+ begin
50
+ ap JSON.parse(response)
51
+ rescue
52
+ ap "There was a problem uploading your element to #{domain}/platform/theme"
53
+ ap response.body
54
+ bundle.cleanup
55
+ end
56
+ else
57
+ ap bundle.errors
58
+ end
59
+ end
5
60
 
6
61
  module Weeblybundler
7
62
  class CLI < Thor
63
+
8
64
  desc "app PATH", "Bundles and uploads your weebly platform app."
65
+ option :watch, :type => :boolean
9
66
  def app( path )
10
- client_id = ENV['WEEBLY_CLIENT_ID']
11
- secret = ENV['WEEBLY_SECRET']
12
- domain = ENV['WEEBLY_DOMAIN'] || 'https://www.weebly.com'
13
-
14
- ap client_id
15
- ap secret
16
- ap domain
17
-
18
- bundle = Bundle.new('app', path, domain, {'client_id' => client_id, 'secret' => secret, 'domain' => domain})
19
-
20
- if bundle.is_valid?
21
- response = bundle.sync('/platform/app')
22
- begin
23
- ap JSON.parse(response.body)
24
- rescue
25
- ap "There was a problem uploading your element to #{domain}/platform/app"
26
- ap response.body
27
- bundle.cleanup
28
- end
29
- else
30
- ap bundle.errors
67
+ if options[:watch]
68
+ return watch("app", path, false)
31
69
  end
70
+
71
+ handleApp(path)
32
72
  end
33
73
 
34
74
  desc "theme PATH", "Bundles and uploads your weebly platform theme."
35
75
  option :publish, :type => :boolean
76
+ option :watch, :type => :boolean
36
77
  def theme( path )
37
- domain = ENV['WEEBLY_DOMAIN'] || 'https://www.weebly.com'
38
- site_id = ENV['WEEBLY_SITE_ID']
39
- token = ENV['WEEBLY_TOKEN']
40
- email = ENV['WEEBLY_EMAIL']
41
-
42
- bundle = Bundle.new('theme', path, domain, {'domain' => domain, 'site_id' => site_id, 'token' => token, 'email' => email})
43
-
44
- if bundle.is_valid?
45
- response = bundle.sync('/platform/theme', options[:publish])
46
- begin
47
- ap JSON.parse(response)
48
- rescue
49
- ap "There was a problem uploading your element to #{domain}/platform/theme"
50
- ap response.body
51
- bundle.cleanup
52
- end
53
- else
54
- ap bundle.errors
78
+ if options[:watch]
79
+ return watch("theme", path, options[:publish])
55
80
  end
81
+
82
+ handleTheme(path, options[:publish])
56
83
  end
57
84
  end
58
85
  end
@@ -1,3 +1,3 @@
1
1
  module Weeblybundler
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
@@ -22,6 +22,7 @@ Gem::Specification.new do |spec|
22
22
  spec.add_dependency 'rest-client'
23
23
  spec.add_dependency 'awesome_print'
24
24
  spec.add_dependency 'jwt'
25
+ spec.add_dependency 'filewatcher'
25
26
 
26
27
  spec.add_development_dependency "bundler", "~> 1.5"
27
28
  spec.add_development_dependency "rake"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: weeblybundler
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bryan Ashley
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-10-18 00:00:00.000000000 Z
11
+ date: 2016-11-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -80,6 +80,20 @@ dependencies:
80
80
  - - ">="
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: filewatcher
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :runtime
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
83
97
  - !ruby/object:Gem::Dependency
84
98
  name: bundler
85
99
  requirement: !ruby/object:Gem::Requirement