Skip to content

Commit

Permalink
Merge pull request #7 from socrata-cookbooks/jdh-update-deps
Browse files Browse the repository at this point in the history
Update deps
  • Loading branch information
hartmantis committed Oct 28, 2016
2 parents d874911 + d61e89f commit 67a4c51
Show file tree
Hide file tree
Showing 59 changed files with 616 additions and 865 deletions.
2 changes: 2 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
AllCops:
TargetRubyVersion: 2.3
9 changes: 4 additions & 5 deletions Berksfile
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
# Encoding: UTF-8
# encoding: utf-8
# frozen_string_literal: true

source 'https://supermarket.chef.io'

metadata

group :unit do
cookbook 'resource_x2go_client_test',
path: 'spec/support/cookbooks/resource_x2go_client_test'
cookbook 'resource_x2go_client_app_test',
path: 'spec/support/cookbooks/resource_x2go_client_app_test'
cookbook 'resource_test',
path: 'spec/support/cookbooks/resource_test'
end

group :integration do
Expand Down
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ X2go Client Cookbook CHANGELOG

Unreleased
----------
- Update dependency cookbook pins
- Clean up new style offenses
- Remove direct dependency on the apt cookbook

v1.0.0 (2016-03-03)
-------------------
Expand Down
6 changes: 3 additions & 3 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Encoding: UTF-8
# encoding: utf-8
# frozen_string_literal: true

source 'https://rubygems.org'

Expand All @@ -22,7 +23,6 @@ group :test do
gem 'fauxhai'
gem 'test-kitchen'
gem 'kitchen-vagrant'
gem 'winrm-transport'
gem 'winrm-fs'
gem 'kitchen-docker'
gem 'kitchen-localhost'
Expand All @@ -37,6 +37,6 @@ group :deploy do
end

group :production do
gem 'chef', '>= 11'
gem 'chef', '>= 12.5'
gem 'berkshelf'
end
3 changes: 2 additions & 1 deletion Guardfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Encoding: UTF-8
# encoding: utf-8
# frozen_string_literal: true

guard :rspec, all_on_start: true, notification: false do
watch(%r{^spec/.+_spec\.rb$})
Expand Down
3 changes: 2 additions & 1 deletion Rakefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Encoding: UTF-8
# encoding: utf-8
# frozen_string_literal: true

require 'rubygems'
require 'English'
Expand Down
3 changes: 2 additions & 1 deletion attributes/default.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Encoding: UTF-8
# encoding: utf-8
# frozen_string_literal: true
#
# Cookbook Name:: x2go-client
# Attributes:: default
Expand Down
6 changes: 1 addition & 5 deletions circle.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
machine:
ruby:
version: 2.1.6
version: 2.3.1
services:
- docker

dependencies:
pre:
- rvm install 2.0.0-p645
override:
- gem install -V berkshelf
- rvm-exec 2.0.0-p645 gem install -V berkshelf
- bundle install --without=development integration
- rvm-exec 2.0.0-p645 bundle install --without=development integration
cache_directories:
- /home/ubuntu/.rvm/gems

Expand All @@ -20,5 +17,4 @@ test:
- cp .kitchen.circle.yml .kitchen.local.yml
override:
- bundle exec rake
- rvm-exec 2.0.0-p645 bundle exec rake
- bundle exec kitchen test
3 changes: 2 additions & 1 deletion libraries/matchers.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Encoding: UTF-8
# encoding: utf-8
# frozen_string_literal: true
#
# Cookbook Name:: x2go-client
# Library:: matchers
Expand Down
3 changes: 2 additions & 1 deletion libraries/resource_x2go_client.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Encoding: UTF-8
# encoding: utf-8
# frozen_string_literal: true
#
# Cookbook Name:: x2go-client
# Library:: resource_x2go_client
Expand Down
3 changes: 2 additions & 1 deletion libraries/resource_x2go_client_app.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Encoding: UTF-8
# encoding: utf-8
# frozen_string_literal: true
#
# Cookbook Name:: x2go-client
# Library:: resource_x2go_client_app
Expand Down
7 changes: 2 additions & 5 deletions libraries/resource_x2go_client_app_debian.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Encoding: UTF-8
# encoding: utf-8
# frozen_string_literal: true
#
# Cookbook Name:: x2go-client
# Library:: resource_x2go_client_app_debian
Expand All @@ -18,7 +19,6 @@
# limitations under the License.
#

