README.md in oops_a_rake-0.1.0 vs README.md in oops_a_rake-0.2.0
- old
+ new
@@ -108,10 +108,28 @@
```sh
bundle exec rake admin:special
```
+### Task with a custom name
+
+```ruby
+class ObscureClassNameTask do
+ include OopsARake::Task.with_options(name: "custom_name")
+
+ def call
+ puts "Hello"
+ end
+end
+```
+
+Invocation:
+
+```sh
+bundle exec rake custom_name
+```
+
## Motivation
Rake is an omnipresent tool in the Ruby world. It has some drawbacks – the main
issue I've heard repeatedly is how difficult it is to test Rake tasks.
@@ -122,10 +140,10 @@
As a result I've seen many codebases which opt for writing thin Rake tasks that
call a plain Ruby object, which is tested in isolation:
```ruby
task :greeting do |_, args|
- GreetingTask.new(*args).call
+ SomeObject.new(*args).call
end
```
Instead of writing this glue-code by hand it's cleaner to write your tasks as
objects: