rundoc 0.0.2 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. checksums.yaml +5 -5
  2. data/.travis.yml +8 -0
  3. data/CHANGELOG.md +3 -0
  4. data/Gemfile +1 -0
  5. data/README.md +63 -15
  6. data/bin/rundoc +8 -0
  7. data/lib/rundoc.rb +14 -1
  8. data/lib/rundoc/code_command.rb +18 -4
  9. data/lib/rundoc/code_command/background.rb +9 -0
  10. data/lib/rundoc/code_command/background/log/clear.rb +17 -0
  11. data/lib/rundoc/code_command/background/log/read.rb +16 -0
  12. data/lib/rundoc/code_command/background/process_spawn.rb +70 -0
  13. data/lib/rundoc/code_command/background/start.rb +36 -0
  14. data/lib/rundoc/code_command/background/stop.rb +17 -0
  15. data/lib/rundoc/code_command/background/wait.rb +19 -0
  16. data/lib/rundoc/code_command/bash.rb +1 -1
  17. data/lib/rundoc/code_command/bash/cd.rb +1 -1
  18. data/lib/rundoc/code_command/file_command/append.rb +2 -0
  19. data/lib/rundoc/code_command/raw.rb +18 -0
  20. data/lib/rundoc/code_command/rundoc_command.rb +2 -1
  21. data/lib/rundoc/code_section.rb +21 -74
  22. data/lib/rundoc/peg_parser.rb +282 -0
  23. data/lib/rundoc/version.rb +1 -1
  24. data/rundoc.gemspec +2 -1
  25. data/test/fixtures/rails_5/rundoc.md +70 -74
  26. data/test/rundoc/code_commands/append_file_test.rb +2 -2
  27. data/test/rundoc/code_commands/background_test.rb +43 -0
  28. data/test/rundoc/code_commands/bash_test.rb +1 -1
  29. data/test/rundoc/code_commands/pipe_test.rb +1 -1
  30. data/test/rundoc/code_commands/remove_contents_test.rb +1 -1
  31. data/test/rundoc/code_section_test.rb +6 -5
  32. data/test/rundoc/parser_test.rb +2 -7
  33. data/test/rundoc/peg_parser_test.rb +348 -0
  34. data/test/rundoc/regex_test.rb +1 -1
  35. data/test/rundoc/test_parse_java.rb +1 -1
  36. data/test/test_helper.rb +1 -1
  37. metadata +33 -4
@@ -1,3 +1,3 @@
1
1
  module Rundoc
2
- VERSION = "0.0.2"
2
+ VERSION = "1.0.0"
3
3
  end
@@ -20,9 +20,10 @@ Gem::Specification.new do |gem|
20
20
 
21
21
  gem.add_dependency "thor"
22
22
  gem.add_dependency "repl_runner"
23
+ gem.add_dependency 'parslet', '~> 1'
23
24
 
24
25
  gem.add_development_dependency "rake"
25
26
  gem.add_development_dependency "mocha"
26
- gem.add_development_dependency "test-unit"
27
+ gem.add_development_dependency "minitest"
27
28
  end
28
29
 
