Class: SchemaDev::Runner
- Inherits:
-
Object
- Object
- SchemaDev::Runner
- Defined in:
- lib/schema_dev/runner.rb
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
Instance Method Summary collapse
- #freshen(quiet: false) ⇒ Object
- #gemfiles(quiet: false) ⇒ Object
- #github_actions(quiet: false) ⇒ Object
-
#initialize(config) ⇒ Runner
constructor
A new instance of Runner.
- #readme(quiet: false) ⇒ Object
- #run(*args, dry_run: false, quick: false, ruby: nil, activerecord: nil, db: nil, freshen: true) ⇒ Object
Constructor Details
#initialize(config) ⇒ Runner
Returns a new instance of Runner.
14 15 16 |
# File 'lib/schema_dev/runner.rb', line 14 def initialize(config) @config = config end |
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
12 13 14 |
# File 'lib/schema_dev/runner.rb', line 12 def config @config end |
Instance Method Details
#freshen(quiet: false) ⇒ Object
36 37 38 39 40 |
# File 'lib/schema_dev/runner.rb', line 36 def freshen(quiet: false) github_actions(quiet: quiet) gemfiles(quiet: quiet) readme(quiet: quiet) end |
#gemfiles(quiet: false) ⇒ Object
24 25 26 27 28 |
# File 'lib/schema_dev/runner.rb', line 24 def gemfiles(quiet: false) if Gemfiles.build(@config) puts '* Updated gemfiles' unless quiet end end |
#github_actions(quiet: false) ⇒ Object
18 19 20 21 22 |
# File 'lib/schema_dev/runner.rb', line 18 def github_actions(quiet: false) if GithubActions.update(@config) puts "* Updated #{GithubActions::WORKFLOW_FILE}" unless quiet end end |
#readme(quiet: false) ⇒ Object
30 31 32 33 34 |
# File 'lib/schema_dev/runner.rb', line 30 def readme(quiet: false) if Readme.update(@config) puts '* Updated README' unless quiet end end |
#run(*args, dry_run: false, quick: false, ruby: nil, activerecord: nil, db: nil, freshen: true) ⇒ Object
42 43 44 45 46 47 48 49 50 51 |
# File 'lib/schema_dev/runner.rb', line 42 def run(*args, dry_run: false, quick: false, ruby: nil, activerecord: nil, db: nil, freshen: true) self.freshen if freshen matrix = MatrixExecutor.new @config.matrix(quick: quick, ruby: ruby, activerecord: activerecord, db: db) return true if matrix.run(Shellwords.join(args.flatten), dry_run: dry_run) puts "\n*** #{matrix.errors.size} failures:\n\t#{matrix.errors.join("\n\t")}" false end |