Sha256: 63ca15a87a4911fcd88584542ba69d9b9dccd383c8719d65e1d0fe7929f94f34

Contents?: true

Size: 1.25 KB

Versions: 1

Compression:

Stored size: 1.25 KB

Contents

require 'rails/generators'

module Ember
  module Generators
    module GeneratorHelpers

      def app_path
        if options[:app_path]
          options[:app_path]
        else
          configuration.paths.app
        end
      end

      def config_path
        if options[:config_path]
          options[:config_path]
        else
          configuration.paths.config
        end
      end

      def rails_engine?
        defined?(ENGINE_PATH)
      end

      def engine_name
        ENGINE_PATH.split('/')[-2]
      end

      def application_name
        if options[:app_name]
          options[:app_name]
        elsif configuration.app_name
          configuration.app_name
        elsif rails_engine?
          engine_name
        else
          'App'
        end
      end

      def class_name
        (class_path + [file_name]).map!{ |m| m.camelize }.join()
      end

      def require_name
        (class_path + [file_name]).map!{ |m| m.dasherize }.join('/')
      end

      def handlebars_template_path
        File.join(class_path, file_name).gsub(/^\//, '')
      end

      def javascript_assets_path
        File.join(::Rails.root, 'app/assets/javascripts')
      end

      def configuration
        ::Rails.configuration.ember
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ember-appkit-rails-0.5.0 lib/generators/ember/generator_helpers.rb