p4util 0.1.6 → 0.2

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: cd44d36a39c704a989054b91c66f3480c3ff3da0
4
- data.tar.gz: f1114069900aa1518b58df8f9067e662740a42c6
3
+ metadata.gz: 4fd37ebdc24b5bcfb77f66ddd30e5c91cfbfca5a
4
+ data.tar.gz: f201b07ddaa262063a9b0078b1ae884dea7814ee
5
5
  SHA512:
6
- metadata.gz: 7332c6b0104de70035fc6098dc98c52b12ee81a4a8ca32b9741aa835ff23d337c651ee2cf48cba98c9e34bf40055d0ab5ef13577a596c87a42dc384d1ec0bcf2
7
- data.tar.gz: 23dc876ed087e73c468527570764cd122ddb7e2778eb4001720c3509119aafab1ce91027b42662b105bea14d08c6c9b0e7575ff43bd54419bca02515900ee3f5
6
+ metadata.gz: 9214db3922784dc505ecce1a13bbca7e759ef0b67289872996a17db61a46e64d6bfa06ef35c7fc65cf50505dca7bc7f31000297234072a7d20ff6f161a7affbc
7
+ data.tar.gz: fbe5ec5af147dd85e44451cb331334b051319996d55a66605d388f8f224041a0181d89ef1119c3483a6618c11983c554d443a5bd2a5d67426ea90d72de7ede84
data/README.md CHANGED
@@ -35,6 +35,8 @@ Or install it yourself as:
35
35
 
36
36
  ## Changes
37
37
 
38
+ * 0.2.0: Added the ability to create 'groups'
39
+
38
40
  * 0.1.2: Added depot model and the ability to customize the view for changelists
39
41
 
40
42
  * 0.1.1: Added documentation for Rake tasks and version string output
@@ -0,0 +1,59 @@
1
+ require 'commands/init/init_model'
2
+
3
+ module Commands
4
+ module Init
5
+ class GroupModel < InitModel
6
+ inheritable_attributes :group, :max_results, :max_scan_rows,
7
+ :max_lock_time, :password_timeout, :timeout,
8
+ :users, :subgroups, :owners
9
+
10
+
11
+ @group = nil
12
+ @max_results = nil
13
+ @max_scan_rows = nil
14
+ @max_lock_time = nil
15
+ @timeout = nil
16
+ @password_timeout = nil
17
+ @users = nil
18
+ @subgroups = nil
19
+ @owners = nil
20
+
21
+ def self.abstract
22
+ true
23
+ end
24
+
25
+ def initialize
26
+ @group = self.class.group
27
+ @max_results = self.class.max_results
28
+ @max_scan_rows = self.class.max_scan_rows
29
+ @timeout = self.class.timeout
30
+ @password_timeout = self.class.password_timeout
31
+ @users = self.class.users
32
+ @subgroups = self.class.subgroups
33
+ @owners = self.class.owners
34
+ end
35
+
36
+ def to_spec
37
+ spec = {
38
+ 'Group' => @group
39
+ }
40
+
41
+ spec['MaxResults'] = @max_results unless @max_results.nil?
42
+ spec['MaxScanRows'] = @max_scan_rows unless @max_scan_rows.nil?
43
+ spec['MaxLockTime'] = @max_lock_time unless @max_lock_time.nil?
44
+ spec['Timeout'] = @timeout unless @timeout.nil?
45
+ spec['PasswordTimeout'] = @password_timeout unless @password_timeout.nil?
46
+ spec['Users'] = @users unless @users.nil?
47
+ spec['Subgroups'] = @subgroups unless @subgroups.nil?
48
+ spec['Owners'] = @owners unless @owners.nil?
49
+
50
+ spec
51
+ end
52
+
53
+ def execute(p4, models=nil, super_user=nil)
54
+ puts "group: #{to_spec}"
55
+ p4.save_group(to_spec)
56
+ end
57
+ end
58
+ end
59
+ end
data/lib/commands/init.rb CHANGED
@@ -4,6 +4,7 @@ require 'commands/init/init_model'
4
4
  require 'commands/init/changelist_model'
5
5
  require 'commands/init/depot_model'
6
6
  require 'commands/init/file_definition'
7
+ require 'commands/init/group_model'
7
8
  require 'commands/init/system_settings_model'
8
9
  require 'commands/init/user_model'
9
10
 
@@ -171,9 +172,14 @@ module Commands
171
172
  def Commands.initialize_p4d(init_dir, p4port, auto)
172
173
  # Go through our init_dir, and evaluate each script as if it were defined
173
174
  # in the Commands::Init module.
174
- Dir.glob("#{init_dir}/**/*.rb") do |file|
175
- contents = IO.read(file)
176
- Commands::Init.class_eval(contents, file)
175
+ if File.directory?(init_dir)
176
+ Dir.glob("#{init_dir}/**/*.rb") do |file|
177
+ contents = IO.read(file)
178
+ Commands::Init.class_eval(contents, file)
179
+ end
180
+ elsif File.file?(init_dir)
181
+ contents = IO.read(init_dir)
182
+ Commands::Init.class_eval(contents, init_dir)
177
183
  end
178
184
 
179
185
  # Note that nothing is actually done until this line. This allows classes
@@ -1,3 +1,3 @@
1
1
  module P4Util
2
- VERSION = '0.1.6'
2
+ VERSION = '0.2'
3
3
  end
@@ -0,0 +1,7 @@
1
+ class SystemGroup < GroupModel
2
+ def rank; 2000 end
3
+ @group = 'system'
4
+ @timeout = 'unset'
5
+ @password_timeout = 'unset'
6
+ @users = ['app']
7
+ end
data/p4init/test_users.rb CHANGED
@@ -12,4 +12,11 @@ class JohnDoeUser < UserModel
12
12
  @login = 'jdoe'
13
13
  @full_name = 'John Doe'
14
14
  @password = 'johndoe1A!'
15
+ end
16
+
17
+ class AppUser < UserModel
18
+ def rank; 11 end
19
+ @login = 'app'
20
+ @full_name = 'Application'
21
+ @password = 'appuser1A!'
15
22
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: p4util
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.6
4
+ version: '0.2'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tristan Juricek
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-05-05 00:00:00.000000000 Z
11
+ date: 2015-05-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -74,6 +74,7 @@ files:
74
74
  - "./lib/commands/init/changelist_model.rb"
75
75
  - "./lib/commands/init/depot_model.rb"
76
76
  - "./lib/commands/init/file_definition.rb"
77
+ - "./lib/commands/init/group_model.rb"
77
78
  - "./lib/commands/init/init_model.rb"
78
79
  - "./lib/commands/init/p4_helpers.rb"
79
80
  - "./lib/commands/init/system_settings_model.rb"
@@ -91,6 +92,7 @@ files:
91
92
  - "./lib/random_util.rb"
92
93
  - "./p4init/287.jpg"
93
94
  - "./p4init/test_changelists.rb"
95
+ - "./p4init/test_groups.rb"
94
96
  - "./p4init/test_system_settings.rb"
95
97
  - "./p4init/test_users.rb"
96
98
  - "./p4util.gemspec"