Class: SourceMonitor::Setup::ProcfilePatcher
- Inherits:
-
Object
- Object
- SourceMonitor::Setup::ProcfilePatcher
- Defined in:
- lib/source_monitor/setup/procfile_patcher.rb
Constant Summary collapse
- JOBS_ENTRY =
"jobs: bundle exec rake solid_queue:start"
Instance Method Summary collapse
-
#initialize(path: "Procfile.dev") ⇒ ProcfilePatcher
constructor
A new instance of ProcfilePatcher.
- #patch ⇒ Object
Constructor Details
#initialize(path: "Procfile.dev") ⇒ ProcfilePatcher
Returns a new instance of ProcfilePatcher.
10 11 12 |
# File 'lib/source_monitor/setup/procfile_patcher.rb', line 10 def initialize(path: "Procfile.dev") @path = Pathname.new(path) end |
Instance Method Details
#patch ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/source_monitor/setup/procfile_patcher.rb', line 14 def patch if path.exist? content = path.read return false if content.match?(/^jobs:/) path.open("a") { |f| f.puts("", JOBS_ENTRY) } else path.write("web: bin/rails server -p 3000\n#{JOBS_ENTRY}\n") end true end |