neocities 0.0.13 → 0.0.16

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: 241ee95f8330172b0d9d56e82b249e4bae87d23dacc2f14d74036714cfee9328
4
- data.tar.gz: 8f8e150736ed822138198213495425b381e655d3ab2e9a5aa25d18cc91feab16
3
+ metadata.gz: 62c435913de9ee21adbc536807d56153b4c5ec3987e069e6fd7ffbca9ff16c46
4
+ data.tar.gz: '069354d31728a5d4fbbc6007c1cf1133e2dec90ed8fbffbf3e5789aa210ffe83'
5
5
  SHA512:
6
- metadata.gz: 4a0345ce430d08488a78f541cef5385b74228b520f1063dbe8bf9da748c4cfab6045e1be5148438bb750e42ed1905798b3dda60d695959bb0b7a17a8a107ad2d
7
- data.tar.gz: 6c899930269e1efe2b62d1925bc6da011226ad7a09ba0b2e8056a118034861df3937a6cb5eedb7e2dae74a200a4b3bf70e32555eabd438eec79df20246b5e27e
6
+ metadata.gz: 1dab02d7cd419ffdec02a00b69a40e0661801e9b0b27c48ed3c2c44974a8b3437a99691ec3b7907a49a6812f2531aa85ae21a7d6f3737dbc1e21e471173c2697
7
+ data.tar.gz: aabbe5d7fbdcae12410510dd5b26e0e37c02e879abfc544d639d0c5aeaa9628f1578530b8f47646ab589be5f811a632f4579d157891f47b9a0ef56a8705fc643
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?
@@ -188,7 +194,8 @@ module Neocities
188
194
  if @no_gitignore == false
189
195
  begin
190
196
  ignores = File.readlines('.gitignore').collect! do |ignore|
191
- File.directory?(ignore.strip!) ? "#{ignore}**" : ignore
197
+ ignore.strip!
198
+ File.directory?(ignore) ? "#{ignore}**" : ignore
192
199
  end
193
200
  paths.select! do |path|
194
201
  res = true
@@ -215,7 +222,7 @@ module Neocities
215
222
  paths.each do |path|
216
223
  next if path.directory?
217
224
  print @pastel.bold("Uploading #{path} ... ")
218
- resp = @client.upload path, path
225
+ resp = @client.upload path, path, @dry_run
219
226
 
220
227
  if resp[:result] == 'error' && resp[:error_type] == 'file_exists'
221
228
  print @pastel.yellow.bold("EXISTS") + "\n"
@@ -333,6 +340,8 @@ HERE
333
340
 
334
341
  #{@pastel.green '$ neocities push --no-gitignore .'} Don't use .gitignore to exclude files
335
342
 
343
+ #{@pastel.green '$ neocities push --dry-run .'} Just show what would be uploaded
344
+
336
345
  HERE
337
346
  exit
338
347
  end
@@ -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
- File.open(path.to_s) do |file|
60
- post 'upload', rpath => file
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
@@ -1,3 +1,3 @@
1
1
  module Neocities
2
- VERSION = '0.0.13'
2
+ VERSION = '0.0.16'
3
3
  end
data/neocities.gemspec CHANGED
@@ -20,6 +20,6 @@ Gem::Specification.new do |spec|
20
20
  spec.add_dependency 'tty-table', '~> 0.10', '= 0.10.0'
21
21
  spec.add_dependency 'tty-prompt', '~> 0.12', '= 0.12.0'
22
22
  spec.add_dependency 'pastel', '~> 0.7', '= 0.7.2'
23
- spec.add_dependency 'httpclient', '~> 2.8', '>= 2.8.3'
23
+ spec.add_dependency 'httpclient-fixcerts', '~> 2.8', '>= 2.8.5'
24
24
  spec.add_dependency 'rake', '~> 12.3', '>= 12.3.1'
25
25
  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.13
4
+ version: 0.0.16
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kyle Drake
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-01-20 00:00:00.000000000 Z
11
+ date: 2022-05-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: tty-table
@@ -71,7 +71,7 @@ dependencies:
71
71
  - !ruby/object:Gem::Version
72
72
  version: 0.7.2
73
73
  - !ruby/object:Gem::Dependency
74
- name: httpclient
74
+ name: httpclient-fixcerts
75
75
  requirement: !ruby/object:Gem::Requirement
76
76
  requirements:
77
77
  - - "~>"
@@ -79,7 +79,7 @@ dependencies:
79
79
  version: '2.8'
80
80
  - - ">="
81
81
  - !ruby/object:Gem::Version
82
- version: 2.8.3
82
+ version: 2.8.5
83
83
  type: :runtime
84
84
  prerelease: false
85
85
  version_requirements: !ruby/object:Gem::Requirement
@@ -89,7 +89,7 @@ dependencies:
89
89
  version: '2.8'
90
90
  - - ">="
91
91
  - !ruby/object:Gem::Version
92
- version: 2.8.3
92
+ version: 2.8.5
93
93
  - !ruby/object:Gem::Dependency
94
94
  name: rake
95
95
  requirement: !ruby/object:Gem::Requirement
@@ -148,7 +148,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
148
148
  - !ruby/object:Gem::Version
149
149
  version: '0'
150
150
  requirements: []
151
- rubygems_version: 3.0.1
151
+ rubygems_version: 3.0.3
152
152
  signing_key:
153
153
  specification_version: 4
154
154
  summary: Neocities.org CLI and API client