Class: Cdtb::GithubActions::GithubActionsGenerator
- Inherits:
-
Rails::Generators::NamedBase
- Object
- Rails::Generators::NamedBase
- Cdtb::GithubActions::GithubActionsGenerator
- Defined in:
- lib/generators/cdtb/github_actions/github_actions_generator.rb
Overview
Generates the given GitHub workflow that validates that the app has the migrations from all gems already installed
Instance Method Summary collapse
Instance Method Details
#copy_github_workflow_file ⇒ Object
9 10 11 |
# File 'lib/generators/cdtb/github_actions/github_actions_generator.rb', line 9 def copy_github_workflow_file copy_file "#{file_name}.yml", ".github/workflows/#{file_name}.yml" end |
#replace_node_version ⇒ Object
21 22 23 24 25 26 27 |
# File 'lib/generators/cdtb/github_actions/github_actions_generator.rb', line 21 def replace_node_version path= File.join(Rails.root, ".node-version") return unless File.exist?(path) node_version= File.read(path).strip gsub_file ".github/workflows/#{file_name}.yml", /NODE_VERSION: \d+\.\d+\.\d+/, "NODE_VERSION: #{node_version}" end |
#replace_ruby_version ⇒ Object
13 14 15 16 17 18 19 |
# File 'lib/generators/cdtb/github_actions/github_actions_generator.rb', line 13 def replace_ruby_version path= File.join(Rails.root, ".ruby-version") return unless File.exist?(path) ruby_version= File.read(path).strip gsub_file ".github/workflows/#{file_name}.yml", /RUBY_VERSION: \d+\.\d+\.\d+/, "RUBY_VERSION: #{ruby_version}" end |