Class: SourceBrowser::Generators::InstallGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Defined in:
lib/generators/source_browser/install/install_generator.rb

Instance Method Summary collapse

Instance Method Details

#edit_config_deploy_ymlObject



17
18
19
20
21
22
23
24
25
# File 'lib/generators/source_browser/install/install_generator.rb', line 17

def edit_config_deploy_yml
  uncomment_lines "config/deploy.yml", /args:/

  insert_into_file "config/deploy.yml", after: "  args:\n" do
    "    BUILDKIT_CONTEXT_KEEP_GIT_DIR: 1\n"
  end
rescue Errno::ENOENT
  puts "Skipping config/deploy.yml"
end

#edit_dockerfileObject



6
7
8
9
10
11
12
13
14
15
# File 'lib/generators/source_browser/install/install_generator.rb', line 6

def edit_dockerfile
  gsub_file "Dockerfile", "curl libjemalloc2", "curl git libjemalloc2"
  gsub_file "Dockerfile", "build-essential git", "build-essential"

  insert_into_file "Dockerfile", after: "USER 1000:1000\n" do
    "\nRUN git config --global --add safe.directory /rails\n"
  end
rescue Errno::ENOENT
  puts "Skipping Dockerfile"
end

#edit_dockerignoreObject



27
28
29
30
31
32
# File 'lib/generators/source_browser/install/install_generator.rb', line 27

def edit_dockerignore
  comment_lines ".dockerignore", "/.git/"
  comment_lines ".dockerignore", "/.gitignore"
rescue Errno::ENOENT
  puts "Skipping .dockerignore"
end