ruby-bepasty-client 1.0.0 → 1.0.2

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: e832e4200ea4decc2a800db7a43ad8deb8c0049000c29c0cb45679e9f62698d8
4
- data.tar.gz: 1e0bcf99dc68452e83d4daec6913190dae4ecb715046c10318ffbee4c61600e9
3
+ metadata.gz: 2c28986881176e4d489f9ec0447c0643b297ab7e2a6d6e6790825de0559129a4
4
+ data.tar.gz: 6b51fdfd43b03748d5beac6da3e3ded8b99d329b51070869d3faac5fdd85bc0b
5
5
  SHA512:
6
- metadata.gz: 3ea2c4da75e919b9a353b2084b5558f8916fc99b070ba9d904fabd4f39fdec682a783f78831b48dff83d10fdf56d82486818d9aa29ae6c78d6a7f0db3cb1ca1b
7
- data.tar.gz: ae41da0e6fb739c7aec2b04fc848f3e64583495acb4051ffa7458719f4c03703a2bb3d4554d139037a231cefacd04d5bc8005e3dfcf9444417d460f80ed720e2
6
+ metadata.gz: 6d769558355a871020f05e59e6517c3db805cf22585ac17dd253a777a3532c9ecadcecab0b65bc3718ccb7c8d1f173e6459a00c0871eea6a211ba7d4a546e7cd
7
+ data.tar.gz: f39fe2809f864ad65ae0cefb0eb5f21c48b5c01d72e77c4a0c89b955501e71da199b85117107bfabcc2dbe43208d945bd2a3f4b2426f88b6b0b44894a76a529b
@@ -139,11 +139,16 @@ module BepastyClient
139
139
  @verbose = true if cfg[:verbose]
140
140
  @server ||= cfg[:server]
141
141
  @password ||= cfg[:password]
142
- @max_life ||= cfg[:max_life]
142
+ @upload_opts[:max_life] ||= cfg[:max_life]
143
143
  end
144
144
 
145
145
  def load_config_file(path)
146
- cfg = YAML.load_file(path)
146
+ begin
147
+ cfg = YAML.load_file(path)
148
+ rescue Errno::ENOENT
149
+ return {}
150
+ end
151
+
147
152
  puts "Reading config at #{path}" if @verbose
148
153
 
149
154
  {
@@ -155,8 +160,6 @@ module BepastyClient
155
160
  value: cfg.fetch('max_life', {}).fetch('value', 1),
156
161
  },
157
162
  }
158
- rescue Errno::ENOENT
159
- {}
160
163
  end
161
164
  end
162
165
  end
@@ -62,6 +62,7 @@ module BepastyClient
62
62
  send_io = io
63
63
  else
64
64
  send_io = StringIO.new(io.read)
65
+ content_type ||= 'text/plain'
65
66
  end
66
67
 
67
68
  if @max_file_size && send_io.size > @max_file_size
@@ -1,3 +1,3 @@
1
1
  module BepastyClient
2
- VERSION = '1.0.0'
2
+ VERSION = '1.0.2'
3
3
  end
