hyde-ftp 0.1.3 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/hyde-ftp.gemspec +1 -2
  2. metadata +3 -4
  3. data/lib/hyde.rb +0 -127
@@ -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.1.3'
7
+ s.version = '0.1.4'
8
8
  s.license = 'MIT'
9
9
  s.date = '2013-06-11'
10
10
 
@@ -24,7 +24,6 @@ Gem::Specification.new do |s|
24
24
  # = MANIFEST =
25
25
  s.files = %w[
26
26
  bin/hyde
27
- lib/hyde.rb
28
27
  CHANGELOG
29
28
  LICENSE
30
29
  README.md
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: 29
4
+ hash: 19
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 3
10
- version: 0.1.3
9
+ - 4
10
+ version: 0.1.4
11
11
  platform: ruby
12
12
  authors:
13
13
  - Jesse Herrick
@@ -42,7 +42,6 @@ extra_rdoc_files: []
42
42
 
43
43
  files:
44
44
  - bin/hyde
45
- - lib/hyde.rb
46
45
  - CHANGELOG
47
46
  - LICENSE
48
47
  - README.md
@@ -1,127 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require 'rubygems'
4
- require 'net/ftp'
5
- require 'yaml'
6
- require 'lib/hyde/ftp-transfer.rb'
7
-
8
- def mirror(path, ftp, initial_path = nil)
9
- initial_path ||= path
10
- Dir.entries(path).each do |file|
11
- next if ['.', '..'].include? file
12
-
13
- file_path = path + '/' + file
14
- short_file_path = file_path[initial_path.length, file_path.length]
15
- if File.directory?(file_path)
16
- ftp.mkdir(file) unless ftp.nlst.index(file)
17
- ftp.chdir(file)
18
- mirror(file_path, ftp, initial_path)
19
- ftp.chdir('..')
20
- else
21
- puts "Deploying: " + short_file_path
22
- puts " To: " + ftp.pwd + '/' + file
23
- ftp.putbinaryfile(path + '/' + file, file)
24
- end
25
- end
26
- end
27
-
28
- def ftp_directory?(ftp, file_name)
29
- ftp.chdir(file_name)
30
- ftp.chdir('..')
31
- true
32
- rescue
33
- false
34
- end
35
-
36
- def clean_ftp(ftp)
37
- ftp.nlst.each do |file|
38
- next if ['.', '..', 'bup', 'backup'].include? file
39
- if ftp_directory? ftp, file
40
- ftp.chdir file
41
- clean_ftp(ftp)
42
- ftp.chdir '..'
43
- puts "Deleting directory: " + ftp.pwd + "/" + file
44
- ftp.rmdir(file)
45
- else
46
- puts "Deleting: " + ftp.pwd + "/" + file
47
- ftp.delete file
48
- end
49
- end
50
- end
51
-
52
- class Jekyll
53
- $jekyll = Jekyll.new()
54
-
55
- def initialize()
56
- nil
57
- end
58
-
59
- def exists()
60
- @jekyll_version = %x( jekyll -version )
61
-
62
- if @jekyll_version[1] = "j"
63
- nil
64
- else
65
- %x( gem install jekyll )
66
- end
67
- end
68
-
69
- def new_site(name)
70
- exists()
71
- %x( jekyll new #{name} )
72
- puts "Site created."
73
- end
74
-
75
- def deploy()
76
-
77
- # Declare Instance Variables
78
- config = YAML.load(File.read(ARGV[1]))
79
-
80
- @ftp_server = config['server']
81
- @username = config['username']
82
- @password = config['password']
83
- @remote_dir = config['remote_dir']
84
- @local_dir = config['local_dir']
85
-
86
- # Initialize FTP
87
- ftp = Net::FTP.new(@ftp_server);
88
- ftp.login(@username, @password)
89
- ftp.chdir(@remote_dir)
90
-
91
- clean_ftp(ftp)
92
-
93
- mirror @local_dir, ftp
94
-
95
- ftp.quit
96
- end
97
-
98
- def help()
99
- command2 = ARGV[1]
100
- case command2
101
- when "deploy"
102
- puts "Build Jekyll site and deploy via FTP."
103
- puts "Usage: hyde deploy _config.yml"
104
- when "new_site"
105
- puts "Create a new Jekyll site."
106
- puts "Usage: hyde new site_name"
107
- else
108
- puts "Commands:"
109
- puts " deploy\n new_site"
110
- end
111
- end
112
- end
113
-
114
- command1 = ARGV[0]
115
- case command1
116
- when "deploy"
117
- $jekyll.deploy
118
- when "new_site"
119
- $jekyll.new_site
120
- when "help"
121
- $jekyll.help
122
- when "list"
123
- %x( hyde help )
124
- else
125
- puts "You didn't give me a command.\nRun 'hyde help' to see a command list."
126
- end
127
-