neocities 0.0.20 → 0.1.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5031613f2ead49cb8b0d897ba928dca50121afbc65b0f624afd89038c6f97c3e
4
- data.tar.gz: 3f6a7813f75c2d0d667700258a5f2a9a60b74176b69cee5c1d26d95892970a91
3
+ metadata.gz: 9ac38f5fc9a0d5bf480367a54323224847b2158de7083103300f91d64983013b
4
+ data.tar.gz: 1b14f63fde6e7d30a658c64425a89dbc95c22cb6cb833c636baaca84fa5797c8
5
5
  SHA512:
6
- metadata.gz: b1ae46e13488bbdd244da5e1f3eb005002f6a2e9a687c9682fc2055ccaf054c76de1f9386ed578b7462745acf1c53d7fac81957b41b474b2f0422ab5823d3f09
7
- data.tar.gz: a72a64b9bc2ea15a3c7c6ad01f8f405802c5476e96b8975081d3e7dbef531543838eb029fcba108c7cc7a96e89725fac8855500c0c8ffd8922235f05a86fb9b9
6
+ metadata.gz: 3aa57d7f75f4b7e1f5c5bb0206d17fee295b84d9f173a40e76b63203d17764525a4abe1035e428e21ef9c6150f5d23006cae284bc57ec0c56c3a9e498e88dc49
7
+ data.tar.gz: 3d2b4e379531d71f1303c1b57786b8da7921b21a02ffb9b6752807fc481e680cd4fa99a12be43b22854e5b0308e5752b5a5f78509fb8c9b66db44fc97ec144e0
data/lib/neocities/cli.rb CHANGED
@@ -324,7 +324,7 @@ module Neocities
324
324
 
325
325
  def pull
326
326
  begin
327
- quiet = !(['--log', '-l'].include? @subargs[0])
327
+ quiet = (['--quiet', '-q'].include? @subargs[0])
328
328
 
329
329
  file = File.read @app_config_path
330
330
  data = JSON.load file
@@ -356,7 +356,84 @@ module Neocities
356
356
  end
357
357
 
358
358
  def display_pizza_help_and_exit
