p4util 0.2 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -0
- data/lib/commands/init/trigger_model.rb +36 -0
- data/lib/commands/init.rb +31 -0
- data/lib/p4util/version.rb +1 -1
- data/p4init/test_triggers.rb +8 -0
- metadata +3 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bfc46ec6b99947c356f6683eb8b96c52ae134eaf
|
4
|
+
data.tar.gz: 3987e3f1d0266b9a39aba55ad725b9918f94af81
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9add8bd786996a757a3141fdf3281a2a8308ec29079dd5bf9c7d1abba6038e7bf7b1ff8c448da9fc9d50cd6eccea5f27256379727a364cec2f07acf461998c63
|
7
|
+
data.tar.gz: d62bcb4ffe245982944a199133f6f97a582a773e73eef4bc7a71d27bfbb43da49d7558305ba10016d63a48d14358ae98d1624cbf2c5de87dc3c613231ea95b9b
|
data/README.md
CHANGED
@@ -0,0 +1,36 @@
|
|
1
|
+
require 'commands/init/init_model'
|
2
|
+
|
3
|
+
module Commands
|
4
|
+
module Init
|
5
|
+
# Each trigger model instance adds an array of triggers
|
6
|
+
class TriggerModel < InitModel
|
7
|
+
inheritable_attributes :triggers
|
8
|
+
|
9
|
+
# An array of strings
|
10
|
+
@triggers = nil
|
11
|
+
|
12
|
+
def self.abstract
|
13
|
+
true
|
14
|
+
end
|
15
|
+
|
16
|
+
def initialize
|
17
|
+
@triggers = self.class.triggers
|
18
|
+
end
|
19
|
+
|
20
|
+
def execute(p4, models=nil, super_user=nil)
|
21
|
+
puts "triggers: #{@triggers}"
|
22
|
+
|
23
|
+
triggers = p4.run('triggers', '-o')[0]['Triggers']
|
24
|
+
puts "current triggers: #{triggers}"
|
25
|
+
triggers = [] if triggers.nil?
|
26
|
+
|
27
|
+
@triggers.each { |t| triggers << t }
|
28
|
+
|
29
|
+
p4.input = {
|
30
|
+
'Triggers' => triggers
|
31
|
+
}
|
32
|
+
p4.run('triggers', '-i')
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
data/lib/commands/init.rb
CHANGED
@@ -6,6 +6,7 @@ require 'commands/init/depot_model'
|
|
6
6
|
require 'commands/init/file_definition'
|
7
7
|
require 'commands/init/group_model'
|
8
8
|
require 'commands/init/system_settings_model'
|
9
|
+
require 'commands/init/trigger_model'
|
9
10
|
require 'commands/init/user_model'
|
10
11
|
|
11
12
|
module Commands
|
@@ -164,6 +165,36 @@ module Commands
|
|
164
165
|
|
165
166
|
:type, :address, :suffix, :map, :spec_map
|
166
167
|
|
168
|
+
## GroupModel ##
|
169
|
+
|
170
|
+
Example:
|
171
|
+
|
172
|
+
class SystemGroup < GroupModel
|
173
|
+
def rank; 2000 end
|
174
|
+
@group = 'system'
|
175
|
+
@timeout = 'unset'
|
176
|
+
@password_timeout = 'unset'
|
177
|
+
@users = ['app']
|
178
|
+
end
|
179
|
+
|
180
|
+
Attributes:
|
181
|
+
|
182
|
+
:group, :max_results, :max_scan_rows,
|
183
|
+
:max_lock_time, :password_timeout, :timeout,
|
184
|
+
:users, :subgroups, :owners
|
185
|
+
|
186
|
+
## TriggerModel ##
|
187
|
+
|
188
|
+
Example:
|
189
|
+
|
190
|
+
class ExampleTriggers < TriggerModel
|
191
|
+
def rank; 50; end
|
192
|
+
|
193
|
+
@triggers = [
|
194
|
+
'trig1 change-submit //depot/dir/... "/usr/bin/s1.pl %changelist%"',
|
195
|
+
'trig2 change-submit -//depot/z/... "/usr/bin/s1.pl %user%"'
|
196
|
+
]
|
197
|
+
end
|
167
198
|
END
|
168
199
|
end
|
169
200
|
|
data/lib/p4util/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: p4util
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tristan Juricek
|
@@ -78,6 +78,7 @@ files:
|
|
78
78
|
- "./lib/commands/init/init_model.rb"
|
79
79
|
- "./lib/commands/init/p4_helpers.rb"
|
80
80
|
- "./lib/commands/init/system_settings_model.rb"
|
81
|
+
- "./lib/commands/init/trigger_model.rb"
|
81
82
|
- "./lib/commands/init/user_model.rb"
|
82
83
|
- "./lib/commands/kill.rb"
|
83
84
|
- "./lib/commands/rake.rb"
|
@@ -94,6 +95,7 @@ files:
|
|
94
95
|
- "./p4init/test_changelists.rb"
|
95
96
|
- "./p4init/test_groups.rb"
|
96
97
|
- "./p4init/test_system_settings.rb"
|
98
|
+
- "./p4init/test_triggers.rb"
|
97
99
|
- "./p4init/test_users.rb"
|
98
100
|
- "./p4util.gemspec"
|
99
101
|
- bin/p4util
|