fx-tftp 0.4 → 0.6

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
  SHA1:
3
- metadata.gz: ff40fb730a73ee5fe8f1ffe16cdbb9202001c46a
4
- data.tar.gz: 460430ac661a1b4da1dcb80eb2fb107b1efa6983
3
+ metadata.gz: 0c1fdd0aa78b89936ecb5a77d442239e6e82bcd6
4
+ data.tar.gz: 097bd1a749e6f113c6471c793b4123bb0690b10e
5
5
  SHA512:
6
- metadata.gz: be546342f4f560c6830af311548025b8dd1e2ef4ebb36548897e5c893bd4ceafd587090f75c03a60fca97b9dea04c746fe882ab970c68959a88fe35f018e3b2e
7
- data.tar.gz: e6ebe1401188bbf0b98f0c4b5bf54a03f091e0addf28757fc806ffff7f09185f6f8c1af6f4f0bb22c9d47f03733eb7fe76627cebf0491cd03fe3edf72a26185f
6
+ metadata.gz: dd91bf0c2ddb9ce72c5d803a42f1b8287e6e7f51e0738896386e5d0aec81e0986b25f8e6a73db721b8c6c5df7940385c768af7869684a46dbbaa4880b8ec06b9
7
+ data.tar.gz: b76310c67e90158dd9aeae33c4f53a068d9dc6929e7ab5a6de7f09a0c2a1f9a4984d3be5857efdd205c8032ddc48a9d09ae69d0f1aafd2de7a16b5307b736a22
data/.gitignore CHANGED
@@ -1,3 +1,4 @@
1
1
  doc/
2
2
  pkg/
3
3
  .yardoc/
4
+ Gemfile.lock
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in fx-tftpd.gemspec
4
+ gemspec
data/README.md CHANGED
@@ -39,6 +39,7 @@ When you combine filename inspection and `#send` and `#recv` methods working on
39
39
  -m, --mode MODE Run in R/W only mode
40
40
  -h, --host HOST Bind do host
41
41
  -p, --path PATH Serving root directory
42
+ -o, --overwrite Overwrite existing files
42
43
 
43
44
  ## Contributing
44
45
 
data/bin/tftpd CHANGED
@@ -9,7 +9,7 @@ require 'tftp'
9
9
 
10
10
  config = {:path => Dir.pwd, :host => '127.0.0.1', :fork => false,
11
11
  :ver => false, :loglevel => Logger::INFO, :logfile => STDOUT,
12
- :no_read => false, :no_write => false}
12
+ :no_read => false, :no_write => false, :overwrite => false}
13
13
 
14
14
  def die!(msg)
15
15
  STDERR.puts msg
@@ -34,6 +34,7 @@ op = OptionParser.new do |o|
34
34
  end
35
35
  o.on('-h', '--host HOST', String, 'Bind do host') {|a| config[:host] = a }
36
36
  o.on('-p', '--path PATH', String, 'Serving root directory') {|a| config[:path] = a }
37
+ o.on('-o', '--overwrite', 'Overwrite existing files') { config[:overwrite] = true }
37
38
  end
38
39
  op.parse! or die!(op)
39
40
  die!(op) if config[:bad_mode]
@@ -16,6 +16,7 @@ Gem::Specification.new do |s|
16
16
  s.homepage = 'https://github.com/drbig/fx-tftp'
17
17
 
18
18
  s.files = `git ls-files`.split("\n")
19
+ s.executables = ['tftpd']
19
20
  s.test_files = s.files.grep(%r{^test/})
20
21
  s.require_paths = ['lib']
21
22
 
@@ -255,10 +255,14 @@ module TFTP
255
255
  end
256
256
  log :info, "#{tag} Write request for #{req.filename} (#{req.mode})"
257
257
  if File.exist? path
258
- log :warn, "#{tag} File already exist"
259
- sock.send(Packet::ERROR.new(6, 'File already exists.').encode, 0)
260
- sock.close
261
- return
258
+ if @opts[:overwrite]
259
+ log :info, "#{tag} Overwrite existing file #{req.filename}"
260
+ else
261
+ log :warn, "#{tag} Refuse to overwrite existing file #{req.filename}"
262
+ sock.send(Packet::ERROR.new(6, 'File already exists.').encode, 0)
263
+ sock.close
264
+ return
265
+ end
262
266
  end
263
267
  mode = 'w'
264
268
  mode += 'b' if req.mode == :octet
@@ -1,4 +1,4 @@
1
1
  module TFTP
2
2
  # Current version string.
3
- VERSION = '0.4'
3
+ VERSION = '0.6'
4
4
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fx-tftp
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.4'
4
+ version: '0.6'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Piotr S. Staszewski
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-01-26 00:00:00.000000000 Z
11
+ date: 2015-07-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rubygems-tasks
@@ -43,7 +43,8 @@ description: Got carried away a bit with the OOness of the whole thing, so while
43
43
  ones. With all the infastructure already in place adding a client should be a breeze,
44
44
  should anyone need it.
45
45
  email: p.staszewski@gmail.com
46
- executables: []
46
+ executables:
47
+ - tftpd
47
48
  extensions: []
48
49
  extra_rdoc_files: []
49
50
  files:
@@ -51,6 +52,7 @@ files:
51
52
  - ".gitignore"
52
53
  - ".travis.yml"
53
54
  - ".yardopts"
55
+ - Gemfile
54
56
  - LICENSE.txt
55
57
  - README.md
56
58
  - Rakefile