quickftp 0.1.0

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.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 33254c2a2c5a1c46aab779afcb1b73a911011d26
4
+ data.tar.gz: 28b180b3abb9134bdf9167c50cea02d357a286dc
5
+ SHA512:
6
+ metadata.gz: f79def306f5c690a8f5c682856cbe6f4fe5b0767aabe68635b49e1abde7b5038af42c17b9a1c9e0cc689f7b7a671c07b9e60e3c474c168042eeb6bf44e4c38ce
7
+ data.tar.gz: 1d68fffa34eebf9cf0a5f3249ca6d6ddbf2f1d85c99283d6a360bf2b4494bbd4b293b41488a54ed5249b2263147ca23563f56c0f635ba8367383020e830055ba
@@ -0,0 +1,5 @@
1
+ .rvmrc
2
+ .env
3
+ .ruby-version
4
+ .rbenv-gemsets
5
+ *.gem
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in quickftp.gemspec
4
+ gemspec
@@ -0,0 +1,25 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ quickftp (0.0.1)
5
+ ftpd (~> 1.1, >= 1.1.1)
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ ftpd (1.1.1)
11
+ memoizer (~> 1.0)
12
+ memoizer (1.0.1)
13
+ minitest (5.8.3)
14
+ rake (10.4.2)
15
+
16
+ PLATFORMS
17
+ ruby
18
+
19
+ DEPENDENCIES
20
+ minitest (~> 5.8, >= 5.8.3)
21
+ quickftp!
22
+ rake (~> 10.4, >= 10.4.2)
23
+
24
+ BUNDLED WITH
25
+ 1.10.6
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 Alfonso Cora
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,38 @@
1
+ # Quickftp
2
+
3
+ Quickftp is a command line application that allows to quickly start an ftp server without worrying about configuration. This makes it a handy tool to transfer files easily.
4
+ Although the server is stable, it's not intended to be used for public servers. This gem is based on the [ftpd gem by Wayne Conrad](https://github.com/wconrad/ftpd/), so you can find more information about reliability and the protocol internals in the gem documentation.
5
+
6
+ ## Installation
7
+
8
+ ```bash
9
+ gem install quickftp
10
+ ```
11
+
12
+ ## Usage
13
+
14
+ To simply start the server at any available port serving the files from the current directory, run:
15
+
16
+ ```bash
17
+ quickftp
18
+ ```
19
+
20
+ ## Options
21
+
22
+ - -h HOST: The interface where the server should start. When not specified, the server will start on localhost.
23
+ - -p PORT: The port where the server should start. When not specified, a random available port will be chosen.
24
+
25
+ ### Examples
26
+
27
+ ```bash
28
+ # start the server in localhost, under port 3002 and files from the current directory:
29
+ quickftp -p 3002
30
+
31
+ # start the server in 192.168.1.1:9000 and serve files from /tmp/dir:
32
+ quickftp /tmp/dir -h 192.168.1.1 -p 9000
33
+ ```
34
+
35
+ ## Contributions and credits
36
+
37
+ - This project is based on the [ftpd gem by Wayne Conrad](https://github.com/wconrad/ftpd/).
38
+ - If you want to contribute to this project, just fork it and create a pull request. Also, feel free to report issues on the [issues section](issues).
@@ -0,0 +1,9 @@
1
+ require 'bundler/gem_tasks'
2
+ require 'rake/testtask'
3
+
4
+ Rake::TestTask.new do |t|
5
+ t.libs << 'test'
6
+ t.test_files = FileList['test/**/test*.rb']
7
+ end
8
+
9
+ task :default => [:test]
@@ -0,0 +1,47 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'ftpd'
4
+ require 'quickftp'
5
+ require 'pathname'
6
+ require 'logger'
7
+
8
+ trap('SIGINT') { throw :ctrl_c }
9
+
10
+ def get_argv(option)
11
+ value = nil
12
+ if option_index = ARGV.index(option)
13
+ value = ARGV[option_index + 1]
14
+ ARGV.slice!(option_index..option_index+1)
15
+ end
16
+ value
17
+ end
18
+
19
+ host = get_argv('-h')
20
+ port = get_argv('-p').to_i
21
+
22
+ if ARGV.any? {|f| f == '--help'}
23
+ # help mode
24
+ puts 'Usage:'
25
+ puts ' quickftp [path/to/directory] [-h HOST] [-p PORT]'
26
+ else
27
+ path = ARGV.first || '.'
28
+ path = Pathname.new(path).realpath.to_s
29
+
30
+ driver = Quickftp::Driver.new(path)
31
+ server = Ftpd::FtpServer.new(driver)
32
+ server.server_name = "Quickftp"
33
+ server.server_version = Quickftp::VERSION
34
+ server.log = Logger.new(STDOUT)
35
+ server.interface = host if host
36
+ server.port = port if port
37
+ server.start
38
+
39
+ puts "#{server.server_name} #{server.server_version}"
40
+ puts "Server listening on #{server.interface}:#{server.bound_port}"
41
+ puts "Serving all files under '#{path}'"
42
+ puts "Press Ctrl+C to stop"
43
+ begin
44
+ sleep
45
+ rescue Exception
46
+ end
47
+ end
@@ -0,0 +1,2 @@
1
+ require 'quickftp/version'
2
+ require 'quickftp/driver'
@@ -0,0 +1,15 @@
1
+ module Quickftp
2
+ class Driver
3
+ def initialize(dir)
4
+ @dir = dir
5
+ end
6
+
7
+ def authenticate(user, password)
8
+ true
9
+ end
10
+
11
+ def file_system(user)
12
+ Ftpd::DiskFileSystem.new(@dir)
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,3 @@
1
+ module Quickftp
2
+ VERSION = '0.1.0'
3
+ end
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2015 Alfonso Cora
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,24 @@
1
+ # -*- encoding: utf-8 -*-
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'quickftp/version'
5
+
6
+ Gem::Specification.new do |gem|
7
+ gem.name = 'quickftp'
8
+ gem.version = Quickftp::VERSION
9
+ gem.authors = ['Alf Cora']
10
+ gem.email = ['alfius@protonmail.com']
11
+ gem.description = %q{Quickftp is an in-place ftp server}
12
+ gem.summary = %q{Quickftp is a command line application that allows to quickly start an ftp server without worrying about configuration. This makes it a handy tool to transfer files easily. It's not intended to be used in public servers.}
13
+ gem.homepage = 'https://github.com/alfonsocora/quickftp'
14
+ gem.license = 'MIT'
15
+
16
+ gem.files = `git ls-files`.split($/)
17
+ gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
18
+ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
19
+ gem.require_paths = ["lib"]
20
+
21
+ gem.add_runtime_dependency 'ftpd', '~> 1.1', '>= 1.1.1'
22
+ gem.add_development_dependency 'minitest', '~> 5.8', '>= 5.8.3'
23
+ gem.add_development_dependency 'rake', '~> 10.4', '>= 10.4.2'
24
+ end
@@ -0,0 +1,8 @@
1
+ require 'test_helper'
2
+
3
+ class TestDriver < Minitest::Test
4
+ def test_authenticates_all_users
5
+ driver = Quickftp::Driver.new('.')
6
+ assert driver.authenticate('someone', 'super secret password')
7
+ end
8
+ end
@@ -0,0 +1,3 @@
1
+ require 'minitest/autorun'
2
+ require 'minitest/pride'
3
+ require 'quickftp'
metadata ADDED
@@ -0,0 +1,123 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: quickftp
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Alf Cora
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-12-10 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: ftpd
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.1'
20
+ - - ">="
21
+ - !ruby/object:Gem::Version
22
+ version: 1.1.1
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ requirements:
27
+ - - "~>"
28
+ - !ruby/object:Gem::Version
29
+ version: '1.1'
30
+ - - ">="
31
+ - !ruby/object:Gem::Version
32
+ version: 1.1.1
33
+ - !ruby/object:Gem::Dependency
34
+ name: minitest
35
+ requirement: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - "~>"
38
+ - !ruby/object:Gem::Version
39
+ version: '5.8'
40
+ - - ">="
41
+ - !ruby/object:Gem::Version
42
+ version: 5.8.3
43
+ type: :development
44
+ prerelease: false
45
+ version_requirements: !ruby/object:Gem::Requirement
46
+ requirements:
47
+ - - "~>"
48
+ - !ruby/object:Gem::Version
49
+ version: '5.8'
50
+ - - ">="
51
+ - !ruby/object:Gem::Version
52
+ version: 5.8.3
53
+ - !ruby/object:Gem::Dependency
54
+ name: rake
55
+ requirement: !ruby/object:Gem::Requirement
56
+ requirements:
57
+ - - "~>"
58
+ - !ruby/object:Gem::Version
59
+ version: '10.4'
60
+ - - ">="
61
+ - !ruby/object:Gem::Version
62
+ version: 10.4.2
63
+ type: :development
64
+ prerelease: false
65
+ version_requirements: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - "~>"
68
+ - !ruby/object:Gem::Version
69
+ version: '10.4'
70
+ - - ">="
71
+ - !ruby/object:Gem::Version
72
+ version: 10.4.2
73
+ description: Quickftp is an in-place ftp server
74
+ email:
75
+ - alfius@protonmail.com
76
+ executables:
77
+ - quickftp
78
+ extensions: []
79
+ extra_rdoc_files: []
80
+ files:
81
+ - ".gitignore"
82
+ - Gemfile
83
+ - Gemfile.lock
84
+ - LICENSE.txt
85
+ - README.md
86
+ - Rakefile
87
+ - bin/quickftp
88
+ - lib/quickftp.rb
89
+ - lib/quickftp/driver.rb
90
+ - lib/quickftp/version.rb
91
+ - license.txt
92
+ - quickftp.gemspec
93
+ - test/lib/quickftp/test_driver.rb
94
+ - test/test_helper.rb
95
+ homepage: https://github.com/alfonsocora/quickftp
96
+ licenses:
97
+ - MIT
98
+ metadata: {}
99
+ post_install_message:
100
+ rdoc_options: []
101
+ require_paths:
102
+ - lib
103
+ required_ruby_version: !ruby/object:Gem::Requirement
104
+ requirements:
105
+ - - ">="
106
+ - !ruby/object:Gem::Version
107
+ version: '0'
108
+ required_rubygems_version: !ruby/object:Gem::Requirement
109
+ requirements:
110
+ - - ">="
111
+ - !ruby/object:Gem::Version
112
+ version: '0'
113
+ requirements: []
114
+ rubyforge_project:
115
+ rubygems_version: 2.4.8
116
+ signing_key:
117
+ specification_version: 4
118
+ summary: Quickftp is a command line application that allows to quickly start an ftp
119
+ server without worrying about configuration. This makes it a handy tool to transfer
120
+ files easily. It's not intended to be used in public servers.
121
+ test_files:
122
+ - test/lib/quickftp/test_driver.rb
123
+ - test/test_helper.rb