Class: Gemkeeper::Configuration
- Inherits:
-
Object
- Object
- Gemkeeper::Configuration
- Defined in:
- lib/gemkeeper/configuration.rb
Defined Under Namespace
Classes: GemDefinition
Constant Summary collapse
- DEFAULT_PORT =
9292- DEFAULT_CONFIG_FILENAME =
"gemkeeper.yml"- CONFIG_PATHS =
Config file lookup paths in order of priority
[ -> { File.join(Dir.pwd, DEFAULT_CONFIG_FILENAME) }, # ./gemkeeper.yml -> { File.("~/.config/gemkeeper/config.yml") }, # XDG config -> { File.("~/.gemkeeper.yml") }, # Home directory -> { "/usr/local/etc/gemkeeper.yml" }, # Homebrew (Intel) -> { "/opt/homebrew/etc/gemkeeper.yml" } # Homebrew (Apple Silicon) ].freeze
Instance Attribute Summary collapse
-
#gems ⇒ Object
readonly
Returns the value of attribute gems.
-
#gems_path ⇒ Object
readonly
Returns the value of attribute gems_path.
-
#pid_file ⇒ Object
readonly
Returns the value of attribute pid_file.
-
#port ⇒ Object
readonly
Returns the value of attribute port.
-
#repos_path ⇒ Object
readonly
Returns the value of attribute repos_path.
Class Method Summary collapse
Instance Method Summary collapse
- #cache_dir ⇒ Object
- #config_ru_path ⇒ Object
- #geminabox_url ⇒ Object
-
#initialize(config_path = nil) ⇒ Configuration
constructor
A new instance of Configuration.
Constructor Details
#initialize(config_path = nil) ⇒ Configuration
Returns a new instance of Configuration.
30 31 32 33 34 |
# File 'lib/gemkeeper/configuration.rb', line 30 def initialize(config_path = nil) @config_path = config_path || find_config_file @config = load_config apply_config end |
Instance Attribute Details
#gems ⇒ Object (readonly)
Returns the value of attribute gems.
20 21 22 |
# File 'lib/gemkeeper/configuration.rb', line 20 def gems @gems end |
#gems_path ⇒ Object (readonly)
Returns the value of attribute gems_path.
20 21 22 |
# File 'lib/gemkeeper/configuration.rb', line 20 def gems_path @gems_path end |
#pid_file ⇒ Object (readonly)
Returns the value of attribute pid_file.
20 21 22 |
# File 'lib/gemkeeper/configuration.rb', line 20 def pid_file @pid_file end |
#port ⇒ Object (readonly)
Returns the value of attribute port.
20 21 22 |
# File 'lib/gemkeeper/configuration.rb', line 20 def port @port end |
#repos_path ⇒ Object (readonly)
Returns the value of attribute repos_path.
20 21 22 |
# File 'lib/gemkeeper/configuration.rb', line 20 def repos_path @repos_path end |
Class Method Details
.config_search_paths ⇒ Object
26 27 28 |
# File 'lib/gemkeeper/configuration.rb', line 26 def self.config_search_paths CONFIG_PATHS.map(&:call) end |
.load(config_path = nil) ⇒ Object
22 23 24 |
# File 'lib/gemkeeper/configuration.rb', line 22 def self.load(config_path = nil) new(config_path) end |
Instance Method Details
#cache_dir ⇒ Object
44 45 46 47 48 49 50 |
# File 'lib/gemkeeper/configuration.rb', line 44 def cache_dir @cache_dir ||= begin dir = File.("./cache") FileUtils.mkdir_p(dir) dir end end |
#config_ru_path ⇒ Object
40 41 42 |
# File 'lib/gemkeeper/configuration.rb', line 40 def config_ru_path File.join(cache_dir, "config.ru") end |
#geminabox_url ⇒ Object
36 37 38 |
# File 'lib/gemkeeper/configuration.rb', line 36 def geminabox_url "http://localhost:#{port}" end |