diff options
author | Louise Crow <louise.crow@gmail.com> | 2011-02-23 11:45:40 +0000 |
---|---|---|
committer | Louise Crow <louise.crow@gmail.com> | 2011-02-23 11:45:40 +0000 |
commit | 59c701ce13f20f73d95ae8eebf5bc01b6e616158 (patch) | |
tree | 81856ce90c3d3ca705569d28e05d56ba2496fa2d | |
parent | 4e4a99c1862f74f4bc760abb0b389b4c2e855c6e (diff) |
Removing rake_tasks plugin - another developer plugin
-rw-r--r-- | vendor/plugins/rake_tasks/MIT-LICENSE | 20 | ||||
-rw-r--r-- | vendor/plugins/rake_tasks/README | 30 | ||||
-rw-r--r-- | vendor/plugins/rake_tasks/init.rb | 1 | ||||
-rw-r--r-- | vendor/plugins/rake_tasks/lib/convert.rb | 47 | ||||
-rw-r--r-- | vendor/plugins/rake_tasks/tasks/deprecated.rake | 10 | ||||
-rw-r--r-- | vendor/plugins/rake_tasks/tasks/environment.rake | 9 | ||||
-rw-r--r-- | vendor/plugins/rake_tasks/tasks/spec.rake | 125 | ||||
-rw-r--r-- | vendor/plugins/rake_tasks/tasks/svn.rake | 59 | ||||
-rw-r--r-- | vendor/plugins/rake_tasks/test/fixtures/views/tests/test.liquid | 0 | ||||
-rw-r--r-- | vendor/plugins/rake_tasks/test/fixtures/views/tests/test.rhtml | 0 | ||||
-rw-r--r-- | vendor/plugins/rake_tasks/test/fixtures/views/tests/test.rjs | 0 | ||||
-rw-r--r-- | vendor/plugins/rake_tasks/test/fixtures/views/tests/test.rxml | 0 | ||||
-rw-r--r-- | vendor/plugins/rake_tasks/test/unit/rhtml_test.rb | 39 |
13 files changed, 0 insertions, 340 deletions
diff --git a/vendor/plugins/rake_tasks/MIT-LICENSE b/vendor/plugins/rake_tasks/MIT-LICENSE deleted file mode 100644 index 1aea3fb6b..000000000 --- a/vendor/plugins/rake_tasks/MIT-LICENSE +++ /dev/null @@ -1,20 +0,0 @@ -Copyright (c) 2007 Integrum Technologies, LLC - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
\ No newline at end of file diff --git a/vendor/plugins/rake_tasks/README b/vendor/plugins/rake_tasks/README deleted file mode 100644 index 3d7f74a87..000000000 --- a/vendor/plugins/rake_tasks/README +++ /dev/null @@ -1,30 +0,0 @@ -rake_tasks -========== - -Overview --------- - -Adds the following Rake tasks: - - rake db:create # Creates the databases defined in your config/database.yml (unless they already exist) - rake db:drop # Drops the database for your currenet RAILS_ENV as defined in config/database.yml - rake db:reset # Drops, creates and then migrates the database for your current RAILS_ENV - rake db:shell # Launches the database shell using the values defined in config/database.yml - - rake svn:add # Adds new files to subversion - rake svn:remove # Removes missing files from subversion - rake svn:ignore # Configures svn:ignore properties on log, tmp, db/schema.rb and config/database.yml - rake svn:conflicts # Resolves all svn conflicts by keeping the working file - - rake spec:check # Check files in the app directory for corresponding test files in the spec directory. - rake spec:sync # Check for missing test files in the spec directory and create them if they don't exist. - -Authors -------- - - Josh Knowles joshknowles@gmal.com - Matt Heidemann matthew.heidemann@gmail.com - Matt Aimonetti mattaimonetti@gmail.com - Curtis Miller curtm95@gmail.com - -Copyright (c) 2007 Integrum Technologies, LLC, released under the MIT license
\ No newline at end of file diff --git a/vendor/plugins/rake_tasks/init.rb b/vendor/plugins/rake_tasks/init.rb deleted file mode 100644 index b8faeb6b4..000000000 --- a/vendor/plugins/rake_tasks/init.rb +++ /dev/null @@ -1 +0,0 @@ -require 'convert'
\ No newline at end of file diff --git a/vendor/plugins/rake_tasks/lib/convert.rb b/vendor/plugins/rake_tasks/lib/convert.rb deleted file mode 100644 index d74b1be40..000000000 --- a/vendor/plugins/rake_tasks/lib/convert.rb +++ /dev/null @@ -1,47 +0,0 @@ -module Convert - # allows different paths for searching to be set - def self.view_path=(path) - @@view_path = path - end - - def self.view_path - @@view_path ||= RAILS_ROOT+'/app/views/' - end - - # Given a file extension will search for all files recursively in a directory - # and move the files using the move command or subversion move command - # - # Example: - # - # Convert::Mover.find(:rhtml).each do |rhtml| - # rhtml.move :erb, :scm => :svn - # end - # - # This will find all .rhtml files within the views directory and move each file - # to a erb extension using subversion - class Mover - - def self.find(file_extension) - files = File.join(Convert::view_path,'**', "*.#{file_extension}") - Dir.glob(files).collect do |path| - self.new(path, file_extension) - end - end - - def initialize(file_path, file_extension) - @file_path = file_path - @file_extension = file_extension - end - - def move_command(move_to_extension, options = {}) - original_path = File.expand_path(@file_path) - new_path = original_path.gsub(".#{@file_extension}", ".#{move_to_extension}") - - "#{options[:scm]} mv #{original_path} #{new_path}".lstrip - end - - def move(move_to_extension, options = {}) - system self.move_command(move_to_extension, options) - end - end -end
\ No newline at end of file diff --git a/vendor/plugins/rake_tasks/tasks/deprecated.rake b/vendor/plugins/rake_tasks/tasks/deprecated.rake deleted file mode 100644 index 4311c3bd1..000000000 --- a/vendor/plugins/rake_tasks/tasks/deprecated.rake +++ /dev/null @@ -1,10 +0,0 @@ -namespace :deprecated do - namespace :convert do - desc 'Moves .rhtml files to a file with .erb extension for subversion' - task :erb => :environment do - Convert::Mover.find(:rhtml).each do |rhtml| - rhtml.move :erb, :scm => :svn - end - end - end -end
\ No newline at end of file diff --git a/vendor/plugins/rake_tasks/tasks/environment.rake b/vendor/plugins/rake_tasks/tasks/environment.rake deleted file mode 100644 index 223bba3e5..000000000 --- a/vendor/plugins/rake_tasks/tasks/environment.rake +++ /dev/null @@ -1,9 +0,0 @@ -# -# Thanks to Chris for this handy task (http://errtheblog.com/post/33) -# -%w[development test production].each do |env| - desc "Runs the following task in the #{env} environment" - task env do - RAILS_ENV = ENV['RAILS_ENV'] = env - end -end
\ No newline at end of file diff --git a/vendor/plugins/rake_tasks/tasks/spec.rake b/vendor/plugins/rake_tasks/tasks/spec.rake deleted file mode 100644 index a4d608d1b..000000000 --- a/vendor/plugins/rake_tasks/tasks/spec.rake +++ /dev/null @@ -1,125 +0,0 @@ -namespace :spec do - unless defined?(RAILS_ROOT) - root_path = File.join(File.dirname(__FILE__), '..') - unless RUBY_PLATFORM =~ /mswin32/ - require 'pathname' - root_path = Pathname.new(root_path).cleanpath(true).to_s - end - RAILS_ROOT = root_path - end - - require "#{RAILS_ROOT}/config/environment" - - PROJ_DIR = "#{RAILS_ROOT}/app/" - - def view_ext - if ActionView::Base.const_defined?('DEFAULT_TEMPLATE_HANDLER_PREFERENCE') && - ActionView::Base::DEFAULT_TEMPLATE_HANDLER_PREFERENCE.include?(:erb) then - return ".html.erb" - else - return ".rhtml" - end - end - - def find_untested_ruby_files - files = {} - `find #{PROJ_DIR} -name '*.rb'`.split(/\n/).each do |file| - spec_file = file.sub('/app/', '/spec/').sub('.rb', '_spec.rb') - dir_type = File.dirname(file).split("/").last - next if dir_type == "helpers" - type = (dir_type == "models" ? "model" : "controller") - File.exists?(spec_file) ? next : files[spec_file] = type - end - files - end - - def find_untested_view_files - files = {} - `find #{PROJ_DIR} -name '*#{view_ext}'`.split(/\n/).each do |file| - spec_file = file.sub('/app/', '/spec/').sub(view_ext, "#{view_ext}_spec.rb") - type = File.dirname(file).split("/").last - File.exists?(spec_file) ? next : files[spec_file] = type - end - files - end - - desc "Check files in the app directory for corresponding test files in the spec directory." - task :check do - # XXX Don't check views, as we use controllers for view tests. Francis. - files = find_untested_ruby_files #.merge(find_untested_view_files) - unless files.empty? - puts "Missing test files:" - files.each {|file, type| puts " #{file}"} - puts - puts "Run the following command(s) to create the missing files:" - puts " rake spec:sync" - end - end - - desc "Check for missing test files in the spec directory and create them if they don't exist." - task :sync do - # Check if an application_controller file exists... hopefully it does not. - has_application_controller = File.exists?("#{PROJ_DIR}/controllers/application_controller.rb") - - files = find_untested_ruby_files - unless files.empty? - files.each do |file, type| - # Get rid of the _spec and file extension - name = File.basename(file).sub("_spec.rb", "").sub(/(_controller|_helper)/, "") - - has_controller = has_helper = false - if type == "controller" - has_controller = File.exists?("#{PROJ_DIR}/controllers/#{name}_controller.rb") - has_helper = File.exists?("#{PROJ_DIR}/helpers/#{name}_helper.rb") - end - - options = "--skip" - options += " --skip-migration" if type == "model" - puts `script/generate rspec_#{type} #{options} #{name} | grep create` - - unless has_controller - FileUtils.rm "#{PROJ_DIR}/controllers/#{name}_controller.rb" if File.exists?("#{PROJ_DIR}/controllers/#{name}_controller.rb") - FileUtils.rm "#{PROJ_DIR}/../spec/controllers/#{name}_controller_spec.rb" if File.exists?("#{PROJ_DIR}/../spec/controllers/#{name}_controller_spec.rb") - end - - unless has_helper - FileUtils.rm "#{PROJ_DIR}/helpers/#{name}_helper.rb" if File.exists?("#{PROJ_DIR}/helpers/#{name}_helper.rb") - FileUtils.rm "#{PROJ_DIR}/../spec/helpers/#{name}_helper_spec.rb" if File.exists?("#{PROJ_DIR}/../spec/helpers/#{name}_helper_spec.rb") - end - end - end - - files = find_untested_view_files - unless files.empty? - action_list = {} - files.each do |file, controller| - action = File.basename(file)[0..-9].sub(view_ext, "") - - if action_list[controller].blank? - action_list[controller] = action - else - action_list[controller] = "#{action_list[controller]} #{action}" - end - end - - action_list.each do |controller, actions| - next if actions.blank? - - has_controller = File.exists?("#{PROJ_DIR}/controllers/#{controller}_controller.rb") - has_helper = File.exists?("#{PROJ_DIR}/helpers/#{controller}_helper.rb") - - puts `script/generate rspec_controller --skip #{controller} #{actions} | grep create` - - unless has_controller - FileUtils.rm "#{PROJ_DIR}/controllers/#{controller}_controller.rb" - FileUtils.rm "#{PROJ_DIR}/../spec/controllers/#{controller}_controller_spec.rb" - end - - unless has_helper - FileUtils.rm "#{PROJ_DIR}/helpers/#{controller}_helper.rb" - FileUtils.rm "#{PROJ_DIR}/../spec/helpers/#{controller}_helper_spec.rb" - end - end - end - end -end diff --git a/vendor/plugins/rake_tasks/tasks/svn.rake b/vendor/plugins/rake_tasks/tasks/svn.rake deleted file mode 100644 index 5da3cab56..000000000 --- a/vendor/plugins/rake_tasks/tasks/svn.rake +++ /dev/null @@ -1,59 +0,0 @@ -namespace :svn do - desc 'Adds new files to subversion' - task :add do - `svn status | grep '^\?' | sed -e 's/? *//' | sed -e 's/ /\ /g' | xargs svn add` - end - - desc 'Removes missing files from subversion' - task :remove do - `svn status | grep '^\!' | sed -e 's/! *//' | sed -e 's/ /\ /g' | xargs svn remove` - end - - desc 'Deletes unknown files' - task :delete do - `svn status | grep '^\?' | sed -e 's/? *//' | sed -e 's/ /\ /g' | xargs rm -Rf` - end - - desc 'Configures svn:ignore properties on log, tmp, db/schema.rb and config/database.yml' - task :ignore => :environment do - ignore :log => '*' - ignore :tmp => '*' - ignore :db => ['schema.rb', '*.sqlite3'] - ignore :config => 'database.yml' - end - - desc 'Resolves all svn conflicts by keeping the working file' - task :conflicts do - `svn status | grep '^C' | sed -e 's/C *//' | sed -e 's/ /\ /g'`.split("\n").each do |conflict| - `mv #{conflict}.working #{conflict}` - `rm #{conflict}.merge-*` - end - end -end - -private - -def ignore(files) - files.each_pair do |location, pattern| - case pattern - when Array - pattern.each { |p| ignore(location => p) } - when String - remove_versioned_files(location, pattern) - update_ignore_property(location, pattern) - end - end -end - -def remove_versioned_files(location, pattern) - path = File.join(location.to_s, pattern) - FileUtils.mv(path, "#{path}.tmp") if File.exists? path - `svn remove '#{path}' --force` - FileUtils.mv("#{path}.tmp", path) if File.exists? "#{path}.tmp" -end - -def update_ignore_property(location, pattern) - ignored_patterns = `svn propget svn:ignore #{location}`.split(/\s/) - ignored_patterns << pattern unless ignored_patterns.include? pattern - `svn propset svn:ignore '#{ignored_patterns.join("\n")}' #{location}` -end
\ No newline at end of file diff --git a/vendor/plugins/rake_tasks/test/fixtures/views/tests/test.liquid b/vendor/plugins/rake_tasks/test/fixtures/views/tests/test.liquid deleted file mode 100644 index e69de29bb..000000000 --- a/vendor/plugins/rake_tasks/test/fixtures/views/tests/test.liquid +++ /dev/null diff --git a/vendor/plugins/rake_tasks/test/fixtures/views/tests/test.rhtml b/vendor/plugins/rake_tasks/test/fixtures/views/tests/test.rhtml deleted file mode 100644 index e69de29bb..000000000 --- a/vendor/plugins/rake_tasks/test/fixtures/views/tests/test.rhtml +++ /dev/null diff --git a/vendor/plugins/rake_tasks/test/fixtures/views/tests/test.rjs b/vendor/plugins/rake_tasks/test/fixtures/views/tests/test.rjs deleted file mode 100644 index e69de29bb..000000000 --- a/vendor/plugins/rake_tasks/test/fixtures/views/tests/test.rjs +++ /dev/null diff --git a/vendor/plugins/rake_tasks/test/fixtures/views/tests/test.rxml b/vendor/plugins/rake_tasks/test/fixtures/views/tests/test.rxml deleted file mode 100644 index e69de29bb..000000000 --- a/vendor/plugins/rake_tasks/test/fixtures/views/tests/test.rxml +++ /dev/null diff --git a/vendor/plugins/rake_tasks/test/unit/rhtml_test.rb b/vendor/plugins/rake_tasks/test/unit/rhtml_test.rb deleted file mode 100644 index 9597e70c6..000000000 --- a/vendor/plugins/rake_tasks/test/unit/rhtml_test.rb +++ /dev/null @@ -1,39 +0,0 @@ -require 'test/unit' -require '../../lib/convert' - -class MoverTest < Test::Unit::TestCase - def setup - Convert.view_path = '../fixtures/views/' - - @rhtml = File.expand_path('../fixtures/views/tests/test.rhtml') - @erb = @rhtml.gsub('.rhtml', '.erb') - end - - def teardown - Dir.glob(File.join(Convert.view_path, '**', '*.erb')) do |file| - mv_file = file.gsub('.erb', '.rhtml') - system "mv #{file} #{mv_file}" - end - end - - def test_should_find_files_with_rhtml_extension - assert_equal 1, Convert::Mover.find(:rhtml).size - end - - def test_should_output_svn_system_call_text - rhtml_files = Convert::Mover.find :rhtml - assert_equal "mv #{@rhtml} #{@erb}", rhtml_files.first.move_command(:erb) - assert_equal "svn mv #{@rhtml} #{@erb}", rhtml_files.first.move_command(:erb, :scm => :svn) - end - - def test_should_move_files_locally - assert File.exist?(@rhtml) - assert !File.exist?(@erb) - - rhtml_files = Convert::Mover.find :rhtml - rhtml_files.first.move(:erb) - - assert !File.exist?(@rhtml) - assert File.exist?(@erb) - end -end
\ No newline at end of file |