Skip to content
This repository was archived by the owner on Oct 29, 2020. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions lib/rails/generators/culerity_generator.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
class CulerityGenerator < ::Rails::Generators::Base
source_root File.expand_path('../templates', __FILE__)
desc "Install Culerity into your application"
def generate_culerity
copy_file 'features/step_definitions/culerity_steps.rb', 'features/step_definitions/culerity_steps.rb'
copy_file 'features/support/env.rb', 'features/support/culerity_env.rb'
copy_file 'config/environments/culerity.rb', 'config/environments/culerity.rb'
gsub_file 'config/environments/culerity.rb', /Rarp/, Rails::Application.subclasses[0].name.to_s.split("::")[0]
gsub_file 'config/database.yml', /cucumber:.*\n/, "cucumber: &CUCUMBER\n"

gsub_file 'config/database.yml', /\z/, "\nculerity:\n <<: *CUCUMBER"

copy_file "lib/tasks/culerity.rake", "lib/tasks/culerity.rake"

copy_file 'public/javascripts/culerity.js', 'public/javascripts/culerity.js'
end
end
19 changes: 19 additions & 0 deletions lib/rails/generators/templates/config/environments/culerity.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
Rarp::Application.configure do
config.cache_classes = true # set because of https://rspec.lighthouseapp.com/projects/16211/tickets/165

# Log error messages when you accidentally call methods on nil.
config.whiny_nils = true

# Show full error reports and disable caching
config.action_controller.consider_all_requests_local = true
config.action_controller.perform_caching = false

# Disable request forgery protection in test environment
config.action_controller.allow_forgery_protection = false

# Tell Action Mailer not to deliver emails to the real world.
# The :test delivery method accumulates sent emails in the
# ActionMailer::Base.deliveries array.
config.action_mailer.delivery_method = :persistent
config.active_support.deprecation = :log
end
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,18 @@ namespace 'culerity' do
task :start do
port = ENV['PORT'] || 3001
environment = ENV["RAILS_ENV"] || 'culerity'
pid_file = RAILS_ROOT + "/tmp/culerity_rails_server.pid"
pid_file = Rails.root.to_s + "/tmp/culerity_rails_server.pid"
if File.exists?(pid_file)
puts "culerity rails server already running; if not, delete tmp/culerity_rails_server.pid and try again"
exit 1
end
rails_server = IO.popen("script/server -e #{environment} -p #{port}", 'r+')
rails_server = IO.popen("rails s -e #{environment} -p #{port}", 'r+')
File.open(pid_file, "w") { |file| file << rails_server.pid }
end

desc "Stops the running rails server for cucumber/culerity tests"
task :stop do
pid_file = RAILS_ROOT + "/tmp/culerity_rails_server.pid"
pid_file = Rails.root.to_s + "/tmp/culerity_rails_server.pid"
if File.exists?(pid_file)
pid = File.read(pid_file).to_i
Process.kill(6, pid)
Expand Down
File renamed without changes.
26 changes: 0 additions & 26 deletions rails_generators/culerity/culerity_generator.rb

This file was deleted.

This file was deleted.