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.
7
8
9
|
# File 'lib/jeweler/commands/version/base.rb', line 7
def base_dir
@base_dir
end
|
#commit ⇒ Object
Returns the value of attribute commit.
7
8
9
|
# File 'lib/jeweler/commands/version/base.rb', line 7
def commit
@commit
end
|
#gemspec ⇒ Object
Returns the value of attribute gemspec.
7
8
9
|
# File 'lib/jeweler/commands/version/base.rb', line 7
def gemspec
@gemspec
end
|
#repo ⇒ Object
Returns the value of attribute repo.
7
8
9
|
# File 'lib/jeweler/commands/version/base.rb', line 7
def repo
@repo
end
|
#version_helper ⇒ Object
Returns the value of attribute version_helper.
7
8
9
|
# File 'lib/jeweler/commands/version/base.rb', line 7
def version_helper
@version_helper
end
|
Class Method Details
.build_for(jeweler) ⇒ Object
37
38
39
40
41
42
43
44
45
46
|
# File 'lib/jeweler/commands/version/base.rb', line 37
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
33
34
35
|
# File 'lib/jeweler/commands/version/base.rb', line 33
def base_dir_path
Pathname.new(base_dir).realpath
end
|
#commit_version ⇒ Object
22
23
24
25
26
27
|
# File 'lib/jeweler/commands/version/base.rb', line 22
def commit_version
if repo
repo.add(working_subdir.join(version_helper.path).to_s)
repo.commit("Version bump to #{version_helper}")
end
end
|
#run ⇒ Object
9
10
11
12
13
14
15
16
|
# File 'lib/jeweler/commands/version/base.rb', line 9
def run
update_version
version_helper.write
gemspec.version = version_helper.to_s
commit_version if repo && commit
end
|
#update_version ⇒ Object
18
19
20
|
# File 'lib/jeweler/commands/version/base.rb', line 18
def update_version
raise 'Subclasses should implement this'
end
|
#working_subdir ⇒ Object
29
30
31
|
# File 'lib/jeweler/commands/version/base.rb', line 29
def working_subdir
@working_subdir ||= base_dir_path.relative_path_from(Pathname.new(repo.dir.path))
end
|