Sha256: c96fee6203ff462e5d8ddbe8049996a6f1c777133286f74e0031c3e40a630626

Contents?: true

Size: 1.69 KB

Versions: 4

Compression:

Stored size: 1.69 KB

Contents

#!/usr/bin/env ruby
require 'pathname'
require 'fileutils'

events_root = Pathname.new(File.expand_path(File.dirname(__FILE__) << "/.."))

rails_root = if defined?(Rails.root)
               Rails.root
             elsif defined?(RAILS_ROOT)
               Pathname.new(RAILS_ROOT)
             else
               Pathname.new(ARGV.first)
             end

if rails_root.exist?
  [%w(db migrate), %w(public stylesheets), %w(public javascripts)].each do |dir|
    rails_root.join(dir.join(File::SEPARATOR)).mkpath
  end

  copies = [
    {:from => %w(db migrate), :to => %w(db migrate), :filename => "20100430163757_create_events.rb"},
    {:from => %w(db migrate),:to => %w(db migrate), :filename => "20100501234548_add_color_to_events.rb"},
    {:from => %w(db migrate),:to => %w(db migrate), :filename => "20100502004451_add_all_day_to_events.rb"},
    {:from => %w(public javascripts),:to => %w(public javascripts), :filename => "event_calendar.js"},
    {:from => %w(public stylesheets),:to => %w(public stylesheets), :filename => "event_calendar.css"},
  ]
  copies.each do |copy|
    copy_from = events_root.join(copy[:from].join(File::SEPARATOR), copy[:filename])
    copy_to = rails_root.join(copy[:to].join(File::SEPARATOR), copy[:filename])
    unless copy_to.exist?
      FileUtils::copy_file copy_from.to_s, copy_to.to_s
    else
      puts "'#{File.join copy[:to], copy[:filename]}' already existed in your application so your existing file was not overwritten."
    end
  end

  puts "---------"
  puts "Copied all refinerycms-events files."
  puts "Now, run rake db:migrate"
else
  puts "Please specify the path of the project that you want to use the events with, i.e. refinerycms-events-install /path/to/project"
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
refinerycms-events-0.0.4 bin/refinerycms-events-install
refinerycms-events-0.0.3 bin/refinerycms-events-install
refinerycms-events-0.0.2 bin/refinerycms-events-install
refinerycms-events-0.0.1 bin/refinerycms-events-install