Class: RailsTemplate18f::Generators::CircleciGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- RailsTemplate18f::Generators::CircleciGenerator
- Includes:
- Base, CloudGovOptions
- Defined in:
- lib/generators/rails_template18f/circleci/circleci_generator.rb
Instance Method Summary collapse
- #install_needed_gems ⇒ Object
- #install_pipeline ⇒ Object
- #update_boundary_diagram ⇒ Object
- #update_oscal_docs ⇒ Object
- #update_readme ⇒ Object
Instance Method Details
#install_needed_gems ⇒ Object
16 17 18 19 20 21 |
# File 'lib/generators/rails_template18f/circleci/circleci_generator.rb', line 16 def install_needed_gems gem_name = "rspec_junit_formatter" return if gem_installed? gem_name gem gem_name, "~> 0.6", group: :test bundle_install end |
#install_pipeline ⇒ Object
23 24 25 26 27 28 |
# File 'lib/generators/rails_template18f/circleci/circleci_generator.rb', line 23 def install_pipeline directory "circleci", ".circleci" copy_file "docker-compose.ci.yml" template "Dockerfile.ci" copy_file "bin/ci-server-start", mode: :preserve end |
#update_boundary_diagram ⇒ Object
55 56 57 58 59 60 61 62 63 64 65 66 |
# File 'lib/generators/rails_template18f/circleci/circleci_generator.rb', line 55 def update_boundary_diagram boundary_filename = "doc/compliance/apps/application.boundary.md" insert_into_file boundary_filename, " System_Ext(github, \"GitHub\", \"GSA-controlled code repository\")\n System_Ext(circleci, \"CircleCI\", \"Continuous Integration Service\")\n", after: "Boundary(cicd, \"CI/CD Pipeline\") {\n" insert_into_file boundary_filename, " Rel(developer, github, \"Publish code\", \"git ssh (22)\")\n Rel(github, circleci, \"Commit hook notifies CircleCI to run CI/CD pipeline\", \"https POST (443)\")\n Rel(circleci, cg_api, \"Deploy App\", \"Auth: SpaceDeployer Service Account, https (443)\")\n EOB\nend\n", before: "@enduml" |
#update_oscal_docs ⇒ Object
68 69 70 |
# File 'lib/generators/rails_template18f/circleci/circleci_generator.rb', line 68 def update_oscal_docs copy_oscal_component "circleci" end |
#update_readme ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/generators/rails_template18f/circleci/circleci_generator.rb', line 30 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" |