Class: Script::Layers::Infrastructure::ScriptRepository

Inherits:
Object
  • Object
show all
Includes:
SmartProperties
Defined in:
lib/project_types/script/layers/infrastructure/script_repository.rb

Instance Method Summary collapse

Instance Method Details

#get_script(language, extension_point_type, script_name) ⇒ Object



10
11
12
13
14
15
16
17
# File 'lib/project_types/script/layers/infrastructure/script_repository.rb', line 10

def get_script(language, extension_point_type, script_name)
  source_file_path = src_code_file(language)
  unless ctx.file_exist?(source_file_path)
    raise Domain::Errors::ScriptNotFoundError.new(extension_point_type, source_file_path)
  end

  Domain::Script.new(script_id(language), script_name, extension_point_type, language)
end

#relative_path_to_srcObject



31
32
33
# File 'lib/project_types/script/layers/infrastructure/script_repository.rb', line 31

def relative_path_to_src
  "src"
end

#with_temp_build_contextObject



19
20
21
22
23
24
25
26
27
28
29
# File 'lib/project_types/script/layers/infrastructure/script_repository.rb', line 19

def with_temp_build_context
  prev_dir = Dir.pwd
  temp_dir = "#{project_base}/temp"
  ctx.mkdir_p(temp_dir)
  ctx.chdir(temp_dir)
  ctx.cp_r("#{src_base}/.", ".")
  yield
ensure
  ctx.chdir(prev_dir)
  ctx.rm_rf(temp_dir)
end