Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Rake Task Management Essentials

You're reading from   Rake Task Management Essentials Deploy, test, and build software to solve real-world automation challenges using Rake.

Arrow left icon
Product type Paperback
Published in Apr 2014
Publisher
ISBN-13 9781783280773
Length 122 pages
Edition Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Andrey Koleshko Andrey Koleshko
Author Profile Icon Andrey Koleshko
Andrey Koleshko
Arrow right icon
View More author details
Toc

Table of Contents (18) Chapters Close

Rake Task Management Essentials
Credits
About the Author
Acknowledgements
About the Reviewers
www.PacktPub.com
Preface
1. The Software Task Management Tool – Rake FREE CHAPTER 2. Working with Files 3. Working with Rules 4. Cleaning Up a Build 5. Running Tasks in Parallel 6. Debugging Rake Tasks 7. Integration with Rails 8. Testing Rake Tasks 9. Continuous Integration 10. Relentless Automation Index

The command-line arguments


The most commonly used rake command-line argument is -T. It shows us a list of available rake tasks that you have already defined.

We have defined the default rake task, and if we try to show the list of all rake tasks, it should be there. However, take a look at what happens in real life using the following command:

$ rake -T

The list is empty. Why? The answer lies within Rake. Run the rake command with the -h option to get the whole list of arguments. Pay attention to the description of the -T option, as shown in the following command-line output:

-T, --tasks [PATTERN] Display the tasks (matching optional PATTERN) with descriptions, then exit.

Note

You can get more information on Rake in the repository at the following GitHub link at https://github.com/jimweirich/rake.

The word description is the cornerstone here. It's a new term that we should know. Additionally, there is also an optional description to name a rake task. However, it's recommended that you define it because you won't see the list of all the defined rake tasks that we've already seen. It will be inconvenient for you to read your Rakefile every time you try to run some rake task. Just accept it as a rule: always leave a description for the defined rake tasks.

Now, add a description to your rake tasks with the desc method call, as shown in the following lines of code:

desc "Says 'Hello, Rake'"
task :default do
  puts 'Hello, Rake.'
end

As you see, it's rather easy. Run the rake -T command again and you will see an output as shown:

$ rake -T
rake default  # Says 'Hello, Rake'

Tip

If you want to list all the tasks even if they don't have descriptions, you can pass an -A option with the -T option to the rake command. The resulting command will look like this: rake -T -A.

You have been reading a chapter from
Rake Task Management Essentials
Published in: Apr 2014
Publisher:
ISBN-13: 9781783280773
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image