@@ -1,5 +1,5 @@
1
1
  ```
2
- :::- rundoc
2
+ :::-- rundoc
3
3
  email = ENV['HEROKU_EMAIL'] || `heroku auth:whoami`
4
4
 
5
5
  Rundoc.configure do |config|
@@ -15,27 +15,27 @@ end
15
15
  $ bin/rundoc build --path test/fixtures/rails_5/rundoc.md
16
16
  -->
17
17
 
18
- Ruby on Rails is a popular web framework written in [Ruby](http://www.ruby-lang.org/). This guide covers using Rails 5 on Heroku. For information about running previous versions of Rails on Heroku, see [Getting Started with Rails 4.x on Heroku](getting-started-with-rails4) or [Getting Started with Rails 3.x on Heroku](getting-started-with-rails3).
18
+ Ruby on Rails is a popular web framework written in [Ruby](http://www.ruby-lang.org/). This guide covers using Rails 5 on Heroku. For information on running previous versions of Rails on Heroku, see the tutorial for [Rails 4.x](getting-started-with-rails4) or [Rails 3.x](getting-started-with-rails3).
19
+
20
+ ```
21
+ :::-- $ ruby -e "exit 1 unless RUBY_VERSION == '2.5.3'"
22
+ ```
19
23
 
20
24
  For this guide you will need:
21
25
 
22
- - Basic Ruby/Rails knowledge.
23
- - A locally installed version of Ruby 2.2.0+, Rubygems, Bundler, and Rails 5+.
24
- - Basic Git knowledge.
26
+ - Basic familiarity with Ruby/Rails and Git
27
+ - A locally installed version of Ruby 2.2.0+, Rubygems, Bundler, and Rails 5+
25
28
  - A Heroku user account: [Signup is free and instant](https://signup.heroku.com/devcenter).
26
29
 
27
- ## Local workstation setup
30
+ ## Local setup
28
31
 
29
- Install the [Heroku Toolbelt](https://toolbelt.heroku.com/) on your local workstation. This ensures that you have access to the [Heroku command-line client](/categories/command-line), Heroku Local, and the Git revision control system. You will also need [Ruby and Rails installed](http://guides.railsgirls.com/install).
32
+ Install the [Heroku CLI](heroku-cli#download-and-install) on your development machine.
30
33
 
31
- Once installed, you'll have access to the `$ heroku` command from your command shell. Log in using the email address and password you used when creating your Heroku account:
32
-
33
-
34
- > callout Note that `$` symbol before commands indicates they should be run on the command line, prompt, or terminal with appropriate permissions. Do not copy the `$` symbol.
34
+ Once installed, the `heroku` command is available from your terminal. Log in using your Heroku account's email address and password:
35
35
 
36
36
  ```term
37
37
  $ heroku login
38
- Enter your Heroku credentials.
38
+ heroku: Enter your Heroku credentials
39
39
  Email: schneems@example.com
40
40
  Password:
41
41
  Could not find an existing public key.
@@ -44,36 +44,33 @@ Generating new SSH public key.
44
44
  Uploading ssh public key /Users/adam/.ssh/id_rsa.pub
45
45
  ```
46
46
 
47
- Press enter at the prompt to upload your existing `ssh` key or create a new one, used for pushing code later on.
48
-
49
- ## Write your app
47
+ Press Enter at the prompt to upload your existing `ssh` key or create a new one, used for pushing code later on.
50
48
 
51
- > callout To run on Heroku, your app must be configured to use the Postgres database, have all dependencies declared in your `Gemfile`.
49
+ ## Create a new Rails app (or upgrade an existing one)
52
50
 
51
+ If you are starting with an existing app that uses a previous version of Rails, [upgrade it to Rails 5](http://edgeguides.rubyonrails.org/upgrading_ruby_on_rails.html#upgrading-from-rails-4-2-to-rails-5-0) before continuing. If you're not starting from an existing app at all, a vanilla Rails 5 app works great as a sample app.
53
52
 
54
- If you are starting from an existing app, [upgrade to Rails 5](http://edgeguides.rubyonrails.org/upgrading_ruby_on_rails.html#upgrading-from-rails-4-2-to-rails-5-0) before continuing. If not, a vanilla Rails 5 app will serve as a suitable sample app. To build a new app make sure that you're using the Rails 5.x using `$ rails -v`. You can get the new version of rails by running,
53
+ To create a new app, first make sure that you're using Rails 5.x by running `rails -v`. If necessary, you can get the new version of rails by running the following:
55
54
 
56
55
  ```term
57
56
  :::>> $ gem install rails --no-ri --no-rdoc
58
57
  ```
59
58
 
60
- Then create a new app:
59
+ Then create a new app and move into its root directory:
61
60
 
62
61
  ```term
63
- :::> $ rails new myapp --database=postgresql
62
+ :::>- $ rails new myapp --database=postgresql
64
63
  ```
65
64
 
66
65
  Then move into your application directory.
67
66
 
68
67
  ```term
69
- :::> $ cd myapp
68
+ :::>- $ cd myapp
70
69
  ```
71
70
 
72
- > callout If you experience problems or get stuck with this tutorial, your questions may be answered in a later part of this document. If you experience a problem, try reading through the entire document and then go back to your issue. It can also be useful to review your previous steps to ensure they all executed correctly.
71
+ ## Add the pg gem
73
72
 
74
- ## Database
75
-
76
- If you already have an app that was created without specifying `--database=postgresql` you will need to add the `pg` gem to your Rails project. Edit your `Gemfile` and change this line:
73
+ If you're using an existing app that was created without specifying `--database=postgresql`, you need to add the `pg` gem to your Rails project. Edit your `Gemfile` and change this line:
77
74
 
78
75
  ```ruby
79
76
  gem 'sqlite3'
@@ -85,7 +82,7 @@ To this:
85
82
  gem 'pg'
86
83
  ```
87
84
 
88
- > callout We highly recommend using PostgreSQL during development. Maintaining [parity between your development](http://www.12factor.net/dev-prod-parity) and deployment environments prevents subtle bugs from being introduced because of differences between your environments. [Install Postgres locally](https://devcenter.heroku.com/articles/heroku-postgresql#local-setup) now if it is not already on your system.
85
+ > callout We highly recommend using PostgreSQL during development. Maintaining [parity between your development](http://www.12factor.net/dev-prod-parity) and deployment environments prevents subtle bugs from being introduced because of differences between your environments. [Install Postgres locally](heroku-postgresql#local-setup) now if it is not already on your system.
89
86
 
90
87
  Now re-install your dependencies (to generate a new `Gemfile.lock`):
91
88
 
@@ -93,11 +90,9 @@ Now re-install your dependencies (to generate a new `Gemfile.lock`):
93
90
  $ bundle install
94
91
  ```
95
92
 
