Class: RubySkills::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/ruby_skills/config.rb

Overview

Resolves project paths and bootstraps a Ruby Skills workspace.

Paths for Skillfile, Skills.lock and the local skills directory are derived from a project root.

Examples:

Initialize the current directory

RubySkills::Config.new.initialize_project!

Since:

  • 0.1.0

Constant Summary collapse

SKILLFILE =

Filename of the project skill manifest.

Since:

  • 0.1.0

"Skillfile"
LOCKFILE =

Filename of the installed-skills lockfile.

Since:

  • 0.1.0

"Skills.lock"
SKILLS_DIRECTORY =

Directory where installed skills are stored.

Since:

  • 0.1.0

".ruby-skills"

Instance Method Summary collapse

Constructor Details

#initialize(root: Dir.pwd) ⇒ Config

Returns a new instance of Config.

Parameters:

  • root (String, Pathname) (defaults to: Dir.pwd)

    project root used to resolve skill paths

Since:

  • 0.1.0



24
25
26
# File 'lib/ruby_skills/config.rb', line 24

def initialize(root: Dir.pwd)
  @root = Pathname.new(root)
end

Instance Method Details

#initialize_project!void

This method returns an undefined value.

Create the skills directory and a starter Skillfile when missing.

Since:

  • 0.1.0



31
32
33
34
# File 'lib/ruby_skills/config.rb', line 31

def initialize_project!
  create_skills_directory
  create_skillfile
end

#lockfile_pathPathname

Returns absolute path to the project lockfile.

Returns:

  • (Pathname)

    absolute path to the project lockfile

Since:

  • 0.1.0



42
43
44
# File 'lib/ruby_skills/config.rb', line 42

def lockfile_path
  @root.join(LOCKFILE)
end

#skillfile_pathPathname

Returns absolute path to the project Skillfile.

Returns:

  • (Pathname)

    absolute path to the project Skillfile

Since:

  • 0.1.0



37
38
39
# File 'lib/ruby_skills/config.rb', line 37

def skillfile_path
  @root.join(SKILLFILE)
end

#skills_pathPathname

Returns absolute path to the local skills directory.

Returns:

  • (Pathname)

    absolute path to the local skills directory

Since:

  • 0.1.0



47
48
49
# File 'lib/ruby_skills/config.rb', line 47

def skills_path
  @root.join(SKILLS_DIRECTORY)
end