require 'chef/dsl/include_recipe'
require_relative 'resource_x2go_client_app'

class Chef
Expand All @@ -27,15 +27,12 @@ class Resource
#
# @author Jonathan Hartman <jonathan.hartman@socrata.com>
class X2goClientAppDebian < X2goClientApp
include Chef::DSL::IncludeRecipe

provides :x2go_client_app, platform: 'debian'

#
# Set up the X2go APT repo and install the client packages.
#
action :install do
include_recipe 'apt'
new_resource.source.nil? && apt_repository('x2go') do
uri 'http://packages.x2go.org/debian'
distribution node['lsb']['codename']
Expand Down
3 changes: 2 additions & 1 deletion libraries/resource_x2go_client_app_fedora.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Encoding: UTF-8
# encoding: utf-8
# frozen_string_literal: true
#
# Cookbook Name:: x2go-client
# Library:: resource_x2go_client_app_fedora
Expand Down
9 changes: 5 additions & 4 deletions libraries/resource_x2go_client_app_mac_os_x.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Encoding: UTF-8
# encoding: utf-8
# frozen_string_literal: true
#
# Cookbook Name:: x2go-client
# Library:: resource_x2go_client_app_mac_os_x
Expand Down Expand Up @@ -27,7 +28,7 @@ class Resource
#
# @author Jonathan Hartman <jonathan.hartman@socrata.com>
class X2goClientAppMacOsX < X2goClientApp
PATH ||= '/Applications/x2goclient.app'.freeze
PATH ||= '/Applications/x2goclient.app'

include Chef::DSL::IncludeRecipe

Expand Down Expand Up @@ -62,12 +63,12 @@ class X2goClientAppMacOsX < X2goClientApp
#
def remote_path
pv = node['platform_version']
url = 'http://code.x2go.org/releases/'
url << if Gem::Version.new(pv) >= Gem::Version.new('10.9')
file = if Gem::Version.new(pv) >= Gem::Version.new('10.9')
'X2GoClient_latest_macosx_10_9.dmg'
else
'X2GoClient_latest_macosx.dmg'
end
"http://code.x2go.org/releases/#{file}"
end
end
end
Expand Down
3 changes: 2 additions & 1 deletion libraries/resource_x2go_client_app_rhel.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Encoding: UTF-8
# encoding: utf-8
# frozen_string_literal: true
#
# Cookbook Name:: x2go-client
# Library:: resource_x2go_client_app_rhel
Expand Down
7 changes: 2 additions & 5 deletions libraries/resource_x2go_client_app_ubuntu.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Encoding: UTF-8
# encoding: utf-8
# frozen_string_literal: true
#
# Cookbook Name:: x2go-client
# Library:: resource_x2go_client_app_ubuntu
Expand All @@ -18,7 +19,6 @@
# limitations under the License.
#

require 'chef/dsl/include_recipe'
require_relative 'resource_x2go_client_app'

class Chef
Expand All @@ -27,15 +27,12 @@ class Resource
#
# @author Jonathan Hartman <jonathan.hartman@socrata.com>
class X2goClientAppUbuntu < X2goClientApp
include Chef::DSL::IncludeRecipe

provides :x2go_client_app, platform: 'ubuntu'

#
# Set up the X2go APT repo and install the client package.
#
action :install do
include_recipe 'apt'
new_resource.source.nil? && apt_repository('x2go') do
uri 'ppa:x2go/stable'
distribution node['lsb']['codename']
Expand Down
7 changes: 4 additions & 3 deletions libraries/resource_x2go_client_app_windows.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Encoding: UTF-8
# encoding: utf-8
# frozen_string_literal: true
#
# Cookbook Name:: x2go-client
# Library:: resource_x2go_client_app_windows
Expand Down Expand Up @@ -26,9 +27,9 @@ class Resource
#
# @author Jonathan Hartman <jonathan.hartman@socrata.com>
class X2goClientAppWindows < X2goClientApp
PATH ||= ::File.expand_path('/Program Files (x86)/x2goclient').freeze
PATH ||= ::File.expand_path('/Program Files (x86)/x2goclient')
URL ||= 'http://code.x2go.org/releases/' \
'X2GoClient_latest_mswin32-setup.exe'.freeze
'X2GoClient_latest_mswin32-setup.exe'

provides :x2go_client_app, platform_family: 'windows'

Expand Down
42 changes: 23 additions & 19 deletions metadata.rb
Original file line number Diff line number Diff line change
@@ -1,24 +1,28 @@
# Encoding: UTF-8
# encoding: utf-8
# frozen_string_literal: true

name 'x2go-client'
maintainer 'Jonathan Hartman'
name 'x2go-client'
maintainer 'Jonathan Hartman'
maintainer_email 'jonathan.hartman@socrata.com'
license 'apache2'
description 'Installs/Configures x2go-client'
license 'apache2'
description 'Installs/Configures x2go-client'
long_description 'Installs/Configures x2go-client'
version '1.0.1'
version '1.0.1'
chef_version '>= 12.1'

depends 'xquartz', '~> 1.1'
depends 'dmg', '~> 2.2'
depends 'windows', '~> 1.38'
depends 'apt', '~> 3.0'
depends 'yum-epel', '~> 0.6'
source_url 'https://github.com/socrata-cookbooks/x2go-client'
issues_url 'https://github.com/socrata-cookbooks/x2go-client/issues'

supports 'mac_os_x'
supports 'windows'
supports 'ubuntu'
supports 'debian'
supports 'redhat'
supports 'centos'
supports 'scientific'
supports 'fedora'
depends 'xquartz', '~> 1.1'
depends 'dmg', '~> 3.0'
depends 'windows', '~> 2.0'
depends 'yum-epel', '~> 1.0'

supports 'mac_os_x'
supports 'windows'
supports 'ubuntu'
supports 'debian'
supports 'redhat'
supports 'centos'
supports 'scientific'
supports 'fedora'
3 changes: 2 additions & 1 deletion recipes/default.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Encoding: UTF-8
# encoding: utf-8
# frozen_string_literal: true
#
# Cookbook Name:: x2go-client
# Recipe:: default
Expand Down
3 changes: 2 additions & 1 deletion spec/recipes/default_spec.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Encoding: UTF-8
# encoding: utf-8
# frozen_string_literal: true

require_relative '../spec_helper'

Expand Down
25 changes: 25 additions & 0 deletions spec/resources.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# encoding: utf-8
# frozen_string_literal: true

require_relative 'spec_helper'

shared_context 'resources' do
%i(resource name platform platform_version action).each { |p| let(p) { nil } }
let(:properties) { {} }
let(:runner) do
ChefSpec::SoloRunner.new(
step_into: resource, platform: platform, version: platform_version
) do |node|
%i(resource name action).each do |p|
next if send(p).nil?
node.default['resource_test'][p] = send(p)
end
properties.each do |k, v|
next if v.nil?
node.default['resource_test']['properties'][k] = v
end
end
end
let(:converge) { runner.converge('resource_test') }
let(:chef_run) { converge }
end
42 changes: 42 additions & 0 deletions spec/resources/x2go_client.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# encoding: utf-8
# frozen_string_literal: true

require_relative '../resources'

shared_context 'resources::x2go_client' do
include_context 'resources'

let(:resource) { 'x2go_client' }
%i(source).each { |p| let(p) { nil } }
let(:properties) { { source: source } }
let(:name) { 'default' }

shared_examples_for 'any platform' do
context 'the default action (:create)' do
shared_examples_for 'any property set' do
it 'installs the x2go_client_app' do
expect(chef_run).to install_x2go_client_app('default')
.with(source: source)
end
end

context 'the default properties' do
it_behaves_like 'any property set'
end

context 'a source property' do
let(:source) { 'https://example.com/x2go.pkg' }

it_behaves_like 'any property set'
end
end

context 'the :remove action' do
let(:action) { :remove }

it 'removes the x2go_client_app' do
expect(chef_run).to remove_x2go_client_app('default')
end
end
end
end
Loading

0 comments on commit 67a4c51

Please sign in to comment.