mokuji 0.2.1 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/bin/mokuji +15 -6
  2. data/lib/mokuji/version.rb +1 -1
  3. metadata +2 -2
data/bin/mokuji CHANGED
@@ -10,9 +10,18 @@ class Moki < Thor
10
10
 
11
11
 
12
12
 
13
- desc "scan PATH (EXPORT_PATH) (CONVERTING_METHOD)", "Scan a directory by its path. You can also set the export path for the file. The default export path is the same as the path you want to scan. Next to that, you can also set the converting method. The options for that are JSON and HTML. Which defaults to HTML."
13
+ desc "scan PATH (EXPORT_PATH) (OUTPUT_TYPE)", "Scan a directory by its path. You can also set the export path for the file. Both can be relative paths. The default export path is the same as the path you want to scan. Next to that, you can also set the output type. The options for that are JSON and HTML. Which defaults to HTML."
14
14
 
15
- def scan path_to_scan, export_path = nil, converting_method = 'html'
15
+ def scan path_to_scan, export_path = nil, output_type = 'html'
16
+
17
+ # Check if the given output type exists
18
+ unless output_type.match(/^(html|json)$/)
19
+
20
+ say "Errr, that output type doesn't exist =/", :red
21
+
22
+ exit
23
+
24
+ end
16
25
 
17
26
  # Convert the paths to absolute paths
18
27
  path_to_scan = File.expand_path(path_to_scan)
@@ -21,7 +30,7 @@ class Moki < Thor
21
30
  # Check if the directory exists
22
31
  unless File.directory?(path_to_scan) then
23
32
 
24
- say "The directory that you want to scan, does not exist", :red
33
+ say "The directory that you want to scan, does not exist.", :red
25
34
 
26
35
  exit
27
36
 
@@ -30,7 +39,7 @@ class Moki < Thor
30
39
  # Check if the directory isn't empty
31
40
  if Dir.entries(path_to_scan).slice(2..-1).empty? then
32
41
 
33
- say "The directory that you want to scan, is empty"
42
+ say "The directory that you want to scan, is empty."
34
43
 
35
44
  exit
36
45
 
@@ -45,7 +54,7 @@ class Moki < Thor
45
54
 
46
55
  unless File.directory?(export_path) then
47
56
 
48
- say "The directory that you want to export to, does not exist", :red
57
+ say "The directory that you want to export to, does not exist.", :red
49
58
 
50
59
  exit
51
60
 
@@ -58,7 +67,7 @@ class Moki < Thor
58
67
  end
59
68
 
60
69
  # Please continue
61
- moki.converting_method = converting_method.to_sym
70
+ moki.converting_method = output_type.to_sym
62
71
  moki.execute
63
72
 
64
73
  say "Directory list successfully created! =D", :green
@@ -4,7 +4,7 @@ module Mokuji
4
4
  # MOKUJI VERSION
5
5
  #
6
6
 
7
- VERSION = "0.2.1"
7
+ VERSION = "0.2.2"
8
8
 
9
9
  end
10
10
 
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: mokuji
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.2.1
5
+ version: 0.2.2
6
6
  platform: ruby
7
7
  authors:
8
8
  - Icid Asset
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-03-06 00:00:00 +01:00
13
+ date: 2011-03-07 00:00:00 +01:00
14
14
  default_executable:
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency