Class: RailsTemplate18f::Generators::GitlabCiGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Includes:
Base, CloudGovOptions
Defined in:
lib/generators/rails_template18f/gitlab_ci/gitlab_ci_generator.rb

Instance Method Summary collapse

Instance Method Details

#install_actionsObject



19
20
21
22
# File 'lib/generators/rails_template18f/gitlab_ci/gitlab_ci_generator.rb', line 19

def install_actions
  template "gitlab-ci.yml", ".gitlab-ci.yml"
  directory "gitlab", ".gitlab"
end

#update_boundary_diagramObject



49
50
51
52
53
54
55
56
57
58
# File 'lib/generators/rails_template18f/gitlab_ci/gitlab_ci_generator.rb', line 49

def update_boundary_diagram
  boundary_filename = "doc/compliance/apps/application.boundary.md"
  insert_into_file boundary_filename, "    System_Ext(gitlabci, \"Cloud.gov Workshop\", \"GSA-run code repository and Continuous Integration Service\")\n", after: "Boundary(cicd, \"CI/CD Pipeline\") {\n"
  insert_into_file boundary_filename, "    Rel(developer, gitlabci, \"Publish code\", \"git ssh (22)\")\n    Rel(gitlabci, cg_api, \"Deploy App\", \"Auth: SpaceDeployer Service Account, https (443)\")\n  EOB\nend\n", before: "@enduml"

#update_readmeObject



24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/generators/rails_template18f/gitlab_ci/gitlab_ci_generator.rb', line 24

def update_readme
  if file_content("README.md").match?(/^## CI\/CD$/)
    insert_into_file "README.md", readme_cicd, after: "## CI/CD\n"
    insert_into_file "README.md", readme_staging_deploy, after: "#### Staging\n"
    insert_into_file "README.md", readme_prod_deploy, after: "#### Production\n"
    insert_into_file "README.md", readme_credentials, after: "#### Credentials and other Secrets\n"
  else
    append_to_file "README.md", "      ## CI/CD\n      \#{readme_cicd}\n\n      ### Deployment\n\n      #### Staging\n      \#{readme_staging_deploy}\n\n      #### Production\n      \#{readme_prod_deploy}\n\n      #### Credentials and other Secrets\n      \#{readme_credentials}\n    EOM\n  end\nend\n"