README.md in heroku_hatchet-4.1.2 vs README.md in heroku_hatchet-5.0.0
- old
+ new
@@ -240,24 +240,67 @@
Hatchet::Runner.new("rails3_mri_193").deploy do |app|
app.run("cat Procfile")
end
```
-This is the prefered way to run commands against the app. You can also string together commands in a session, but it's less deterministic due to difficulties in driving a REPL programatically via [repl_runner](http://github.com/schneems/repl_runner).
+By default commands will be shell escaped (to prevent commands from escaping the `heroku run` command), if you want to manage your own quoting you can use the `raw: true` option:
+```
+app.run('echo \$HELLO \$NAME', raw: true)
+```
-```ruby
-Hatchet::Runner.new("rails3_mri_193").deploy do |app|
- app.run("bash") do |bash|
- bash.run("ls") {|result| assert_match "Gemfile.lock", result }
- bash.run("cat Procfile") {|result| assert_match "web:", result }
- end
-end
+You can specify Heroku flags to the `heroku run` command by passing in the `heroku:` key along with a hash.
+
```
+app.run("nproc", heroku: { "size" => "performance-l" })
+# => 8
+```
-Please read the docs on [repl_runner](http://github.com/schneems/repl_runner) for more info. The only interactive commands that are supported out of the box are `rails console`, `bash`, and `irb`. It is fairly easy to add your own though.
+You can see a list of Heroku flags by running:
+```
+$ heroku run --help
+run a one-off process inside a heroku dyno
+
+USAGE
+ $ heroku run
+
+OPTIONS
+ -a, --app=app (required) app to run command against
+ -e, --env=env environment variables to set (use ';' to split multiple vars)
+ -r, --remote=remote git remote of app to use
+ -s, --size=size dyno size
+ -x, --exit-code passthrough the exit code of the remote command
+ --no-notify disables notification when dyno is up (alternatively use HEROKU_NOTIFICATIONS=0)
+ --no-tty force the command to not run in a tty
+ --type=type process type
+```
+
+By default Hatchet will set the app name and the exit code
+
+
+```
+app.run("exit 127")
+puts $?.exitcode
+# => 127
+```
+
+To skip a value you can use the constant:
+
+```
+app.run("exit 127", heroku: { "exit-code" => Hatchet::App::SkipDefaultOption})
+puts $?.exitcode
+# => 0
+```
+
+To specify a flag that has no value (such as `--no-notify`, `no-tty`, or `--exit-code`) pass a `nil` value:
+
+```
+app.run("echo 'foo'", heroku: { "no-notify" => nil })
+# This is the same as `heroku run echo 'foo' --no-notify`
+```
+
## Modify Application Files on Disk
While template apps provided from your `hatchet.json` can provide different test cases, you may want to test minor varriations of an app. You can do this by using the `before_deploy` hook to modify files on disk inside of an app in a threadsafe way that will only affect the app's local instance:
```ruby
@@ -300,9 +343,13 @@
Hatchet supports testing Heroku CI.
```ruby
Hatchet::Runner.new("rails5_ruby_schema_format").run_ci do |test_run|
assert_match "Ruby buildpack tests completed successfully", test_run.output
+
+ test_run.run_again # Runs tests again, for example to make sure the cache was used
+
+ assert_match "Using rake", test_run.output
end
```
Call the `run_ci` method on the hatchet `Runner`. The object passed to the block is a `Hatchet::TestRun` object. You can call: