-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathProject.rb
43 lines (32 loc) · 985 Bytes
/
Project.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
require 'Colorify'
# projects can be any sort of software project
# that is deployed often: in our case it consists
# of bluffparse and our merb web service
class Project
include Colorify
def load
project = {}
puts colorBlack("creating a new project")
puts colorBlack("-------------------")
print colorBlack("Name: ")
project["name"] = STDIN.gets.chomp
print colorBlack("Repo: ")
project["repo"] = STDIN.gets.chomp
print colorBlack("Deploy Location: ")
project["dlocation"] = STDIN.gets.chomp
print colorBlack("Custom Build Command: ")
project["build"] = STDIN.gets.chomp
hash = File.open('pac.yml') do |f| YAML.load f end
if hash.nil? or hash.eql? false then
hash = {}
end
if hash["services"].nil? then
projects = {}
hash["projects"] = projects
end
hash["projects"]["#{project["name"]}"] = project
File.open("pac.yml", 'w') do |f|
f.puts hash.to_yaml
end
end
end