siteleaf 2.2.1 → 2.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ce6fc710cfc1acbebaf8d32fd7b2fd8a71d4214a927f3044123f83379edd39ca
4
- data.tar.gz: 230fb95a0b07b80a64bfe9327ea91a29c7666bbb30451f213c54954b1363e32d
3
+ metadata.gz: 2bd0d1ce58e3d7f0059cd0139fac42e5111efc232ee2cf758dc541088c9cc49f
4
+ data.tar.gz: ed3a5393e428f18c0f86f0e0709e5f6ea57990512aff8dfe726233a1599bfde1
5
5
  SHA512:
6
- metadata.gz: ea19934dd0aea81f63d0e92369d757888011cbd951c015b7e69de6b3813e3774e69fd5bcff527b9207f610b29f7a1f4bd1ba894e99342090e273b539bbd4a5f9
7
- data.tar.gz: 0a72065cf23659cbe5efa2beea7590588bcd22235ce00f42e4be3a3fb4084ab5671f258dd025427e2db48cb4690d11d29635a5f8a2a2617cd628b5093e64d380
6
+ metadata.gz: f4510e656e0fd8ecfe51d46bc0548e2af4a351fc7d6d7f9f76a3d77db9c133042c742c3fef8a8717696bcff70a18cf0ebe8c6771ff9c7cf980e7c271b73e4a65
7
+ data.tar.gz: d03897ef87c4a63b09487ff843ad129940f63e5704e94054b9724b6ce63e96af60b1e19f4ccde4bf2379c3f44226a4498f6aaa568eaff66de0a2965ade0123d9
data/README.md CHANGED
@@ -79,6 +79,12 @@ To download your theme (or the default theme for new sites) from Siteleaf, run t
79
79
  To publish your site changes to your hosting provider, run the following command:
80
80
 
81
81
  siteleaf publish
82
+
83
+ **Clean unused uploads:**
84
+
85
+ To check for unused uploads and tidy up disk space (runs locally):
86
+
87
+ siteleaf clean _uploads
82
88
 
83
89
  **For a full list of commands, run:**
84
90
 
data/bin/siteleaf CHANGED
@@ -16,6 +16,7 @@ Commands:
16
16
  auth Login in with your credentials
17
17
  c, config DOMAIN Configure an existing directory
18
18
  n, new DOMAIN Creates new site on siteleaf.net
19
+ clean Clean up unused uploads
19
20
  pull Pulls files for configured site from Siteleaf
20
21
  push Pushes all files in dir to configured site
21
22
  publish Publish website to hosting provider
@@ -93,7 +94,7 @@ def pull(site_id)
93
94
  puts path
94
95
  end
95
96
  print '(y/n)? '
96
- if $stdin.gets.chomp == 'y'
97
+ if $stdin.gets.chomp.downcase == 'y'
97
98
  missing_files.each do |path|
98
99
  print "Deleting #{path}..."
99
100
  ::File.delete(path)
@@ -210,6 +211,42 @@ def preview(site_id, quiet = true)
210
211
  end
211
212
  end
212
213
 
214
+ def clean(path = '_uploads')
215
+ searcher = if system('which ag', out: File::NULL)
216
+ ['ag', '-lQ']
217
+ else
218
+ puts "\nWarning: Silver Searcher not found, install for faster results (https://geoff.greer.fm/ag/)\n"
219
+ ['grep', '-lr']
220
+ end
221
+
222
+ puts "\nBuilding Jekyll site..."
223
+ system 'bundle exec jekyll build --future --unpublished --drafts'
224
+
225
+ puts "\nFinding unused files..."
226
+ unused = Dir.glob("#{path}/**/*").select do |file|
227
+ next unless File.file? file
228
+ escaped = Jekyll::URL.escape_path file
229
+
230
+ found = system(*searcher, escaped.sub(/^_/, '/'), '_site', out: File::NULL) ||
231
+ system(*searcher, file.sub(/^_/, '/'), '_site', out: File::NULL)
232
+
233
+ if !found
234
+ puts file
235
+ true
236
+ end
237
+ end
238
+
239
+ if unused.length == 0
240
+ puts "\nNo unused files found."
241
+ else
242
+ puts "=> Delete above #{unused.length} file(s)? (y/n)"
243
+ if $stdin.gets.chomp.downcase == 'y'
244
+ FileUtils.rm unused
245
+ puts "=> #{unused.size} file(s) deleted."
246
+ end
247
+ end
248
+ end
249
+
213
250
  def config(site)
214
251
  Siteleaf.save_settings({site_id: site.id}, '.siteleaf.yml')
215
252
  puts "=> Site configured."
@@ -325,6 +362,8 @@ begin
325
362
  import(file, quiet)
326
363
  end
327
364
  end
365
+ when 'clean'
366
+ ARGV[1] ? clean(ARGV[1]) : clean
328
367
  else
329
368
  puts "Error: `#{ARGV[0]}` command not found.\n"
330
369
  puts help
@@ -1,3 +1,3 @@
1
1
  module Siteleaf
2
- VERSION = "2.2.1"
2
+ VERSION = "2.3.0"
3
3
  end
data/siteleaf.gemspec CHANGED
@@ -16,7 +16,6 @@ Gem::Specification.new do |gem|
16
16
  gem.required_ruby_version = '>= 1.9.3'
17
17
 
18
18
  gem.add_dependency 'httparty', '>= 0.16.0'
19
- gem.add_dependency 'psych', '>= 2.1.0'
20
19
  gem.add_dependency 'jekyll', '>= 1.4.1'
21
20
  gem.add_dependency 'rack'
22
21
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: siteleaf
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.1
4
+ version: 2.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Siteleaf
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-11-21 00:00:00.000000000 Z
11
+ date: 2024-09-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty
@@ -24,20 +24,6 @@ dependencies:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: 0.16.0
27
- - !ruby/object:Gem::Dependency
28
- name: psych
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - ">="
32
- - !ruby/object:Gem::Version
33
- version: 2.1.0
34
- type: :runtime
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - ">="
39
- - !ruby/object:Gem::Version
40
- version: 2.1.0
41
27
  - !ruby/object:Gem::Dependency
42
28
  name: jekyll
43
29
  requirement: !ruby/object:Gem::Requirement