runcible 0.4.5 → 0.4.6

Sign up to get free protection for your applications and to get access to all the features.
data/CONTRIBUTING.md ADDED
@@ -0,0 +1,7 @@
1
+ ## Contributing
2
+
3
+ 1. Fork it
4
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
5
+ 3. Commit your changes (`git commit -am 'Added some feature'`)
6
+ 4. Push to the branch (`git push origin my-new-feature`)
7
+ 5. Create new Pull Request
data/Gemfile ADDED
@@ -0,0 +1,16 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in runcible.gemspec
4
+ gemspec
5
+
6
+ group :test do
7
+ gem 'rake', '0.9.2.2'
8
+ gem 'vcr'
9
+ gem 'webmock'
10
+ gem 'minitest'
11
+ gem 'parseconfig'
12
+ end
13
+
14
+ group :debug do
15
+ gem 'debugger'
16
+ end
data/LICENSE ADDED
@@ -0,0 +1,22 @@
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.
data/README.md ADDED
@@ -0,0 +1,165 @@
1
+ # Runcible
2
+
3
+ [![Build Status](https://secure.travis-ci.org/Katello/runcible.png)](http://travis-ci.org/Katello/runcible)
4
+
5
+ Exposing Pulp's juiciest parts. http://www.pulpproject.org/
6
+
7
+ Latest Live Tested Version: **pulp-server-2.1.1-0.5.beta.el6.noarch**
8
+
9
+ Current stable Runcible: https://github.com/Katello/runcible/tree/0.3
10
+
11
+ For in-depth class and method documentation: http://katello.github.com/runcible/
12
+
13
+ ## Installation
14
+
15
+ Add this line to your application's Gemfile:
16
+
17
+ gem 'runcible'
18
+
19
+ And then execute:
20
+
21
+ $ bundle
22
+
23
+ Or install it yourself as:
24
+
25
+ $ gem install runcible
26
+
27
+ ## Usage
28
+
29
+ ### Set Configuration
30
+
31
+ The base configuration allows for the following to be set.
32
+
33
+ Runcible::Base.config = {
34
+ :url => "",
35
+ :api_path => "",
36
+ :user => "",
37
+ :logger => ""
38
+ }
39
+
40
+ Required Configuration
41
+
42
+ :uri => The base URI of the Pulp server (default: https://localhost)
43
+ :api_path => The API path of the Pulp server (default: pulp/api/v2/)
44
+ :user => The Pulp username to be used in authentication
45
+ :logger => The location to log RestClient calls (e.g. stdout)
46
+
47
+ Authentication Options are either HTTP or Oauth:
48
+
49
+ :http_auth => {:password => ''}
50
+
51
+ :oauth => {:oauth_secret => "",
52
+ :oauth_key => "" }
53
+
54
+ For an example on parsing the Pulp server.conf and using values provided within for the configuration see the [test_runner](https://github.com/Katello/runcible/blob/master/test/integration/test_runner.rb)
55
+
56
+ ### Make a Request
57
+
58
+ Runcible provides two represntation's of Pulp entities to make API calls: [resources](https://github.com/Katello/runcible/tree/master/lib/runcible/resources) and [extensions](https://github.com/Katello/runcible/tree/master/lib/runcible/extensions)
59
+
60
+ The best examples of how to use either the resources or extensions can be found within the [tests](https://github.com/Katello/runcible/tree/master/test/integration)
61
+
62
+ #### Resources
63
+
64
+ Resources are designed to be one-for-one with the Pulp API calls in terms of required parameters and naming of the calls. For example, in order to create a repository, associate a Yum importer and a distributor:
65
+
66
+ Runcible::Resources::Repository.create("Repository_ID")
67
+ Runcible::Resources::Repository.associate_importer("Repository_ID", "yum_importer", {})
68
+ Runcible::Resources::Repository.associate_distributor("Repository_ID", "yum_distributor", {"relative_url" => "/", "http" => true, "https" => true})
69
+
70
+ #### Extensions
71
+
72
+ Extensions are constructs around the Pulp API that make retrieving, accessing or creating certain data types easier. For example, providing objects that represent the details of a yum importer or distributor, and providing functions to create a Repository with an importer and distributors in a single call. The same three step process above using extensions is:
73
+
74
+ Runcible::Extensions::Repository.create_with_importer_and_distributors("Repository_ID", {:id=>'yum_importer'}, [{'type_id' => 'yum_distributor', 'id'=>'123', 'auto_publish'=>true, 'config'=>{'relative_url' => '/', 'http' => true, 'https' => true}}])
75
+
76
+ Alternatively, using distributor and importer objects:
77
+
78
+ distributors = [Runcible::Extensions::YumDistributor.new('/path', true, true, :id => '123')]
79
+ importer = Runcible::Extensions::YumImporter.new()
80
+ Runcible::Extensions::Repository.create_with_importer_and_distributors("Repository_ID", importer, distributors)
81
+
82
+
83
+ ## Testing
84
+
85
+ To run all tests using recorded data, run:
86
+
87
+ rake test mode=none
88
+
89
+ To run all tests to record data:
90
+
91
+ rake test mode=all
92
+
93
+ To run a single test using recorded data, run:
94
+
95
+ rake test mode=none test=extensions/respository
96
+ or (by filename)
97
+ rake test mode=none test=./test/extensions/respository_test.rb
98
+
99
+ To run tests against your live Pulp without recording a new cassette set record flag to false (does not apply to mode=none):
100
+
101
+ record=false
102
+
103
+ To run with oauth, simply append the following to any commend:
104
+
105
+ auth_type=oauth
106
+
107
+ To see RestClient logs while testing:
108
+
109
+ logging=true
110
+
111
+
112
+ ## Building and Releasing
113
+
114
+ ### Gem
115
+
116
+ While anyone can grab the source and build a new version of the gem, only those with Rubygems.org permissions on the project can release an official version.
117
+
118
+ To build a new version of Runcible, first bump the version depending on the type of release.
119
+
120
+ cd runcible/
121
+ vim lib/runcible/version.rb
122
+
123
+ Now update the version to the new version, and commit the changes.
124
+
125
+ git commit -a -m 'Version bump'
126
+
127
+ Now build:
128
+
129
+ gem build runcible.gemspec
130
+
131
+
132
+ #### Official Release
133
+
134
+ For an official release, again assuming you have the right permssions:
135
+
136
+ gem push runcible-<version>.gem
137
+
138
+ ### RPM Release
139
+
140
+ If you are wanting to generate a new RPM build, please make sure you have followed the steps above if the build is going to include new code. All builds should first go in gem form to Rubygems. You'll need to make sure tito is installed:
141
+
142
+ yum install tito
143
+
144
+ Now tag, making sure the tag version matches the gem version:
145
+
146
+ tito tag
147
+
148
+ Assuming you have the right dependencies available, you can do a local test build with tito (although we recommend using mock):
149
+
150
+ tito build --test --rpm
151
+
152
+ With mock:
153
+
154
+ tito build --test --rpm --builder=mock --builder-arg mock=<name_of_mock_config>
155
+
156
+ From here there are a variety of options to build and release an RPM pakaged version of Runcible (e.g. you can build an SRPM to feed to Koji, or use mock locally)
157
+
158
+ ## Contributing
159
+
160
+ 1. Fork it
161
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
162
+ 3. Commit your changes (`git commit -am 'Added some feature'`)
163
+ 4. Ensure all tests are passing
164
+ 5. Push to the branch (`git push origin my-new-feature`)
165
+ 6. Create new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,82 @@
1
+ #!/usr/bin/env rake
2
+ require "bundler/gem_tasks"
3
+ require "rake/testtask"
4
+
5
+ namespace :test do
6
+ "Runs the unit tests"
7
+ Rake::TestTask.new :unit do |t|
8
+ t.pattern = 'test/unit/test_*.rb'
9
+ end
10
+
11
+ [:resources, :extensions].each do |task_name|
12
+ desc "Runs the #{task_name} tests"
13
+ task task_name do
14
+ options = {}
15
+
16
+ options[:mode] = ENV['mode'] || 'none'
17
+ options[:test_name] = ENV['test']
18
+ options[:auth_type] = ENV['auth_type']
19
+ options[:logging] = ENV['logging']
20
+
21
+ if !['new_episodes', 'all', 'none', 'once'].include?(options[:mode])
22
+ puts "Invalid test mode"
23
+ else
24
+ require "./test/test_runner"
25
+
26
+ test_runner = PulpMiniTestRunner.new
27
+
28
+ if options[:test_name]
29
+ puts "Running tests for: #{options[:test_name]}"
30
+ else
31
+ puts "Running tests for: #{task_name}"
32
+ end
33
+
34
+ test_runner.run_tests(task_name, options)
35
+ Rake::Task[:update_test_version].invoke if options[:mode] == "all" && ENV['record'] != false
36
+ end
37
+ end
38
+ end
39
+ end
40
+
41
+ desc "Updats the version of Pulp tested against in README"
42
+ task :update_test_version do
43
+ text = File.open('README.md').read
44
+
45
+ File.open('README.md', 'w+') do |file|
46
+ original_regex = /Latest Live Tested Version: *.*/
47
+ pulp_version = `rpm -q pulp-server`.strip
48
+ replacement_string = "Latest Live Tested Version: **#{pulp_version}**"
49
+ replace = text.gsub!(original_regex, replacement_string)
50
+ file.puts replace
51
+ end
52
+ end
53
+
54
+ desc "Finds functions without dedicated tests"
55
+ task :untested do
56
+ test_functions = `grep -r 'def test_' test/ --exclude-dir=test/fixtures --include=*.rb --no-filename`
57
+ lib_functions = `grep -r 'def self' lib/ --exclude=base.rb --include=*.rb --no-filename`
58
+
59
+ test_functions = test_functions.split("\n").map{ |str| str.strip.split("def test_")[1] }.to_set
60
+ lib_functions = lib_functions.split("\n").map{ |str| str.strip.split("def self.")[1].split("(").first }.to_set
61
+
62
+ difference = (lib_functions - test_functions).to_a
63
+
64
+ if !difference.empty?
65
+ puts difference
66
+ exit 1
67
+ end
68
+ end
69
+
70
+ desc "Clears out all cassette files"
71
+ task :clear_cassettes do
72
+ `rm -rf test/fixtures/vcr_cassettes/*.yml`
73
+ `rm -rf test/fixtures/vcr_cassettes/extensions/*.yml`
74
+ `rm -rf test/fixtures/vcr_cassettes/support/*.yml`
75
+ end
76
+
77
+ desc "Runs all tests"
78
+ task :test do
79
+ Rake::Task['test:unit'].invoke
80
+ Rake::Task['test:resources'].invoke
81
+ Rake::Task['test:extensions'].invoke
82
+ end
@@ -1,3 +1,3 @@
1
1
  module Runcible
2
- VERSION = "0.4.5"
2
+ VERSION = "0.4.6"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: runcible
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.5
4
+ version: 0.4.6
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -130,6 +130,11 @@ files:
130
130
  - lib/runcible/resources/user.rb
131
131
  - lib/runcible/resources/unit.rb
132
132
  - lib/runcible/resources/repository_group.rb
133
+ - LICENSE
134
+ - Rakefile
135
+ - Gemfile
136
+ - README.md
137
+ - CONTRIBUTING.md
133
138
  homepage: https://github.com/Katello/runcible
134
139
  licenses: []
135
140
  post_install_message: