glynn 1.0.11 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 97e79c9d356db219138794c973897b9e6df229b0
4
+ data.tar.gz: 8fa4e16bcc32bfeb2d82e8a3d0e1ecee1c85f0f0
5
+ SHA512:
6
+ metadata.gz: 7a811cf2dee93667152c489d39053fd5813f7bc54295db79a3936ebb4efc66e6e4e17eaae782237e795e253f3aa3f3e819ee58d3bd14982908a1e5a80233401f
7
+ data.tar.gz: f514fe9529376ad92371eb206b8735a67433c0f2ba33f44159ddc6c8271b00a7e5550aa431e7cf66568cb6f19d89f569a76b9e89af0096066ee2022785661b81
data/bin/glynn CHANGED
@@ -19,8 +19,9 @@ case ARGV.size
19
19
  options['ftp_username'] = ARGV[2]
20
20
  options['ftp_password'] = ARGV[3]
21
21
  end
22
- options = Jekyll.configuration(options)
22
+ options = Jekyll.configuration(options)
23
23
  ftp_port = (options['ftp_port'] || 21).to_i
24
+ passive = options['ftp_passive'] || true
24
25
 
25
26
  puts "Building site: #{options['source']} -> #{options['destination']}"
26
27
  jekyll = Glynn::Jekyll.new
@@ -52,7 +53,7 @@ rescue NoMethodError, Interrupt
52
53
  exit
53
54
  end
54
55
 
55
- ftp = Glynn::Ftp.new(options['ftp_host'], ftp_port, {:username => username, :password => password})
56
+ ftp = Glynn::Ftp.new(options['ftp_host'], ftp_port, {:username => username, :password => password, :passive => passive})
56
57
  puts "\r\nConnected to server. Sending site"
57
58
  ftp.sync(options['destination'], options['ftp_dir'])
58
59
  puts "Successfully sent site"
data/lib/glynn/file.rb CHANGED
@@ -2,7 +2,12 @@ module Glynn
2
2
  class File
3
3
 
4
4
  def self.is_bin?(f)
5
- %x(file #{f}) !~ /text/
5
+ file_test = %x(file #{f})
6
+
7
+ # http://stackoverflow.com/a/8873922
8
+ file_test = file_test.encode('UTF-16', 'UTF-8', :invalid => :replace, :replace => '').encode('UTF-8', 'UTF-16')
9
+
10
+ file_test !~ /text/
6
11
  end
7
12
  end
8
13
  end
data/lib/glynn/ftp.rb CHANGED
@@ -2,12 +2,13 @@ require 'net/ftp'
2
2
 
3
3
  module Glynn
4
4
  class Ftp
5
- attr_reader :host, :port, :username, :password
5
+ attr_reader :host, :port, :username, :password, :passive
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
+ @passive = options[:passive]
11
12
  end
12
13
 
13
14
  def sync(local, distant)
@@ -19,7 +20,7 @@ module Glynn
19
20
  private
20
21
  def connect
21
22
  Net::FTP.open(host) do |ftp|
22
- ftp.passive = true
23
+ ftp.passive = @passive
23
24
  ftp.connect(host, port)
24
25
  ftp.login(username, password)
25
26
  yield ftp
@@ -35,8 +36,9 @@ module Glynn
35
36
  end
36
37
  Dir.foreach(local) do |file_name|
37
38
  # If the file/directory is hidden (first character is a dot), we ignore it
38
- next if file_name =~ /^\./
39
+ next if file_name =~ /^(\.|\.\.)$/
39
40
 
41
+ puts " -> " + file_name
40
42
  if ::File.stat(local + "/" + file_name).directory?
41
43
  # It is a directory, we recursively send it
42
44
  begin
data/lib/glynn/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Glynn
2
- VERSION = '1.0.11'
2
+ VERSION = '1.1.0'
3
3
  end
metadata CHANGED
@@ -1,49 +1,57 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: glynn
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.11
5
- prerelease:
4
+ version: 1.1.0
6
5
  platform: ruby
7
6
  authors:
8
7
  - Damien MATHIEU
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2012-05-26 00:00:00.000000000Z
11
+ date: 2014-09-20 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: bundler
16
- requirement: &70365074332120 !ruby/object:Gem::Requirement
17
- none: false
15
+ requirement: !ruby/object:Gem::Requirement
18
16
  requirements:
19
- - - ! '>='
17
+ - - ">="
20
18
  - !ruby/object:Gem::Version
21
19
  version: '0'
22
20
  type: :development
23
21
  prerelease: false
24
- version_requirements: *70365074332120
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
25
27
  - !ruby/object:Gem::Dependency
26
28
  name: minitest
27
- requirement: &70365074485020 !ruby/object:Gem::Requirement
28
- none: false
29
+ requirement: !ruby/object:Gem::Requirement
29
30
  requirements:
30
- - - ! '>='
31
+ - - ">="
31
32
  - !ruby/object:Gem::Version
32
33
  version: '0'
33
34
  type: :development
34
35
  prerelease: false
35
- version_requirements: *70365074485020
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
36
41
  - !ruby/object:Gem::Dependency
37
42
  name: jekyll
38
- requirement: &70365074484500 !ruby/object:Gem::Requirement
39
- none: false
43
+ requirement: !ruby/object:Gem::Requirement
40
44
  requirements:
41
- - - ! '>='
45
+ - - ">="
42
46
  - !ruby/object:Gem::Version
43
47
  version: '0'
44
48
  type: :runtime
45
49
  prerelease: false
46
- version_requirements: *70365074484500
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
47
55
  description: Deploy a jekyll weblog through ftp
48
56
  email: 42@dmathieu.com
49
57
  executables:
@@ -51,34 +59,35 @@ executables:
51
59
  extensions: []
52
60
  extra_rdoc_files: []
53
61
  files:
62
+ - bin/glynn
54
63
  - lib/glynn.rb
55
64
  - lib/glynn/file.rb
56
65
  - lib/glynn/ftp.rb
57
66
  - lib/glynn/jekyll.rb
58
67
  - lib/glynn/version.rb
59
- - bin/glynn
60
68
  homepage: https://github.com/dmathieu/glynn
61
- licenses: []
69
+ licenses:
70
+ - MIT
71
+ metadata: {}
62
72
  post_install_message:
63
73
  rdoc_options: []
64
74
  require_paths:
65
75
  - lib
66
76
  required_ruby_version: !ruby/object:Gem::Requirement
67
- none: false
68
77
  requirements:
69
- - - ! '>='
78
+ - - ">="
70
79
  - !ruby/object:Gem::Version
71
80
  version: '0'
72
81
  required_rubygems_version: !ruby/object:Gem::Requirement
73
- none: false
74
82
  requirements:
75
- - - ! '>='
83
+ - - ">="
76
84
  - !ruby/object:Gem::Version
77
85
  version: '0'
78
86
  requirements: []
79
87
  rubyforge_project:
80
- rubygems_version: 1.8.17
88
+ rubygems_version: 2.2.2
81
89
  signing_key:
82
- specification_version: 3
90
+ specification_version: 4
83
91
  summary: Deploy a jekyll weblog through ftp
84
92
  test_files: []
93
+ has_rdoc: