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.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/bin/pagiii +5 -10
  3. data/lib/pagiii/theme_sync.rb +5 -5
  4. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f2fe9ec1ddc232ed551e6cb30a884545ec59970b3100002978490eaf799b3a3a
4
- data.tar.gz: dcbc6259ae1eb30b35c76d5696cf4ae75956162359e446afc17b3ab4338ed516
3
+ metadata.gz: 3920600316701c41b365055d7bd9b4c3051184f97d53b76399cd1e988fa4b6be
4
+ data.tar.gz: d088b0a82ed527a3c2861214bdbe3fdbb93a38cc6adbde91acf6f585edeacb77
5
5
  SHA512:
6
- metadata.gz: aa04567bc09e65b8a88a2997090bd1c4d6b48a7ea574dc84fda1bd02a4f3ac9ddafa6410c5c227dafc2ba22395f6c7d3a14982a773b42da7efddd37b0c2b4ab4
7
- data.tar.gz: 1a15296efcc294ebdc6aee0ef9ce41694576e9d218c2260aa81c20527110d659e4d9a75e8ba1ff221f8f284916ff3ac91783a0e9c1fae75e02b9612670c39d61
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
- client_id = 'IuIwOC38m7acKuJRo-nkG22ZzeVpWLDPMPnoaoRzQp8'
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.exists?(dir)
49
+ FileUtils.mkdir_p(dir) unless Dir.exist?(dir)
55
50
  file = File.join(dir, 'config.json')
56
51
  hash = {}
57
- if File.exists?(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.exists?(dir)
65
+ return nil unless Dir.exist?(dir)
71
66
  file = File.join(dir, 'config.json')
72
- return nil unless File.exists?(file)
67
+ return nil unless File.exist?(file)
73
68
  hash = JSON.parse(IO.read(file))
74
69
  hash
75
70
  end
@@ -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
- Dir.entries(dir).reject{|x| [".", ".."].include?(x)}.each do |file|
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.exists?(path.first)
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pagiii
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sugiarto