Sha256: 9b0bd42a98978a7adeb3914b6a27c6c921ce093ad9237e3e82fa770808f737a8

Contents?: true

Size: 1.39 KB

Versions: 9

Compression:

Stored size: 1.39 KB

Contents

module Restspec
  module Install
    class InstallRunner < Thor::Group
      include Thor::Actions

      argument :project

      class_option :api_prefix, :desc => "api prefix to use", :required => true

      def self.source_root
        File.dirname(__FILE__)
      end

      def create_project_dir
        empty_directory project
      end

      def copy_gemfile
        copy_file 'templates/Gemfile', "#{project}/Gemfile"
      end

      def create_spec_folders
        empty_directory "#{project}/spec"
        empty_directory "#{project}/spec/api"
        empty_directory "#{project}/spec/support"
      end

      def create_spec_helper
        template 'templates/spec_helper.rb', "#{project}/spec/spec_helper.rb"
      end

      def create_rspec_config
        template 'templates/restspec_config.rb', "#{project}/spec/api/restspec/restspec_config.rb"
      end

      def create_api_dsl_files
        create_file "#{project}/spec/api/restspec/api_endpoints.rb"
        create_file "#{project}/spec/api/restspec/api_schemas.rb"
        create_file "#{project}/spec/api/restspec/api_requirements.rb"
      end

      def create_support_files
        create_file "#{project}/spec/support/custom_matchers.rb"
        copy_file "templates/custom_macros.rb", "#{project}/spec/support/custom_macros.rb"
      end

      def install_gems
        inside(project) { run 'bundle install' }
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
restspec-0.3.2 lib/restspec/runners/install/install_runner.rb
restspec-0.3.1 lib/restspec/runners/install/install_runner.rb
restspec-0.3.0 lib/restspec/runners/install/install_runner.rb
restspec-0.2.6 lib/restspec/runners/install/install_runner.rb
restspec-0.2.5 lib/restspec/runners/install/install_runner.rb
restspec-0.2.4 lib/restspec/runners/install/install_runner.rb
restspec-0.2.3 lib/restspec/runners/install/install_runner.rb
restspec-0.2.2 lib/restspec/runners/install/install_runner.rb
restspec-0.2.1 lib/restspec/runners/install/install_runner.rb