glynn 1.0.6 → 1.0.7
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/VERSION +1 -1
- data/bin/glynn +4 -4
- data/glynn.gemspec +2 -2
- data/lib/glynn/ftp.rb +5 -1
- data/spec/lib/ftp_spec.rb +12 -3
- metadata +15 -15
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.0.
|
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'],
|
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.
|
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-
|
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(
|
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.
|
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-
|
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: &
|
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: *
|
25
|
+
version_requirements: *2154685660
|
26
26
|
- !ruby/object:Gem::Dependency
|
27
27
|
name: jekyll
|
28
|
-
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: *
|
36
|
+
version_requirements: *2154705580
|
37
37
|
- !ruby/object:Gem::Dependency
|
38
38
|
name: jeweler
|
39
|
-
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: *
|
47
|
+
version_requirements: *2154707160
|
48
48
|
- !ruby/object:Gem::Dependency
|
49
49
|
name: sdoc
|
50
|
-
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: *
|
58
|
+
version_requirements: *2154708720
|
59
59
|
- !ruby/object:Gem::Dependency
|
60
60
|
name: sdoc-helpers
|
61
|
-
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: *
|
69
|
+
version_requirements: *2154710300
|
70
70
|
- !ruby/object:Gem::Dependency
|
71
71
|
name: jekyll
|
72
|
-
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: *
|
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: -
|
123
|
+
hash: -1694366324833160504
|
124
124
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
125
125
|
none: false
|
126
126
|
requirements:
|