oleg 0.8.0 → 0.9.0

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e2c98a618bee0b37cb5705e210ba7f8f68074852
4
- data.tar.gz: a52a2608c0a829aa5ba152e42f110fb794841271
3
+ metadata.gz: eed44d55e531af33f1af968ab032e572e8b67603
4
+ data.tar.gz: 304c2bbb2d683678264bb8b77e7b8eee870fc737
5
5
  SHA512:
6
- metadata.gz: 32a1bde2f363fe02e851d11264b5eba3f6e8547dcf4cd165b9ef58b7ae6fed0730b8dcf89bd4318517e83319a9f844a354b8bd20c4a33d3dbaceff8ac6636c75
7
- data.tar.gz: 4691effe76d202330e907159feed5c1df0190dbe0f96bd18af91f0951ae7699e432c82f3361789f65696004615a79bbd827d26595e6759ae1a9d2a95aaa1c12e
6
+ metadata.gz: a716d582f3817f63035131082860a415d0c5bb6d8be2980a0d97c375ab945a2cff3facb528683caf113b1da885fa6f8be1dae21c81e4e4620fefac00444b9b02
7
+ data.tar.gz: e84c918bff6a8e24f1fbda04de66dccdf6d200ecbdb9f6f3816473246fded075ce7df66bab4e8a134bb41cd67cd88f0b8f507dfb6c625a9613fe6ac67981fa53
data/lib/leg.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  require 'fileutils'
2
+ require 'net/ftp'
2
3
  require 'yaml'
3
4
  require 'rugged'
4
5
  require 'redcarpet'
data/lib/leg/commands.rb CHANGED
@@ -4,6 +4,7 @@ end
4
4
 
5
5
  require 'leg/commands/base_command'
6
6
 
7
+ require 'leg/commands/deploy'
7
8
  require 'leg/commands/diff'
8
9
  require 'leg/commands/doc'
9
10
  require 'leg/commands/help'
@@ -36,6 +36,12 @@ class Leg::Commands::BaseCommand
36
36
  },
37
37
  doc: {
38
38
  true: "There is no doc folder."
39
+ },
40
+ doc_out: {
41
+ true: "There are no doc output files."
42
+ },
43
+ ftp: {
44
+ true: "There is no ftp.yml file."
39
45
  }
40
46
  }
41
47
 
@@ -63,6 +69,10 @@ class Leg::Commands::BaseCommand
63
69
  valid = true if File.exist?(File.join(@config[:path], "steps.diff"))
64
70
  when :doc
65
71
  valid = true if File.exist?(File.join(@config[:path], "doc"))
72
+ when :doc_out
73
+ valid = true if File.exist?(File.join(@config[:path], "doc/html_out"))
74
+ when :ftp
75
+ valid = true if File.exist?(File.join(@config[:path], "ftp.yml"))
66
76
  else
67
77
  raise NotImplementedError
68
78
  end
@@ -0,0 +1,33 @@
1
+ class Leg::Commands::Deploy < Leg::Commands::BaseCommand
2
+ def self.name
3
+ "deploy"
4
+ end
5
+
6
+ def self.summary
7
+ "Pushes output files in doc/ to production server"
8
+ end
9
+
10
+ def run
11
+ needs! :config, :doc, :doc_out, :ftp
12
+
13
+ only = @args.empty? ? nil : @args
14
+
15
+ FileUtils.cd(File.join(@config[:path], "doc/html_out")) do
16
+ ftp_config = YAML.load(File.read(File.join(@config[:path], "ftp.yml")))
17
+ Net::FTP.open(ftp_config[:host], ftp_config[:username], ftp_config[:password]) do |ftp|
18
+ ftp.chdir(ftp_config[:root])
19
+ Dir["**/*"].each do |f|
20
+ if only.nil? || only.any? { |o| f[o] }
21
+ puts f
22
+ if File.directory?(f)
23
+ ftp.mkdir(f) rescue Net::FTPPermError
24
+ elsif File.file?(f)
25
+ ftp.putbinaryfile(f)
26
+ end
27
+ end
28
+ end
29
+ end
30
+ end
31
+ end
32
+ end
33
+
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: oleg
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.0
4
+ version: 0.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeremy Ruten
@@ -64,6 +64,7 @@ files:
64
64
  - lib/leg/cli.rb
65
65
  - lib/leg/commands.rb
66
66
  - lib/leg/commands/base_command.rb
67
+ - lib/leg/commands/deploy.rb
67
68
  - lib/leg/commands/diff.rb
68
69
  - lib/leg/commands/doc.rb
69
70
  - lib/leg/commands/fancy.rb