hyde-ftp 0.0.2 → 0.0.4

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/CHANGELOG CHANGED
@@ -1,2 +1,4 @@
1
1
  Version 0.0.1: Beta Released.
2
- Version 0.0.2: Fixed a few bugs.
2
+ Version 0.0.2: Fixed a few bugs.
3
+ Version 0.0.3: Cleaned up code.
4
+ Version 0.0.4: More code cleaning.
data/bin/hyde CHANGED
@@ -1,68 +1,16 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- require 'rubygems'
4
3
  require 'net/ftp'
5
4
  require 'yaml'
6
- require 'thor'
5
+ require '../lib/hyde/ftp-transfer.rb'
7
6
 
8
- class Jekyll < Thor
7
+ class Jekyll
9
8
  $jekyll = Jekyll.new()
10
9
 
11
10
  def initialize()
12
11
  nil
13
12
  end
14
13
 
15
- # FTP Stuff
16
- no_commands do
17
- def mirror(path, ftp, initial_path = nil)
18
- initial_path ||= path
19
- Dir.entries(path).each do |file|
20
- next if ['.', '..'].include? file
21
-
22
- file_path = path + '/' + file
23
- short_file_path = file_path[initial_path.length, file_path.length]
24
- if File.directory?(file_path)
25
- ftp.mkdir(file) unless ftp.nlst.index(file)
26
- ftp.chdir(file)
27
- mirror(file_path, ftp, initial_path)
28
- ftp.chdir('..')
29
- else
30
- puts "Deploying: " + short_file_path
31
- puts " To: " + ftp.pwd + '/' + file
32
- ftp.putbinaryfile(path + '/' + file, file)
33
- end
34
- end
35
- end
36
-
37
-
38
- def ftp_directory?(ftp, file_name)
39
- ftp.chdir(file_name)
40
- ftp.chdir('..')
41
- true
42
- rescue
43
- false
44
- end
45
-
46
- def clean_ftp(ftp)
47
- ftp.nlst.each do |file|
48
- next if ['.', '..', 'bup', 'backup'].include? file
49
- if ftp_directory? ftp, file
50
- ftp.chdir file
51
- clean_ftp(ftp)
52
- ftp.chdir '..'
53
- puts "Deleting directory: " + ftp.pwd + "/" + file
54
- ftp.rmdir(file)
55
- else
56
- puts "Deleting: " + ftp.pwd + "/" + file
57
- ftp.delete file
58
- end
59
- end
60
- end
61
- end
62
-
63
- # END FTP Stuff
64
-
65
- desc "check for Jekyll", "Check if Jekyll is on the system"
66
14
  def exists()
67
15
  @jekyll_version = %x( jekyll -version )
68
16
 
@@ -73,14 +21,12 @@ end
73
21
  end
74
22
  end
75
23
 
76
- desc "new site", "Create a new Jekyll site."
77
24
  def new_site(name)
78
25
  $jekyll.exists()
