runcible 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
data/lib/runcible.rb CHANGED
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2012 Eric D Helms
1
+ # Copyright (c) 2012 Red Hat
2
2
  #
3
3
  # MIT License
4
4
  #
@@ -21,11 +21,14 @@
21
21
  # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
22
  # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23
23
 
24
- require "runcible/version"
25
- require "runcible/base"
24
+ # require "runcible/version"
25
+ # require "runcible/base"
26
26
 
27
- resources = Dir[File.dirname(__FILE__) + '/runcible/resources/*.rb']
27
+ resources = Dir[File.dirname(__FILE__) + '/runcible/version.rb']
28
+ resources += Dir[File.dirname(__FILE__) + '/runcible/base.rb']
29
+ resources += Dir[File.dirname(__FILE__) + '/runcible/resources/*.rb']
28
30
  resources += Dir[File.dirname(__FILE__) + '/runcible/extensions/importer.rb']
29
31
  resources += Dir[File.dirname(__FILE__) + '/runcible/extensions/distributor.rb']
30
32
  resources += Dir[File.dirname(__FILE__) + '/runcible/extensions/*.rb']
33
+
31
34
  resources.each{ |f| require f }
data/lib/runcible/base.rb CHANGED
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2012 Eric D Helms
1
+ # Copyright (c) 2012 Red Hat
2
2
  #
3
3
  # MIT License
4
4
  #
@@ -40,16 +40,16 @@ module Runcible
40
40
  end
41
41
  end
42
42
 
43
- def self.install(id, type_id, units)
44
- self.install_content(id, generate_content(type_id, units))
43
+ def self.install_content(id, type_id, units)
44
+ self.install_units(id, generate_content(type_id, units))
45
45
  end
46
46
 
47
- def self.update(id, type_id, units)
48
- self.update_content(id, generate_content(type_id, units))
47
+ def self.update_content(id, type_id, units)
48
+ self.update_units(id, generate_content(type_id, units))
49
49
  end
50
50
 
51
- def self.uninstall(id, type_id, units)
52
- self.uninstall_content(id, generate_content(type_id, units))
51
+ def self.uninstall_content(id, type_id, units)
52
+ self.uninstall_units(id, generate_content(type_id, units))
53
53
  end
54
54
 
55
55
  def self.generate_content(type_id, units)
@@ -31,9 +31,9 @@ module Runcible
31
31
 
32
32
  def initialize(params={})
33
33
  @auto_publish = false
34
- self.id = SecureRandom.hex(10)
34
+ self.id = params[:id] || SecureRandom.hex(10)
35
35
  params.each{|k,v| self.send("#{k.to_s}=",v)}
36
36
  end
37
37
  end
38
38
  end
39
- end
39
+ end
@@ -1,3 +1,27 @@
1
+ # Copyright (c) 2012 Red Hat
2
+ #
3
+ # MIT License
4
+ #
5
+ # Permission is hereby granted, free of charge, to any person obtaining
6
+ # a copy of this software and associated documentation files (the
7
+ # "Software"), to deal in the Software without restriction, including
8
+ # without limitation the rights to use, copy, modify, merge, publish,
9
+ # distribute, sublicense, and/or sell copies of the Software, and to
10
+ # permit persons to whom the Software is furnished to do so, subject to
11
+ # the following conditions:
12
+ #
13
+ # The above copyright notice and this permission notice shall be
14
+ # included in all copies or substantial portions of the Software.
15
+ #
16
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23
+
24
+
1
25
  module Runcible
2
26
  module Extensions
3
27
  class Errata < Runcible::Base
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2012 Eric D Helms
1
+ # Copyright (c) 2012 Red Hat
2
2
  #
3
3
  # MIT License
4
4
  #
@@ -45,13 +45,20 @@ module Runcible
45
45
 
46
46
  optional[:distributors] = distributors.collect do |d|
47
47
  if d.is_a?(Distributor)
48
- [d.type_id, d.config, d.auto_publish, d.id]
48
+ {'distributor_type' => d.type_id,
49
+ "distributor_config" => d.config,
50
+ "auto_publish" => d.auto_publish,
51
+ "distributor_id" => d.id
52
+ }
49
53
  else
50
- [d['type_id'], d['config'], d['auto_publish'], d['id']]
54
+ {'distributor_type' => d['type_id'],
55
+ "distributor_config" => d['config'],
56
+ "auto_publish" => d['auto_publish'],
57
+ "distributor_id" => d['id']
58
+ }
51
59
  end