359
- puts "Sorry, we're fresh out of dough today. Try again tomorrow."
359
+ excuses = [
360
+ "Sorry, we're fresh out of pineapple today.",
361
+ "All the toppings just went rogue and are currently answering to no god.",
362
+ "Our bicycle delivery guy is out today for ska band practice.",
363
+ "Doughpocalypse now. Pizza's off until further notice.",
364
+ "Mamma mia! We're outta the cheesa.",
365
+ "The sauce of our youth ran dry. Pizza is off the menu for now.",
366
+ "There was this pizza place in Portland called Lonesomes that taped burned CDs of local bands to the pizza box. It was pretty dope.",
367
+ "No dough, no go, sorry joe.",
368
+ "I'll be right with you after I figure out how to center a div in CSS.",
369
+ "The pizza gods demand rest. Are the hunger pangs interrupting your game?",
370
+ "Our pizza chef currently has the high score on the Road Kings pinball machine, you dare disturb him?",
371
+ "Today's special: disappointment. Pizza unavailable.",
372
+ "Our last pizza became a perpetual motion machine, left the atmosphere and is flying through the heavens.",
373
+ "Ran out of oregano and optimism. See you next time.",
374
+ "WAR AND PEACE, BY LEO TOLSTOY, BOOK ONE: 1805, CHAPTER I “Well, Prince, so Genoa and Lucca are now just family estates of the Buonapartes. But I warn you, if you don’t tell me that this means war, if you still try to defend the infamies and horrors perpetrated by that Antichrist—I really believe he is Antichrist—I will have nothing more to do with you and you are no longer my friend, no longer my ‘faithful slave,’ as you call yourself! But how do you do? I see I have frightened you—sit down and tell me all the news.”
375
+
376
+ It was in July, 1805, and the speaker was the well-known Anna Pávlovna Schérer, maid of honor and favorite of the Empress Márya Fëdorovna. With these words she greeted Prince Vasíli Kurágin, a man of high rank and importance, who was the first to arrive at her reception. Anna Pávlovna had had a cough for some days. She was, as she said, suffering from la grippe; grippe being then a new word in St. Petersburg, used only by the elite.
377
+
378
+ All her invitations without exception, written in French, and delivered by a scarlet-liveried footman that morning, ran as follows:
379
+
380
+ “If you have nothing better to do, Count (or Prince), and if the prospect of spending an evening with a poor invalid is not too terrible, I shall be very charmed to see you tonight between 7 and 10—Annette Schérer.”
381
+
382
+ “Heavens! what a virulent attack!” replied the prince, not in the least disconcerted by this reception. He had just entered, wearing an embroidered court uniform, knee breeches, and shoes, and had stars on his breast and a serene expression on his flat face. He spoke in that refined French in which our grandfathers not only spoke but thought, and with the gentle, patronizing intonation natural to a man of importance who had grown old in society and at court. He went up to Anna Pávlovna, kissed her hand, presenting to her his bald, scented, and shining head, and complacently seated himself on the sofa.
383
+
384
+ “First of all, dear friend, tell me how you are. Set your friend’s mind at rest,” said he without altering his tone, beneath the politeness and affected sympathy of which indifference and even irony could be discerned.
385
+
386
+ “Can one be well while suffering morally? Can one be calm in times like these if one has any feeling?” said Anna Pávlovna. “You are staying the whole evening, I hope?”
387
+
388
+ “And the fete at the English ambassador’s? Today is Wednesday. I must put in an appearance there,” said the prince. “My daughter is coming for me to take me there.”
389
+
390
+ “I thought today’s fete had been canceled. I confess all these festivities and fireworks are becoming wearisome.”
391
+
392
+ “If they had known that you wished it, the entertainment would have been put off,” said the prince, who, like a wound-up clock, by force of habit said things he did not even wish to be believed.
393
+
394
+ “Don’t tease! Well, and what has been decided about Novosíltsev’s dispatch? You know everything.”
395
+
396
+ “What can one say about it?” replied the prince in a cold, listless tone. “What has been decided? They have decided that Buonaparte has burnt his boats, and I believe that we are ready to burn ours.”
397
+
398
+ Prince Vasíli always spoke languidly, like an actor repeating a stale part. Anna Pávlovna Schérer on the contrary, despite her forty years, overflowed with animation and impulsiveness. To be an enthusiast had become her social vocation and, sometimes even when she did not feel like it, she became enthusiastic in order not to disappoint the expectations of those who knew her. The subdued smile which, though it did not suit her faded features, always played round her lips expressed, as in a spoiled child, a continual consciousness of her charming defect, which she neither wished, nor could, nor considered it necessary, to correct.
399
+
400
+ In the midst of a conversation on political matters Anna Pávlovna burst out:
401
+
402
+ “Oh, don’t speak to me of Austria. Perhaps I don’t understand things, but Austria never has wished, and does not wish, for war. She is betraying us! Russia alone must save Europe. Our gracious sovereign recognizes his high vocation and will be true to it. That is the one thing I have faith in! Our good and wonderful sovereign has to perform the noblest role on earth, and he is so virtuous and noble that God will not forsake him. He will fulfill his vocation and crush the hydra of revolution, which has become more terrible than ever in the person of this murderer and villain! We alone must avenge the blood of the just one.... Whom, I ask you, can we rely on?... England with her commercial spirit will not and cannot understand the Emperor Alexander’s loftiness of soul. She has refused to evacuate Malta. She wanted to find, and still seeks, some secret motive in our actions. What answer did Novosíltsev get? None. The English have not understood and cannot understand the self-abnegation of our Emperor who wants nothing for himself, but only desires the good of mankind. And what have they promised? Nothing! And what little they have promised they will not perform! Prussia has always declared that Buonaparte is invincible, and that all Europe is powerless before him.... And I don’t believe a word that Hardenburg says, or Haugwitz either. This famous Prussian neutrality is just a trap. I have faith only in God and the lofty destiny of our adored monarch. He will save Europe!”
403
+
404
+ She suddenly paused, smiling at her own impetuosity.
405
+
406
+ “I think,” said the prince with a smile, “that if you had been sent instead of our dear Wintzingerode you would have captured the King of Prussia’s consent by assault. You are so eloquent. Will you give me a cup of tea?”
407
+
408
+ “In a moment. À propos,” she added, becoming calm again, “I am expecting two very interesting men tonight, le Vicomte de Mortemart, who is connected with the Montmorencys through the Rohans, one of the best French families. He is one of the genuine émigrés, the good ones. And also the Abbé Morio. Do you know that profound thinker? He has been received by the Emperor. Had you heard?”
409
+
410
+ “I shall be delighted to meet them,” said the prince. “But tell me,” he added with studied carelessness as if it had only just occurred to him, though the question he was about to ask was the chief motive of his visit, “is it true that the Dowager Empress wants Baron Funke to be appointed first secretary at Vienna? The baron by all accounts is a poor creature.”
411
+
412
+ Prince Vasíli wished to obtain this post for his son, but others were trying through the Dowager Empress Márya Fëdorovna to secure it for the baron.
413
+
414
+ Anna Pávlovna almost closed her eyes to indicate that neither she nor anyone else had a right to criticize what the Empress desired or was pleased with.
415
+
416
+ “Baron Funke has been recommended to the Dowager Empress by her sister,” was all she said, in a dry and mournful tone.
417
+
418
+ As she named the Empress, Anna Pávlovna’s face suddenly assumed an expression of profound and sincere devotion and respect mingled with sadness, and this occurred every time she mentioned her illustrious patroness. She added that Her Majesty had deigned to show Baron Funke beaucoup d’estime, and again her face clouded over with sadness.
419
+
420
+ The prince was silent and looked indifferent. But, with the womanly and courtierlike quickness and tact habitual to her, Anna Pávlovna wished both to rebuke him (for daring to speak as he had done of a man recommended to the Empress) and at the same time to console him, so she said:
421
+
422
+ “Now about your family. Do you know that since your daughter came out everyone has been enraptured by her? They say she is amazingly beautiful.”
423
+
424
+ The prince bowed to signify his respect and gratitude.
425
+
426
+ “I often think,” she continued after a short pause, drawing nearer to the prince and smiling amiably at him as if to show that political and social topics were ended and the time had come for intimate conversation—“I often think how unfairly sometimes the joys of life are distributed. Why has fate given you two such splendid children? I don’t speak of Anatole, your youngest. I don’t like him,” she added in a tone admitting of no rejoinder and raising her eyebrows. “Two such charming children. And really you appreciate them less than anyone, and so you don’t deserve to have them.”
427
+
428
+ And she smiled her ecstatic smile.
429
+
430
+ “I can’t help it,” said the prince. “Lavater would have said I lack the bump of paternity.”
431
+
432
+ “Don’t joke; I mean to have a serious talk with you. Do you know I am dissatisfied with your younger son? Between ourselves” (and her face assumed its melancholy expression), “he was mentioned at Her Majesty’s and you were pitied....”
433
+
434
+ The prince answered nothing, but she looked at him significantly, awaiting a reply. He frowned."
435
+ ]
436
+ puts @pastel.bright_red(excuses.sample)
360
437
  exit
