Skip to content

Commit

Permalink
Export tasks/ as trema/rake_tasks
Browse files Browse the repository at this point in the history
  • Loading branch information
yasuhito committed Mar 17, 2015
1 parent 5ec84e5 commit d299a0c
Show file tree
Hide file tree
Showing 7 changed files with 73 additions and 0 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Rake Tasks
==========

A collection of rake tasks for use with [Trema][trema] and Trema apps.

[trema]: https://github.com/trema/trema_ruby
8 changes: 8 additions & 0 deletions cucumber.rake
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
begin
require 'cucumber/rake/task'
Cucumber::Rake::Task.new
rescue LoadError
task :cucumber do
$stderr.puts 'Cucumber is disabled'
end
end
25 changes: 25 additions & 0 deletions flog.rake
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
begin
require 'flog'

desc 'Analyze for code complexity'
task :flog do
flog = Flog.new(continue: true)
flog.flog(*FileList['*.rb'])
threshold = 0

bad_methods = flog.totals.select do |name, score|
!(/##{flog.no_method}$/ =~ name) && score > threshold
end
bad_methods.sort { |a, b| a[1] <=> b[1] }.reverse.each do |name, score|
printf "%8.1f: %s\n", score, name
end
unless bad_methods.empty?
$stderr.puts "#{bad_methods.size} methods "\
"have a complexity > #{threshold}"
end
end
rescue LoadError
task :flog do
$stderr.puts 'Flog is disabled'
end
end
11 changes: 11 additions & 0 deletions reek.rake
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
begin
require 'reek/rake/task'
Reek::Rake::Task.new do |t|
t.fail_on_error = false
t.verbose = false
end
rescue LoadError
task :reek do
$stderr.puts 'Reek is disabled'
end
end
3 changes: 3 additions & 0 deletions rspec.rake
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
require 'rspec/core/rake_task'

RSpec::Core::RakeTask.new
8 changes: 8 additions & 0 deletions rubocop.rake
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
begin
require 'rubocop/rake_task'
RuboCop::RakeTask.new
rescue LoadError
task :rubocop do
$stderr.puts 'RuboCop is disabled'
end
end
12 changes: 12 additions & 0 deletions yard.rake
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
begin
require 'yard'
YARD::Rake::YardocTask.new do |t|
t.files = ['lib/**/*.rb']
t.options = ['--no-private']
t.options << '--debug' << '--verbose' if verbose == true
end
rescue LoadError
task :yard do
$stderr.puts 'YARD is disabled'
end
end

0 comments on commit d299a0c

Please sign in to comment.