Class: Script::ScriptProject
- Inherits:
-
ShopifyCli::Project
- Object
- ShopifyCli::Project
- Script::ScriptProject
- Defined in:
- lib/project_types/script/script_project.rb
Constant Summary collapse
- SUPPORTED_LANGUAGES =
%w(ts)- SOURCE_DIR =
"src"
Instance Attribute Summary collapse
-
#extension_point_type ⇒ Object
readonly
Returns the value of attribute extension_point_type.
-
#language ⇒ Object
readonly
Returns the value of attribute language.
-
#script_name ⇒ Object
readonly
Returns the value of attribute script_name.
Class Method Summary collapse
Instance Method Summary collapse
- #file_name ⇒ Object
-
#initialize(*args) ⇒ ScriptProject
constructor
A new instance of ScriptProject.
- #source_file ⇒ Object
- #source_path ⇒ Object
Methods inherited from ShopifyCli::Project
#config, current, current_project_type, #env, has_current?, project_name, write
Constructor Details
#initialize(*args) ⇒ ScriptProject
Returns a new instance of ScriptProject.
10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/project_types/script/script_project.rb', line 10 def initialize(*args) super @extension_point_type = lookup_config('extension_point_type') @script_name = lookup_config('script_name') @language = 'ts' ShopifyCli::Core::Monorail. = { "script_name" => @script_name, "extension_point_type" => @extension_point_type, "language" => @language, } end |
Instance Attribute Details
#extension_point_type ⇒ Object (readonly)
Returns the value of attribute extension_point_type.
8 9 10 |
# File 'lib/project_types/script/script_project.rb', line 8 def extension_point_type @extension_point_type end |
#language ⇒ Object (readonly)
Returns the value of attribute language.
8 9 10 |
# File 'lib/project_types/script/script_project.rb', line 8 def language @language end |
#script_name ⇒ Object (readonly)
Returns the value of attribute script_name.
8 9 10 |
# File 'lib/project_types/script/script_project.rb', line 8 def script_name @script_name end |
Class Method Details
.cleanup(ctx:, script_name:, root_dir:) ⇒ Object
48 49 50 51 |
# File 'lib/project_types/script/script_project.rb', line 48 def cleanup(ctx:, script_name:, root_dir:) ctx.chdir(root_dir) ctx.rm_r("#{root_dir}/#{script_name}") if ctx.dir_exist?("#{root_dir}/#{script_name}") end |
.create(ctx, dir) ⇒ Object
42 43 44 45 46 |
# File 'lib/project_types/script/script_project.rb', line 42 def create(ctx, dir) raise Errors::ScriptProjectAlreadyExistsError, dir if ctx.dir_exist?(dir) ctx.mkdir_p(dir) ctx.chdir(dir) end |
Instance Method Details
#file_name ⇒ Object
22 23 24 |
# File 'lib/project_types/script/script_project.rb', line 22 def file_name "script.#{language}" end |
#source_file ⇒ Object
26 27 28 |
# File 'lib/project_types/script/script_project.rb', line 26 def source_file "#{SOURCE_DIR}/#{file_name}" end |
#source_path ⇒ Object
30 31 32 |
# File 'lib/project_types/script/script_project.rb', line 30 def source_path "#{script_name}/#{source_file}" end |