52
60
  end if !distributors.empty?
53
61
  optional[:id] = id
54
- #debugger
55
62
  create(id, optional)
56
63
  end
57
64
 
@@ -1,3 +1,27 @@
1
+ # Copyright (c) 2012 Red Hat
2
+ #
3
+ # MIT License
4
+ #
5
+ # Permission is hereby granted, free of charge, to any person obtaining
6
+ # a copy of this software and associated documentation files (the
7
+ # "Software"), to deal in the Software without restriction, including
8
+ # without limitation the rights to use, copy, modify, merge, publish,
9
+ # distribute, sublicense, and/or sell copies of the Software, and to
10
+ # permit persons to whom the Software is furnished to do so, subject to
11
+ # the following conditions:
12
+ #
13
+ # The above copyright notice and this permission notice shall be
14
+ # included in all copies or substantial portions of the Software.
15
+ #
16
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23
+
24
+
1
25
  module Runcible
2
26
  module Extensions
3
27
  class Rpm < Runcible::Base
@@ -40,10 +40,10 @@ module Runcible
40
40
  end
41
41
 
42
42
  def self.update(id, optional={})
43
- required = required_params(binding.send(:local_variables), binding)
44
- call(:put, path(id), :payload => { :required => required, :optional => optional })
43
+ call(:put, path(id), :payload => { :delta => optional })
45
44
  end
46
45
 
46
+
47
47
  def self.upload_profile(id, content_type, profile)
48
48
  required = required_params(binding.send(:local_variables), binding, ["id"])
49
49
  call(:post, path("#{id}/profiles/"), :payload => { :required => required })
@@ -57,6 +57,15 @@ module Runcible
57
57
  call(:delete, path(id))
58
58
  end
59
59
 
60
+ def self.retrieve_binding(id, repo_id, distributor_id)
61
+ call(:get, path("#{id}/bindings/#{repo_id}/#{distributor_id}"))
62
+ end
63
+
64
+ def self.retrieve_bindings(id)
65
+ call(:get, path("#{id}/bindings/"))
66
+ end
67
+
68
+
60
69
  def self.bind(id, repo_id, distributor_id)
61
70
  required = required_params(binding.send(:local_variables), binding, ["id"])
62
71
  call(:post, path("#{id}/bindings"), :payload => { :required => required })
@@ -70,17 +79,17 @@ module Runcible
70
79
  call(:get, path("#{id}/bindings/"))
71
80
  end
72
81
 
73
- def self.install_content(id, units, options="")
82
+ def self.install_units(id, units, options="")
74
83
  required = required_params(binding.send(:local_variables), binding, ["id"])
75
84
  call(:post, path("#{id}/actions/content/install/"), :payload => { :required => required })
76
85
  end
77
86
 
78
- def self.update_content(id, units, options="")
87
+ def self.update_units(id, units, options="")
79
88
  required = required_params(binding.send(:local_variables), binding, ["id"])
80
89
  call(:post, path("#{id}/actions/content/update/"), :payload => { :required => required })
81
90
  end
82
91
 
83
- def self.uninstall_content(id, units, options="")
92
+ def self.uninstall_units(id, units, options="")
84
93
  required = required_params(binding.send(:local_variables), binding, ["id"])
85
94
  call(:post, path("#{id}/actions/content/uninstall/"), :payload => { :required => required })
86
95
  end
@@ -0,0 +1,49 @@
1
+ # Copyright (c) 2012 Red Hat, Inc.
2
+ #
3
+ # MIT License
4
+ #
5
+ # Permission is hereby granted, free of charge, to any person obtaining
6
+ # a copy of this software and associated documentation files (the
7
+ # "Software"), to deal in the Software without restriction, including
8
+ # without limitation the rights to use, copy, modify, merge, publish,
9
+ # distribute, sublicense, and/or sell copies of the Software, and to
10
+ # permit persons to whom the Software is furnished to do so, subject to
11
+ # the following conditions:
12
+ #
13
+ # The above copyright notice and this permission notice shall be
14
+ # included in all copies or substantial portions of the Software.
15
+ #
16
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23
+
24
+ require 'active_support/core_ext/hash'
25
+
26
+ module Runcible
27
+ module Resources
28
+ class ConsumerGroup < Runcible::Base
29
+
30
+ def self.path(id=nil)
31
+ groups = "consumer_groups/"
32
+ id.nil? ? groups : groups + "#{id}/"
33
+ end
34
+
35
+ def self.create(id, optional={})
36
+ required = required_params(binding.send(:local_variables), binding)
37
+ call(:post, path, :payload => { :required => required, :optional => optional })
38
+ end
39
+
40
+ def self.delete(id)
41
+ call(:delete, path(id))
42
+ end
43
+
44
+ def self.retrieve(id)
45
+ call(:get, path(id))
46
+ end
47
+ end
48
+ end
49
+ end
@@ -4,10 +4,10 @@ module Runcible
4
4
  class EventNotifier < Runcible::Base
5
5
 
6
6
  class EventTypes
7
- REPO_SYNC_COMPLETE = 'repo-sync-finished'
8
- REPO_SYNC_START = 'repo-sync-started'
9
- REPO_PUBLISH_COMPLETE = 'repo-publish-finished'
10
- REPO_PUBLISH_START = 'repo-publish-started'
7
+ REPO_SYNC_COMPLETE = 'repo.sync.finish'
8
+ REPO_SYNC_START = 'repo.sync.start'
9
+ REPO_PUBLISH_COMPLETE = 'repo.publish.finish'
10
+ REPO_PUBLISH_START = 'repo.publish.start'
11
11
  end
12
12
 
13
13
  class NotifierTypes
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2012 Eric D Helms
1
+ # Copyright (c) 2012 Red Hat
2
2
  #
3
3
  # MIT License
4
4
  #
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2012 Eric D Helms
1
+ # Copyright (c) 2012 Red Hat
2
2
  #
3
3
  # MIT License
4
4
  #
@@ -29,7 +29,7 @@ module Runcible
29
29
 
30
30
  def self.path(repo_id, importer, schedule_id=nil)
31
31
  repo_path = Runcible::Resources::Repository.path(repo_id)
32
- path = "#{repo_path}importers/#{importer}/sync_schedules/"
32
+ path = "#{repo_path}importers/#{importer}/schedules/sync/"
33
33
  (schedule_id == nil) ? path : "#{path}#{schedule_id}/"
34
34
  end
35
35
 
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2012 Eric D Helms
1
+ # Copyright (c) 2012 Red Hat
2
2
  #
3
3
  # MIT License
4
4
  #
@@ -32,11 +32,11 @@ module Runcible
32
32
 
33
33
  def self.add(id, login)
34
34
  required = required_params(binding.send(:local_variables), binding, ["id"])
35
- call(:post, "#{path(id)}/users/", :payload => { :required => required })
35
+ call(:post, "#{path(id)}users/", :payload => { :required => required })
36
36
  end
37
37
 
38
38
  def self.remove(id, login)
39
- call(:delete, "#{path(id)}/users/#{login}/")
39
+ call(:delete, "#{path(id)}users/#{login}/")
40
40
  end
41
41
 
42
42
  end
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2012 Eric D Helms
1
+ # Copyright (c) 2012 Red Hat
2
2
  #
3
3
  # MIT License
4
4
  #
@@ -11,7 +11,5 @@ module Runcible
11
11
  end
12
12
  end
13
13
 
14
-
15
-
16
14
  end
17
15
  end
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2012 Eric D Helms
1
+ # Copyright (c) 2012 Red Hat
2
2
  #
3
3
  # MIT License
4
4
  #
@@ -1,3 +1,3 @@
1
1
  module Runcible
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: runcible
3
3
  version: !ruby/object:Gem::Version
4
- hash: 25
4
+ hash: 31
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 1
10
- version: 0.1.1
9
+ - 2
10
+ version: 0.1.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Eric D Helms
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2012-10-16 00:00:00 Z
18
+ date: 2012-10-25 00:00:00 Z
19
19
  dependencies: []
20
20
 
21
21
  description: Exposing Pulp's juiciest components to the Ruby world.
@@ -48,6 +48,7 @@ files:
48
48
  - lib/runcible/resources/consumer.rb
49
49
  - lib/runcible/resources/user.rb
50
50
  - lib/runcible/resources/role.rb
51
+ - lib/runcible/resources/consumer_group.rb
51
52
  - lib/runcible/resources/repository.rb
52
53
  - lib/runcible/resources/unit.rb
53
54
  homepage: https://github.com/Katello/runcible