Class: RSpec::Core::ProjectInitializer

Inherits:
Object
  • Object
show all
Defined in:
lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-core-3.12.0/lib/rspec/core/project_initializer.rb

Overview

Generates conventional files for an RSpec project.

Constant Summary collapse

DOT_RSPEC_FILE =
'.rspec'
SPEC_HELPER_FILE =
'spec/spec_helper.rb'

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(opts = {}) ⇒ ProjectInitializer

Returns a new instance of ProjectInitializer.



13
14
15
16
17
18
19
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-core-3.12.0/lib/rspec/core/project_initializer.rb', line 13

def initialize(opts={})
  @destination = opts.fetch(:destination, Dir.getwd)
  @stream = opts.fetch(:report_stream, $stdout)
  @template_path = opts.fetch(:template_path) do
    File.expand_path("../project_initializer", __FILE__)
  end
end

Instance Attribute Details

#destinationObject (readonly)

Returns the value of attribute destination.



8
9
10
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-core-3.12.0/lib/rspec/core/project_initializer.rb', line 8

def destination
  @destination
end

#streamObject (readonly)

Returns the value of attribute stream.



8
9
10
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-core-3.12.0/lib/rspec/core/project_initializer.rb', line 8

def stream
  @stream
end

#template_pathObject (readonly)

Returns the value of attribute template_path.



8
9
10
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-core-3.12.0/lib/rspec/core/project_initializer.rb', line 8

def template_path
  @template_path
end

Instance Method Details

#runObject



21
22
23
24
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-core-3.12.0/lib/rspec/core/project_initializer.rb', line 21

def run
  copy_template DOT_RSPEC_FILE
  copy_template SPEC_HELPER_FILE
end