Class: Gem::Release::Files::Templates
- Inherits:
-
Struct
- Object
- Struct
- Gem::Release::Files::Templates
- Defined in:
- lib/gem/release/files/templates.rb,
lib/gem/release/files/templates/group.rb
Defined Under Namespace
Classes: Group
Constant Summary collapse
- BUILTIN =
[ ['./.gem-release/%s'], ['~/.gem-release/%s'], ['../../templates/', __FILE__], ]
- CUSTOM =
[ ['./.gem-release/%s'], ['~/.gem-release/%s'], ['../../templates/%s', __FILE__], ]
- EXECUTABLE =
[ ['./.gem-release/executable'], ['~/.gem-release/executable'], ['../../templates/executable', __FILE__], ]
- LICENSE =
[ ['./.gem-release/licenses'], ['~/.gem-release/licenses'], ['../../templates/licenses', __FILE__], ]
Instance Attribute Summary collapse
-
#data ⇒ Object
Returns the value of attribute data.
-
#files ⇒ Object
Returns the value of attribute files.
-
#groups ⇒ Object
Returns the value of attribute groups.
Class Method Summary collapse
Instance Method Summary collapse
- #[](filename) ⇒ Object
- #all ⇒ Object
- #builtin ⇒ Object
- #custom ⇒ Object
- #executable ⇒ Object
- #license ⇒ Object
- #templates_for(sources, files = nil, opts = {}) ⇒ Object
Instance Attribute Details
#data ⇒ Object
Returns the value of attribute data
4 5 6 |
# File 'lib/gem/release/files/templates.rb', line 4 def data @data end |
#files ⇒ Object
Returns the value of attribute files
4 5 6 |
# File 'lib/gem/release/files/templates.rb', line 4 def files @files end |
#groups ⇒ Object
Returns the value of attribute groups
4 5 6 |
# File 'lib/gem/release/files/templates.rb', line 4 def groups @groups end |
Class Method Details
.executable(target) ⇒ Object
29 30 31 32 33 |
# File 'lib/gem/release/files/templates.rb', line 29 def self.executable(target) file = Templates.new([".*"], [], {}).executable file.target = target if file file end |
.license(name, data) ⇒ Object
35 36 37 38 39 |
# File 'lib/gem/release/files/templates.rb', line 35 def self.license(name, data) file = Templates.new(["#{name}{,.*}"], [], data).license file.target = "LICENSE#{File.extname(file.target)}" if file file end |
Instance Method Details
#[](filename) ⇒ Object
41 42 43 |
# File 'lib/gem/release/files/templates.rb', line 41 def [](filename) all.detect { |file| file.filename == filename } end |
#all ⇒ Object
45 46 47 48 |
# File 'lib/gem/release/files/templates.rb', line 45 def all all = builtin + custom all.flatten.uniq(&:target) end |
#builtin ⇒ Object
50 51 52 |
# File 'lib/gem/release/files/templates.rb', line 50 def builtin templates_for(BUILTIN, files) end |
#custom ⇒ Object
54 55 56 |
# File 'lib/gem/release/files/templates.rb', line 54 def custom templates_for(CUSTOM, '**/*') end |
#executable ⇒ Object
58 59 60 |
# File 'lib/gem/release/files/templates.rb', line 58 def executable templates_for(EXECUTABLE).first end |
#license ⇒ Object
62 63 64 |
# File 'lib/gem/release/files/templates.rb', line 62 def license templates_for(LICENSE, files).first end |