nanoc-lftp 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 7ab616c6865de5dcd87e8226f5450cd198f65c08
4
+ data.tar.gz: 9b6d367ac6bbf9ac4570c4120640ea88bbaf93d5
5
+ SHA512:
6
+ metadata.gz: c53c26bdb7746c8fdac90941e7470fb4b39852888e95338785ea1562b02cba7d000d60e92fa6337f39805a5f0fb05517649877dbb4098453869b15cb820f5984
7
+ data.tar.gz: f88e4a5404ebbe3c95cfb57600c81a250ecc92e40417e84a240202954f8929f1562a3a56e1de4d06b0eabeab887135b0d998a64c7d3aa2daa10c2edc2e20ed4f
data/Gemfile ADDED
@@ -0,0 +1,7 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
4
+
5
+ gem 'minitest'
6
+ gem 'rake'
7
+ gem 'coveralls', require: false
data/Gemfile.lock ADDED
@@ -0,0 +1,48 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ nanoc-lftp (1.0.0)
5
+ nanoc (>= 3.6.7, < 4.0.0)
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ colored (1.2)
11
+ coveralls (0.7.0)
12
+ multi_json (~> 1.3)
13
+ rest-client
14
+ simplecov (>= 0.7)
15
+ term-ansicolor
16
+ thor
17
+ cri (2.6.1)
18
+ colored (~> 1.2)
19
+ docile (1.1.3)
20
+ mime-types (2.1)
21
+ minitest (5.2.3)
22
+ multi_json (1.8.4)
23
+ nanoc (3.7.5)
24
+ cri (~> 2.3)
25
+ rake (10.1.1)
26
+ rest-client (1.6.7)
27
+ mime-types (>= 1.16)
28
+ simplecov (0.8.2)
29
+ docile (~> 1.1.0)
30
+ multi_json
31
+ simplecov-html (~> 0.8.0)
32
+ simplecov-html (0.8.0)
33
+ systemu (2.6.3)
34
+ term-ansicolor (1.3.0)
35
+ tins (~> 1.0)
36
+ thor (0.18.1)
37
+ tins (1.0.0)
38
+
39
+ PLATFORMS
40
+ ruby
41
+
42
+ DEPENDENCIES
43
+ bundler (~> 1.5)
44
+ coveralls
45
+ minitest
46
+ nanoc-lftp!
47
+ rake
48
+ systemu (~> 2.6)
data/LICENSE ADDED
@@ -0,0 +1,19 @@
1
+ Copyright (c) 2014 Denis Defreyne and contributors
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ of this software and associated documentation files (the "Software"), to deal
5
+ in the Software without restriction, including without limitation the rights
6
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ copies of the Software, and to permit persons to whom the Software is
8
+ furnished to do so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in all
11
+ copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19
+ SOFTWARE.
data/NEWS.md ADDED
@@ -0,0 +1,5 @@
1
+ # nanoc-lftp news
2
+
3
+ ## 1.0.0
4
+
5
+ Initial release.
data/README.md ADDED
@@ -0,0 +1,26 @@
1
+ [![Build Status](https://travis-ci.org/nanoc/nanoc-lftp.png)](https://travis-ci.org/nanoc/nanoc-lftp)
2
+ [![Code Climate](https://codeclimate.com/github/nanoc/nanoc-lftp.png)](https://codeclimate.com/github/nanoc/nanoc-lftp)
3
+ [![Coverage Status](https://coveralls.io/repos/nanoc/nanoc-lftp/badge.png?branch=master)](https://coveralls.io/r/nanoc/nanoc-lftp)
4
+
5
+ # nanoc-lftp
6
+
7
+ This provides a [lftp](http://lftp.yar.ru/) deployer for [nanoc](http://nanoc.ws).
8
+
9
+ Works with nanoc 3.x.
10
+
11
+ ## Installation
12
+
13
+ `gem install nanoc-lftp`
14
+
15
+ ## Usage
16
+
17
+ ```yaml
18
+ deploy:
19
+ public:
20
+ kind: lftp
21
+ dst_host: ftp://nanoc.ws
22
+ dst_path: /var/www/nanoc.ws
23
+ ```
24
+
25
+ This deployer also reads the `options` attribute, which is an array passed to
26
+ the `lftp` command.
data/Rakefile ADDED
@@ -0,0 +1,10 @@
1
+ # encoding: utf-8
2
+
3
+ require 'rake/testtask'
4
+
5
+ Rake::TestTask.new do |t|
6
+ t.libs = %w( lib test )
7
+ t.test_files = FileList['test/**/test_*.rb', 'test/**/*_spec.rb']
8
+ end
9
+
10
+ task :default => :test
data/lib/nanoc-lftp.rb ADDED
@@ -0,0 +1,3 @@
1
+ # encoding: utf-8
2
+
3
+ require 'nanoc/lftp'
data/lib/nanoc/lftp.rb ADDED
@@ -0,0 +1,9 @@
1
+ # encoding: utf-8
2
+
3
+ module Nanoc
4
+ module LFTP
5
+ end
6
+ end
7
+
8
+ require 'nanoc/lftp/version'
9
+ require 'nanoc/lftp/deployer'
@@ -0,0 +1,52 @@
1
+ # encoding: utf-8
2
+
3
+ require 'shellwords'
4
+ require 'systemu'
5
+
6
+ module Nanoc::LFTP
7
+
8
+ class Deployer < Nanoc::Extra::Deployer
9
+
10
+ identifier :lftp
11
+
12
+ def run
13
+ # Get params
14
+ src = source_path + '/'
15
+ dst_host = config.fetch(:dst_host) do
16
+ raise Nanoc::Errors::GenericTrivial, 'No dst_host found in deployment configuration'
17
+ end
18
+ dst_path = config.fetch(:dst_path) do
19
+ raise Nanoc::Errors::GenericTrivial, 'No dst_path found in deployment configuration'
20
+ end
21
+ options = config.fetch(:options, [])
22
+
23
+ # Build command
24
+ options_esc = options.flatten.map { |e| esc(e) }
25
+ lftp_cmd = [ 'mirror', '--reverse', *options_esc, esc(src), esc(dst_path) ].join(' ') + ' ; quit'
26
+ cmd = [ 'lftp', '-e', lftp_cmd, dst_host ]
27
+
28
+ # Run
29
+ if dry_run
30
+ warn 'Performing a dry-run; no actions will actually be performed'
31
+ $stdout.puts(cmd)
32
+ else
33
+ run_shell_cmd(cmd)
34
+ end
35
+ end
36
+
37
+ private
38
+
39
+ def esc(s)
40
+ Shellwords.escape(s)
41
+ end
42
+
43
+ # Runs the given shell command. It will raise an error if execution fails
44
+ # (results in a nonzero exit code).
45
+ def run_shell_cmd(args)
46
+ status = systemu(args, 'stdout' => $stdout, 'stderr' => $stderr)
47
+ raise "command exited with a nonzero status code #{status.exitstatus} (command: #{args})" if !status.success?
48
+ end
49
+
50
+ end
51
+
52
+ end
@@ -0,0 +1,7 @@
1
+ # encoding: utf-8
2
+
3
+ module Nanoc
4
+ module LFTP
5
+ VERSION = '1.0.0'
6
+ end
7
+ end
@@ -0,0 +1,30 @@
1
+ # encoding: utf-8
2
+
3
+ $LOAD_PATH.unshift(File.expand_path('../lib/', __FILE__))
4
+ require 'nanoc/lftp/version'
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = 'nanoc-lftp'
8
+ s.version = Nanoc::LFTP::VERSION
9
+ s.homepage = 'http://nanoc.ws/'
10
+ s.summary = 'LFTP deployer for nanoc'
11
+ s.description = 'Provides an :lftp deployer for nanoc'
12
+
13
+ s.author = 'Denis Defreyne'
14
+ s.email = 'denis.defreyne@stoneship.org'
15
+ s.license = 'MIT'
16
+
17
+ s.required_ruby_version = '>= 1.9.3'
18
+
19
+ s.files = Dir['[A-Z]*'] +
20
+ Dir['{lib,test}/**/*'] +
21
+ [ 'nanoc-lftp.gemspec' ]
22
+ s.require_paths = [ 'lib' ]
23
+
24
+ s.rdoc_options = [ '--main', 'README.md' ]
25
+ s.extra_rdoc_files = [ 'LICENSE', 'README.md', 'NEWS.md' ]
26
+
27
+ s.add_runtime_dependency('nanoc', '>= 3.6.7', '< 4.0.0')
28
+ s.add_development_dependency('systemu', '~> 2.6')
29
+ s.add_development_dependency('bundler', '~> 1.5')
30
+ end
@@ -0,0 +1,24 @@
1
+ # encoding: utf-8
2
+
3
+ require 'helper'
4
+
5
+ class Nanoc::LFTP::FilterTest < Minitest::Test
6
+
7
+ def test_deploy
8
+ rsync = Nanoc::LFTP::Deployer.new(
9
+ 'output',
10
+ dst_host: 'ftp://example.com:123',
11
+ dst_path: '/foo/path with spaces/subdir')
12
+
13
+ def rsync.run_shell_cmd(args)
14
+ @shell_cms_args = args
15
+ end
16
+
17
+ rsync.run
18
+ assert_equal(
19
+ [ 'lftp', '-e', 'mirror --reverse output/ /foo/path\ with\ spaces/subdir ; quit', 'ftp://example.com:123' ],
20
+ rsync.instance_eval { @shell_cms_args }
21
+ )
22
+ end
23
+
24
+ end
data/test/helper.rb ADDED
@@ -0,0 +1,9 @@
1
+ # encoding: utf-8
2
+
3
+ require 'coveralls'
4
+ Coveralls.wear!
5
+
6
+ require 'minitest'
7
+ require 'minitest/autorun'
8
+ require 'nanoc'
9
+ require 'nanoc-lftp'
metadata ADDED
@@ -0,0 +1,110 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: nanoc-lftp
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Denis Defreyne
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-02-07 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: nanoc
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: 3.6.7
20
+ - - "<"
21
+ - !ruby/object:Gem::Version
22
+ version: 4.0.0
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ requirements:
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ version: 3.6.7
30
+ - - "<"
31
+ - !ruby/object:Gem::Version
32
+ version: 4.0.0
33
+ - !ruby/object:Gem::Dependency
34
+ name: systemu
35
+ requirement: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - "~>"
38
+ - !ruby/object:Gem::Version
39
+ version: '2.6'
40
+ type: :development
41
+ prerelease: false
42
+ version_requirements: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - "~>"
45
+ - !ruby/object:Gem::Version
46
+ version: '2.6'
47
+ - !ruby/object:Gem::Dependency
48
+ name: bundler
49
+ requirement: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - "~>"
52
+ - !ruby/object:Gem::Version
53
+ version: '1.5'
54
+ type: :development
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - "~>"
59
+ - !ruby/object:Gem::Version
60
+ version: '1.5'
61
+ description: Provides an :lftp deployer for nanoc
62
+ email: denis.defreyne@stoneship.org
63
+ executables: []
64
+ extensions: []
65
+ extra_rdoc_files:
66
+ - LICENSE
67
+ - README.md
68
+ - NEWS.md
69
+ files:
70
+ - Gemfile
71
+ - Gemfile.lock
72
+ - LICENSE
73
+ - NEWS.md
74
+ - README.md
75
+ - Rakefile
76
+ - lib/nanoc-lftp.rb
77
+ - lib/nanoc/lftp.rb
78
+ - lib/nanoc/lftp/deployer.rb
79
+ - lib/nanoc/lftp/version.rb
80
+ - nanoc-lftp.gemspec
81
+ - test/deployers/test_lftp.rb
82
+ - test/helper.rb
83
+ homepage: http://nanoc.ws/
84
+ licenses:
85
+ - MIT
86
+ metadata: {}
87
+ post_install_message:
88
+ rdoc_options:
89
+ - "--main"
90
+ - README.md
91
+ require_paths:
92
+ - lib
93
+ required_ruby_version: !ruby/object:Gem::Requirement
94
+ requirements:
95
+ - - ">="
96
+ - !ruby/object:Gem::Version
97
+ version: 1.9.3
98
+ required_rubygems_version: !ruby/object:Gem::Requirement
99
+ requirements:
100
+ - - ">="
101
+ - !ruby/object:Gem::Version
102
+ version: '0'
103
+ requirements: []
104
+ rubyforge_project:
105
+ rubygems_version: 2.4.5
106
+ signing_key:
107
+ specification_version: 4
108
+ summary: LFTP deployer for nanoc
109
+ test_files: []
110
+ has_rdoc: