right_api_helper 0.0.2 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/README.md CHANGED
@@ -57,10 +57,31 @@ You can also pass a logger object to the `right_api_client` gem. For example:
57
57
  * Need to further sanitize VCR output before including spec/cassettes dir.
58
58
  * break `lib/right_api_helper/api15.rb` apart into separate helpers?
59
59
 
60
+
61
+ ## Using Vagrant
62
+
63
+ For local gem development using Vagrant, you must have Vagrant 1.2 or greater installed. Please see the [vagrant documentation](http://docs.vagrantup.com/v2/) for instructions. This was tested on Vagrant 1.4.3, so I would start with that.
64
+
65
+ You will also need to install some gems and the berkshelf and omnibus vagrant plugins.
66
+ Here are the commands:
67
+
68
+ $ bundle
69
+ $ vagrant plugin install vagrant-berkshelf
70
+ $ vagrant plugin install vagrant-omnibus
71
+ $ vagrant up
72
+
73
+ Once your instance is launched and configured, ssh in and run the specs
74
+
75
+ $ vagrant ssh
76
+ > cd /vagrant
77
+ > bundle
78
+ > bundle exec rake spec
79
+
80
+
60
81
  ## Contributing
61
82
 
62
83
  1. Fork it ( https://github.com/caryp/right_api_helper/fork )
63
84
  2. Create your feature branch (`git checkout -b my-new-feature`)
64
85
  3. Commit your changes (`git commit -am 'Add some feature'`)
65
86
  4. Push to the branch (`git push origin my-new-feature`)
66
- 5. Create a new Pull Request
87
+ 5. Create a new Pull Request
data/Vagrantfile ADDED
@@ -0,0 +1,52 @@
1
+ # -*- mode: ruby -*-
2
+ # vi: set ft=ruby :
3
+
4
+ # Load creds from a file
5
+ right_api_secrets = YAML.load_file("#{ENV['HOME']}/.right_api_client/login.yml")
6
+
7
+
8
+ # Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
9
+ VAGRANTFILE_API_VERSION = "2"
10
+
11
+ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
12
+
13
+ # Every Vagrant virtual environment requires a box to build off of.
14
+ config.vm.box = "opscode_ubuntu-12.04_chef-provisionerless"
15
+
16
+ # The url from where the 'config.vm.box' box will be fetched if it
17
+ # doesn't already exist on the user's system.
18
+ config.vm.box_url = "http://opscode-vm-bento.s3.amazonaws.com/vagrant/virtualbox/opscode_ubuntu-12.04_chef-provisionerless.box"
19
+
20
+ # Share an additional folder to the guest VM. The first argument is
21
+ # the path on the host to the actual folder. The second argument is
22
+ # the path on the guest to mount the folder. And the optional third
23
+ # argument is a set of non-required options.
24
+ config.vm.synced_folder "~/.right_api_client", "/vagrant/.right_api_client"
25
+
26
+ # Enable provisioning with chef solo, specifying a cookbooks path, roles
27
+ # path, and data_bags path (all relative to this Vagrantfile), and adding
28
+ # some recipes and/or roles.
29
+ #
30
+ config.vm.provision :chef_solo do |chef|
31
+ chef.cookbooks_path = "./cookbooks"
32
+ chef.add_recipe "right_api_helper::default"
33
+ chef.add_recipe "right_api_helper::development"
34
+ chef.json = {
35
+ :right_api_helper => {
36
+ :account_id => right_api_secrets[:account_id],
37
+ :user_email => right_api_secrets[:email],
38
+ :user_password => right_api_secrets[:password]
39
+ }
40
+ }
41
+ end
42
+
43
+ # tell vagrant-omnibus to install a specific vesion of Chef
44
+ # you will need to install the vagrant-omnibus plugin
45
+ config.omnibus.chef_version = "11.6.0"
46
+
47
+ # tell vagrant to use bershelf to pull in cookbook dependencies
48
+ # you will need to install the vagrant-berkshelf plugin
49
+ config.berkshelf.enabled = true
50
+ config.berkshelf.berksfile_path = "./cookbooks/right_api_helper/Berksfile"
51
+
52
+ end
@@ -0,0 +1,15 @@
1
+ .vagrant
2
+ Berksfile.lock
3
+ *~
4
+ *#
5
+ .#*
6
+ \#*#
7
+ .*.sw[a-z]
8
+ *.un~
9
+ /cookbooks
10
+
11
+ # Bundler
12
+ Gemfile.lock
13
+ bin/*
14
+ .bundle/*
15
+
@@ -0,0 +1,3 @@
1
+ site :opscode
2
+
3
+ metadata
@@ -0,0 +1,3 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem 'berkshelf'
@@ -0,0 +1,20 @@
1
+ Copyright (C) 2014 RightScale, Inc.
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,55 @@
1
+ # right_api_helper cookbook
2
+
3
+ installs the `right_api_helper` gem and prerequisites
4
+
5
+ # Requirements
6
+
7
+ Attributes
8
+ ----------
9
+ #### right_api_client::default
10
+ <table>
11
+ <tr>
12
+ <th>Key</th>
13
+ <th>Type</th>
14
+ <th>Description</th>
15
+ <th>Default</th>
16
+ </tr>
17
+ <tr>
18
+ <td><tt>['right_api_client']['user_email']</tt></td>
19
+ <td>String</td>
20
+ <td>the RightScale user's email address</td>
21
+ <td><tt>nil</tt></td>
22
+ </tr>
23
+ <tr>
24
+ <td><tt>['right_api_client']['user_password']</tt></td>
25
+ <td>String</td>
26
+ <td>the RightScale user's password</td>
27
+ <td><tt>nil</tt></td>
28
+ </tr>
29
+ <tr>
30
+ <td><tt>['right_api_client']['accound_id']</tt></td>
31
+ <td>String</td>
32
+ <td>the RightScale account ID</td>
33
+ <td><tt>nil</tt></td>
34
+ </tr>
35
+
36
+ </table>
37
+
38
+ Usage
39
+ -----
40
+ #### cas_portal::default
41
+ Just include `cas_portal::default` in your node's `run_list`:
42
+
43
+ ```json
44
+ {
45
+ "name":"my_node",
46
+ "run_list": [
47
+ "recipe[cas_portal::default]"
48
+ ]
49
+ }
50
+
51
+ # Recipes
52
+
53
+ # Author
54
+
55
+ Author:: RightScale, Inc. (<cary@rightscale.com>)
@@ -0,0 +1,5 @@
1
+ # encoding: utf-8
2
+
3
+ require 'bundler'
4
+ require 'bundler/setup'
5
+ require 'berkshelf/thor'
@@ -0,0 +1,3 @@
1
+ node.default['right_api_client']['user_email'] = nil
2
+ node.default['right_api_client']['user_password'] = nil
3
+ node.default['right_api_client']['account_id'] = nil
@@ -0,0 +1,96 @@
1
+ # Put files/directories that should be ignored in this file when uploading
2
+ # or sharing to the community site.
3
+ # Lines that start with '# ' are comments.
4
+
5
+ # OS generated files #
6
+ ######################
7
+ .DS_Store
8
+ Icon?
9
+ nohup.out
10
+ ehthumbs.db
11
+ Thumbs.db
12
+
13
+ # SASS #
14
+ ########
15
+ .sass-cache
16
+
17
+ # EDITORS #
18
+ ###########
19
+ \#*
20
+ .#*
21
+ *~
22
+ *.sw[a-z]
23
+ *.bak
24
+ REVISION
25
+ TAGS*
26
+ tmtags
27
+ *_flymake.*
28
+ *_flymake
29
+ *.tmproj
30
+ .project
31
+ .settings
32
+ mkmf.log
33
+
34
+ ## COMPILED ##
35
+ ##############
36
+ a.out
37
+ *.o
38
+ *.pyc
39
+ *.so
40
+ *.com
41
+ *.class
42
+ *.dll
43
+ *.exe
44
+ */rdoc/
45
+
46
+ # Testing #
47
+ ###########
48
+ .watchr
49
+ .rspec
50
+ spec/*
51
+ spec/fixtures/*
52
+ test/*
53
+ features/*
54
+ Guardfile
55
+ Procfile
56
+
57
+ # SCM #
58
+ #######
59
+ .git
60
+ */.git
61
+ .gitignore
62
+ .gitmodules
63
+ .gitconfig
64
+ .gitattributes
65
+ .svn
66
+ */.bzr/*
67
+ */.hg/*
68
+ */.svn/*
69
+
70
+ # Berkshelf #
71
+ #############
72
+ Berksfile
73
+ Berksfile.lock
74
+ cookbooks/*
75
+ tmp
76
+
77
+ # Cookbooks #
78
+ #############
79
+ CONTRIBUTING
80
+ CHANGELOG*
81
+
82
+ # Strainer #
83
+ ############
84
+ Colanderfile
85
+ Strainerfile
86
+ .colander
87
+ .strainer
88
+
89
+ # Vagrant #
90
+ ###########
91
+ .vagrant
92
+ Vagrantfile
93
+
94
+ # Travis #
95
+ ##########
96
+ .travis.yml
@@ -0,0 +1,13 @@
1
+ name 'right_api_helper'
2
+ maintainer 'RightScale, Inc.'
3
+ maintainer_email 'cary@rightscale.com'
4
+ license 'MIT'
5
+ description 'Installs/Configures right_api_helper'
6
+ long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
7
+ version '0.1.0'
8
+
9
+ depends 'apt'
10
+ depends 'build-essential'
11
+
12
+ depends 'git' # for dev environment
13
+
@@ -0,0 +1,61 @@
1
+ #
2
+ # Cookbook Name:: right_api_helper
3
+ # Recipe:: default
4
+ #
5
+ # Copyright (C) 2014 RightScale, Inc.
6
+ #
7
+ # Permission is hereby granted, free of charge, to any person obtaining
8
+ # a copy of this software and associated documentation files (the
9
+ # "Software"), to deal in the Software without restriction, including
10
+ # without limitation the rights to use, copy, modify, merge, publish,
11
+ # distribute, sublicense, and/or sell copies of the Software, and to
12
+ # permit persons to whom the Software is furnished to do so, subject to
13
+ # the following conditions:
14
+ #
15
+ # The above copyright notice and this permission notice shall be
16
+ # included in all copies or substantial portions of the Software.
17
+ #
18
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
19
+ # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20
+ # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
21
+ # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
22
+ # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
23
+ # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
24
+ # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25
+ #
26
+
27
+ # system setup
28
+ #
29
+ include_recipe "apt"
30
+ include_recipe "build-essential"
31
+
32
+ # install ruby 1.9
33
+ #
34
+ package "ruby1.9.1"
35
+ package "ruby1.9.1-dev"
36
+
37
+ bash "update-alternatives --set ruby /usr/bin/ruby1.9.1"
38
+ bash "update-alternatives --set gem /usr/bin/gem1.9.1"
39
+
40
+ # add RightScale API credentials
41
+ #
42
+ directory "/home/vagrant/.right_api_client"
43
+
44
+ template "/home/vagrant/.right_api_client/login.yml" do
45
+ source "login.yml.erb"
46
+ user "vagrant"
47
+ mode 0600
48
+ variables({
49
+ :user_email => node['right_api_helper']['user_email'],
50
+ :user_password => node['right_api_helper']['user_password'],
51
+ :account_id => node['right_api_helper']['account_id']
52
+ })
53
+ end
54
+
55
+ # install gem
56
+ #
57
+ gem_package "right_api_helper"
58
+
59
+
60
+
61
+
@@ -0,0 +1,28 @@
1
+ #
2
+ # Cookbook Name:: right_api_helper
3
+ # Recipe:: default
4
+ #
5
+ # Copyright (C) 2014 RightScale, Inc.
6
+ #
7
+ # Permission is hereby granted, free of charge, to any person obtaining
8
+ # a copy of this software and associated documentation files (the
9
+ # "Software"), to deal in the Software without restriction, including
10
+ # without limitation the rights to use, copy, modify, merge, publish,
11
+ # distribute, sublicense, and/or sell copies of the Software, and to
12
+ # permit persons to whom the Software is furnished to do so, subject to
13
+ # the following conditions:
14
+ #
15
+ # The above copyright notice and this permission notice shall be
16
+ # included in all copies or substantial portions of the Software.
17
+ #
18
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
19
+ # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20
+ # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
21
+ # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
22
+ # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
23
+ # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
24
+ # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25
+ #
26
+
27
+ include_recipe "git"
28
+ gem_package "bundler"
@@ -0,0 +1,35 @@
1
+ # The API login details can be put in a YAML file. This is an example login.yml which
2
+ # will be needed for login_to_client_irb.rb quick login method.
3
+
4
+ # Account ID is a required parameter. You can find your account number by logging into the
5
+ # RightScale dashboard (https://my.rightscale.com), navigate to the Settings > Account Settings page.
6
+ # The account number is at the end of the browser address bar.
7
+ :account_id: <%= @account_id %>
8
+
9
+ # There are five login mechanisms:
10
+
11
+ # 0. Use the following parameters to login with your email and base64-encoded password:
12
+ # To encode your plaintext password, use 'base64' command or similar.
13
+ #:email: <%= @user_email %>
14
+ #:password_base64: my_password_encoded_as_base64
15
+
16
+ # 1. Use the following parameters to login with your email and plaintext password:
17
+ :email: <%= @user_email %>
18
+ :password: <%= @user_password %>
19
+
20
+ # 2. Use the following parameter to login with an instance_token:
21
+ # To find the instance_token, launch a server, navigate to the info page and under
22
+ # User Data box, you will see RS_API_TOKEN = your_account_id:the_instance_token
23
+ #:instance_token: my_instance_token
24
+
25
+ # 3. Use the following parameter to send a pre-authenticated cookie with every request:
26
+ #:cookies: my_cookie_string
27
+
28
+ # 4. Use the following parameter to send an existing OAuth access token with every request:
29
+ # To learn more about OAuth and how to obtain an access token, see
30
+ # http://support.rightscale.com/12-Guides/03-Rightscale_API/OAuth
31
+ #:access_token: my_token_string
32
+
33
+ # The following are optional parameters:
34
+ #:api_url: (this defaults to https://my.rightscale.com)
35
+ #:api_version: (this defaults to 1.5)
@@ -1,3 +1,3 @@
1
1
  module RightApiHelper
2
- VERSION = "0.0.2"
2
+ VERSION = "1.0.0"
3
3
  end
data/spec/spec_helper.rb CHANGED
@@ -28,8 +28,8 @@ VCR.configure do |c|
28
28
  c.hook_into :webmock
29
29
  c.configure_rspec_metadata!
30
30
 
31
- # Uncomment this to record new cassettes
32
- #c.default_cassette_options = { :record => :all }
31
+ # Comment this to record new cassettes for fast unit testing
32
+ c.default_cassette_options = { :record => :all }
33
33
 
34
34
  # filer out authentication data
35
35
  login_info = YAML::load(File.open("#{ENV['HOME']}/.right_api_client/login.yml"))
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: right_api_helper
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 1.0.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -153,7 +153,20 @@ files:
153
153
  - LICENSE
154
154
  - README.md
155
155
  - Rakefile
156
+ - Vagrantfile
156
157
  - bin/organize
158
+ - cookbooks/right_api_helper/.gitignore
159
+ - cookbooks/right_api_helper/Berksfile
160
+ - cookbooks/right_api_helper/Gemfile
161
+ - cookbooks/right_api_helper/LICENSE
162
+ - cookbooks/right_api_helper/README.md
163
+ - cookbooks/right_api_helper/Thorfile
164
+ - cookbooks/right_api_helper/attributes/default.rb
165
+ - cookbooks/right_api_helper/chefignore
166
+ - cookbooks/right_api_helper/metadata.rb
167
+ - cookbooks/right_api_helper/recipes/default.rb
168
+ - cookbooks/right_api_helper/recipes/development.rb
169
+ - cookbooks/right_api_helper/templates/default/login.yml.erb
157
170
  - demo/deployments.json
158
171
  - demo/index.html
159
172
  - demo/logo.png