ruby-generator 0.1.0 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/generator.rb +15 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3849225ecfa62d470dca5a5877a4b83f8a1e467c15ec42aab9bd1e056fe8ec30
|
4
|
+
data.tar.gz: c6d5ac6fb750990cfd2c85182ae54d6cf051feab529a817250a3b68c7622fa02
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fc4fbf58f569aeb808ae617344d964a563cfec5cc20c60a060d97bf1e0b06ba01df15a9e5dfb8ad6db6f81c1ace986466e10cb8be3e43748a0cb596e6f1ab0e4
|
7
|
+
data.tar.gz: d990456f52e19587078ec8cb0bb072583e020f747fee77748fa998e0c4f21e54826bfb2007e34848fdc19851a30fac78caefa8c7ed4297f536b3abacdf0eee63
|
data/lib/generator.rb
CHANGED
@@ -5,15 +5,23 @@ class Generator
|
|
5
5
|
NC='\033[0m'
|
6
6
|
CREATED = "#{GREEN}created#{NC}"
|
7
7
|
ADDLINE = "#{GREEN}added#{NC}"
|
8
|
+
ERROR = "#{RED}Error#{NC}: "
|
8
9
|
|
9
10
|
def run(array)
|
10
11
|
if array[0] == "new"
|
11
12
|
new(array[1])
|
13
|
+
elsif array[0] == "--help"
|
14
|
+
help
|
12
15
|
else
|
13
|
-
|
16
|
+
error("unknown command")
|
14
17
|
end
|
15
18
|
end
|
16
19
|
|
20
|
+
def error(error_text)
|
21
|
+
system("printf '#{ERROR} #{GREEN}#{error_text}#{NC}\n'")
|
22
|
+
system("printf 'type #{GREEN}ruby-generator --help#{NC} for more options\n'")
|
23
|
+
end
|
24
|
+
|
17
25
|
def new(project)
|
18
26
|
# print "What would you like to call your project? "
|
19
27
|
# project = gets.strip
|
@@ -55,4 +63,10 @@ class Generator
|
|
55
63
|
add_line('--color', "#{path}/.rspec")
|
56
64
|
end
|
57
65
|
|
66
|
+
def help
|
67
|
+
system("printf '\n#{GREEN}Ruby Generator Commands#{NC}\n'")
|
68
|
+
system("printf -- '-----------------------\n'")
|
69
|
+
system("printf '#{RED}new <project name>#{NC} - Creates a new ruby project.\n\n'")
|
70
|
+
end
|
71
|
+
|
58
72
|
end
|