96
- To get more information on why this change is needed and how to configure your app to run Postgres locally, see [why you cannot use Sqlite3 on Heroku](https://devcenter.heroku.com/articles/sqlite3).
97
-
98
- In addition to using the `pg` gem, you'll also need to ensure the `config/database.yml` is using the `postgresql` adapter.
93
+ For more information on why Postgres is recommended instead of Sqlite3, see [why you cannot use Sqlite3 on Heroku](sqlite3).
99
94
 
100
- The development section of your `config/database.yml` file should look something like this:
95
+ In addition to using the `pg` gem, ensure that your `config/database.yml` file is using the `postgresql` adapter. The development section of your `config/database.yml` file should look something like this:
101
96
 
102
97
  ```term
103
98
  :::>> $ cat config/database.yml
@@ -105,15 +100,15 @@ The development section of your `config/database.yml` file should look something
105
100
 
106
101
  Be careful here. If you omit the `sql` at the end of `postgresql` in the `adapter` section, your application will not work.
107
102
 
108
- ## Welcome page
103
+ ## Create a welcome page
109
104
 
110
- Rails 5 no longer has a static index page in production. When you're using a new app, there will not be a root page in production, so we need to create one. We will first create a controller called `welcome` for our home page to live:
105
+ Rails 5 no longer has a static index page in production by default. When you're using a new app, there will not be a root page in production, so we need to create one. We will first create a controller called `welcome` for our home page to live:
111
106
 
112
107
  ```term
113
- :::> $ rails generate controller welcome
108
+ :::>- $ rails generate controller welcome
114
109
  ```
115
110
 
116
- Next we'll add an index page.
111
+ Next we'll add an index page:
117
112
 
118
113
  ```html
119
114
  :::>> file.write app/views/welcome/index.html.erb
@@ -133,14 +128,16 @@ Now we need to make Rails route to this action. We'll edit `config/routes.rb` to
133
128
  You can verify that the page is there by running your server:
134
129
 
135
130
  ```term
136
- $ rails server
131
+ :::>> background.start("rails server", name: "server")
132
+ :::-- background.stop(name: "server")
137
133
  ```
138
134
 
139
135
  And visiting [http://localhost:3000](http://localhost:3000) in your browser. If you do not see the page, [use the logs](#view-the-logs) that are output to your server to debug.
140
136
 
141
137
  ## Heroku gems
142
138
 
143
- Previous versions of Rails required you to add a gem to your project [rails_12factor](https://github.com/heroku/rails_12factor) to enable static asset serving and logging on Heroku. If you are deploying a new application this gem is not needed. If you are upgrading an existing application you can remove this gem provided you have the apprpriate configuration in your `config/environments/production.rb` file:
139
+ Previous versions of Rails required you to add a gem to your project [rails_12factor](https://github.com/heroku/rails_12factor) to enable static asset serving and logging on Heroku. If you are deploying a new application, this gem is not needed. If you are upgrading an existing application, you can remove this gem provided you have the apprpriate configuration in your `config/environments/production.rb` file:
140
+
144
141
 
145
142
  ```ruby
146
143
  # config/environments/production.rb
@@ -153,13 +150,15 @@ if ENV["RAILS_LOG_TO_STDOUT"].present?
153
150
  end
154
151
  ```
155
152
 
156
- ## Specify Ruby version in app
153
+ ## Specify your Ruby version
154
+
155
+ Rails 5 requires Ruby 2.2.0 or above. Heroku has a recent version of Ruby installed by default, however you can specify an exact version by using the `ruby` DSL in your `Gemfile`. Depending on your version of Ruby that you are currently running it might look like this:
157
156
 
158
- Rails 5 requires Ruby 2.2.0 or above. Heroku has a recent version of Ruby installed by default, however you can specify an exact version by using the `ruby` DSL in your `Gemfile`.
159
157
 
160
158
  ```ruby
161
- :::>> file.append Gemfile
162
- ruby "2.4.1"
159
+ :::-- $ sed -i'' -e '/^ruby/d' ./Gemfile
160
+ :::-> file.append Gemfile#4
161
+ ruby "2.5.3"
163
162
  ```
164
163
 
165
164
  You should also be running the same version of Ruby locally. You can check this by running `$ ruby -v`. You can get more information on [specifying your Ruby version on Heroku here](https://devcenter.heroku.com/articles/ruby-versions).
@@ -169,11 +168,11 @@ You should also be running the same version of Ruby locally. You can check this
169
168
  Heroku relies on [Git](http://git-scm.com/), a distributed source control management tool, for deploying your project. If your project is not already in Git, first verify that `git` is on your system:
170
169
 
171
170
  ```term
172
- :::> $ git --help
171
+ :::>- $ git --help
173
172
  :::>> | $ head -n 5
174
173
  ```
175
174
 
176
- If you don't see any output or get `command not found` you will need to install it on your system. Verify that the [Heroku toolbelt](https://toolbelt.heroku.com/) is installed.
175
+ If you don't see any output or get `command not found` you need to install Git on your system.
177
176
 
178
177
  Once you've verified that Git works, first make sure you are in your Rails app directory by running `$ ls`:
179
178
 
@@ -186,9 +185,9 @@ The output should look like this:
186
185
  Now run these commands in your Rails app directory to initialize and commit your code to Git:
187
186
 
188
187
  ```term
189
- :::> $ git init
190
- :::> $ git add .
191
- :::> $ git commit -m "init"
188
+ :::>- $ git init
189
+ :::>- $ git add .
190
+ :::>- $ git commit -m "init"
192
191
  ```
193
192
 
194
193
  You can verify everything was committed correctly by running:
@@ -213,7 +212,7 @@ You can verify that the remote was added to your project by running:
213
212
  :::>> $ git config --list | grep heroku
214
213
  ```
215
214
 
216
- If you see `fatal: not in a git directory` then you are likely not in the correct directory. Otherwise you may deploy your code. After you deploy your code, you will need to migrate your database, make sure it is properly scaled, and use logs to debug any issues that come up.
215
+ If you see `fatal: not in a git directory` then you are likely not in the correct directory. Otherwise you can deploy your code. After you deploy your code, you need to migrate your database, make sure it is properly scaled, and use logs to debug any issues that come up.
217
216
 
218
217
  Deploy your code:
219
218
 
@@ -225,13 +224,13 @@ It is always a good idea to check to see if there are any warnings or errors in
225
224
 
226
225
  ## Migrate your database
227
226
 
228
- If you are using the database in your application you need to manually migrate the database by running:
227
+ If you are using the database in your application, you need to manually migrate the database by running:
229
228
 
230
229
  ```term
231
230
  $ heroku run rake db:migrate
232
231
  ```
233
232
 
234
- Any commands after the `heroku run` will be executed on a Heroku [dyno](dynos). You can obtain an interactive shell session by running `$ heroku run bash`.
233
+ Any commands after the `heroku run` are executed on a Heroku [dyno](dynos). You can obtain an interactive shell session by running `$ heroku run bash`.
235
234
 
236
235
  ## Visit your application
237
236
 
@@ -240,7 +239,7 @@ You've deployed your code to Heroku. You can now instruct Heroku to execute a pr
240
239
  Let's ensure we have one dyno running the `web` process type:
241
240
 
242
241
  ```term
243
- :::> $ heroku ps:scale web=1
242
+ :::>- $ heroku ps:scale web=1
244
243
  ```
245
244
 
246
245
  You can check the state of the app's dynos. The `heroku ps` command lists the running dynos of your application:
@@ -261,7 +260,7 @@ You should now see the "Hello World" text we inserted above.
261
260
 
262
261
  Heroku gives you a default web URL for simplicity while you are developing. When you are ready to scale up and use Heroku for production you can add your own [custom domain](https://devcenter.heroku.com/articles/custom-domains).
263
262
 
264
- ## View the logs
263
+ ## View logs
265
264
 
266
265
  If you run into any problems getting your app to perform properly, you will need to check the logs.
267
266
 
@@ -279,11 +278,11 @@ $ heroku logs --tail
279
278
 
280
279
  ## Dyno sleeping and scaling
281
280
 
282
- By default, new applications are deployed to a free dyno. Free apps will "sleep" to conserve resources. You can find more information about this behavior by reading about [free dyno behavior](https://devcenter.heroku.com/articles/free-dyno-hours).
281
+ By default, new applications are deployed to a free dyno. Free apps will "sleep" to conserve resources. You can find more information about this behavior by reading about [free dyno behavior](free-dyno-hours).
283
282
 
284
283
  To avoid dyno sleeping, you can upgrade to a hobby or professional dyno type as described in the [Dyno Types](dyno-types) article. For example, if you migrate your app to a professional dyno, you can easily scale it by running a command telling Heroku to execute a specific number of dynos, each running your web process type.
285
284
 
286
- ## Rails console
285
+ ## Run the Rails console
287
286
 
288
287
  Heroku allows you to run commands in a [one-off dyno](one-off-dynos) - scripts and applications that only need to be executed when needed - using the `heroku run` command. Use this to launch a Rails console process attached to your local terminal for experimenting in your app's environment:
289
288
 
@@ -295,7 +294,7 @@ irb(main):001:0> puts 1+1
295
294
 
296
295
  Another useful command for debugging is `$ heroku run bash` which will spin up a new dyno and give you access to a bash session.
297
296
 
298
- ## Rake
297
+ ## Run Rake commands
299
298
 
300
299
  Rake can be run as an attached process exactly like the console:
301
300
 
@@ -303,7 +302,7 @@ Rake can be run as an attached process exactly like the console:
303
302
  $ heroku run rake db:migrate
304
303
  ```
305
304
 
306
- ## Webserver
305
+ ## Configure your webserver
307
306
 
308
307
  By default, your app's web process runs `rails server`, which uses Puma in Rails 5. If you are upgrading an app you'll need to add `puma` to your application `Gemfile`:
309
308
 
@@ -314,14 +313,14 @@ gem 'puma'
314
313
  Then run
315
314
 
316
315
  ```term
317
- :::> $ bundle install
316
+ :::>- $ bundle install
318
317
  ```
319
318
 
320
319
  Now you are ready to configure your app to use Puma. For this tutorial we will use the default `config/puma.rb` of that ships with Rails 5, but we recommend reading more about configuring your application for maximum performance by [reading the Puma documentation](https://devcenter.heroku.com/articles/deploying-rails-applications-with-the-puma-web-server).
321
320
 
322
321
  Finally you will need to tell Heroku how to run your Rails app by creating a `Procfile` in the root of your application directory.
323
322
 
324
- ### Procfile
323
+ ### Create a Procfile
325
324
 
326
325
  Change the command used to launch your web process by creating a file called [Procfile](procfile) and entering this:
327
326
 
@@ -330,11 +329,11 @@ Change the command used to launch your web process by creating a file called [Pr
330
329
  web: bundle exec puma -t 5:5 -p ${PORT:-3000} -e ${RACK_ENV:-development}
331
330
  ```
332
331
 
333
- > Note: The case of `Procfile` matters, the first letter must be uppercase.
332
+ > Note: This file must be named `Procfile` exactly.
334
333
 
335
334
  We recommend generating a Puma config file based on [our Puma documentation](https://devcenter.heroku.com/articles/deploying-rails-applications-with-the-puma-web-server) for maximum performance.
336
335
 
337
- To use the Procfile locally you can use `heroku local`.
336
+ To use the Procfile locally, you can use `heroku local`.
338
337
 
339
338
  In addition to running commands in your `Procfile` `heroku local` can also help you manage environment variables locally through a `.env` file. Set the local `RACK_ENV` to development in your environment and a `PORT` to connect to. Before pushing to Heroku you'll want to test with the `RACK_ENV` set to production since this is the environment your Heroku app will run in.
340
339
 
@@ -348,30 +347,24 @@ In addition to running commands in your `Procfile` `heroku local` can also help
348
347
  You'll also want to add `.env` to your `.gitignore` since this is for local environment setup.
349
348
 
350
349
  ```term
351
- :::> $ echo ".env" >> .gitignore
352
- :::> $ git add .gitignore
353
- :::> $ git commit -m "add .env to .gitignore"
350
+ :::>- $ echo ".env" >> .gitignore
351
+ :::>- $ git add .gitignore
352
+ :::>- $ git commit -m "add .env to .gitignore"
354
353
  ```
355
354
 
356
355
  Test your Procfile locally using Foreman. You can now start your web server by running:
357
356
 
358
357
  ```term
359
- $ heroku local
360
- [OKAY] Loaded ENV .env File as KEY=VALUE Format
361
- 11:06:35 AM web.1 | [18878] Puma starting in cluster mode...
362
- 11:06:35 AM web.1 | [18878] * Version 3.8.2 (ruby 2.4.1-p111), codename: Sassy Salamander
363
- 11:06:35 AM web.1 | [18878] * Min threads: 5, max threads: 5
364
- 11:06:35 AM web.1 | [18878] * Environment: development
365
- 11:06:35 AM web.1 | [18878] * Process workers: 2
366
- 11:06:35 AM web.1 | [18878] * Preloading application
358
+ :::>> background.start("heroku local", name: "local", wait: "Ctrl-C to stop")
359
+ :::-- background.stop(name: "local")
367
360
  ```
368
361
 
369
362
  Looks good, so press `Ctrl+C` to exit and you can deploy your changes to Heroku:
370
363
 
371
364
  ```term
372
- :::> $ git add .
373
- :::> $ git commit -m "use puma via procfile"
374
- :::> $ git push heroku master
365
+ :::>- $ git add .
366
+ :::>- $ git commit -m "use puma via procfile"
367
+ :::>- $ git push heroku master
375
368
  ```
376
369
 
377
370
  Check `ps`. You'll see that the web process uses your new command specifying Puma as the web server.
@@ -390,7 +383,7 @@ $ heroku logs
390
383
 
391
384
  There are several options for invoking the [Rails asset pipeline](http://guides.rubyonrails.org/asset_pipeline.html) when deploying to Heroku. For general information on the asset pipeline please see the [Rails 3.1+ Asset Pipeline on Heroku Cedar](rails-asset-pipeline) article.
392
385
 
393
- The `config.assets.initialize_on_precompile` option has been removed is and not needed for Rails 5. Also, any failure in asset compilation will now cause the push to fail. For Rails 5 asset pipeline support see the [Ruby Support](https://devcenter.heroku.com/articles/ruby-support#rails-5-x-applications) page.
386
+ The `config.assets.initialize_on_precompile` option has been removed is and not needed for Rails 5. Also, any failure in asset compilation will now cause the push to fail. For Rails 5 asset pipeline support see the [Ruby Support](ruby-support#rails-5-x-applications) page.
394
387
 
395
388
  ## Troubleshooting
396
389
 
@@ -438,6 +431,9 @@ end
438
431
 
439
432
  Confirm it works locally, then push to Heroku.
440
433
 
441
- ## Done
434
+ ## Next steps
435
+
436
+ Congratulations! You have deployed your first Rails 5 application to Heroku. Here's some recommended reading:
442
437
 
443
- You have deployed your first application to Heroku. The next step is to deploy your own application. You can read more about Ruby on Heroku at the [Dev Center](https://devcenter.heroku.com/categories/ruby).
438
+ * Visit the [Ruby support category](/categories/ruby-support) to learn more about using Ruby and Rails on Heroku.
439
+ * The [Deployment category](/categories/deployment) provides a variety of powerful integrations and features to help streamline and simplify your deployments.
@@ -1,6 +1,6 @@
1
1
  require 'test_helper'
2
2
 
3
- class AppendFileTest < Test::Unit::TestCase
3
+ class AppendFileTest < Minitest::Test
4
4
 
5
5
  def test_appends_to_a_file
6
6
  Dir.mktmpdir do |dir|
@@ -71,7 +71,7 @@ gem 'rails', '4.0.0'
71
71
  Dir.chdir(dir) do
72
72
  FileUtils.touch("file-1234.txt")
73
73
  FileUtils.touch("file-5678.txt")
74
- assert_raise do
74
+ assert_raises do
75
75
  cc = Rundoc::CodeCommand::FileCommand::Append.new("file-*.txt")
76
76
  cc << "some text"
77
77
  cc.call
@@ -0,0 +1,43 @@
1
+ require 'test_helper'
2
+
3
+ class BackgroundTest < Minitest::Test
4
+ def test_background_start
5
+ Dir.mktmpdir do |dir|
6
+ Dir.chdir(dir) do
7
+
8
+ file = "foo.txt"
9
+ `echo 'foo' >> #{file}`
10
+
11
+ background_start = Rundoc::CodeCommand::Background::Start.new("tail -f #{file}",
12
+ name: "tail",
13
+ wait: "f"
14
+ )
15
+ output = background_start.call
16
+
17
+ assert_match("foo", output)
18
+ assert_equal(true, background_start.alive?)
19
+
20
+ log_read = Rundoc::CodeCommand::Background::Log::Read.new(name: "tail")
21
+ output = log_read.call
22
+
23
+ assert_equal("foo", output.chomp)
24
+
25
+ log_clear = Rundoc::CodeCommand::Background::Log::Clear.new(name: "tail")
26
+ output = log_clear.call
27
+ assert_equal("", output)
28
+
29
+ `echo 'bar' >> #{file}`
30
+
31
+ log_read = Rundoc::CodeCommand::Background::Log::Read.new(name: "tail")
32
+ output = log_read.call
33
+
34
+ assert_equal("bar", output.chomp)
35
+
36
+ background_stop = Rundoc::CodeCommand::Background::Stop.new(name: "tail")
37
+ background_stop.call
38
+
39
+ assert_equal(false, background_start.alive?)
40
+ end
41
+ end
42
+ end
43
+ end
@@ -1,6 +1,6 @@
1
1
  require 'test_helper'
2
2
 
3
- class BashTest < Test::Unit::TestCase
3
+ class BashTest < Minitest::Test
4
4
 
5
5
  def test_bash_returns_cd
6
6
  original_dir = `pwd`
@@ -1,6 +1,6 @@
1
1
  require 'test_helper'
2
2
 
3
- class PipeTest < Test::Unit::TestCase
3
+ class PipeTest < Minitest::Test
4
4
 
5
5
  def test_pipe
6
6
  pipe_cmd = "tail -n 2"