Class: Brut::CLI::Apps::New::Segments::Heroku
- Inherits:
-
Base
- Object
- Base
- Brut::CLI::Apps::New::Segments::Heroku
show all
- Defined in:
- lib/brut/cli/apps/new/segments/heroku.rb
Instance Attribute Summary
Attributes inherited from Base
#project_root
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Base
#create!, #output_post_add_messaging
Constructor Details
#initialize(project_root:, templates_dir:) ⇒ Heroku
Returns a new instance of Heroku.
5
6
7
8
|
# File 'lib/brut/cli/apps/new/segments/heroku.rb', line 5
def initialize(project_root:, templates_dir:)
@project_root = project_root
@templates_dir = templates_dir / "segments" / "Heroku"
end
|
Class Method Details
.friendly_name ⇒ Object
2
|
# File 'lib/brut/cli/apps/new/segments/heroku.rb', line 2
def self.friendly_name = "Heroku-based Deployment"
|
.segment_name ⇒ Object
3
|
# File 'lib/brut/cli/apps/new/segments/heroku.rb', line 3
def self.segment_name = "heroku"
|
Instance Method Details
#<=>(other) ⇒ Object
19
20
21
22
23
24
25
26
27
28
29
|
# File 'lib/brut/cli/apps/new/segments/heroku.rb', line 19
def <=>(other)
if self.class == other.class
0
elsif other.class == Brut::CLI::Apps::New::Segments::Sidekiq
-1
else
1
end
end
|
#add! ⇒ Object
10
11
12
13
14
15
16
17
|
# File 'lib/brut/cli/apps/new/segments/heroku.rb', line 10
def add!
operations = copy_files(@templates_dir, @project_root) +
other_operations
operations.each do |operation|
operation.call
end
end
|
#other_operations ⇒ Object
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
# File 'lib/brut/cli/apps/new/segments/heroku.rb', line 31
def other_operations
[
Brut::CLI::Apps::New::Ops::InsertIntoFile.new(
file: @project_root / "Dockerfile.dx",
content: %{
# Installs the Heroku CLI, per Heroku docs at
# https://devcenter.heroku.com/articles/heroku-cli#install-with-ubuntu-debian-apt-get
RUN curl https://cli-assets.heroku.com/install-ubuntu.sh | sh
},
before_line: "# Up to now, RUN directives ran as the root user. When using this container"
),
Brut::CLI::Apps::New::Ops::AppendToFile.new(
file: @project_root / ".gitignore",
content: %{
# These are generated by bin/deploy
deploy/Dockerfile.*
}
),
]
end
|