Skip to content
Browse files

environmental changes

  • Loading branch information...
1 parent d790860 commit 23d05e4a8f087c535feeb692ed1d52b36cbd94a9 @gigix gigix committed Nov 5, 2012
Showing with 53 additions and 0 deletions.
  1. +2 −0 .gitignore
  2. +1 −0 .rvmrc
  3. +2 −0 Gemfile
  4. +21 −0 Gemfile.lock
  5. +4 −0 Rakefile
  6. +23 −0 lib/tasks/analysis.rake
View
2 .gitignore
@@ -15,3 +15,5 @@
/tmp
/.idea
public/system
+
+analyzer/*
View
1 .rvmrc
@@ -0,0 +1 @@
+rvm use --create 1.9.2@ocelots
View
2 Gemfile
@@ -17,6 +17,8 @@ end
gem 'jquery-rails'
group :development, :test do
+ gem "rails_best_practices", "~> 1.11.1"
+ gem "flay"
gem 'sqlite3'
gem 'rspec-rails'
gem 'machinist'
View
21 Gemfile.lock
@@ -29,6 +29,7 @@ GEM
i18n (~> 0.6)
multi_json (~> 1.0)
arel (3.0.2)
+ awesome_print (1.1.0)
aws-sdk (1.6.5)
httparty (~> 0.7)
json (~> 1.4)
@@ -37,19 +38,25 @@ GEM
builder (3.0.0)
chronic (0.7.0)
cocaine (0.3.0)
+ code_analyzer (0.3.0)
+ sexp_processor
coffee-rails (3.2.2)
coffee-script (>= 2.2.0)
railties (~> 3.2.0)
coffee-script (2.2.0)
coffee-script-source
execjs
coffee-script-source (1.3.3)
+ colored (1.2)
diff-lcs (1.1.3)
erubis (2.7.0)
execjs (1.4.0)
multi_json (~> 1.0)
faker (1.0.1)
i18n (~> 0.4)
+ flay (2.0.0)
+ ruby_parser (~> 3.0.0)
+ sexp_processor (~> 4.0)
hike (1.2.1)
httparty (0.8.3)
multi_json (~> 1.0)
@@ -77,6 +84,7 @@ GEM
mime-types
pg (0.14.1)
polyglot (0.3.3)
+ progressbar (0.11.0)
rack (1.4.1)
rack-cache (1.2)
rack (>= 0.4)
@@ -92,6 +100,14 @@ GEM
activesupport (= 3.2.8)
bundler (~> 1.0)
railties (= 3.2.8)
+ rails_best_practices (1.11.1)
+ activesupport
+ awesome_print
+ code_analyzer
+ colored
+ erubis
+ i18n
+ progressbar
railties (3.2.8)
actionpack (= 3.2.8)
activesupport (= 3.2.8)
@@ -115,11 +131,14 @@ GEM
activesupport (>= 3.0)
railties (>= 3.0)
rspec (~> 2.11.0)
+ ruby_parser (3.0.1)
+ sexp_processor (~> 4.1)
sass (3.2.1)
sass-rails (3.2.5)
railties (~> 3.2.0)
sass (>= 3.1.10)
tilt (~> 1.3)
+ sexp_processor (4.1.2)
slim (1.3.0)
temple (~> 0.4.1)
tilt (~> 1.3.3)
@@ -148,11 +167,13 @@ DEPENDENCIES
chronic
coffee-rails (~> 3.2.1)
faker
+ flay
jquery-rails
machinist
paperclip
pg
rails (= 3.2.8)
+ rails_best_practices (~> 1.11.1)
rspec-rails
sass-rails (~> 3.2.3)
slim
View
4 Rakefile
@@ -5,3 +5,7 @@
require File.expand_path('../config/application', __FILE__)
Ocelots::Application.load_tasks
+
+Rake::Task[:default].prerequisites.clear
+# task :default => %w(db:drop db:migrate analyzer:flay analyzer:rails_best_practices spec stats)
+task :default => %w(db:drop db:migrate db:test:prepare analyzer:flay spec stats)
View
23 lib/tasks/analysis.rake
@@ -0,0 +1,23 @@
+namespace :analyzer do
+ desc "run rails_best_practices"
+ task :rails_best_practices do
+ require 'rails_best_practices'
+ app_root = Rake.application.original_dir
+ output_file = File.join(app_root, 'analyzer', 'rails_best_practices.html')
+ analyzer = RailsBestPractices::Analyzer.new(app_root, {
+ 'format' => 'html',
+ 'with-textmate' => true,
+ 'output-file' => output_file
+ })
+ analyzer.analyze
+ analyzer.output
+ fail "found bad practices, see details in " + output_file if analyzer.runner.errors.size >0
+ end
+
+ desc "run flay and analyze code for structural similarities"
+ task :flay do
+ output = `flay #{FileList["lib/**/*.rb", "app/**/*.rb"].join(' ')}`
+ fail "Error #{$?}: #{output}" unless $? == 0
+ puts output
+ end
+end

0 comments on commit 23d05e4

Please sign in to comment.
Something went wrong with that request. Please try again.