Sha256: 681dc1c7a4e5a3be34b1d5d868d49013f02578beee70fc428f218177013a2dd5

Contents?: true

Size: 1.18 KB

Versions: 5

Compression:

Stored size: 1.18 KB

Contents

require 'rake'

namespace :kuby do
  namespace :rails_app do
    namespace :db do
      task :rewrite_config do
        Kuby.load!

        config_file = File.join(Kuby.environment.kubernetes.plugin(:rails_app).root, 'config', 'database.yml')

        if rails_app = Kuby.environment.kubernetes.plugin(:rails_app)
          database = rails_app.database

          if database.plugin.respond_to?(:rewritten_configs)
            File.write(config_file, YAML.dump(database.plugin.rewritten_configs))
            Kuby.logger.info("Wrote #{config_file}")
          end
        end
      end

      task :bootstrap do
        Kuby.load!

        if rails_app = Kuby.environment.kubernetes.plugin(:rails_app)
          if database = rails_app.database
            database.plugin.bootstrap
          end
        end
      end

      task :migrate do
        next unless Kernel.const_defined?('::ActiveRecord')

        Rake::Task['environment'].invoke
        Rake::Task['db:migrate'].invoke
      end
    end

    namespace :assets do
      task :copy do
        Kuby.load!

        if assets = Kuby.environment.kubernetes.plugin(:rails_assets)
          assets.copy_task.run
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
kuby-core-0.20.2 lib/kuby/plugins/rails_app/tasks.rake
kuby-core-0.20.1 lib/kuby/plugins/rails_app/tasks.rake
kuby-core-0.20.0 lib/kuby/plugins/rails_app/tasks.rake
kuby-core-0.19.0 lib/kuby/plugins/rails_app/tasks.rake
kuby-core-0.18.0 lib/kuby/plugins/rails_app/tasks.rake