Class: Jeweler::Commands::Version::Base
- Inherits:
-
Object
- Object
- Jeweler::Commands::Version::Base
show all
- Defined in:
- lib/jeweler/commands/version/base.rb
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
Instance Attribute Details
#base_dir ⇒ Object
Returns the value of attribute base_dir.
8
9
10
|
# File 'lib/jeweler/commands/version/base.rb', line 8
def base_dir
@base_dir
end
|
#commit ⇒ Object
Returns the value of attribute commit.
8
9
10
|
# File 'lib/jeweler/commands/version/base.rb', line 8
def commit
@commit
end
|
#gemspec ⇒ Object
Returns the value of attribute gemspec.
8
9
10
|
# File 'lib/jeweler/commands/version/base.rb', line 8
def gemspec
@gemspec
end
|
#repo ⇒ Object
Returns the value of attribute repo.
8
9
10
|
# File 'lib/jeweler/commands/version/base.rb', line 8
def repo
@repo
end
|
#version_helper ⇒ Object
Returns the value of attribute version_helper.
8
9
10
|
# File 'lib/jeweler/commands/version/base.rb', line 8
def version_helper
@version_helper
end
|
Class Method Details
.build_for(jeweler) ⇒ Object
42
43
44
45
46
47
48
49
50
51
|
# File 'lib/jeweler/commands/version/base.rb', line 42
def self.build_for(jeweler)
command = new
command.repo = jeweler.repo
command.version_helper = jeweler.version_helper
command.gemspec = jeweler.gemspec
command.commit = jeweler.commit
command.base_dir = jeweler.base_dir
command
end
|
Instance Method Details
#base_dir_path ⇒ Object
37
38
39
|
# File 'lib/jeweler/commands/version/base.rb', line 37
def base_dir_path
Pathname.new(base_dir).realpath
end
|
#commit_version ⇒ Object
23
24
25
26
27
28
|
# File 'lib/jeweler/commands/version/base.rb', line 23
def commit_version
if self.repo
self.repo.add(working_subdir.join(version_helper.path))
self.repo.commit("Version bump to #{self.version_helper.to_s}")
end
end
|
#run ⇒ Object
10
11
12
13
14
15
16
17
|
# File 'lib/jeweler/commands/version/base.rb', line 10
def run
update_version
self.version_helper.write
self.gemspec.version = self.version_helper.to_s
commit_version if self.repo && self.commit
end
|
#update_version ⇒ Object
19
20
21
|
# File 'lib/jeweler/commands/version/base.rb', line 19
def update_version
raise "Subclasses should implement this"
end
|
#working_subdir ⇒ Object
30
31
32
33
34
35
|
# File 'lib/jeweler/commands/version/base.rb', line 30
def working_subdir
return @working_subdir if @working_subdir
cwd = base_dir_path
@working_subdir = cwd.relative_path_from(Pathname.new(repo.dir.path))
@working_subdir
end
|