Skip to content

Commit

Permalink
Add 'tasks/' from commit 'f0555ee5b63855bbd24102d92325844a5c1e4e7e'
Browse files Browse the repository at this point in the history
git-subtree-dir: tasks
git-subtree-mainline: e1b96ea
git-subtree-split: f0555ee
  • Loading branch information
yasuhito committed Mar 17, 2015
2 parents e1b96ea + f0555ee commit 861cee2
Show file tree
Hide file tree
Showing 10 changed files with 797 additions and 0 deletions.
34 changes: 34 additions & 0 deletions tasks/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
*.gem
*.rbc
/.config
/coverage/
/InstalledFiles
/pkg/
/spec/reports/
/test/tmp/
/test/version_tmp/
/tmp/

## Specific to RubyMotion:
.dat*
.repl_history
build/

## Documentation cache and generated files:
/.yardoc/
/_yardoc/
/doc/
/rdoc/

## Environment normalisation:
/.bundle/
/lib/bundler/man/

# for a library or gem, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# Gemfile.lock
# .ruby-version
# .ruby-gemset

# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
.rvmrc
675 changes: 675 additions & 0 deletions tasks/LICENSE

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions tasks/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 tasks/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
15 changes: 15 additions & 0 deletions tasks/flay.rake
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
begin
require 'rake/tasklib'
require 'flay'
require 'flay_task'
FlayTask.new do |t|
t.dirs = FileList['lib/**/*.rb'].map do |each|
each[/[^\/]+/]
end.uniq
t.verbose = true
end
rescue LoadError
task :flay do
$stderr.puts 'Flay is disabled'
end
end
25 changes: 25 additions & 0 deletions tasks/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['lib/**/*.rb'])
threshold = 10

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 tasks/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 tasks/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 tasks/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 tasks/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 861cee2

Please sign in to comment.