glynn 1.0.8 → 1.0.9

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.8
1
+ 1.0.9
data/glynn.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "glynn"
8
- s.version = "1.0.8"
8
+ s.version = "1.0.9"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Damien MATHIEU"]
12
- s.date = "2011-09-29"
12
+ s.date = "2012-01-31"
13
13
  s.description = "Deploy a jekyll weblog through ftp"
14
14
  s.email = "42@dmathieu.com"
15
15
  s.executables = ["glynn"]
data/lib/glynn/ftp.rb CHANGED
@@ -18,9 +18,11 @@ module Glynn
18
18
 
19
19
  private
20
20
  def connect
21
- ftp = Net::FTP.new(host_with_port, username, password)
22
- yield ftp
23
- ftp.close
21
+ Net::FTP.open(host) do |ftp|
22
+ ftp.connect(host, port)
23
+ ftp.login(username, password)
24
+ yield ftp
25
+ end
24
26
  end
25
27
 
26
28
  def send_dir(ftp, local, distant)
data/spec/lib/ftp_spec.rb CHANGED
@@ -11,30 +11,36 @@ describe "FTP Interface" do
11
11
  end
12
12
  end
13
13
 
14
- it 'should login to ftp server' do
15
- @mock.should_receive(:close)
16
- Net::FTP.should_receive(:new).with('localhost:21', nil, nil).and_return(@mock)
17
-
14
+ it 'should connect to ftp server' do
15
+ Net::FTP.should_receive(:open).with('localhost').and_return(@mock)
18
16
 
19
17
  Glynn::Ftp.new('localhost').send(:connect) do |ftp|
20
18
  ftp.should eql(@mock)
21
19
  end
22
20
  end
23
21
 
22
+ it 'should login to ftp server' do
23
+ Net::FTP.should_receive(:open).with('localhost').and_return(@mock)
24
+
25
+ Glynn::Ftp.new('localhost').send(:connect) do |ftp|
26
+ @mock.should_receive(:login).with(nil, nil)
27
+ end
28
+ end
29
+
24
30
  it 'should use the given port' do
25
- @mock.should_receive(:close)
26
- Net::FTP.should_receive(:new).with('localhost:1234', nil, nil).and_return(@mock)
31
+ Net::FTP.should_receive(:open).with('localhost').and_return(@mock)
27
32
 
28
33
  Glynn::Ftp.new('localhost', 1234).send(:connect) do |ftp|
34
+ @mock.should_receive(:connect).with('localhost', 1234)
29
35
  ftp.should eql(@mock)
30
36
  end
31
37
  end
32
38
 
33
39
  it 'should accept a username and password' do
34
- @mock.should_receive(:close)
35
- Net::FTP.should_receive(:new).with('localhost:21', 'username', 'password').and_return(@mock)
40
+ Net::FTP.should_receive(:open).with('localhost').and_return(@mock)
36
41
 
37
42
  Glynn::Ftp.new('localhost', 21, {:username => 'username', :password => 'password'}).send(:connect) do |ftp|
43
+ @mock.should_receive(:login).with('username', 'password')
38
44
  ftp.should eql(@mock)
39
45
  end
40
46
  end
@@ -59,12 +65,13 @@ describe "FTP Interface" do
59
65
  end
60
66
 
61
67
  it 'should connect itself to the server and send the local file to distant directory' do
62
- @mock.should_receive(:close)
63
-
64
68
  FakeFS do
65
- interface = Glynn::Ftp.new('localhost')
66
- Net::FTP.should_receive(:new).with('localhost:21', nil, nil).and_return(@mock)
67
- interface.should_receive(:send_dir).with(@mock, '/test', '/blah')
69
+ Net::FTP.should_receive(:open).with('localhost').and_return(@mock)
70
+ interface = Glynn::Ftp.new('localhost') do |ftp|
71
+ @mock.should_receive(:connect).with('localhost', 21)
72
+ @mock.should_receive(:login).with(nil, nil)
73
+ interface.should_receive(:send_dir).with(@mock, '/test', '/blah')
74
+ end
68
75
 
69
76
  interface.sync '/test', '/blah'
70
77
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: glynn
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.8
4
+ version: 1.0.9
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-09-29 00:00:00.000000000Z
12
+ date: 2012-01-31 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rdiscount
16
- requirement: &70131593457960 !ruby/object:Gem::Requirement
16
+ requirement: &70171743230860 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70131593457960
24
+ version_requirements: *70171743230860
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: jekyll
27
- requirement: &70131593457300 !ruby/object:Gem::Requirement
27
+ requirement: &70171743230160 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *70131593457300
35
+ version_requirements: *70171743230160
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: jeweler
38
- requirement: &70131593456520 !ruby/object:Gem::Requirement
38
+ requirement: &70171743229540 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '0'
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *70131593456520
46
+ version_requirements: *70171743229540
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: sdoc
49
- requirement: &70131593455820 !ruby/object:Gem::Requirement
49
+ requirement: &70171743228960 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: '0'
55
55
  type: :runtime
56
56
  prerelease: false
57
- version_requirements: *70131593455820
57
+ version_requirements: *70171743228960
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: sdoc-helpers
60
- requirement: &70131593455180 !ruby/object:Gem::Requirement
60
+ requirement: &70171743228320 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ! '>='
@@ -65,10 +65,10 @@ dependencies:
65
65
  version: '0'
66
66
  type: :runtime
67
67
  prerelease: false
68
- version_requirements: *70131593455180
68
+ version_requirements: *70171743228320
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: jekyll
71
- requirement: &70131593454560 !ruby/object:Gem::Requirement
71
+ requirement: &70171743227780 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ! '>='
@@ -76,7 +76,7 @@ dependencies:
76
76
  version: 0.5.4
77
77
  type: :runtime
78
78
  prerelease: false
79
- version_requirements: *70131593454560
79
+ version_requirements: *70171743227780
80
80
  description: Deploy a jekyll weblog through ftp
81
81
  email: 42@dmathieu.com
82
82
  executables:
@@ -118,7 +118,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
118
118
  version: '0'
119
119
  segments:
120
120
  - 0
121
- hash: 3204594906216525315
121
+ hash: 3112693191030928112
122
122
  required_rubygems_version: !ruby/object:Gem::Requirement
123
123
  none: false
124
124
  requirements: