Sha256: 236cd9a2472f95170af2b8e3c0475b31400ad955fbdff00a81f71a186b50fd5e

Contents?: true

Size: 1.3 KB

Versions: 4

Compression:

Stored size: 1.3 KB

Contents

namespace :theme do
  desc 'Lists all installed themes'
  task :list do
    require File.expand_path('../../../zen', __FILE__)

    Zen::Theme::REGISTERED.each do |name, pkg|
      if pkg.about.nil? or pkg.about.empty?
        puts "* #{name}"
      else
        puts "* #{name}\n  #{pkg.about}"
      end
    end
  end

  desc 'Migrates a specific theme'
  task :migrate, :name, :version do |task, args|
    require File.expand_path('../../../zen', __FILE__)

    if !args[:name]
      abort 'You need to specify the name of the theme.'
    end

    if !args[:version]
      version = nil
      puts 'No version specified, choosing the most recent version...'
    else
      version = args[:version].to_i
    end

    name = args[:name].to_sym

    if !Zen::Theme::REGISTERED[name]
      abort 'The specified theme does not exist.'
    end

    theme = Zen::Theme::REGISTERED[name]
    table = 'migrations_theme_' + theme.name.to_s

    # Fetch the migrations directory
    if theme.respond_to?(:migration_dir) and !theme.migration_dir.nil?
      dir = theme.migration_dir
    else
      abort 'The specified theme does not have a migrations directory.'
    end

    if !File.directory?(dir)
      abort 'The theme\'s migration directory doesn\'t exist.'
    end

    Zen::Migrator.run(theme.name, dir, table, version)
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
zen-0.4.3 lib/zen/task/theme.rake
zen-0.4.2 lib/zen/task/theme.rake
zen-0.4.1 lib/zen/task/theme.rake
zen-0.4 lib/zen/task/theme.rake