Sha256: a6e507743bb4838ba901f9f3b8d09d6982b6b98cbbc3f5c5ad309f62d91f3dc4

Contents?: true

Size: 780 Bytes

Versions: 5

Compression:

Stored size: 780 Bytes

Contents

require 'rake'

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

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

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

      task :create_unless_exists do
        begin
          Rake::Task['environment'].invoke
          ActiveRecord::Base.connection
        rescue ActiveRecord::NoDatabaseError => e
          Rake::Task['db:create'].invoke
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
kuby-core-0.7.2 lib/kuby/kubernetes/plugins/rails_app/tasks.rake
kuby-core-0.7.1 lib/kuby/kubernetes/plugins/rails_app/tasks.rake
kuby-core-0.7.0 lib/kuby/kubernetes/plugins/rails_app/tasks.rake
kuby-core-0.6.1 lib/kuby/kubernetes/plugins/rails_app/tasks.rake
kuby-core-0.6.0 lib/kuby/kubernetes/plugins/rails_app/tasks.rake