@@ -0,0 +1,88 @@
1
+ .TH bepastyrb 8 2023\-05\-14 1.0.0
2
+ .SH NAME
3
+ .PP
4
+ \fB\fCbepastyrb\fR \- upload files to bepasty servers
5
+ .SH SYNOPSIS
6
+ .PP
7
+ \fB\fCbepastyrb\fR [\fIoptions\fP] [\fIfile\fP\&...]
8
+ .SH DESCRIPTION
9
+ .PP
10
+ \fB\fCbepastyrb\fR uploads one or more files to bepasty servers. If no \fIfile\fP is given
11
+ as an argument, \fB\fCbepastyrb\fR will read from standard input.
12
+ .PP
13
+ bepasty server URL needs to be given using option \fB\fC\-s\fR, \fB\fC\-\-server\fR or can be
14
+ set in a config file, see \fB\fCCONFIG FILES\fR\&.
15
+ .PP
16
+ If no life time is set, it defaults to one day.
17
+ .SH OPTIONS
18
+ .TP
19
+ \fB\fC\-v\fR, \fB\fC\-\-verbose\fR
20
+ Enable verbose output.
21
+ .TP
22
+ \fB\fC\-s\fR, \fB\fC\-\-server\fR=\fISERVER\fP
23
+ bepasty server URL.
24
+ .TP
25
+ \fB\fC\-p\fR, \fB\fC\-\-password\fR=\fIPASSWORD\fP
26
+ bepasty server password.
27
+ .TP
28
+ \fB\fC\-\-password\-file\fR=\fIFILE\fP
29
+ Read bepasty server password from a file.
30
+ .TP
31
+ \fB\fC\-f\fR, \fB\fC\-\-filename\fR=\fINAME\fP
32
+ File name including extension. Can be used to provide name for files read
33
+ from standard input or to override given file name.
34
+ .TP
35
+ \fB\fC\-t\fR, \fB\fC\-\-content\-type\fR=\fITYPE\fP
36
+ Content mime type. If not given, the mime type is guessed by the bepasty server
37
+ based on file name.
38
+ .TP
39
+ \fB\fC\-\-minute\fR=[\fIN\fP]
40
+ Keep the file for \fIN\fP minutes, defaults to 30 minutes.
41
+ .TP
42
+ \fB\fC\-\-hour\fR=[\fIN\fP]
43
+ Keep the file for \fIN\fP hours, defaults to 1 hour.
44
+ .TP
45
+ \fB\fC\-\-day\fR=[\fIN\fP]
46
+ Keep the file for \fIN\fP days, defaults to 1 day.
47
+ .TP
48
+ \fB\fC\-\-week\fR=[\fIN\fP]
49
+ Keep the file for \fIN\fP weeks, defaults to 1 week.
50
+ .TP
51
+ \fB\fC\-\-month\fR=[\fIN\fP]
52
+ Keep the file for \fIN\fP months, defaults to 1 month.
53
+ .TP
54
+ \fB\fC\-\-forever\fR
55
+ Keep the file as long as possible.
56
+ .SH CONFIG FILES
57
+ .PP
58
+ Config files can be used to provide default values for certain options.
59
+ Command\-line options override settings found in config files. Config files are
60
+ read from the following locations:
61
+ .RS
62
+ .IP \(bu 2
63
+ \fB\fC/etc/bepastyrb.yml\fR
64
+ .IP \(bu 2
65
+ \fB\fC$XDG_CONFIG_HOME/bepastyrb.yml\fR or \fB\fC~/.config/bepastyrb.yml\fR
66
+ .RE
67
+ .PP
68
+ Settings from user's config will override settings in \fB\fC/etc\fR\&.
69
+ .PP
70
+ Example configuration:
71
+ .PP
72
+ .RS
73
+ .nf
74
+ # bepasty config file in YAML
75
+ server: https://bepasty.yourserver.tld
76
+ # password: optional password if the server uses it
77
+ # password_file: read password from a file
78
+ # max_life:
79
+ # unit: minutes|hours|days|weeks|months|forever
80
+ # value: 14
81
+ .fi
82
+ .RE
83
+ .SH SEE ALSO
84
+ .PP
85
+ bepasty server: \[la]https://bepasty-server.readthedocs.org/\[ra]
86
+ .SH BUGS
87
+ .PP
88
+ Report bugs to \[la]https://github.com/aither64/ruby-bepasty-client\[ra]\&.
@@ -14,6 +14,7 @@ Gem::Specification.new do |spec|
14
14
  spec.license = 'MIT'
15
15
 
16
16
  spec.files = `git ls-files -z`.split("\x0")
17
+ spec.files += Dir['man/man?/*.?']
17
18
  spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
19
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
20
  spec.require_paths = ['lib']
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-bepasty-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jakub Skokan
@@ -71,6 +71,7 @@ files:
71
71
  - lib/bepasty-client/cli.rb
72
72
  - lib/bepasty-client/client.rb
73
73
  - lib/bepasty-client/version.rb
74
+ - man/man1/bepastyrb.1
74
75
  - man/man1/bepastyrb.1.md
75
76
  - ruby-bepasty-client.gemspec
76
77
  - shell.nix