Class: Bashly::Library
- Inherits:
-
Object
- Object
- Bashly::Library
- Defined in:
- lib/bashly/library.rb
Instance Attribute Summary collapse
-
#args ⇒ Object
Returns the value of attribute args.
-
#config ⇒ Object
readonly
Returns the value of attribute config.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
-
#upgrade_string ⇒ Object
readonly
Returns the value of attribute upgrade_string.
Instance Method Summary collapse
- #files ⇒ Object
- #find_file(path) ⇒ Object
-
#initialize(path, config, upgrade_string: nil) ⇒ Library
constructor
A new instance of Library.
- #post_install_message ⇒ Object
Constructor Details
#initialize(path, config, upgrade_string: nil) ⇒ Library
Returns a new instance of Library.
6 7 8 9 10 |
# File 'lib/bashly/library.rb', line 6 def initialize(path, config, upgrade_string: nil) @path = path.to_s @config = config @upgrade_string = upgrade_string end |
Instance Attribute Details
#args ⇒ Object
Returns the value of attribute args.
4 5 6 |
# File 'lib/bashly/library.rb', line 4 def args @args end |
#config ⇒ Object (readonly)
Returns the value of attribute config.
3 4 5 |
# File 'lib/bashly/library.rb', line 3 def config @config end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
3 4 5 |
# File 'lib/bashly/library.rb', line 3 def path @path end |
#upgrade_string ⇒ Object (readonly)
Returns the value of attribute upgrade_string.
3 4 5 |
# File 'lib/bashly/library.rb', line 3 def upgrade_string @upgrade_string end |
Instance Method Details
#files ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/bashly/library.rb', line 12 def files if custom_handler custom_handler.files else config['files'].map do |file| { path: file['target'] % target_file_args, content: file_contents("#{path}/#{file['source']}"), } end end end |
#find_file(path) ⇒ Object
34 35 36 |
# File 'lib/bashly/library.rb', line 34 def find_file(path) files.find { |f| f[:path] == path } end |
#post_install_message ⇒ Object
26 27 28 29 30 31 32 |
# File 'lib/bashly/library.rb', line 26 def if custom_handler custom_handler. else config['post_install_message'] end end |