Class: RSCM::Perforce
- Inherits:
-
Base
- Object
- Base
- RSCM::Perforce
show all
- Defined in:
- lib/rscm/scm/perforce.rb
Overview
Perforce RSCM implementation.
Understands operations against multiple client-workspaces You need the p4/p4d executable on the PATH in order for it to work.
Constant Summary
collapse
- @@counter =
0
Constants inherited
from Base
Base::DEFAULT_QUIET_PERIOD, Base::THIRTY_TWO_WEEKS_AGO, Base::TWO_WEEKS_AGO
Instance Attribute Summary collapse
Attributes inherited from Base
#default_options, #logger
Instance Method Summary
collapse
-
#add(relative_filename) ⇒ Object
-
#can_create_central? ⇒ Boolean
-
#central_exists? ⇒ Boolean
-
#checkout(to_identifier = nil, &proc) ⇒ Object
-
#commit(message, &proc) ⇒ Object
-
#create_central ⇒ Object
-
#destroy_central ⇒ Object
-
#diff(revfile, &proc) ⇒ Object
-
#edit(file) ⇒ Object
-
#import_central(dir, comment) ⇒ Object
-
#initialize(port = "1666", user = ENV["LOGNAME"], pwd = "", client_name = Perforce.next_client_name) ⇒ Perforce
constructor
A new instance of Perforce.
-
#install_trigger(trigger_command, damagecontrol_install_dir) ⇒ Object
-
#move(relative_src, relative_dest) ⇒ Object
-
#p4admin ⇒ Object
-
#p4client ⇒ Object
-
#revisions(from_identifier, to_identifier = Time.infinity) ⇒ Object
-
#supports_trigger? ⇒ Boolean
-
#transactional? ⇒ Boolean
-
#trigger_installed?(trigger_command, trigger_files_checkout_dir) ⇒ Boolean
-
#trigger_mechanism ⇒ Object
-
#uninstall_trigger(trigger_command, trigger_files_checkout_dir) ⇒ Object
-
#uptodate?(from_identifier) ⇒ Boolean
Methods inherited from Base
#==, #checked_out?, #checkout_commandline, #checkout_dir, #checkout_dir=, #destroy_working_copy, #file, #open, #poll_new_revisions, #rootdir, #to_identifier, #to_yaml_properties, #update_commandline
Constructor Details
#initialize(port = "1666", user = ENV["LOGNAME"], pwd = "", client_name = Perforce.next_client_name) ⇒ Perforce
Returns a new instance of Perforce.
26
27
28
|
# File 'lib/rscm/scm/perforce.rb', line 26
def initialize(port = "1666", user = ENV["LOGNAME"], pwd = "", client_name = Perforce.next_client_name)
@port, @user, @pwd, @client_name = port, user, pwd, client_name
end
|
Instance Attribute Details
#client_name ⇒ Object
Returns the value of attribute client_name.
20
21
22
|
# File 'lib/rscm/scm/perforce.rb', line 20
def client_name
@client_name
end
|
#port ⇒ Object
Returns the value of attribute port.
21
22
23
|
# File 'lib/rscm/scm/perforce.rb', line 21
def port
@port
end
|
#pwd ⇒ Object
Returns the value of attribute pwd.
23
24
25
|
# File 'lib/rscm/scm/perforce.rb', line 23
def pwd
@pwd
end
|
#repository_root_dir ⇒ Object
Returns the value of attribute repository_root_dir.
24
25
26
|
# File 'lib/rscm/scm/perforce.rb', line 24
def repository_root_dir
@repository_root_dir
end
|
#user ⇒ Object
Returns the value of attribute user.
22
23
24
|
# File 'lib/rscm/scm/perforce.rb', line 22
def user
@user
end
|
Instance Method Details
#add(relative_filename) ⇒ Object
79
80
81
|
# File 'lib/rscm/scm/perforce.rb', line 79
def add(relative_filename)
p4client.add(relative_filename)
end
|
#can_create_central? ⇒ Boolean
38
39
40
|
# File 'lib/rscm/scm/perforce.rb', line 38
def can_create_central?
true
end
|
#central_exists? ⇒ Boolean
52
53
54
|
# File 'lib/rscm/scm/perforce.rb', line 52
def central_exists?
p4admin.central_exists?
end
|
#checkout(to_identifier = nil, &proc) ⇒ Object
75
76
77
|
# File 'lib/rscm/scm/perforce.rb', line 75
def checkout(to_identifier = nil, &proc)
p4client.checkout(to_identifier, &proc)
end
|
#commit(message, &proc) ⇒ Object
87
88
89
|
# File 'lib/rscm/scm/perforce.rb', line 87
def commit(message, &proc)
p4client.submit(message, &proc)
end
|
#create_central ⇒ Object
42
43
44
45
46
|
# File 'lib/rscm/scm/perforce.rb', line 42
def create_central
raise "perforce depot can be created only from tests" unless @repository_root_dir
@p4d = P4Daemon.new(@repository_root_dir)
@p4d.start
end
|
#destroy_central ⇒ Object
48
49
50
|
# File 'lib/rscm/scm/perforce.rb', line 48
def destroy_central
@p4d.shutdown
end
|
#diff(revfile, &proc) ⇒ Object
119
120
121
|
# File 'lib/rscm/scm/perforce.rb', line 119
def diff(revfile, &proc)
p4client.diff(revfile, &proc)
end
|
#edit(file) ⇒ Object
99
100
101
|
# File 'lib/rscm/scm/perforce.rb', line 99
def edit(file)
p4client.edit(file)
end
|
#import_central(dir, comment) ⇒ Object
68
69
70
71
72
73
|
# File 'lib/rscm/scm/perforce.rb', line 68
def import_central(dir, )
with_create_client(dir) do |client|
client.add_all(list_files)
client.submit()
end
end
|
#install_trigger(trigger_command, damagecontrol_install_dir) ⇒ Object
107
108
109
|
# File 'lib/rscm/scm/perforce.rb', line 107
def install_trigger(trigger_command, damagecontrol_install_dir)
p4admin.install_trigger(trigger_command)
end
|
#move(relative_src, relative_dest) ⇒ Object
83
84
85
|
# File 'lib/rscm/scm/perforce.rb', line 83
def move(relative_src, relative_dest)
p4client.move(checkout_dir, relative_src, relative_dest)
end
|
#p4admin ⇒ Object
30
31
32
|
# File 'lib/rscm/scm/perforce.rb', line 30
def p4admin
@p4admin ||= P4Admin.new(@port, @user, @pwd)
end
|
#p4client ⇒ Object
34
35
36
|
# File 'lib/rscm/scm/perforce.rb', line 34
def p4client
@p4client ||= p4admin.create_client(@checkout_dir, @client_name)
end
|
#revisions(from_identifier, to_identifier = Time.infinity) ⇒ Object
91
92
93
|
# File 'lib/rscm/scm/perforce.rb', line 91
def revisions(from_identifier, to_identifier=Time.infinity)
p4client.revisions(from_identifier, to_identifier)
end
|
#supports_trigger? ⇒ Boolean
60
61
62
|
# File 'lib/rscm/scm/perforce.rb', line 60
def supports_trigger?
true
end
|
#transactional? ⇒ Boolean
64
65
66
|
# File 'lib/rscm/scm/perforce.rb', line 64
def transactional?
true
end
|
#trigger_installed?(trigger_command, trigger_files_checkout_dir) ⇒ Boolean
103
104
105
|
# File 'lib/rscm/scm/perforce.rb', line 103
def trigger_installed?(trigger_command, trigger_files_checkout_dir)
p4admin.trigger_installed?(trigger_command)
end
|
#trigger_mechanism ⇒ Object
115
116
117
|
# File 'lib/rscm/scm/perforce.rb', line 115
def trigger_mechanism
"p4 triggers -i"
end
|
#uninstall_trigger(trigger_command, trigger_files_checkout_dir) ⇒ Object
111
112
113
|
# File 'lib/rscm/scm/perforce.rb', line 111
def uninstall_trigger(trigger_command, trigger_files_checkout_dir)
p4admin.uninstall_trigger(trigger_command)
end
|
#uptodate?(from_identifier) ⇒ Boolean
95
96
97
|
# File 'lib/rscm/scm/perforce.rb', line 95
def uptodate?(from_identifier)
p4client.uptodate?
end
|