361
438
  end
362
439
 
@@ -416,7 +493,7 @@ HERE
416
493
  display_banner
417
494
 
418
495
  puts <<HERE
419
- #{@pastel.magenta.bold 'pull'} - Get the most recent version of files from your site
496
+ #{@pastel.magenta.bold 'pull'} - Get the most recent version of files from your site, does not download if files haven't changed
420
497
 
421
498
  HERE
422
499
  exit
@@ -7,10 +7,9 @@ require 'json'
7
7
  require 'pathname'
8
8
  require 'uri'
9
9
  require 'digest'
10
- require 'httpclient'
10
+ require 'http'
11
11
  require 'pastel'
12
12
  require 'date'
13
-
14
13
  require 'whirly'
15
14
 
16
15
  module Neocities
@@ -19,7 +18,6 @@ module Neocities
19
18
 
20
19
  def initialize(opts={})
21
20
  @uri = URI.parse API_URI
22
- @http = HTTPClient.new force_basic_auth: true
23
21
  @opts = opts
24
22
  @pastel = Pastel.new eachline: "\n"
25
23
 
@@ -28,9 +26,9 @@ module Neocities
28
26
  end
29
27
 
30
28
  if opts[:api_key]
31
- @http.default_header = {'Authorization' => "Bearer #{opts[:api_key]}"}
29
+ @http = HTTP.auth("Bearer #{opts[:api_key]}")
32
30
  else
