Class: Submodule::Task
- Inherits:
-
Rake::TaskLib
- Object
- Rake::TaskLib
- Submodule::Task
- Defined in:
- lib/submodule.rb
Instance Attribute Summary collapse
-
#branch ⇒ Object
Returns the value of attribute branch.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
Instance Method Summary collapse
-
#initialize {|_self| ... } ⇒ Task
constructor
A new instance of Task.
Constructor Details
#initialize {|_self| ... } ⇒ Task
Returns a new instance of Task.
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/submodule.rb', line 11 def initialize @cwd = Dir.pwd base = File.basename Dir["*.gemspec"][0], ".gemspec" if base[0] base = File.basename Dir["*.gemspec"][0], ".gemspec" @version_file = "lib/#{base}/version.rb" end gitmodules = IniFile.new('./.gitmodules').to_h @path = gitmodules[gitmodules.keys.first]["path"] @path = File.(@path, @cwd) @submodule_name = gitmodules.keys.first.gsub('submodule ', '').gsub('"', '').gsub('vendor/', '') @github = gitmodules[gitmodules.keys.first]["url"].gsub('https://github.com/', '').gsub('.git', '') # TODO: detect default branch @branch = "master" yield self if block_given? define end |
Instance Attribute Details
#branch ⇒ Object
Returns the value of attribute branch.
9 10 11 |
# File 'lib/submodule.rb', line 9 def branch @branch end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
8 9 10 |
# File 'lib/submodule.rb', line 8 def path @path end |