Skip to content

Commit

Permalink
remove obsolete code
Browse files Browse the repository at this point in the history
  • Loading branch information
mkristian committed Jan 30, 2012
1 parent 2d678f6 commit 671c43e
Show file tree
Hide file tree
Showing 26 changed files with 2 additions and 1,128 deletions.
10 changes: 0 additions & 10 deletions features/generators.feature
Expand Up @@ -6,13 +6,3 @@ Feature: Generators for ixtlan-guard
And I execute "rails generate scaffold account name:string --skip"
And I execute "rake db:migrate test"
Then the output should contain "7 tests, 10 assertions, 0 failures, 0 errors"

Scenario: The user-management-model generator creates user/group models, etc
Given I create new rails application with template "user_management.template" and "user-management" specs
And I execute "rails generate rspec:install"
And I execute "rails generate ixtlan:user_management_models user group name:string domain name:string locale code:string"
# this tes env is needed since we execute the specs directly
And I execute "rails rake db:migrate -- -Drails.env=test"
# needed due to bug in rspec-maven-plugin with emtpy gem-path
And I execute "gem exec ../rubygems/bin/rspec spec/user_management_models_spec.rb"
Then the output should contain "14 examples, 0 failures"
83 changes: 1 addition & 82 deletions features/step_definitions/simple_steps.rb
@@ -1,82 +1 @@
require 'fileutils'
require File.join(File.dirname(__FILE__), 'ruby_maven')

def rmvn
@rmvn ||= Maven::RubyMaven.new
end

def copy_tests(tests)
FileUtils.mkdir_p(@app_directory)
FileUtils.cp_r(File.join('templates', "tests-#{tests}", "."),
File.join(@app_directory, 'test'))
end

def copy_specs(specs)
FileUtils.mkdir_p(@app_directory)
FileUtils.cp_r(File.join('templates', "specs-#{specs}", "."),
File.join(@app_directory, 'spec'))
end

def create_rails_application(template)
name = template.sub(/.template$/, '')
@app_directory = File.join('target', name)

# rails version from gemspec
gemspec = File.read(Dir.glob("*.gemspec")[0])
rails_version = gemspec.split("\n").detect { |l| l =~ /development_dep.*rails/ }.sub(/'$/, '').sub(/.*'/, '')

rmvn.options['-Dplugin.version'] = '0.28.4-SNAPSHOT'
rmvn.options['-Drails.version'] = rails_version
rmvn.options['-Dgem.home'] = ENV['GEM_HOME']
rmvn.options['-Dgem.path'] = ENV['GEM_PATH']
rmvn.options['-o'] = nil

FileUtils.rm_rf(@app_directory)

rmvn.exec("rails", "new", @app_directory, "-f")

# TODO that should be done via the rails new task !!!
rmvn.exec_in(@app_directory, "rails", "rake", "rails:template LOCATION=" + File.expand_path("templates/#{template}"))
end

Given /^I create new rails application with template "(.*)"$/ do |template|
create_rails_application(template)
end

Given /^I create new rails application with template "(.*)" and "(.*)" tests$/ do |template, tests|
create_rails_application(template)
copy_tests(tests)
end

Given /^I create new rails application with template "(.*)" and "(.*)" specs$/ do |template, specs|
create_rails_application(template)
copy_specs(specs)
end

Given /^me an existing rails application "(.*)"$/ do |name|
@app_directory = File.join('target', name)
end

Given /^me an existing rails application "(.*)" and "(.*)" tests$/ do |name, tests|
@app_directory = File.join('target', name)
copy_tests(tests)
end

Given /^me an existing rails application "(.*)" and "(.*)" specs$/ do |name, specs|
@app_directory = File.join('target', name)
copy_specs(specs)
end

And /^I execute \"(.*)\"$/ do |args|
rmvn.options['-l'] = "output.log"
rmvn.exec_in(@app_directory, args)
end

Then /^the output should contain \"(.*)\"$/ do |expected|
result = File.read(File.join(@app_directory, "output.log"))
expected.split(/\"?\s+and\s+\"?/).each do |exp|
puts exp
(result =~ /.*#{exp}.*/).should_not be_nil
end
end

require 'maven/cucumber_steps'
13 changes: 0 additions & 13 deletions lib/generators/active_record/templates/flavor_migration.rb

This file was deleted.

8 changes: 0 additions & 8 deletions lib/generators/active_record/templates/flavor_model.rb

This file was deleted.

43 changes: 0 additions & 43 deletions lib/generators/active_record/templates/group_model.rb

This file was deleted.

13 changes: 0 additions & 13 deletions lib/generators/active_record/templates/group_user_migration.rb

This file was deleted.

124 changes: 0 additions & 124 deletions lib/generators/active_record/templates/user_model.rb

This file was deleted.

0 comments on commit 671c43e

Please sign in to comment.