33
- @http.set_auth API_URI, opts[:sitename], opts[:password]
31
+ @http = HTTP.basic_auth user: opts[:sitename], pass: opts[:password]
34
32
  end
35
33
  end
36
34
 
@@ -68,7 +66,7 @@ module Neocities
68
66
  uri_parser = URI::Parser.new
69
67
  resp[:files].each do |file|
70
68
  if !file[:is_directory]
71
- print @pastel.bold("Loading #{file[:path]} ... ") if !quiet
69
+ print @pastel.bold("Pulling #{file[:path]} ... ") if !quiet
72
70
 
73
71
  if
74
72
  last_pull_time && \
@@ -82,18 +80,9 @@ module Neocities
82
80
  end
83
81
 
84
82
  pathtotry = uri_parser.escape(domain + file[:path])
85
- fileconts = @http.get pathtotry
86
-
87
- # follow redirects
88
- while fileconts.status == 301
89
- new_path = fileconts.header['location'][0]
90
- print "\n#{@pastel.red "Fetch from #{pathtotry} failed."}\nTrying #{new_path} instead..." if !quiet
83
+ fileconts = @http.follow.get pathtotry
91
84
 
92
- pathtotry = new_path
93
- fileconts = @http.get pathtotry
94
- end
95
-
96
- if fileconts.ok?
85
+ if fileconts.status == 200
97
86
  print "#{@pastel.green.bold 'SUCCESS'}\n" if !quiet
98
87
  success_loaded += 1
99
88
 
@@ -115,7 +104,7 @@ module Neocities
115
104
  Whirly.stop if quiet
116
105
 
117
106
  # display stats
118
- puts @pastel.green "\nSuccessfully fetched #{success_loaded} files in #{total_time} seconds"
107
+ puts @pastel.green "\nSuccessfully fetched #{success_loaded} files in #{total_time.round(2)} seconds"
119
108
  end
120
109
 
121
110
  def key
@@ -135,7 +124,7 @@ module Neocities
135
124
 
136
125
  rpath = (remote_path || path.basename)
137
126
 
138
- res = upload_hash rpath, Digest::SHA1.file(path.to_s).hexdigest
127
+ res = upload_hash rpath.to_s, Digest::SHA1.file(path.to_s).hexdigest
139
128
 
140
129
  if res[:files] && res[:files][remote_path.to_s.to_sym] == true
141
130
  return {result: 'error', error_type: 'file_exists', message: 'file already exists and matches local file, not uploading'}
@@ -144,7 +133,7 @@ module Neocities
144
133
  return {result: 'success'}
145
134
  else
146
135
  File.open(path.to_s) do |file|
147
- post 'upload', rpath => file
136
+ post 'upload', rpath => HTTP::FormData::File.new(file)
148
137
  end
149
138
  end
150
139
  end
@@ -170,13 +159,12 @@ module Neocities
170
159
  uri = @uri+path
