Sha256: 0f04e071c76da3eb998daf19f0b9d7d73fc3d9b3a4070f30524cf25b1371132a
Contents?: true
Size: 1.73 KB
Versions: 4
Compression:
Stored size: 1.73 KB
Contents
namespace :okei do def app @app ||= ( Rake::Task.task_defined?("railties:install:migrations") ? "" : "app:" ) end desc "Installs the units gem into rails application" task install: %w(dependencies:install db:migrate) do system "rake routes:mount" if app.blank? end namespace :db do desc "Copies and runs db migrations from okei gem" task migrate: %w(install:migrations environment) do system "rake db:migrate SCOPE=okei RAILS_ENV=#{ Rails.env }" end end namespace :install do desc "Copies migrations from okei gem to application" task :migrations do Rake::Task["#{ app }railties:install:migrations"].reenable Rake::Task["#{ app }okei:install:migrations"].invoke end end namespace :dependencies do desc "Installs gem dependencies" task :install do system "rake #{ app }corrector:install" Rake::Task["#{ app }railties:install:migrations"].reenable system "rake #{ app }uuids:install" end end namespace :routes do desc "Mounts units API routes" task :mount do insert_into_file( "config/routes.rb", before: "\nend", line: "\n\n mount Okei::Engine => \"/okei\"", engine: "Okei::Engine" ) end def insert_into_file(name, before:, line:, engine:) text = File.read(name) return if text[engine] File.write name, text.gsub(before, line << before) end end namespace :test do desc "Prepares spec environment" task prepare: %w(cache:prepare) do system "rake db:migrate RAILS_ENV=test" end end namespace :cache do desc "Creates spec/dummy/temp/cache folder" task :prepare do system "mkdir spec/dummy/tmp/cache -p -v" end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
okei-1.0.2 | lib/tasks/okei_tasks.rake |
okei-1.0.1 | lib/tasks/okei_tasks.rake |
okei-1.0.0 | lib/tasks/okei_tasks.rake |
okei-1.0.0.pre.rc | lib/tasks/okei_tasks.rake |