glynn 1.0.5 → 1.0.6
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/README.md +2 -1
- data/VERSION +1 -1
- data/bin/glynn +1 -1
- data/glynn.gemspec +3 -3
- data/lib/glynn/file.rb +2 -2
- data/lib/glynn/ftp.rb +6 -6
- data/lib/glynn/jekyll.rb +2 -2
- data/spec/lib/file_spec.rb +4 -4
- data/spec/lib/ftp_spec.rb +15 -15
- data/spec/lib/jekyll_spec.rb +5 -5
- data/spec/spec_helper.rb +0 -5
- metadata +16 -16
data/README.md
CHANGED
@@ -1,7 +1,8 @@
|
|
1
1
|
Glynn
|
2
2
|
=====
|
3
3
|
|
4
|
-
Glynn offers you a bin to easily send a jekyll powered blog to your host through FTP.
|
4
|
+
Glynn offers you a bin to easily send a jekyll powered blog to your host through FTP.
|
5
|
+
[](http://travis-ci.org/dmathieu/glynn)
|
5
6
|
|
6
7
|
Installation
|
7
8
|
------------
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.0.
|
1
|
+
1.0.6
|
data/bin/glynn
CHANGED
@@ -52,7 +52,7 @@ rescue NoMethodError, Interrupt
|
|
52
52
|
exit
|
53
53
|
end
|
54
54
|
|
55
|
-
ftp = Glynn::Ftp.new(options['ftp_host'], 21, {:username => username, :password => password})
|
55
|
+
ftp = Glynn::Ftp.new(options['ftp_host'], options['ftp_port'] || 21, {: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.6"
|
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-07-27}
|
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}
|
@@ -40,7 +40,7 @@ Gem::Specification.new do |s|
|
|
40
40
|
]
|
41
41
|
s.homepage = %q{http://github.com/dmathieu/glynn}
|
42
42
|
s.require_paths = ["lib"]
|
43
|
-
s.rubygems_version = %q{1.
|
43
|
+
s.rubygems_version = %q{1.6.2}
|
44
44
|
s.summary = %q{Deploy a jekyll weblog through ftp}
|
45
45
|
s.test_files = [
|
46
46
|
"spec/lib/file_spec.rb",
|
data/lib/glynn/file.rb
CHANGED
data/lib/glynn/ftp.rb
CHANGED
@@ -3,26 +3,26 @@ require 'net/ftp'
|
|
3
3
|
module Glynn
|
4
4
|
class Ftp
|
5
5
|
attr_reader :host, :port, :username, :password
|
6
|
-
|
6
|
+
|
7
7
|
def initialize(host, port = 21, options = Hash.new)
|
8
8
|
options = {:username => nil, :password => nil}.merge(options)
|
9
9
|
@host, @port = host, port
|
10
10
|
@username, @password = options[:username], options[:password]
|
11
11
|
end
|
12
|
-
|
12
|
+
|
13
13
|
def sync(local, distant)
|
14
14
|
connect do |ftp|
|
15
15
|
send_dir(ftp, local, distant)
|
16
16
|
end
|
17
17
|
end
|
18
|
-
|
18
|
+
|
19
19
|
private
|
20
20
|
def connect
|
21
21
|
ftp = Net::FTP.new(host, username, password)
|
22
22
|
yield ftp
|
23
23
|
ftp.close
|
24
24
|
end
|
25
|
-
|
25
|
+
|
26
26
|
def send_dir(ftp, local, distant)
|
27
27
|
begin
|
28
28
|
ftp.mkdir(distant)
|
@@ -33,7 +33,7 @@ module Glynn
|
|
33
33
|
Dir.foreach(local) do |file_name|
|
34
34
|
# If the file/directory is hidden (first character is a dot), we ignore it
|
35
35
|
next if file_name =~ /^\./
|
36
|
-
|
36
|
+
|
37
37
|
if ::File.stat(local + "/" + file_name).directory?
|
38
38
|
# It is a directory, we recursively send it
|
39
39
|
begin
|
@@ -52,7 +52,7 @@ module Glynn
|
|
52
52
|
end
|
53
53
|
end
|
54
54
|
end
|
55
|
-
|
55
|
+
|
56
56
|
end
|
57
57
|
end
|
58
58
|
end
|
data/lib/glynn/jekyll.rb
CHANGED
data/spec/lib/file_spec.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
require File.dirname(__FILE__) + '/../spec_helper'
|
2
|
-
|
2
|
+
|
3
3
|
describe "File module" do
|
4
4
|
before(:all) do
|
5
5
|
FakeFS.activate!
|
@@ -7,14 +7,14 @@ describe "File module" do
|
|
7
7
|
after(:all) do
|
8
8
|
FakeFS.deactivate!
|
9
9
|
end
|
10
|
-
|
10
|
+
|
11
11
|
it "should return file is text" do
|
12
12
|
File.open('/test/README', 'w') { |f| f.write 'N/A' }
|
13
13
|
Glynn::File.is_bin?('/test/README').should eql(true)
|
14
14
|
end
|
15
|
-
|
15
|
+
|
16
16
|
it "should return file is binary" do
|
17
17
|
File.open('/test/README', 'w') { |f| f.write ['0', '1', '2', '3'].pack('A3A3A3') }
|
18
18
|
Glynn::File.is_bin?('/test/README').should eql(true)
|
19
19
|
end
|
20
|
-
end
|
20
|
+
end
|
data/spec/lib/ftp_spec.rb
CHANGED
@@ -1,63 +1,63 @@
|
|
1
1
|
require File.dirname(__FILE__) + '/../spec_helper'
|
2
|
-
|
2
|
+
|
3
3
|
describe "FTP Interface" do
|
4
4
|
before(:each) do
|
5
5
|
# We mock the FTP server
|
6
|
-
@mock = mock('Ftp server'
|
7
|
-
|
6
|
+
@mock = mock('Ftp server').as_null_object
|
7
|
+
|
8
8
|
# And the puttextfile method
|
9
9
|
class Net::FTP
|
10
10
|
def puttextfile; true; end
|
11
11
|
end
|
12
12
|
end
|
13
|
-
|
13
|
+
|
14
14
|
it 'should login to ftp server' do
|
15
15
|
@mock.should_receive(:close)
|
16
16
|
Net::FTP.should_receive(:new).with('localhost', nil, nil).and_return(@mock)
|
17
|
-
|
18
|
-
|
17
|
+
|
18
|
+
|
19
19
|
Glynn::Ftp.new('localhost').send(:connect) do |ftp|
|
20
20
|
ftp.should eql(@mock)
|
21
21
|
end
|
22
22
|
end
|
23
|
-
|
23
|
+
|
24
24
|
it 'should accept a username and password' do
|
25
25
|
@mock.should_receive(:close)
|
26
26
|
Net::FTP.should_receive(:new).with('localhost', 'username', 'password').and_return(@mock)
|
27
|
-
|
27
|
+
|
28
28
|
Glynn::Ftp.new('localhost', 21, {:username => 'username', :password => 'password'}).send(:connect) do |ftp|
|
29
29
|
ftp.should eql(@mock)
|
30
30
|
end
|
31
31
|
end
|
32
|
-
|
32
|
+
|
33
33
|
it 'should recursively send a directory' do
|
34
34
|
# We expect NET/FTP to create every file
|
35
35
|
@mock.should_receive(:putbinaryfile).with('/test/README', '/blah/README').and_return(true)
|
36
36
|
@mock.should_receive(:putbinaryfile).with('/test/subdir/README', '/blah/subdir/README').and_return(true)
|
37
37
|
@mock.should_receive(:mkdir).with('/blah')
|
38
38
|
@mock.should_receive(:mkdir).with('/blah/subdir').twice
|
39
|
-
|
39
|
+
|
40
40
|
FakeFS do
|
41
41
|
# We create the fake files and directories
|
42
42
|
Dir.mkdir('/test') unless File.exists?('/test')
|
43
43
|
Dir.mkdir('/test/subdir') unless File.exists?('/test')
|
44
44
|
File.open('/test/README', 'w') { |f| f.write 'N/A' }
|
45
45
|
File.open('/test/subdir/README', 'w') { |f| f.write 'N/A' }
|
46
|
-
|
46
|
+
|
47
47
|
# And send them
|
48
48
|
Glynn::Ftp.new('localhost').send(:send_dir, @mock, '/test', '/blah')
|
49
49
|
end
|
50
50
|
end
|
51
|
-
|
51
|
+
|
52
52
|
it 'should connect itself to the server and send the local file to distant directory' do
|
53
53
|
@mock.should_receive(:close)
|
54
|
-
|
54
|
+
|
55
55
|
FakeFS do
|
56
56
|
interface = Glynn::Ftp.new('localhost')
|
57
57
|
Net::FTP.should_receive(:new).with('localhost', nil, nil).and_return(@mock)
|
58
58
|
interface.should_receive(:send_dir).with(@mock, '/test', '/blah')
|
59
|
-
|
59
|
+
|
60
60
|
interface.sync '/test', '/blah'
|
61
61
|
end
|
62
62
|
end
|
63
|
-
end
|
63
|
+
end
|
data/spec/lib/jekyll_spec.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
require File.dirname(__FILE__) + '/../spec_helper'
|
2
|
-
|
2
|
+
|
3
3
|
describe "Relation between glynn and jekyll" do
|
4
4
|
before(:all) do
|
5
5
|
FakeFS.activate!
|
@@ -8,21 +8,21 @@ describe "Relation between glynn and jekyll" do
|
|
8
8
|
after(:all) do
|
9
9
|
FakeFS.deactivate!
|
10
10
|
end
|
11
|
-
|
11
|
+
|
12
12
|
it 'should create a new website' do
|
13
13
|
jekyll = Glynn::Jekyll.new({ 'source' => '/' })
|
14
14
|
jekyll.build
|
15
15
|
end
|
16
|
-
|
16
|
+
|
17
17
|
it 'should accept the ftp host option' do
|
18
18
|
File.open('/_config.yml', 'w') { |f| f.write 'ftp_host: example.com' }
|
19
19
|
options = Jekyll.configuration({'source' => '/'})
|
20
20
|
options['ftp_host'].should eql('example.com')
|
21
21
|
end
|
22
|
-
|
22
|
+
|
23
23
|
it 'should accept the fto dir option' do
|
24
24
|
File.open('/_config.yml', 'w') { |f| f.write 'ftp_dir: /home/glynn' }
|
25
25
|
options = Jekyll.configuration({'source' => '/'})
|
26
26
|
options['ftp_dir'].should eql('/home/glynn')
|
27
27
|
end
|
28
|
-
end
|
28
|
+
end
|
data/spec/spec_helper.rb
CHANGED
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.6
|
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-07-27 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: &2158401740 !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: *2158401740
|
26
26
|
- !ruby/object:Gem::Dependency
|
27
27
|
name: jekyll
|
28
|
-
requirement: &
|
28
|
+
requirement: &2158409380 !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: *2158409380
|
37
37
|
- !ruby/object:Gem::Dependency
|
38
38
|
name: jeweler
|
39
|
-
requirement: &
|
39
|
+
requirement: &2158410880 !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: *2158410880
|
48
48
|
- !ruby/object:Gem::Dependency
|
49
49
|
name: sdoc
|
50
|
-
requirement: &
|
50
|
+
requirement: &2158412480 !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: *2158412480
|
59
59
|
- !ruby/object:Gem::Dependency
|
60
60
|
name: sdoc-helpers
|
61
|
-
requirement: &
|
61
|
+
requirement: &2158414160 !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: *2158414160
|
70
70
|
- !ruby/object:Gem::Dependency
|
71
71
|
name: jekyll
|
72
|
-
requirement: &
|
72
|
+
requirement: &2158415880 !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: *2158415880
|
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: -4347291183296770297
|
124
124
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
125
125
|
none: false
|
126
126
|
requirements:
|
@@ -129,7 +129,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
129
129
|
version: '0'
|
130
130
|
requirements: []
|
131
131
|
rubyforge_project:
|
132
|
-
rubygems_version: 1.
|
132
|
+
rubygems_version: 1.6.2
|
133
133
|
signing_key:
|
134
134
|
specification_version: 3
|
135
135
|
summary: Deploy a jekyll weblog through ftp
|