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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4fd37ebdc24b5bcfb77f66ddd30e5c91cfbfca5a
4
- data.tar.gz: f201b07ddaa262063a9b0078b1ae884dea7814ee
3
+ metadata.gz: bfc46ec6b99947c356f6683eb8b96c52ae134eaf
4
+ data.tar.gz: 3987e3f1d0266b9a39aba55ad725b9918f94af81
5
5
  SHA512:
6
- metadata.gz: 9214db3922784dc505ecce1a13bbca7e759ef0b67289872996a17db61a46e64d6bfa06ef35c7fc65cf50505dca7bc7f31000297234072a7d20ff6f161a7affbc
7
- data.tar.gz: fbe5ec5af147dd85e44451cb331334b051319996d55a66605d388f8f224041a0181d89ef1119c3483a6618c11983c554d443a5bd2a5d67426ea90d72de7ede84
6
+ metadata.gz: 9add8bd786996a757a3141fdf3281a2a8308ec29079dd5bf9c7d1abba6038e7bf7b1ff8c448da9fc9d50cd6eccea5f27256379727a364cec2f07acf461998c63
7
+ data.tar.gz: d62bcb4ffe245982944a199133f6f97a582a773e73eef4bc7a71d27bfbb43da49d7558305ba10016d63a48d14358ae98d1624cbf2c5de87dc3c613231ea95b9b
data/README.md CHANGED
@@ -35,6 +35,8 @@ Or install it yourself as:
35
35
 
36
36
  ## Changes
37
37
 
38
+ * 0.3.0: Added the ability to initialize triggers
39
+
38
40
  * 0.2.0: Added the ability to create 'groups'
39
41
 
40
42
  * 0.1.2: Added depot model and the ability to customize the view for changelists
@@ -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
 
@@ -1,3 +1,3 @@
1
1
  module P4Util
2
- VERSION = '0.2'
2
+ VERSION = '0.3.0'
3
3
  end
@@ -0,0 +1,8 @@
1
+ class ExampleTriggers < TriggerModel
2
+ def rank; 50; end
3
+
4
+ @triggers = [
5
+ 'trig1 change-submit //depot/dir/... "/usr/bin/s1.pl %changelist%"',
6
+ 'trig2 change-submit -//depot/z/... "/usr/bin/s1.pl %user%"'
7
+ ]
8
+ end
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: '0.2'
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