summaryrefslogtreecommitdiff
path: root/lib/generators/nifty/config/config_generator.rb
blob: 811c80e02e076d0e21df792aac9b8695f6443e78 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
require 'generators/nifty'

module Nifty
  module Generators
    class ConfigGenerator < Base
      argument :config_name, :type => :string, :default => 'app', :banner => 'config_name'

      def create_config
        template "load_config.rb", "config/initializers/load_#{file_name}_config.rb"
        copy_file "config.yml", "config/#{file_name}_config.yml"
      end

      private

      def file_name
        config_name.underscore
      end

      def constant_name
        config_name.underscore.upcase
      end
    end
  end
end