Sha256: c90e594a761a39c87784b04332a87ee9dd556c3a6c02e34dd2e00e5751274139

Contents?: true

Size: 1.47 KB

Versions: 7

Compression:

Stored size: 1.47 KB

Contents

module Gemsmith
  module Skeletons
    class RailsSkeleton < BaseSkeleton
      def create_model_files
        template "#{model_root}/class_methods.rb.tt", template_options
        template "#{model_root}/instance_methods.rb.tt", template_options
      end

      def create_view_files
        template "#{lib_gem_root}/action_view/instance_methods.rb.tt", template_options
      end

      def create_controller_files
        template "#{controller_root}/class_methods.rb.tt", template_options
        template "#{controller_root}/instance_methods.rb.tt", template_options
      end

      def create_generator_files
        empty_directory "#{generator_root}/templates"
        template "#{generator_root}/install/install_generator.rb.tt", template_options
        template "#{generator_root}/install/USAGE.tt", template_options
        template "#{generator_root}/upgrade/upgrade_generator.rb.tt", template_options
        template "#{generator_root}/upgrade/USAGE.tt", template_options
      end

      def create_travis_gemfiles
        if template_options[:travis]
          template "%gem_name%/gemfiles/rails-3.2.x.gemfile.tt", template_options
        end
      end

      private

      def lib_gem_root
        "#{lib_root}/%gem_name%"
      end

      def model_root
        "#{lib_gem_root}/active_record"
      end

      def controller_root
        "#{lib_gem_root}/action_controller"
      end

      def generator_root
        "#{lib_root}/generators/%gem_name%"
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
gemsmith-3.2.0 lib/gemsmith/skeletons/rails_skeleton.rb
gemsmith-3.1.0 lib/gemsmith/skeletons/rails_skeleton.rb
gemsmith-3.0.0 lib/gemsmith/skeletons/rails_skeleton.rb
gemsmith-2.4.0 lib/gemsmith/skeletons/rails_skeleton.rb
gemsmith-2.3.0 lib/gemsmith/skeletons/rails_skeleton.rb
gemsmith-2.2.0 lib/gemsmith/skeletons/rails_skeleton.rb
gemsmith-2.1.0 lib/gemsmith/skeletons/rails_skeleton.rb