glynn 1.0.6 → 1.0.7

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.6
1
+ 1.0.7
data/bin/glynn CHANGED
@@ -20,14 +20,14 @@ case ARGV.size
20
20
  options['ftp_password'] = ARGV[3]
21
21
  end
22
22
  options = Jekyll.configuration(options)
23
-
23
+ ftp_port = options['ftp_port'].to_i || 21
24
24
 
25
25
  puts "Building site: #{options['source']} -> #{options['destination']}"
26
26
  jekyll = Glynn::Jekyll.new
27
27
  jekyll.build
28
28
  puts "Successfully generated site"
29
29
 
30
- puts "Sending site over FTP (host: #{options['ftp_host']})"
30
+ puts "Sending site over FTP (host: #{options['ftp_host']}, port: #{ftp_port})"
31
31
  begin
32
32
  if options['ftp_username'].nil?
33
33
  print "FTP Username: "
@@ -35,7 +35,7 @@ begin
35
35
  else
36
36
  username = options['ftp_username']
37
37
  end
38
-
38
+
39
39
  if options['ftp_password'].nil?
40
40
  print "FTP Password: "
41
41
  # We hide the entered characters before to ask for the password
@@ -52,7 +52,7 @@ rescue NoMethodError, Interrupt
52
52
  exit
53
53
  end
54
54
 
55
- ftp = Glynn::Ftp.new(options['ftp_host'], options['ftp_port'] || 21, {:username => username, :password => password})
55
+ ftp = Glynn::Ftp.new(options['ftp_host'], ftp_port, {:username => username, :password => password})
56
56
  puts "\r\nConnected to server. Sending site"
57
57
  ftp.sync(options['destination'], options['ftp_dir'])
58
58
  puts "Successfully sent site"
data/glynn.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{glynn}
8
- s.version = "1.0.6"
8
+ s.version = "1.0.7"
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 = %q{2011-07-27}
12
+ s.date = %q{2011-09-16}
13
13
  s.default_executable = %q{glynn}
14
14
  s.description = %q{Deploy a jekyll weblog through ftp}
15
15
  s.email = %q{42@dmathieu.com}
data/lib/glynn/ftp.rb CHANGED
@@ -18,7 +18,7 @@ module Glynn
18
18
 
19
19
  private
20
20
  def connect
21
- ftp = Net::FTP.new(host, username, password)
21
+ ftp = Net::FTP.new(host_with_port, username, password)
22
22
  yield ftp
23
23
  ftp.close
24
24
  end
@@ -52,7 +52,11 @@ module Glynn
52
52
  end
53
53
  end
54
54
  end
55
+ end
55
56
 
57
+ private
58
+ def host_with_port
59
+ "#{host}:#{port}"
56
60
  end
57
61
  end
58
62
  end
data/spec/lib/ftp_spec.rb CHANGED
@@ -13,7 +13,7 @@ describe "FTP Interface" do
13
13
 
14
14
  it 'should login to ftp server' do
15
15
  @mock.should_receive(:close)
16
- Net::FTP.should_receive(:new).with('localhost', nil, nil).and_return(@mock)
16
+ Net::FTP.should_receive(:new).with('localhost:21', nil, nil).and_return(@mock)
17
17
 
18
18
 
19
19
  Glynn::Ftp.new('localhost').send(:connect) do |ftp|
@@ -21,9 +21,18 @@ describe "FTP Interface" do
21
21
  end
22
22
  end
23
23
 
24
+ 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)
27
+
28
+ Glynn::Ftp.new('localhost', 1234).send(:connect) do |ftp|
29
+ ftp.should eql(@mock)
30
+ end
31
+ end
32
+
24
33
  it 'should accept a username and password' do
25
34
  @mock.should_receive(:close)
26
- Net::FTP.should_receive(:new).with('localhost', 'username', 'password').and_return(@mock)
35
+ Net::FTP.should_receive(:new).with('localhost:21', 'username', 'password').and_return(@mock)
27
36
 
28
37
  Glynn::Ftp.new('localhost', 21, {:username => 'username', :password => 'password'}).send(:connect) do |ftp|
29
38
  ftp.should eql(@mock)
@@ -54,7 +63,7 @@ describe "FTP Interface" do
54
63
 
55
64
  FakeFS do