171
160
  uri.query = URI.encode_www_form params
172
161
  resp = @http.get uri
173
-
174
162
  JSON.parse resp.body, symbolize_names: true
175
163
  end
176
164
 
177
165
  def post(path, args={})
178
166
  uri = @uri+path
179
- resp = @http.post uri, args
167
+ resp = @http.post uri, form: args
180
168
  JSON.parse resp.body, symbolize_names: true
181
169
  end
182
170
  end
@@ -1,3 +1,3 @@
1
1
  module Neocities
2
- VERSION = '0.0.20'
2
+ VERSION = '0.1.1'
3
3
  end
data/neocities.gemspec CHANGED
@@ -16,11 +16,12 @@ Gem::Specification.new do |spec|
16
16
  spec.test_files = spec.files.grep(%r{^(tests)/})
17
17
  spec.require_paths = ["lib"]
18
18
  spec.extensions = ['ext/mkrf_conf.rb']
19
+ spec.required_ruby_version = '>3.0.0'
19
20
 
20
- spec.add_dependency 'tty-table', '~> 0.10', '= 0.10.0'
21
- spec.add_dependency 'tty-prompt', '~> 0.12', '= 0.12.0'
22
- spec.add_dependency 'pastel', '~> 0.7', '= 0.7.2'
23
- spec.add_dependency 'httpclient-fixcerts', '~> 2.8', '>= 2.8.5'
24
- spec.add_dependency 'rake', '~> 12.3', '>= 12.3.1'
21
+ spec.add_dependency 'tty-table', '~> 0.12', '= 0.12.0'
22
+ spec.add_dependency 'tty-prompt', '~> 0.23', '= 0.23.1'
23
+ spec.add_dependency 'pastel', '~> 0.8', '= 0.8.0'
24
+ spec.add_dependency 'http', '~> 5.3', '>= 5.3.1'
25
+ spec.add_dependency 'rake', '~> 13', '>= 13.3.0'
25
26
  spec.add_dependency 'whirly', '~> 0.3', '>= 0.3.0'
26
27
  end
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: neocities
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.20
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kyle Drake
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2024-07-22 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: tty-table
@@ -16,100 +15,100 @@ dependencies:
16
15
  requirements:
17
16
  - - "~>"
18
17
  - !ruby/object:Gem::Version
19
- version: '0.10'
18
+ version: '0.12'
20
19
  - - '='
21
20
  - !ruby/object:Gem::Version
22
- version: 0.10.0
21
+ version: 0.12.0
23
22
  type: :runtime
24
23
  prerelease: false
25
24
  version_requirements: !ruby/object:Gem::Requirement
26
25
  requirements:
27
26
  - - "~>"
28
27
  - !ruby/object:Gem::Version
29
- version: '0.10'
28
+ version: '0.12'
30
29
  - - '='
31
30
  - !ruby/object:Gem::Version
32
- version: 0.10.0
31
+ version: 0.12.0
33
32
  - !ruby/object:Gem::Dependency
34
33
  name: tty-prompt
35
34
  requirement: !ruby/object:Gem::Requirement
36
35
  requirements:
37
36
  - - "~>"
38
37
  - !ruby/object:Gem::Version
39
- version: '0.12'
38
+ version: '0.23'
40
39
  - - '='
41
40
  - !ruby/object:Gem::Version
42
- version: 0.12.0
41
+ version: 0.23.1
43
42
  type: :runtime
44
43
  prerelease: false
45
44
  version_requirements: !ruby/object:Gem::Requirement
46
45
  requirements:
47
46
  - - "~>"
48
47
  - !ruby/object:Gem::Version
49
- version: '0.12'
48
+ version: '0.23'
50
49
  - - '='
51
50
  - !ruby/object:Gem::Version
52
- version: 0.12.0
51
+ version: 0.23.1
53
52
  - !ruby/object:Gem::Dependency
54
53
  name: pastel
55
54
  requirement: !ruby/object:Gem::Requirement
