Sha256: bee565cdd4230ada2c049b5b47d1a5578364a95ce4d6ff463a251bd7617f87b8

Contents?: true

Size: 1.29 KB

Versions: 17

Compression:

Stored size: 1.29 KB

Contents

require 'rake'
require 'rake/tasklib'
require 'fileutils'

class CmsLite
  class Tasks < ::Rake::TaskLib
    def initialize
      define
    end
  
    private
    def define
      namespace :cms_lite do
        
        task :app_env do
          Rake::Task[:environment].invoke if defined?(RAILS_ROOT)
        end
        
        desc 'Translate all pages in the given language directory to all other languages.  Pass a language with language=en, language=ja, etc'
        task :translate do
          language = ENV['language'] || 'en'
          CmsLite.translate_pages(language)
        end
        
        desc 'Create basic directory structure for cms lite'  
        task :setup => :app_env do
          page_path = "#{RAILS_ROOT}/content/pages/en/cmslite"
          protected_path = "#{RAILS_ROOT}/content/protected-pages/en/cmslite-protected"
          FileUtils.mkdir_p(page_path) unless File.directory?(page_path)
          FileUtils.mkdir_p(protected_path) unless File.directory?(protected_path)
          File.open("#{page_path}/hello-world.htm", 'w') {|f| f.write("Hello World") }
          File.open("#{protected_path}/hello-world.htm", 'w') {|f| f.write("Hello World") }    
          puts "finished setting up cmslite directories"
        end
        
      end
    end
  end
end
CmsLite::Tasks.new

Version data entries

17 entries across 17 versions & 2 rubygems

Version Path
jbasdf-cms-lite-0.2.7 lib/cms_lite/tasks.rb
jbasdf-cms-lite-0.3.1 lib/cms_lite/tasks.rb
jbasdf-cms-lite-0.3.2 lib/cms_lite/tasks.rb
jbasdf-cms-lite-0.3.3 lib/cms_lite/tasks.rb
cms-lite-0.5.7 lib/cms_lite/tasks.rb
cms-lite-0.5.6 lib/cms_lite/tasks.rb
cms-lite-0.5.4 lib/cms_lite/tasks.rb
cms-lite-0.5.3 lib/cms_lite/tasks.rb
cms-lite-0.5.2 lib/cms_lite/tasks.rb
cms-lite-0.4.0 lib/cms_lite/tasks.rb
cms-lite-0.4.1 lib/cms_lite/tasks.rb
cms-lite-0.5.0 lib/cms_lite/tasks.rb
cms-lite-0.5.1 lib/cms_lite/tasks.rb
cms-lite-0.3.2 lib/cms_lite/tasks.rb
cms-lite-0.3.1 lib/cms_lite/tasks.rb
cms-lite-0.2.7 lib/cms_lite/tasks.rb
cms-lite-0.3.3 lib/cms_lite/tasks.rb