Sha256: 7b93e0bb129a29f04655b927f8b12b676309be366098c6fef581f9f5d6ea3ee7

Contents?: true

Size: 889 Bytes

Versions: 7

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

7 entries across 7 versions & 1 rubygems

Version Path
fgraph-0.6.1 lib/tasks/fgraph.rake
fgraph-0.6.0 lib/tasks/fgraph.rake
fgraph-0.5.1 lib/tasks/fgraph.rake
fgraph-0.5.0 lib/tasks/fgraph.rake
fgraph-0.4.0 lib/tasks/fgraph.rake
fgraph-0.3.4 lib/tasks/fgraph.rake
fgraph-0.3.3 lib/tasks/fgraph.rake