Class: Gitenv::Config
- Inherits:
-
Object
- Object
- Gitenv::Config
- Defined in:
- lib/gitenv/config.rb
Instance Attribute Summary collapse
-
#actions ⇒ Object
readonly
Returns the value of attribute actions.
-
#repos ⇒ Object
readonly
Returns the value of attribute repos.
Instance Method Summary collapse
- #all_files(options = {}) ⇒ Object
- #copy(file, options = {}) ⇒ Object
- #dot_files(options = {}) ⇒ Object
- #ignores ⇒ Object
- #include(other_config_file, optional: false) ⇒ Object
-
#initialize ⇒ Config
constructor
A new instance of Config.
- #repo(path, &block) ⇒ Object
- #symlink(file, options = {}) ⇒ Object
Constructor Details
Instance Attribute Details
#actions ⇒ Object (readonly)
Returns the value of attribute actions.
5 6 7 |
# File 'lib/gitenv/config.rb', line 5 def actions @actions end |
#repos ⇒ Object (readonly)
Returns the value of attribute repos.
5 6 7 |
# File 'lib/gitenv/config.rb', line 5 def repos @repos end |
Instance Method Details
#all_files(options = {}) ⇒ Object
31 32 33 |
# File 'lib/gitenv/config.rb', line 31 def all_files( = {}) matcher :all_files, end |
#copy(file, options = {}) ⇒ Object
25 26 27 28 29 |
# File 'lib/gitenv/config.rb', line 25 def copy(file, = {}) raise 'You must specify a repository or a source directory to copy from' unless @context.from Copy::Action.new(@context.dup, matcher(file), ).tap { |a| @actions << a } end |
#dot_files(options = {}) ⇒ Object
35 36 37 |
# File 'lib/gitenv/config.rb', line 35 def dot_files( = {}) matcher :dot_files, end |
#ignores ⇒ Object
46 47 48 |
# File 'lib/gitenv/config.rb', line 46 def ignores @context.ignores end |
#include(other_config_file, optional: false) ⇒ Object
50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/gitenv/config.rb', line 50 def include(other_config_file, optional: false) raise 'Only absolute paths can be included' unless Pathname.new(other_config_file).absolute? absolute_path = File.(other_config_file) unless File.exist?(absolute_path) raise "Cannot find file to include #{absolute_path}" unless optional return end contents = File.open(absolute_path, 'r').read instance_eval contents, absolute_path end |
#repo(path, &block) ⇒ Object
13 14 15 16 17 |
# File 'lib/gitenv/config.rb', line 13 def repo(path, &block) @repos << Repository.new(path) @context.from path, &block self end |