pagiii 0.1.3 → 0.1.5
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 +4 -4
- data/bin/pagiii +5 -10
- data/lib/pagiii/theme_sync.rb +5 -5
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3920600316701c41b365055d7bd9b4c3051184f97d53b76399cd1e988fa4b6be
|
4
|
+
data.tar.gz: d088b0a82ed527a3c2861214bdbe3fdbb93a38cc6adbde91acf6f585edeacb77
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5de379c4510602833a8927f3e8d08316f0c1f84d6b9e38aef77780b8d712600298f32236a4069a064773bd3190a0a4daebcc529d52b3218f7ec28142bbc00d8b
|
7
|
+
data.tar.gz: ddec27a75e9a29921fcd7a16e144ced66de3e0301c9298a054482959da7d78764745ef5d39b152ce24874b4c141d49853bddbd5f268dca1d4dba65e486db4720
|
data/bin/pagiii
CHANGED
@@ -14,12 +14,7 @@ def root_api
|
|
14
14
|
"https://pagiii.com"
|
15
15
|
end
|
16
16
|
|
17
|
-
|
18
|
-
secret_id = 'WlENailhg7KEbZqXXwX4Y470HYGL8-U2af_bOZGVWeQ'
|
19
|
-
redirect_uri = 'http://localhost:7654'
|
20
|
-
scope = 'read_theme write_theme delete_theme'
|
21
|
-
|
22
|
-
program :version, '0.1.3'
|
17
|
+
program :version, '0.1.5'
|
23
18
|
program :description, 'Pagiii CLI'
|
24
19
|
|
25
20
|
|
@@ -51,10 +46,10 @@ end
|
|
51
46
|
|
52
47
|
def update_config(email, password)
|
53
48
|
dir = "#{Dir.home}/.pagiii"
|
54
|
-
FileUtils.mkdir_p(dir) unless Dir.
|
49
|
+
FileUtils.mkdir_p(dir) unless Dir.exist?(dir)
|
55
50
|
file = File.join(dir, 'config.json')
|
56
51
|
hash = {}
|
57
|
-
if File.
|
52
|
+
if File.exist?(file)
|
58
53
|
hash = JSON.parse(IO.read(file))
|
59
54
|
end
|
60
55
|
hash[:email] = email
|
@@ -67,9 +62,9 @@ end
|
|
67
62
|
|
68
63
|
def read_config
|
69
64
|
dir = "#{Dir.home}/.pagiii"
|
70
|
-
return nil unless Dir.
|
65
|
+
return nil unless Dir.exist?(dir)
|
71
66
|
file = File.join(dir, 'config.json')
|
72
|
-
return nil unless File.
|
67
|
+
return nil unless File.exist?(file)
|
73
68
|
hash = JSON.parse(IO.read(file))
|
74
69
|
hash
|
75
70
|
end
|
data/lib/pagiii/theme_sync.rb
CHANGED
@@ -33,8 +33,7 @@ class Pagiii::ThemeSync
|
|
33
33
|
end
|
34
34
|
|
35
35
|
|
36
|
-
def sync_file(site, theme_name, file)
|
37
|
-
#puts "sync #{file}"
|
36
|
+
def sync_file(site, theme_name, file)
|
38
37
|
conn = Faraday.new(
|
39
38
|
url: @root_api,
|
40
39
|
params: {param: '1'},
|
@@ -149,7 +148,8 @@ class Pagiii::ThemeSync
|
|
149
148
|
Dir.entries('.').each do |dir|
|
150
149
|
if ALLOWED_DIRS.include?(dir) && File.directory?(dir)
|
151
150
|
puts "--#{dir}"
|
152
|
-
|
151
|
+
# skip files starts_with dot
|
152
|
+
Dir.entries(dir).reject{|x| x =~ /(^\.)/}.each do |file|
|
153
153
|
print "----#{file}"
|
154
154
|
file_path = "./#{dir}/#{file}"
|
155
155
|
resp = sync_file(site, theme, file_path)
|
@@ -224,7 +224,7 @@ class Pagiii::ThemeSync
|
|
224
224
|
say "downloading #{asset['asset_key']}"
|
225
225
|
response = download_asset(site: site, theme_id: parsed_response['theme']['id'], key: asset['asset_key'])
|
226
226
|
path = File.split(asset['asset_key'])
|
227
|
-
FileUtils.mkdir(path.first) unless Dir.
|
227
|
+
FileUtils.mkdir(path.first) unless Dir.exist?(path.first)
|
228
228
|
File.open(asset['asset_key'], 'wb') do |f|
|
229
229
|
f.write(response.body)
|
230
230
|
end
|
@@ -302,4 +302,4 @@ class Pagiii::ThemeSync
|
|
302
302
|
end
|
303
303
|
|
304
304
|
|
305
|
-
end
|
305
|
+
end
|