Sha256: 8eec2e13714321820209e7c8b2779c42fb9bbfe98c0e2ff2843097c7409ea30c

Contents?: true

Size: 889 Bytes

Versions: 2

Compression:

Stored size: 889 Bytes

Contents

require 'fileutils'

namespace :fgraph do
  desc "Create fgraph.yml configuration file in Rails config folder"
  task :setup => :environment do
    fgraph_config = File.join(Rails.root, "config", "fgraph.yml")
    fgraph_template_dir = File.join(Rails.root, "vendor", "plugins", "fgraph", "templates")
    
    unless File.exists?(fgraph_template_dir)
      fgraph_data_dir = Gem.datadir('fgraph')
      if fgraph_data_dir
        fgraph_template_dir = fgraph_data_dir.split('/')[0..-3].join('/') + '/templates'
      end
    end
    
    unless File.exist?(fgraph_config)
      fgraph_config_template = File.join(fgraph_template_dir, "fgraph.yml")
      FileUtils.cp fgraph_config_template, fgraph_config
      puts "#{RAILS_ROOT}/config/fgraph.yml created, please update your app_id and app_secret."
    else
      puts "#{RAILS_ROOT}/config/fgraph.yml already exists."
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
fgraph-0.7.0 lib/tasks/fgraph.rake
fgraph-0.6.2 lib/tasks/fgraph.rake