Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add rake task for style and tests #167

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,20 @@ namespace :gem do
system 'gem build trollolo.gemspec'
end
end

require 'rubocop/rake_task'
require 'rspec/core/rake_task'

task default: %i[rubocop spec]

desc 'Run tests'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rahul2240 the issue is about creating a single rake task that run both the tests and rubocop. 😉

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Ana06 using rake will do both the tasks (test,style check) if there is some offence then only it will not complete.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rahul2240 what do you mean with using rake? what command would you run?

Copy link
Member Author

@rahul2240 rahul2240 Feb 20, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Ana06 I am using only "rake" as a command and it is doing both the task i.e testing as well as style checking.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rahul2240 and what happens if we add another unrelated rake task in the future?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Ana06 Right now test and style check is set as default for rake command if unrelated rake task is added in future then we will have to use (rake taskname) to run it.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Ana06 If I am doing it wrong please let me know I am ready to start again 😄

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rahul2240 if we add a task in the future you will have to run rake taskname and then you can not run both things at the same time. We want a single rake task, not two, that runs everything that Travis run.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Ana06 Ok now I got it. Cann't we add that task to default? so that it runs automatically with rake command, Or we need a more simpler method?

task :spec do
RSpec::Core::RakeTask.new
end

desc 'Run rubocop'
task :rubocop do
RuboCop::RakeTask.new do |t|
t.options = ['--display-cop-names']
end
end