Sha256: cbfa354ec2527a8f3878f9bb8a657f1351704fc8b1cefc9502e6304a0401227f

Contents?: true

Size: 679 Bytes

Versions: 3

Compression:

Stored size: 679 Bytes

Contents

module Gemsmith
  module Skeletons
    # Configures Rake support.
    class RakeSkeleton < BaseSkeleton
      def create
        cli.template "%gem_name%/Rakefile.tt", configuration.to_h
        configure_rakefile
      end

      private

      def rspec_task
        "spec" if configuration.create_rspec?
      end

      def rubocop_task
        "rubocop" if configuration.create_rubocop?
      end

      def default_tasks
        [rspec_task, rubocop_task].compact
      end

      def configure_rakefile
        return if default_tasks.empty?
        cli.append_to_file "%gem_name%/Rakefile", %(\ntask default: %w(#{default_tasks.join(" ")})\n)
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
gemsmith-6.2.0 lib/gemsmith/skeletons/rake_skeleton.rb
gemsmith-6.1.0 lib/gemsmith/skeletons/rake_skeleton.rb
gemsmith-6.0.0 lib/gemsmith/skeletons/rake_skeleton.rb