56
55
  requirements:
57
56
  - - "~>"
58
57
  - !ruby/object:Gem::Version
59
- version: '0.7'
58
+ version: '0.8'
60
59
  - - '='
61
60
  - !ruby/object:Gem::Version
62
- version: 0.7.2
61
+ version: 0.8.0
63
62
  type: :runtime
64
63
  prerelease: false
65
64
  version_requirements: !ruby/object:Gem::Requirement
66
65
  requirements:
67
66
  - - "~>"
68
67
  - !ruby/object:Gem::Version
69
- version: '0.7'
68
+ version: '0.8'
70
69
  - - '='
71
70
  - !ruby/object:Gem::Version
72
- version: 0.7.2
71
+ version: 0.8.0
73
72
  - !ruby/object:Gem::Dependency
74
- name: httpclient-fixcerts
73
+ name: http
75
74
  requirement: !ruby/object:Gem::Requirement
76
75
  requirements:
77
76
  - - "~>"
78
77
  - !ruby/object:Gem::Version
79
- version: '2.8'
78
+ version: '5.3'
80
79
  - - ">="
81
80
  - !ruby/object:Gem::Version
82
- version: 2.8.5
81
+ version: 5.3.1
83
82
  type: :runtime
84
83
  prerelease: false
85
84
  version_requirements: !ruby/object:Gem::Requirement
86
85
  requirements:
87
86
  - - "~>"
88
87
  - !ruby/object:Gem::Version
89
- version: '2.8'
88
+ version: '5.3'
90
89
  - - ">="
91
90
  - !ruby/object:Gem::Version
92
- version: 2.8.5
91
+ version: 5.3.1
93
92
  - !ruby/object:Gem::Dependency
94
93
  name: rake
95
94
  requirement: !ruby/object:Gem::Requirement
96
95
  requirements:
97
96
  - - "~>"
98
97
  - !ruby/object:Gem::Version
99
- version: '12.3'
98
+ version: '13'
100
99
  - - ">="
101
100
  - !ruby/object:Gem::Version
102
- version: 12.3.1
101
+ version: 13.3.0
103
102
  type: :runtime
104
103
  prerelease: false
105
104
  version_requirements: !ruby/object:Gem::Requirement
106
105
  requirements:
107
106
  - - "~>"
108
107
  - !ruby/object:Gem::Version
109
- version: '12.3'
108
+ version: '13'
110
109
  - - ">="
111
110
  - !ruby/object:Gem::Version
112
- version: 12.3.1
111
+ version: 13.3.0
113
112
  - !ruby/object:Gem::Dependency
114
113
  name: whirly
115
114
  requirement: !ruby/object:Gem::Requirement
@@ -130,7 +129,6 @@ dependencies:
130
129
  - - ">="
131
130
  - !ruby/object:Gem::Version
132
131
  version: 0.3.0
133
- description:
134
132
  email:
135
133
  - contact@neocities.org
136
134
  executables:
@@ -153,23 +151,21 @@ homepage: https://neocities.org
153
151
  licenses:
154
152
  - MIT
155
153
  metadata: {}
156
- post_install_message:
157
154
  rdoc_options: []
158
155
  require_paths:
159
156
  - lib
160
157
  required_ruby_version: !ruby/object:Gem::Requirement
161
158
  requirements:
162
- - - ">="
159
+ - - ">"
163
160
  - !ruby/object:Gem::Version
164
- version: '0'
161
+ version: 3.0.0
165
162
  required_rubygems_version: !ruby/object:Gem::Requirement
166
163
  requirements:
167
164
  - - ">="
168
165
  - !ruby/object:Gem::Version
169
166
  version: '0'
170
167
  requirements: []
171
- rubygems_version: 3.5.13
172
- signing_key:
168
+ rubygems_version: 3.6.9
173
169
  specification_version: 4
174
170
  summary: Neocities.org CLI and API client
175
171
  test_files: []