mina-ftp 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +17 -0
- data/Gemfile +3 -0
- data/LICENSE.txt +22 -0
- data/README.md +76 -0
- data/Rakefile +1 -0
- data/lib/mina-ftp.rb +5 -0
- data/lib/mina/ftp.rb +76 -0
- data/mina-ftp.gemspec +22 -0
- metadata +80 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 9c4e1f124a2f947ff40dba7a20de6e75a2719534
|
4
|
+
data.tar.gz: c8be756c382628ce5e86ea67b3f3e41a804d5932
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 909420a84450c922fc7fa10a1a6352fcd0e7cbcbe8cf4017aa3952b40a9c2e16aa302af336d0d63e34296ea8351cb39cbfe35a8c6a5838eab6900c568aa68fdd
|
7
|
+
data.tar.gz: 4b33e436937a9862f915fd36b37202eecfebf6b74b80e846e49b8be82429694d643c8c2bb83fe756fa9064f03bc6b7f64f67a30f5205a18793e8f1b33e818ce7
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2013 Stas SUȘCOV
|
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.
|
data/README.md
ADDED
@@ -0,0 +1,76 @@
|
|
1
|
+
# FTP support for Mina
|
2
|
+
|
3
|
+
You can use mina now to deploy static websites to FTP servers.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
gem 'mina-ftp'
|
10
|
+
|
11
|
+
And then execute:
|
12
|
+
|
13
|
+
$ bundle
|
14
|
+
|
15
|
+
Or install it yourself as:
|
16
|
+
|
17
|
+
$ gem install mina-ftp
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
|
21
|
+
Use mina to generate the config file:
|
22
|
+
|
23
|
+
$ bundle exec mina init
|
24
|
+
|
25
|
+
Load the FTP tasks:
|
26
|
+
|
27
|
+
```ruby
|
28
|
+
require 'mina/ftp'
|
29
|
+
```
|
30
|
+
|
31
|
+
Add some settings to the `config/deploy.rb` or to `Minafile` file.
|
32
|
+
|
33
|
+
```ruby
|
34
|
+
set :ftp_path, 'public_www'
|
35
|
+
set :ftp_host, 'ftp.domain.com'
|
36
|
+
set :ftp_username, 'user@domain.com'
|
37
|
+
set :ftp_password, 'secret'
|
38
|
+
```
|
39
|
+
|
40
|
+
Update `deploy` task to invoke `ftp:deploy` task:
|
41
|
+
|
42
|
+
```ruby
|
43
|
+
task :deploy do
|
44
|
+
invoke :'ftp:deploy'
|
45
|
+
end
|
46
|
+
```
|
47
|
+
|
48
|
+
Deploy it!
|
49
|
+
|
50
|
+
$ bundle exec mina deploy
|
51
|
+
|
52
|
+
Use `--verbose` flag if you want to see FTP client calls.
|
53
|
+
|
54
|
+
To clear the remote path, use the `ftp:empty` task:
|
55
|
+
|
56
|
+
$ bundle exec mina ftp:empty
|
57
|
+
|
58
|
+
Thats it.
|
59
|
+
|
60
|
+
## Todo
|
61
|
+
|
62
|
+
Write some tests.
|
63
|
+
|
64
|
+
## Contributing
|
65
|
+
|
66
|
+
1. Fork it
|
67
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
68
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
69
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
70
|
+
5. Create new Pull Request
|
71
|
+
|
72
|
+
## Thanks and credits
|
73
|
+
|
74
|
+
This gem uses [ftp_sync](https://github.com/jebw/ftp_sync) gem.
|
75
|
+
|
76
|
+
Huge thanks to [mina](https://github.com/nadarei/mina) developers for the awesome tool.
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
data/lib/mina-ftp.rb
ADDED
data/lib/mina/ftp.rb
ADDED
@@ -0,0 +1,76 @@
|
|
1
|
+
require 'rake/contrib/ftptools'
|
2
|
+
require 'ftp_sync'
|
3
|
+
|
4
|
+
# # Modules: FTP
|
5
|
+
# Adds settings and tasks for uploading to FTP
|
6
|
+
#
|
7
|
+
# require 'mina/ftp'
|
8
|
+
#
|
9
|
+
# ## Settings
|
10
|
+
# Any and all of these settings can be overwritten in your `deploy.rb`.
|
11
|
+
#
|
12
|
+
# ### ftp_host
|
13
|
+
# Sets the FTP server hostname
|
14
|
+
|
15
|
+
set_default :ftp_host, domain
|
16
|
+
|
17
|
+
# ### ftp_path
|
18
|
+
# Sets the FTP target path
|
19
|
+
|
20
|
+
set_default :ftp_path, domain
|
21
|
+
|
22
|
+
# ### ftp_username
|
23
|
+
# Sets the default FTP username
|
24
|
+
|
25
|
+
set_default :ftp_username, 'CHANGE THIS'
|
26
|
+
|
27
|
+
# ### ftp_password
|
28
|
+
# Sets the default FTP password
|
29
|
+
|
30
|
+
set_default :ftp_password, 'CHANGE THIS'
|
31
|
+
|
32
|
+
# ### ftp_from_path
|
33
|
+
# Local files location, defaults to: public
|
34
|
+
|
35
|
+
set_default :ftp_from_path, 'public'
|
36
|
+
|
37
|
+
# ### ftp_files_pattern
|
38
|
+
# Pattern to match what files to be uploaded, like with `Dir#glob`
|
39
|
+
# Defaults to: **/*
|
40
|
+
|
41
|
+
set_default :ftp_files_pattern, '**/*'
|
42
|
+
|
43
|
+
# ### ftp_client
|
44
|
+
# Sets up the ftp client
|
45
|
+
set_default :ftp_client, proc{
|
46
|
+
FtpSync.new(ftp_host, ftp_username, ftp_password, :verbose => verbose_mode?)
|
47
|
+
}
|
48
|
+
|
49
|
+
# ## Deploy tasks
|
50
|
+
# These tasks are meant to be invoked inside deploy scripts, not invoked on
|
51
|
+
# their own.
|
52
|
+
|
53
|
+
namespace 'ftp' do
|
54
|
+
# ### ftp:deploy
|
55
|
+
# Starts a deploy to FTP server
|
56
|
+
desc 'Starts a deploy to FTP server'
|
57
|
+
task :deploy do
|
58
|
+
print_str '-----> Starting FTP deployment to %s' % ftp_host
|
59
|
+
Dir.chdir(ftp_from_path)
|
60
|
+
local_path = Dir.pwd
|
61
|
+
local_files = Dir.glob(ftp_files_pattern).select{ |fn| File.file?(fn) }
|
62
|
+
|
63
|
+
ftp_client.push_files(local_path, ftp_path, local_files)
|
64
|
+
end
|
65
|
+
|
66
|
+
# ### aws:s3:empty
|
67
|
+
# Empties bucket of any files
|
68
|
+
desc 'Empty the FTP path'
|
69
|
+
task :empty do
|
70
|
+
Dir.chdir(ftp_from_path)
|
71
|
+
local_files = Dir.glob(ftp_files_pattern)
|
72
|
+
|
73
|
+
ftp_client.remove_files(ftp_path, local_files)
|
74
|
+
print_str '-----> Cleaned %s on %s' % [ftp_path, ftp_host]
|
75
|
+
end
|
76
|
+
end
|
data/mina-ftp.gemspec
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'mina-ftp'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "mina-ftp"
|
8
|
+
spec.version = Mina::Ftp::VERSION
|
9
|
+
spec.authors = ["Stas SUȘCOV"]
|
10
|
+
spec.email = ["stas@net.utcluj.ro"]
|
11
|
+
spec.description = %q{Adds FTP support for mina.}
|
12
|
+
spec.summary = %q{Deploy to FTP using mina.}
|
13
|
+
spec.homepage = "https://github.com/stas/mina-ftp"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files`.split($/)
|
17
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
18
|
+
spec.require_paths = ["lib"]
|
19
|
+
|
20
|
+
spec.add_dependency "mina"
|
21
|
+
spec.add_dependency "ftp_sync"
|
22
|
+
end
|
metadata
ADDED
@@ -0,0 +1,80 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: mina-ftp
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Stas SUȘCOV
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2013-07-16 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: mina
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - '>='
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - '>='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: ftp_sync
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
description: Adds FTP support for mina.
|
42
|
+
email:
|
43
|
+
- stas@net.utcluj.ro
|
44
|
+
executables: []
|
45
|
+
extensions: []
|
46
|
+
extra_rdoc_files: []
|
47
|
+
files:
|
48
|
+
- .gitignore
|
49
|
+
- Gemfile
|
50
|
+
- LICENSE.txt
|
51
|
+
- README.md
|
52
|
+
- Rakefile
|
53
|
+
- lib/mina-ftp.rb
|
54
|
+
- lib/mina/ftp.rb
|
55
|
+
- mina-ftp.gemspec
|
56
|
+
homepage: https://github.com/stas/mina-ftp
|
57
|
+
licenses:
|
58
|
+
- MIT
|
59
|
+
metadata: {}
|
60
|
+
post_install_message:
|
61
|
+
rdoc_options: []
|
62
|
+
require_paths:
|
63
|
+
- lib
|
64
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - '>='
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
70
|
+
requirements:
|
71
|
+
- - '>='
|
72
|
+
- !ruby/object:Gem::Version
|
73
|
+
version: '0'
|
74
|
+
requirements: []
|
75
|
+
rubyforge_project:
|
76
|
+
rubygems_version: 2.0.3
|
77
|
+
signing_key:
|
78
|
+
specification_version: 4
|
79
|
+
summary: Deploy to FTP using mina.
|
80
|
+
test_files: []
|