Sha256: 6169ee43a130537278f1d881e3c4992054da2618e5a1c8099a4db76bb063233b

Contents?: true

Size: 1.04 KB

Versions: 3

Compression:

Stored size: 1.04 KB

Contents

require "bundler/gem_tasks"

namespace :web do
  # Yields to a block after chdir'ing to the specified
  # path (relative to the app root), then chdir's back
  def run_from_directory(path)
    old_dir = Dir::pwd
    Dir::chdir("#{File::dirname(__FILE__)}/#{path}")
    yield
    Dir::chdir(old_dir)
  end
  
  desc 'Build the website from source'
  task :build do
    raise 'Middleman not found. Try "gem install middleman".' if `which middleman` == ''
    run_from_directory('web') do
      system("middleman build --clean")
    end
  end

  desc "Preview the website at http://0.0.0.0:4567"
  task :preview do
    raise 'Middleman not found. Try "gem install middleman".' if `which middleman` == ''
    run_from_directory('web') do
      system("middleman server --bind-address=0.0.0.0")
    end
  end

  desc "Deploy the website to github pages"
  task :deploy do
    run_from_directory('.') do
      system("git subtree push --prefix web/build origin gh-pages")
    end
  end

  desc "Build and deploy the website"
  task :build_dep => [:build, :deploy] do
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
twee2-0.5.0 Rakefile
twee2-0.4.2 Rakefile
twee2-0.4.1 Rakefile