Sha256: b1d969047ffc6024ca54b75c9b8f2fbb2e2bf53cab9b73e70f3a2d7d9311c6b7

Contents?: true

Size: 1.23 KB

Versions: 4

Compression:

Stored size: 1.23 KB

Contents

module Gemsmith
  module Skeletons
    class RailsSkeleton < BaseSkeleton
      def create_engine
        gem_name = template_options.fetch :gem_name
        system "rails plugin new #{gem_name} #{engine_options}"
        remove_file "#{gem_name}/MIT-LICENSE", template_options
        remove_file "#{gem_name}/README.rdoc", 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-4.1.x.gemfile.tt", template_options
        end
      end

      private

      def engine_options
        "--skip --skip-bundle --skip-test-unit --skip-keeps --mountable --dummy-path=spec/dummy"
      end

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

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

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
gemsmith-5.3.0 lib/gemsmith/skeletons/rails_skeleton.rb
gemsmith-5.2.0 lib/gemsmith/skeletons/rails_skeleton.rb
gemsmith-5.1.0 lib/gemsmith/skeletons/rails_skeleton.rb
gemsmith-5.0.0 lib/gemsmith/skeletons/rails_skeleton.rb