Class: RailsTemplate18f::Generators::GithubActionsGenerator

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

Instance Method Summary collapse

Instance Method Details

#install_actionsObject



18
19
20
21
22
23
24
# File 'lib/generators/rails_template18f/github_actions/github_actions_generator.rb', line 18

def install_actions
  directory "github", ".github"
  if !terraform_manage_spaces?
    remove_file ".github/workflows/terraform-production.yml"
    remove_file ".github/workflows/deploy-production.yml"
  end
end

#update_boundary_diagramObject



51
52
53
54
55
56
57
58
59
60
# File 'lib/generators/rails_template18f/github_actions/github_actions_generator.rb', line 51

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

#update_oscal_docsObject



62
63
64
# File 'lib/generators/rails_template18f/github_actions/github_actions_generator.rb', line 62

def update_oscal_docs
  copy_oscal_component "github_actions"
end

#update_readmeObject



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

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"