Class: Mobilis::GenericProject
- Inherits:
-
Object
- Object
- Mobilis::GenericProject
show all
- Extended by:
- Forwardable
- Includes:
- ActionsProjectsTake
- Defined in:
- lib/mobilis/generic_project.rb
Overview
base class for projects. Child classes should override generate and as needed child_env_vars
Instance Method Summary
collapse
#append_line, #oblivious_run_command, #run_command, #run_docker, #set_file_contents, #set_second_line, #write_file
Constructor Details
#initialize(data, metaproject) ⇒ GenericProject
Returns a new instance of GenericProject.
21
22
23
24
25
26
27
|
# File 'lib/mobilis/generic_project.rb', line 21
def initialize data, metaproject
@data = data
data[:attributes] = {} unless data[:attributes]
data[:options] = [] unless data[:options]
data[:links] = [] unless data[:links]
@metaproject = metaproject
end
|
Instance Method Details
#child_env_vars ⇒ Object
environment env vars added to linked child services
31
32
33
|
# File 'lib/mobilis/generic_project.rb', line 31
def child_env_vars
[]
end
|
#children ⇒ Object
39
40
41
|
# File 'lib/mobilis/generic_project.rb', line 39
def children
links.map {|name| @metaproject.project_by_name name }
end
|
#display ⇒ Object
51
52
53
|
# File 'lib/mobilis/generic_project.rb', line 51
def display
ap @data
end
|
#docker_image_name ⇒ Object
75
76
77
|
# File 'lib/mobilis/generic_project.rb', line 75
def docker_image_name
return "#{ @metaproject.username }/#{ name }"
end
|
#env_vars ⇒ Object
35
36
37
|
# File 'lib/mobilis/generic_project.rb', line 35
def env_vars
[]
end
|
#generate ⇒ Object
generate the local file structure to support the project
96
97
98
|
# File 'lib/mobilis/generic_project.rb', line 96
def generate
FileUtils.mkdir_p name
end
|
#generate_build_sh ⇒ Object
81
82
83
84
85
|
# File 'lib/mobilis/generic_project.rb', line 81
def generate_build_sh
write_file "build.sh" do |f|
f.write "docker build -t #{ docker_image_name } ."
end
end
|
#git_commit_all(message) ⇒ Object
88
89
90
91
92
|
# File 'lib/mobilis/generic_project.rb', line 88
def git_commit_all message
end
|
#linked_to_rails_project ⇒ Object
47
48
49
|
# File 'lib/mobilis/generic_project.rb', line 47
def linked_to_rails_project
parents.find {|l| l.instance_of? Mobilis::RailsProject}
end
|
#links ⇒ Object
67
68
69
|
# File 'lib/mobilis/generic_project.rb', line 67
def links
@data[:links]
end
|
#name ⇒ Object
55
56
57
|
# File 'lib/mobilis/generic_project.rb', line 55
def name
@data[:name]
end
|
#options ⇒ Object
59
60
61
|
# File 'lib/mobilis/generic_project.rb', line 59
def options
@data[:options]
end
|
#parents ⇒ Object
43
44
45
|
# File 'lib/mobilis/generic_project.rb', line 43
def parents
@metaproject.projects.filter {|l| l.links.include? name}
end
|
#set_links(new_links) ⇒ Object
71
72
73
|
# File 'lib/mobilis/generic_project.rb', line 71
def set_links new_links
@data[:links] = new_links
end
|
#type ⇒ Object
63
64
65
|
# File 'lib/mobilis/generic_project.rb', line 63
def type
@data[:type]
end
|