dandelion 0.3.4 → 0.3.5
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.
- data/LICENSE +19 -0
- data/lib/dandelion/backend/sftp.rb +12 -3
- data/lib/dandelion/version.rb +1 -1
- data/test/test_ftp.rb +5 -3
- data/test/test_sftp.rb +9 -2
- metadata +12 -11
data/LICENSE
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
Copyright (C) 2011 Scott Nelson
|
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
|
11
|
+
all 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
|
19
|
+
THE SOFTWARE.
|
@@ -9,7 +9,7 @@ module Dandelion
|
|
9
9
|
|
10
10
|
def initialize(config)
|
11
11
|
require 'net/sftp'
|
12
|
-
@config = config
|
12
|
+
@config = { 'preserve_permissions' => true }.merge(config)
|
13
13
|
options = {
|
14
14
|
:password => @config['password'],
|
15
15
|
:port => @config['port'] || Net::SSH::Transport::Session::DEFAULT_PORT,
|
@@ -38,6 +38,10 @@ module Dandelion
|
|
38
38
|
@sftp.upload!(temp, path(file))
|
39
39
|
end
|
40
40
|
end
|
41
|
+
if @config['preserve_permissions']
|
42
|
+
mode = get_mode(file)
|
43
|
+
@sftp.setstat!(path(file), :permissions => mode) if mode
|
44
|
+
end
|
41
45
|
end
|
42
46
|
|
43
47
|
def delete(file)
|
@@ -54,7 +58,12 @@ module Dandelion
|
|
54
58
|
end
|
55
59
|
|
56
60
|
private
|
57
|
-
|
61
|
+
|
62
|
+
def get_mode(file)
|
63
|
+
stat = File.stat(file) if File.exists?(file)
|
64
|
+
stat.mode if stat
|
65
|
+
end
|
66
|
+
|
58
67
|
def cleanpath(path)
|
59
68
|
Pathname.new(path).cleanpath.to_s if path
|
60
69
|
end
|
@@ -91,4 +100,4 @@ module Dandelion
|
|
91
100
|
end
|
92
101
|
end
|
93
102
|
end
|
94
|
-
end
|
103
|
+
end
|
data/lib/dandelion/version.rb
CHANGED
data/test/test_ftp.rb
CHANGED
@@ -1,12 +1,14 @@
|
|
1
1
|
require 'dandelion/backend/ftp'
|
2
|
-
require 'mocha'
|
3
2
|
require 'net/ftp'
|
4
3
|
require 'test/unit'
|
4
|
+
require 'mocha'
|
5
5
|
|
6
6
|
class TestFTP < Test::Unit::TestCase
|
7
7
|
def setup
|
8
8
|
@ftp = mock()
|
9
|
-
Net::FTP.stubs(:
|
9
|
+
Net::FTP.stubs(:new).returns(@ftp)
|
10
|
+
@ftp.expects(:connect).once
|
11
|
+
@ftp.expects(:login).once
|
10
12
|
@ftp.expects(:passive=).with(true).once
|
11
13
|
@ftp.expects(:chdir).with('foo').once
|
12
14
|
@backend = Dandelion::Backend::FTP.new('path' => 'foo')
|
@@ -44,4 +46,4 @@ class TestFTP < Test::Unit::TestCase
|
|
44
46
|
@backend.delete('bar/baz')
|
45
47
|
@backend.delete('bar/baz/qux')
|
46
48
|
end
|
47
|
-
end
|
49
|
+
end
|
data/test/test_sftp.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'dandelion/backend/sftp'
|
2
|
-
require 'mocha'
|
3
2
|
require 'net/sftp'
|
4
3
|
require 'test/unit'
|
4
|
+
require 'mocha'
|
5
5
|
|
6
6
|
class TestSFTP < Test::Unit::TestCase
|
7
7
|
def setup
|
@@ -27,8 +27,15 @@ class TestSFTP < Test::Unit::TestCase
|
|
27
27
|
end
|
28
28
|
|
29
29
|
def test_write
|
30
|
+
File.stubs(:stat).returns(stub(mode: 0xDEADBEEF))
|
31
|
+
File.stubs(:exists?).with('bar').returns(true)
|
32
|
+
File.stubs(:exists?).with('bar/baz').returns(true)
|
33
|
+
|
30
34
|
@sftp.expects(:upload!).with(:temp, 'foo/bar').once
|
35
|
+
@sftp.expects(:setstat!).with('foo/bar', :permissions => 0xDEADBEEF).once
|
31
36
|
@sftp.expects(:upload!).with(:temp, 'foo/bar/baz').once
|
37
|
+
@sftp.expects(:setstat!).with('foo/bar/baz', :permissions => 0xDEADBEEF).once
|
38
|
+
|
32
39
|
@backend.write('bar', 'baz')
|
33
40
|
@backend.write('bar/baz', 'qux')
|
34
41
|
end
|
@@ -44,4 +51,4 @@ class TestSFTP < Test::Unit::TestCase
|
|
44
51
|
@backend.delete('bar/baz')
|
45
52
|
@backend.delete('bar/baz/qux')
|
46
53
|
end
|
47
|
-
end
|
54
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dandelion
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.5
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2011-
|
12
|
+
date: 2011-12-19 00:00:00.000000000Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: grit
|
16
|
-
requirement: &
|
16
|
+
requirement: &2153620700 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: 2.4.1
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *2153620700
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: mocha
|
27
|
-
requirement: &
|
27
|
+
requirement: &2153620200 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: 0.9.12
|
33
33
|
type: :development
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *2153620200
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: net-sftp
|
38
|
-
requirement: &
|
38
|
+
requirement: &2153619740 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: 2.0.5
|
44
44
|
type: :development
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *2153619740
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: aws-s3
|
49
|
-
requirement: &
|
49
|
+
requirement: &2153619280 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ! '>='
|
@@ -54,7 +54,7 @@ dependencies:
|
|
54
54
|
version: 0.6.0
|
55
55
|
type: :development
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *2153619280
|
58
58
|
description: Incremental Git repository deployment
|
59
59
|
email:
|
60
60
|
- scottbnel@gmail.com
|
@@ -65,6 +65,7 @@ extra_rdoc_files: []
|
|
65
65
|
files:
|
66
66
|
- .gitignore
|
67
67
|
- Gemfile
|
68
|
+
- LICENSE
|
68
69
|
- README.md
|
69
70
|
- Rakefile
|
70
71
|
- bin/dandelion
|
@@ -136,7 +137,7 @@ rubyforge_project:
|
|
136
137
|
rubygems_version: 1.8.10
|
137
138
|
signing_key:
|
138
139
|
specification_version: 3
|
139
|
-
summary: dandelion-0.3.
|
140
|
+
summary: dandelion-0.3.5
|
140
141
|
test_files:
|
141
142
|
- test/fixtures/diff
|
142
143
|
- test/fixtures/ls_tree
|