Class: Cerberus::SCM::Perforce
- Defined in:
- lib/cerberus/scm/perforce.rb
Constant Summary collapse
- CHANGES_LOG_REGEXP =
/^Change (\d+) on (.*) by (.*)\n\n(.*)/m
Instance Attribute Summary collapse
-
#current_revision ⇒ Object
readonly
Returns the value of attribute current_revision.
-
#last_author ⇒ Object
readonly
Returns the value of attribute last_author.
-
#last_commit_message ⇒ Object
readonly
Returns the value of attribute last_commit_message.
Instance Method Summary collapse
- #has_changes? ⇒ Boolean
-
#initialize(path, config = {}) ⇒ Perforce
constructor
A new instance of Perforce.
- #installed? ⇒ Boolean
- #update! ⇒ Object
- #url ⇒ Object
Constructor Details
#initialize(path, config = {}) ⇒ Perforce
Returns a new instance of Perforce.
8 9 10 11 12 |
# File 'lib/cerberus/scm/perforce.rb', line 8 def initialize(path, config = {}) super @p4_view = @config[:scm, :view] @client_name = Socket.gethostname + ":" + @path.gsub(' ', ':') end |
Instance Attribute Details
#current_revision ⇒ Object (readonly)
Returns the value of attribute current_revision.
33 34 35 |
# File 'lib/cerberus/scm/perforce.rb', line 33 def current_revision @current_revision end |
#last_author ⇒ Object (readonly)
Returns the value of attribute last_author.
34 35 36 |
# File 'lib/cerberus/scm/perforce.rb', line 34 def @last_author end |
#last_commit_message ⇒ Object (readonly)
Returns the value of attribute last_commit_message.
35 36 37 |
# File 'lib/cerberus/scm/perforce.rb', line 35 def @last_commit_message end |
Instance Method Details
#has_changes? ⇒ Boolean
25 26 27 |
# File 'lib/cerberus/scm/perforce.rb', line 25 def has_changes? !@status.include?('file(s) up-to-date.') end |
#installed? ⇒ Boolean
14 15 16 |
# File 'lib/cerberus/scm/perforce.rb', line 14 def installed? exec_successful? "#{@config[:bin_path]}p4 info" end |
#update! ⇒ Object
18 19 20 21 22 23 |
# File 'lib/cerberus/scm/perforce.rb', line 18 def update! FileUtils.mkpath(@path) unless test(?d,@path) create_client @status = execute("sync") end |
#url ⇒ Object
29 30 31 |
# File 'lib/cerberus/scm/perforce.rb', line 29 def url @view end |