56
65
  interface = Glynn::Ftp.new('localhost')
57
- Net::FTP.should_receive(:new).with('localhost', nil, nil).and_return(@mock)
66
+ Net::FTP.should_receive(:new).with('localhost:21', nil, nil).and_return(@mock)
58
67
  interface.should_receive(:send_dir).with(@mock, '/test', '/blah')
59
68
 
60
69
  interface.sync '/test', '/blah'
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.6
4
+ version: 1.0.7
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,12 +9,12 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-07-27 00:00:00.000000000 +02:00
12
+ date: 2011-09-16 00:00:00.000000000 +02:00
13
13
  default_executable: glynn
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rdiscount
17
- requirement: &2158401740 !ruby/object:Gem::Requirement
17
+ requirement: &2154685660 !ruby/object:Gem::Requirement
18
18
  none: false
19
19
  requirements:
20
20
  - - ! '>='
@@ -22,10 +22,10 @@ dependencies:
22
22
  version: '0'
23
23
  type: :runtime
24
24
  prerelease: false
25
- version_requirements: *2158401740
25
+ version_requirements: *2154685660
26
26
  - !ruby/object:Gem::Dependency
27
27
  name: jekyll
28
- requirement: &2158409380 !ruby/object:Gem::Requirement
28
+ requirement: &2154705580 !ruby/object:Gem::Requirement
29
29
  none: false
30
30
  requirements:
31
31
  - - ! '>='
@@ -33,10 +33,10 @@ dependencies:
33
33
  version: '0'
34
34
  type: :runtime
35
35
  prerelease: false
36
- version_requirements: *2158409380
36
+ version_requirements: *2154705580
37
37
  - !ruby/object:Gem::Dependency
38
38
  name: jeweler
39
- requirement: &2158410880 !ruby/object:Gem::Requirement
39
+ requirement: &2154707160 !ruby/object:Gem::Requirement
40
40
  none: false
41
41
  requirements:
42
42
  - - ! '>='
@@ -44,10 +44,10 @@ dependencies:
44
44
  version: '0'
45
45
  type: :runtime
46
46
  prerelease: false
47
- version_requirements: *2158410880
47
+ version_requirements: *2154707160
48
48
  - !ruby/object:Gem::Dependency
49
49
  name: sdoc
50
- requirement: &2158412480 !ruby/object:Gem::Requirement
50
+ requirement: &2154708720 !ruby/object:Gem::Requirement
51
51
  none: false
52
52
  requirements:
53
53
  - - ! '>='
@@ -55,10 +55,10 @@ dependencies:
55
55
  version: '0'
56
56
  type: :runtime
57
57
  prerelease: false
58
- version_requirements: *2158412480
58
+ version_requirements: *2154708720
59
59
  - !ruby/object:Gem::Dependency
60
60
  name: sdoc-helpers
61
- requirement: &2158414160 !ruby/object:Gem::Requirement
61
+ requirement: &2154710300 !ruby/object:Gem::Requirement
62
62
  none: false
63
63
  requirements:
64
64
  - - ! '>='
@@ -66,10 +66,10 @@ dependencies:
66
66
  version: '0'
67
67
  type: :runtime
68
68
  prerelease: false
69
- version_requirements: *2158414160
69
+ version_requirements: *2154710300
70
70
  - !ruby/object:Gem::Dependency
71
71
  name: jekyll
72
- requirement: &2158415880 !ruby/object:Gem::Requirement
72
+ requirement: &2154712120 !ruby/object:Gem::Requirement
73
73
  none: false
74
74
  requirements:
75
75
  - - ! '>='
@@ -77,7 +77,7 @@ dependencies:
77
77
  version: 0.5.4
78
78
  type: :runtime
79
79
  prerelease: false
80
- version_requirements: *2158415880
80
+ version_requirements: *2154712120
81
81
  description: Deploy a jekyll weblog through ftp
82
82
  email: 42@dmathieu.com
83
83
  executables:
@@ -120,7 +120,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
120
120
  version: '0'
121
121
  segments:
122
122
  - 0
123
- hash: -4347291183296770297
123
+ hash: -1694366324833160504
124
124
  required_rubygems_version: !ruby/object:Gem::Requirement
125
125
  none: false
126
126
  requirements: