Class: Docman::GitRepoProvider
- Inherits:
-
Command
- Object
- Hash
- Command
- Docman::GitRepoProvider
show all
- Defined in:
- lib/docman/commands/git_repo_provider_cmd.rb
Instance Attribute Summary collapse
Attributes inherited from Command
#type
Instance Method Summary
collapse
Methods inherited from Command
#add_action, #add_actions, #config, create, #describe, #initialize, #perform, #prefix, register_command, #replace_placeholder, #run_actions, #run_with_hooks
Methods included from Logging
#log, logger, #logger, #prefix, #properties_info, #with_logging
Instance Attribute Details
#version(remote = false) ⇒ Object
Returns the value of attribute version.
4
5
6
|
# File 'lib/docman/commands/git_repo_provider_cmd.rb', line 4
def version
@version
end
|
Instance Method Details
#changed? ⇒ Boolean
19
20
21
22
23
24
25
|
# File 'lib/docman/commands/git_repo_provider_cmd.rb', line 19
def changed?
stored_version = @context.stored_version['result']
@last_version = GitUtil.last_revision(self['target_path'])
v = version(true)
stored_version != v
end
|
#changed_from_last_version? ⇒ Boolean
33
34
35
|
# File 'lib/docman/commands/git_repo_provider_cmd.rb', line 33
def changed_from_last_version?
@last_version != @version
end
|
#execute ⇒ Object
13
14
15
16
17
|
# File 'lib/docman/commands/git_repo_provider_cmd.rb', line 13
def execute
@execute_result = get_content
@version = @context['type'] == 'root' ? @context['build_path'] : @execute_result
end
|
#get_content ⇒ Object
27
28
29
30
31
|
# File 'lib/docman/commands/git_repo_provider_cmd.rb', line 27
def get_content
single_branch = @context.has_key?("single_branch") ? @context["single_branch"] : true
depth = @context.has_key?("depth") ? @context["depth"] : 1
GitUtil.get(@context['repo'], self['target_path'], @context.version_type, @context.version, single_branch, depth)
end
|
#validate_command ⇒ Object
8
9
10
11
|
# File 'lib/docman/commands/git_repo_provider_cmd.rb', line 8
def validate_command
raise "Please provide 'context'" if @context.nil?
raise "Context should be of type 'Info'" unless @context.is_a? Docman::Info
end
|