Module: Cog::Config::ProjectConfig

Included in:
Cog::Config
Defined in:
lib/cog/config/project_config.rb

Overview

Cog::Config methods related to projects

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#project_cogfile_pathString (readonly)

Returns path to the project’s DSL::Cogfile.

Returns:



8
9
10
# File 'lib/cog/config/project_config.rb', line 8

def project_cogfile_path
  @project_cogfile_path
end

#project_generator_pathString? (readonly)

Returns directory in which to place project generators.

Returns:

  • (String, nil)

    directory in which to place project generators



17
18
19
# File 'lib/cog/config/project_config.rb', line 17

def project_generator_path
  @project_generator_path
end

#project_pathString (readonly)

Returns directory in which to place generated output. For example, the destination parameter of Generator#stamp is relative to this path.

Returns:

  • (String)

    directory in which to place generated output. For example, the destination parameter of Generator#stamp is relative to this path.



11
12
13
# File 'lib/cog/config/project_config.rb', line 11

def project_path
  @project_path
end

#project_plugin_pathString? (readonly)

Returns directory in which to place project plugins.

Returns:

  • (String, nil)

    directory in which to place project plugins



20
21
22
# File 'lib/cog/config/project_config.rb', line 20

def project_plugin_path
  @project_plugin_path
end

#project_rootString (readonly)

Returns directory in which the project’s DSL::Cogfile is found.

Returns:



14
15
16
# File 'lib/cog/config/project_config.rb', line 14

def project_root
  @project_root
end

#project_template_pathString? (readonly)

Returns directory in which to place project templates.

Returns:

  • (String, nil)

    directory in which to place project templates



23
24
25
# File 'lib/cog/config/project_config.rb', line 23

def project_template_path
  @project_template_path
end

Instance Method Details

#project?Boolean

Returns whether or not we operating in the context of a project.

Returns:

  • (Boolean)

    whether or not we operating in the context of a project



26
27
28
# File 'lib/cog/config/project_config.rb', line 26

def project?
  !@project_root.nil?
end

#supported_project_filesArray<String>

Returns list of paths to files in the #project_path which are written in a supported language.

Returns:



31
32
33
34
35
36
37
38
# File 'lib/cog/config/project_config.rb', line 31

def supported_project_files
  if project?
    exts = Cog.language_extensions.join ','
    Dir.glob "#{Cog.project_path}/**/*.{#{exts}}"
  else
    []
  end
end