neocities 0.0.14 → 0.0.15
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/lib/neocities/cli.rb +9 -1
- data/lib/neocities/client.rb +7 -3
- data/lib/neocities/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9b3185c56a16a8132c1f871bbef07c0628975ae85b9fd98ec38f37b427419424
|
4
|
+
data.tar.gz: 744b27b670777d84163cffd0d7c38407f1cf203087a937d0ce1dc2d81e1ccf78
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 46a4dfd7168ae12776709129cc2988194ae4c7d9b9a9af1f3710a67171c8d80d65010c94b449f9b9b455146efbb2d8a24eb975e6af608361219241a90b8afb4d
|
7
|
+
data.tar.gz: 2afb7960dbefdb2e0c2d18e0ea8f4d664b56da69665cdb972dd8be9fa3e6b1185a353f7429723739ee14b8f2b5721ff3f936fd7c5fd5de4a141df383f0ca9daa
|
data/lib/neocities/cli.rb
CHANGED
@@ -161,15 +161,21 @@ module Neocities
|
|
161
161
|
def push
|
162
162
|
@no_gitignore = false
|
163
163
|
@excluded_files = []
|
164
|
+
@dry_run = false
|
164
165
|
loop {
|
165
166
|
case @subargs[0]
|
166
167
|
when '--no-gitignore' then @subargs.shift; @no_gitignore = true
|
167
168
|
when '-e' then @subargs.shift; @excluded_files.push(@subargs.shift)
|
169
|
+
when '--dry-run' then @subargs.shift; @dry_run = true
|
168
170
|
when /^-/ then puts(@pastel.red.bold("Unknown option: #{@subargs[0].inspect}")); display_push_help_and_exit
|
169
171
|
else break
|
170
172
|
end
|
171
173
|
}
|
172
174
|
|
175
|
+
if @dry_run
|
176
|
+
puts @pastel.green.bold("Doing a dry run, not actually pushing anything")
|
177
|
+
end
|
178
|
+
|
173
179
|
root_path = Pathname @subargs[0]
|
174
180
|
|
175
181
|
if !root_path.exist?
|
@@ -216,7 +222,7 @@ module Neocities
|
|
216
222
|
paths.each do |path|
|
217
223
|
next if path.directory?
|
218
224
|
print @pastel.bold("Uploading #{path} ... ")
|
219
|
-
resp = @client.upload path, path
|
225
|
+
resp = @client.upload path, path, @dry_run
|
220
226
|
|
221
227
|
if resp[:result] == 'error' && resp[:error_type] == 'file_exists'
|
222
228
|
print @pastel.yellow.bold("EXISTS") + "\n"
|
@@ -334,6 +340,8 @@ HERE
|
|
334
340
|
|
335
341
|
#{@pastel.green '$ neocities push --no-gitignore .'} Don't use .gitignore to exclude files
|
336
342
|
|
343
|
+
#{@pastel.green '$ neocities push --dry-run .'} Just show what would be uploaded
|
344
|
+
|
337
345
|
HERE
|
338
346
|
exit
|
339
347
|
end
|
data/lib/neocities/client.rb
CHANGED
@@ -42,7 +42,7 @@ module Neocities
|
|
42
42
|
post 'upload_hash', remote_path => sha1_hash
|
43
43
|
end
|
44
44
|
|
45
|
-
def upload(path, remote_path=nil)
|
45
|
+
def upload(path, remote_path=nil, dry_run=false)
|
46
46
|
path = Pathname path
|
47
47
|
|
48
48
|
unless path.exist?
|
@@ -56,8 +56,12 @@ module Neocities
|
|
56
56
|
if res[:files] && res[:files][remote_path.to_s.to_sym] == true
|
57
57
|
return {result: 'error', error_type: 'file_exists', message: 'file already exists and matches local file, not uploading'}
|
58
58
|
else
|
59
|
-
|
60
|
-
|
59
|
+
if dry_run
|
60
|
+
return {result: 'success'}
|
61
|
+
else
|
62
|
+
File.open(path.to_s) do |file|
|
63
|
+
post 'upload', rpath => file
|
64
|
+
end
|
61
65
|
end
|
62
66
|
end
|
63
67
|
end
|
data/lib/neocities/version.rb
CHANGED
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.
|
4
|
+
version: 0.0.15
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kyle Drake
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-03-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: tty-table
|