Class: RSpec::Core::ProjectInitializer Private
Do not use. This class is for internal use only.
Relationships & Source Files | |
Inherits: | Object |
Defined in: | rspec-core/lib/rspec/core/project_initializer.rb |
Overview
Generates conventional files for an ::RSpec
project.
Constant Summary
-
DOT_RSPEC_FILE =
# File 'rspec-core/lib/rspec/core/project_initializer.rb', line 10'.rspec'
-
SPEC_HELPER_FILE =
# File 'rspec-core/lib/rspec/core/project_initializer.rb', line 11'spec/spec_helper.rb'
Class Method Summary
- .new(opts = {}) ⇒ ProjectInitializer constructor Internal use only
Instance Attribute Summary
- #destination readonly Internal use only
- #stream readonly Internal use only
- #template_path readonly Internal use only
Instance Method Summary
- #run Internal use only
- #copy_template(file) private Internal use only
- #report_creating(file) private Internal use only
- #report_exists(file) private Internal use only
Instance Attribute Details
#destination (readonly)
[ GitHub ]# File 'rspec-core/lib/rspec/core/project_initializer.rb', line 8
attr_reader :destination, :stream, :template_path
#stream (readonly)
[ GitHub ]# File 'rspec-core/lib/rspec/core/project_initializer.rb', line 8
attr_reader :destination, :stream, :template_path
#template_path (readonly)
[ GitHub ]# File 'rspec-core/lib/rspec/core/project_initializer.rb', line 8
attr_reader :destination, :stream, :template_path
Instance Method Details
#copy_template(file) (private)
[ GitHub ]# File 'rspec-core/lib/rspec/core/project_initializer.rb', line 28
def copy_template(file) destination_file = File.join(destination, file) return report_exists(file) if File.exist?(destination_file) report_creating(file) RSpec::Support::DirectoryMaker.mkdir_p(File.dirname(destination_file)) File.open(destination_file, 'w') do |f| f.write File.read(File.join(template_path, file)) end end
#report_creating(file) (private)
[ GitHub ]# File 'rspec-core/lib/rspec/core/project_initializer.rb', line 43
def report_creating(file) stream.puts " create #{file}" end
#report_exists(file) (private)
[ GitHub ]# File 'rspec-core/lib/rspec/core/project_initializer.rb', line 39
def report_exists(file) stream.puts " exist #{file}" end
#run
[ GitHub ]# File 'rspec-core/lib/rspec/core/project_initializer.rb', line 21
def run copy_template DOT_RSPEC_FILE copy_template SPEC_HELPER_FILE end