Permalink
Browse files

add basic generator

  • Loading branch information...
1 parent b5139a0 commit 183c1b193e6620431826c3b594c568d4592fb0af @davidsulc davidsulc committed Feb 26, 2011
@@ -0,0 +1,22 @@
+# encoding: utf-8
+
+module Sugarcrm
+ module Generators
+ class ConfigGenerator < Rails::Generators::Base
+ desc 'Creates a SugarCRM gem configuration file at config/sugarcrm.yml, and an initializer at config/initializers/sugarcrm.rb'
+
+ def self.source_root
+ @_sugarcrm_source_root ||= File.expand_path("../templates", __FILE__)
+ end
+
+ def create_config_file
+ template 'sugarcrm.yml', File.join('config', 'sugarcrm.yml')
+ end
+
+ def create_initializer_file
+ template 'initializer.rb', File.join('config', 'initializers', 'sugarcrm.rb')
+ end
+ end
+ end
+end
+
@@ -0,0 +1 @@
+SugarCRM::Session.new_from_file(File.join(Rails.root, 'config', 'sugarcrm.yml'))
@@ -0,0 +1,4 @@
+config:
+ base_url: http://127.0.0.1/sugarcrm # where your SugarCRM instance is located
+ username: admin
+ password: letmein

0 comments on commit 183c1b1

Please sign in to comment.