neocities 0.0.16 → 0.0.17

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: 62c435913de9ee21adbc536807d56153b4c5ec3987e069e6fd7ffbca9ff16c46
4
- data.tar.gz: '069354d31728a5d4fbbc6007c1cf1133e2dec90ed8fbffbf3e5789aa210ffe83'
3
+ metadata.gz: 2e868d70dd0564036428471413481d66f764cde75087d25a4aef0ec945d5792b
4
+ data.tar.gz: 9d180d291b6169253110534aef62a48ec3ee8b43a8f50dc6a4635695d1ce525a
5
5
  SHA512:
6
- metadata.gz: 1dab02d7cd419ffdec02a00b69a40e0661801e9b0b27c48ed3c2c44974a8b3437a99691ec3b7907a49a6812f2531aa85ae21a7d6f3737dbc1e21e471173c2697
7
- data.tar.gz: aabbe5d7fbdcae12410510dd5b26e0e37c02e879abfc544d639d0c5aeaa9628f1578530b8f47646ab589be5f811a632f4579d157891f47b9a0ef56a8705fc643
6
+ metadata.gz: d2a884cc70d5ffb3521a472e2f1a582963f44b3e390f171486c6c3d08125041779cf65e562decc6a3aeaafbfa2d7e956efbb22ee77cd7b5cb3e3f096d7d15e11
7
+ data.tar.gz: aab95d2837cdcdfa49b35cabf4a4b57fae898f2189bcd16f34b16e5729b9f415491fe4c7a024376d0b0e5eb24c98cea2c5743269fa6d21431876bd2b4f58e157
data/ext/mkrf_conf.rb CHANGED
@@ -1,5 +1,6 @@
1
1
  require 'rubygems'
2
- require 'rubygems/dependency_installer.rb'
2
+ require 'rubygems/command'
3
+ require 'rubygems/dependency_installer'
3
4
  begin
4
5
  Gem::Command.build_args = ARGV
5
6
  rescue NoMethodError
data/lib/neocities/cli.rb CHANGED
@@ -162,11 +162,13 @@ module Neocities
162
162
  @no_gitignore = false
163
163
  @excluded_files = []
164
164
  @dry_run = false
165
+ @prune = false
165
166
  loop {
166
167
  case @subargs[0]
167
168
  when '--no-gitignore' then @subargs.shift; @no_gitignore = true
168
169
  when '-e' then @subargs.shift; @excluded_files.push(@subargs.shift)
169
170
  when '--dry-run' then @subargs.shift; @dry_run = true
171
+ when '--prune' then @subargs.shift; @prune = true
170
172
  when /^-/ then puts(@pastel.red.bold("Unknown option: #{@subargs[0].inspect}")); display_push_help_and_exit
171
173
  else break
172
174
  end
@@ -188,6 +190,28 @@ module Neocities
188
190
  display_push_help_and_exit
189
191
  end
190
192
 
193
+ if @prune
194
+ pruned_dirs = []
195
+ resp = @client.list
196
+ resp[:files].each do |file|
197
+ path = Pathname(File.join(@subargs[0], file[:path]))
198
+
199
+ pruned_dirs << path if !path.exist? && (file[:is_directory])
200
+
201
+ if !path.exist? && !pruned_dirs.include?(path.dirname)
202
+ print @pastel.bold("Deleting #{file[:path]} ... ")
203
+ resp = @client.delete_wrapper_with_dry_run file[:path], @dry_run
204
+
205
+ if resp[:result] == 'success'
206
+ print @pastel.green.bold("SUCCESS") + "\n"
207
+ else
208
+ print "\n"
209
+ display_response resp
210
+ end
211
+ end
212
+ end
213
+ end
214
+
191
215
  Dir.chdir(root_path) do
192
216
  paths = Dir.glob(File.join('**', '*'))
193
217
 
@@ -66,6 +66,14 @@ module Neocities
66
66
  end
67
67
  end
68
68
 
69
+ def delete_wrapper_with_dry_run(paths, dry_run=false)
70
+ if dry_run
71
+ return {result: 'success'}
72
+ else
73
+ delete(paths)
74
+ end
75
+ end
76
+
69
77
  def delete(*paths)
70
78
  post 'delete', 'filenames[]' => paths
71
79
  end
@@ -1,3 +1,3 @@
1
1
  module Neocities
2
- VERSION = '0.0.16'
2
+ VERSION = '0.0.17'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: neocities
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.16
4
+ version: 0.0.17
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kyle Drake
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-05-01 00:00:00.000000000 Z
11
+ date: 2022-05-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: tty-table