Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make the server parts JRuby compatible #15

Merged
merged 4 commits into from
Jan 25, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,20 @@ language: ruby
before_install: gem install bundler -v 1.15.4
bundler_args: "--without development"
script:
- echo travis_fold:start:DEBUG
- cat Gemfile.lock
- bundle list
- echo travis_fold:end:DEBUG
- COVERAGE=yes bundle exec rake $CHECK
cache: bundler
matrix:
include:
- rvm: 2.4.1
env: PUPPET_GEM_VERSION='~> 5'
- rvm: jruby-1.7.26
env: PUPPET_GEM_VERSION='~> 5'
- rvm: jruby-9.1.9.0
env: PUPPET_GEM_VERSION='~> 5'
- rvm: 2.4.1
env: CHECK=rubocop
- rvm: 2.4.1
Expand Down
23 changes: 17 additions & 6 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,13 +1,24 @@
require "bundler/gem_tasks"
require "rspec/core/rake_task"
require 'rubocop/rake_task'
require 'bundler/gem_tasks'

RSpec::Core::RakeTask.new(:spec)
task :default => :spec

#### RUBOCOP ####
require 'rubocop/rake_task'

RuboCop::RakeTask.new(:rubocop) do |t|
t.options = ['--display-cop-names']
end

#### RSPEC ####
require 'rspec/core/rake_task'

RSpec::Core::RakeTask.new(:spec) do |t|
if RUBY_PLATFORM == "java"
t.exclude_pattern = 'spec/{acceptance/**/*.rb,integration/**/*.rb,puppet/resource_api/{*_context,command}_spec.rb,puppet/util/network_device/simple/device_spec.rb}'
t.rspec_opts = '--tag ~agent_test'
end
end

namespace :spec do
desc 'Run RSpec code examples with coverage collection'
task :coverage do
Expand All @@ -16,13 +27,13 @@ namespace :spec do
end
end

#### LICENSE_FINDER ####
desc 'Check for unapproved licenses in dependencies'
task(:license_finder) do
system('license_finder --decisions-file=.dependency_decisions.yml') || raise(StandardError, 'Unapproved license(s) found on dependencies')
end

task :default => :spec

#### CHANGELOG ####
begin
require 'github_changelog_generator/task'
GitHubChangelogGenerator::RakeTask.new :changelog do |config|
Expand Down
5 changes: 3 additions & 2 deletions lib/puppet/resource_api.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
require 'pathname'
require 'puppet/resource_api/command'
# do not load command support on the puppetserver
require 'puppet/resource_api/command' unless RUBY_PLATFORM == 'java'
require 'puppet/resource_api/errors'
require 'puppet/resource_api/glue'
require 'puppet/resource_api/puppet_context'
require 'puppet/resource_api/puppet_context' unless RUBY_PLATFORM == 'java'
require 'puppet/resource_api/version'
require 'puppet/type'

Expand Down
1 change: 0 additions & 1 deletion spec/puppet/resource_api/command_spec.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
require 'spec_helper'
require 'puppet/resource_api/command'

RSpec.describe Puppet::ResourceApi::Command do
subject(:command) { described_class.new 'commandname' }
Expand Down
8 changes: 4 additions & 4 deletions spec/puppet/resource_api_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@
end
end

describe '#load_provider' do
describe '#load_provider', agent_test: true do
before(:each) { described_class.register_type(definition) }

context 'when loading a non-existing provider' do
Expand All @@ -372,7 +372,7 @@
end
end

context 'with a provider that does canonicalization' do
context 'with a provider that does canonicalization', agent_test: true do
let(:definition) do
{
name: 'canonicalizer',
Expand Down Expand Up @@ -481,7 +481,7 @@ def set(_context, changes)
end
end

context 'with a provider that does not need canonicalization' do
context 'with a provider that does not need canonicalization', agent_test: true do
let(:definition) do
{
name: 'passthrough',
Expand Down Expand Up @@ -583,7 +583,7 @@ def set(_context, changes)
end
end

context 'with a `remote_resource` provider' do
context 'with a `remote_resource` provider', agent_test: true do
let(:definition) do
{
name: 'remoter',
Expand Down