Sha256: e142caef2a09419d8354f93827abec308c861210a8e212e7fa562e8da0e4a30d

Contents?: true

Size: 1.25 KB

Versions: 5

Compression:

Stored size: 1.25 KB

Contents

namespace :spina do
  
  desc "Install Spina"
  task install: :environment do
    begin
      ActiveRecord::Base.connection
    rescue ActiveRecord::NoDatabaseError
      puts "ERROR: database does not exist, run \"rails db:create\" first"
    else
      Rails::Command.invoke :generate, ["spina:install"]
    end
  end
  
  desc "First deploy"
  task first_deploy: :environment do
    # First deploy will run the same steps as the install generator, but skips copying files
    Rails::Command.invoke :generate, ["spina:install", "--first-deploy"]
  end
  
  desc "Silent First deploy"
  task silent_first_deploy: :environment do
    # Silent First deploy will run the same steps as First Deploy but without prompts
    Rails::Command.invoke :generate, ["spina:install", "--first-deploy", "--silent"]
  end
  
  desc "Generate all pages based on the theme config"
  task bootstrap: :environment do
    Spina::Account.first.save
  end

  desc "Update translations after adding locales"
  task update_translations: :environment do
    Spina.locales.each do |locale|
      Mobility.with_locale(locale) do

        Spina::Page.all.order(:id).each do |page|
          page.title = page.title(fallback: I18n.fallbacks[locale])
          page.save
        end

      end
    end
  end

end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
spina-2.12.0 lib/tasks/install.rake
spina-2.11.0 lib/tasks/install.rake
spina-2.10.0 lib/tasks/install.rake
spina-2.9.1 lib/tasks/install.rake
spina-2.9.0 lib/tasks/install.rake