79
26
  %x( jekyll new #{name} )
80
27
  puts "Site created."
81
28
  end
82
29
 
83
- desc "deploy site", "Deploy website via FTP."
84
30
  def deploy()
85
31
  # Build Site
86
32
  %x( jekyll build )
data/hyde-ftp.gemspec CHANGED
@@ -4,7 +4,7 @@ Gem::Specification.new do |s|
4
4
  s.rubygems_version = '1.3.5'
5
5
 
6
6
  s.name = 'hyde-ftp'
7
- s.version = '0.0.2'
7
+ s.version = '0.0.4'
8
8
  s.license = 'MIT'
9
9
  s.date = '2013-09-12'
10
10
 
@@ -25,6 +25,7 @@ Gem::Specification.new do |s|
25
25
  s.files = %w[
26
26
  bin/hyde
27
27
  lib/hyde.rb
28
+ lib/hyde/ftp-transfer.rb
28
29
  CHANGELOG
29
30
  LICENSE
30
31
  README.md
data/lib/hyde.rb CHANGED
@@ -1,68 +1,16 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- require 'rubygems'
4
3
  require 'net/ftp'
5
4
  require 'yaml'
6
- require 'thor'
5
+ require '../lib/hyde/ftp-transfer.rb'
7
6
 
8
- class Jekyll < Thor
7
+ class Jekyll
9
8
  $jekyll = Jekyll.new()
10
9
 
11
10
  def initialize()
12
11
  nil
13
12
  end
14
13
 
15
- # FTP Stuff
16
- no_commands do
17
- def mirror(path, ftp, initial_path = nil)
18
- initial_path ||= path
19
- Dir.entries(path).each do |file|
20
- next if ['.', '..'].include? file
21
-
22
- file_path = path + '/' + file
23
- short_file_path = file_path[initial_path.length, file_path.length]
24
- if File.directory?(file_path)
25
- ftp.mkdir(file) unless ftp.nlst.index(file)
26
- ftp.chdir(file)
27
- mirror(file_path, ftp, initial_path)
28
- ftp.chdir('..')
29
- else
30
- puts "Deploying: " + short_file_path
31
- puts " To: " + ftp.pwd + '/' + file
32
- ftp.putbinaryfile(path + '/' + file, file)
33
- end
34
- end
35
- end
36
-
37
-
38
- def ftp_directory?(ftp, file_name)
39
- ftp.chdir(file_name)
40
- ftp.chdir('..')
41
- true
42
- rescue
43
- false
44
- end
45
-
46
- def clean_ftp(ftp)
47
- ftp.nlst.each do |file|
48
- next if ['.', '..', 'bup', 'backup'].include? file
49
- if ftp_directory? ftp, file
50
- ftp.chdir file
51
- clean_ftp(ftp)
52
- ftp.chdir '..'
53
- puts "Deleting directory: " + ftp.pwd + "/" + file
54
- ftp.rmdir(file)
55
- else
56
- puts "Deleting: " + ftp.pwd + "/" + file
57
- ftp.delete file
58
- end
59
- end
60
- end
61
- end
62
-
63
- # END FTP Stuff
64
-
65
- desc "check for Jekyll", "Check if Jekyll is on the system"
66
14
  def exists()
67
15
  @jekyll_version = %x( jekyll -version )
68
16
 
@@ -73,14 +21,12 @@ end
73
21
  end
74
22
  end
75
23
 
76
- desc "new site", "Create a new Jekyll site."
77
24
  def new_site(name)
78
25
  $jekyll.exists()
79
26
  %x( jekyll new #{name} )
80
27
  puts "Site created."
81
28
  end
82
29
 
83
- desc "deploy site", "Deploy website via FTP."
84
30
  def deploy()
85
31
  # Build Site
86
32
  %x( jekyll build )
@@ -0,0 +1,43 @@
1
+ def mirror(path, ftp, initial_path = nil)
2
+ initial_path ||= path
3
+ Dir.entries(path).each do |file|
4
+ next if ['.', '..'].include? file
5
+
6
+ file_path = path + '/' + file
7
+ short_file_path = file_path[initial_path.length, file_path.length]
8
+ if File.directory?(file_path)
9
+ ftp.mkdir(file) unless ftp.nlst.index(file)
10
+ ftp.chdir(file)
11
+ mirror(file_path, ftp, initial_path)
12
+ ftp.chdir('..')
13
+ else
14
+ puts "Deploying: " + short_file_path
15
+ puts " To: " + ftp.pwd + '/' + file
16
+ ftp.putbinaryfile(path + '/' + file, file)
17
+ end
18
+ end
19
+ end
20
+
21
+ def ftp_directory?(ftp, file_name)
22
+ ftp.chdir(file_name)
23
+ ftp.chdir('..')
24
+ true
25
+ rescue
26
+ false
27
+ end
28
+
29
+ def clean_ftp(ftp)
30
+ ftp.nlst.each do |file|
31
+ next if ['.', '..', 'bup', 'backup'].include? file
32
+ if ftp_directory? ftp, file
33
+ ftp.chdir file
34
+ clean_ftp(ftp)
35
+ ftp.chdir '..'
36
+ puts "Deleting directory: " + ftp.pwd + "/" + file
37
+ ftp.rmdir(file)
38
+ else
39
+ puts "Deleting: " + ftp.pwd + "/" + file
40
+ ftp.delete file
41
+ end
42
+ end
43
+ end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hyde-ftp
3
3
  version: !ruby/object:Gem::Version
4
- hash: 27
4
+ hash: 23
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 2
10
- version: 0.0.2
9
+ - 4
10
+ version: 0.0.4
11
11
  platform: ruby
12
12
  authors:
13
13
  - Jesse Herrick
@@ -44,6 +44,7 @@ extra_rdoc_files: []
44
44
  files:
45
45
  - bin/hyde
46
46
  - lib/hyde.rb
47
+ - lib/hyde/ftp-transfer.rb
47
48
  - CHANGELOG
48
49
  - LICENSE
49
50
  - README.md