Skip to content
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
1 change: 1 addition & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
PATH_add bin
30 changes: 30 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Ruby

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
test:

runs-on: ubuntu-latest

strategy:
matrix:
ruby-version: [jruby-9.3]

steps:
- uses: actions/checkout@v2
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby-version }}
bundler-cache: true
- name: Install dependencies
run: bundle install
- name: Run RuboCop
run: bundle exec rubocop
- name: Run test
run: bundle exec rake specs
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
pkg
# no Gemfile.lock
Gemfile.lock
.ruby-version
*.gem
target
Expand Down
6 changes: 6 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
repos:
- repo: https://github.com/mattlqx/pre-commit-ruby
rev: v1.3.5
hooks:
- id: rubocop

48 changes: 25 additions & 23 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,32 +1,34 @@
AllCops:
TargetRubyVersion: 2.1
Exclude:
- 'Gemfile.lock'
- pkg/**/*

Style/Copyright:
Enabled: false
require:
- rubocop-rake
- rubocop-performance

Style/Documentation:
Enabled: false
AllCops:
TargetRubyVersion: 2.6
NewCops: enable

Style/SafeNavigation:
Metrics:
Enabled: false

Style/SymbolArray:
EnforcedStyle: brackets
Naming/FileName:
Exclude:
- lib/jar-dependencies.rb

Style/FrozenStringLiteralComment:
Enabled: false
Performance/Casecmp:
AutoCorrect: false

Style/Dir:
Style/Alias:
EnforcedStyle: prefer_alias_method
Style/BlockDelimiters:
IgnoredMethods: []
Style/Documentation:
Enabled: false

Layout/IndentHeredoc:
Style/EnvHome:
Enabled: false

Layout/MultilineMethodCallIndentation:
EnforcedStyle: indented

Performance/RegexpMatch:
Style/FetchEnvVar:
Enabled: false
Style/HashSyntax:
EnforcedStyle: ruby19_no_mixed_keys
Style/RescueStandardError:
EnforcedStyle: implicit
Style/TernaryParentheses:
EnforcedStyle: require_parentheses_when_complex
26 changes: 0 additions & 26 deletions .travis.yml

This file was deleted.

8 changes: 2 additions & 6 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
#-*- mode: ruby -*-
# frozen_string_literal: true

source 'https://rubygems.org'

gemspec

gem 'copyright-header', '1.0.8', platform: :mri, group: :copyright

gem 'pry', require: false, group: :development
gem 'ffi', '~> 1.11.3', require: false, group: :development
63 changes: 63 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
PATH
remote: .
specs:
jar-dependencies (0.4.1)

GEM
remote: https://rubygems.org/
specs:
ast (2.4.2)
columnize (0.9.0)
json (2.6.2-java)
linecache (1.3.1-java)
minitest (5.10.3)
parallel (1.22.1)
parser (3.1.2.0)
ast (~> 2.4.1)
rainbow (3.1.1)
rake (13.0.6)
regexp_parser (2.5.0)
rexml (3.2.5)
rubocop (1.31.1)
json (~> 2.3)
parallel (~> 1.10)
parser (>= 3.1.0.0)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 1.8, < 3.0)
rexml (>= 3.2.5, < 4.0)
rubocop-ast (>= 1.18.0, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 1.4.0, < 3.0)
rubocop-ast (1.18.0)
parser (>= 3.1.1.0)
rubocop-performance (1.14.2)
rubocop (>= 1.7.0, < 2.0)
rubocop-ast (>= 0.4.0)
rubocop-rake (0.6.0)
rubocop (~> 1.0)
ruby-debug (0.11.0)
columnize (>= 0.1)
linecache (~> 1.3.1)
ruby-debug-base (~> 0.11.0.0)
ruby-debug-base (0.11.0-java)
ruby-maven (3.3.13)
ruby-maven-libs (~> 3.3.9)
ruby-maven-libs (3.3.9)
ruby-progressbar (1.11.0)
unicode-display_width (2.2.0)

PLATFORMS
universal-java-11

DEPENDENCIES
jar-dependencies!
minitest (~> 5.10.0)
rake (~> 13.0)
rubocop (~> 1.31)
rubocop-performance (~> 1.14)
rubocop-rake (~> 0.6)
ruby-debug (~> 0.11)
ruby-maven (~> 3.3)

BUNDLED WITH
2.3.16
4 changes: 1 addition & 3 deletions Mavenfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#-*- mode: ruby -*-
# frozen_string_literal: true

gemfile

Expand Down Expand Up @@ -59,5 +59,3 @@ profile id: :release do
default_goal :deploy
end
end

# vim: syntax=Ruby
28 changes: 6 additions & 22 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
#-*- mode: ruby -*-
# frozen_string_literal: true

task default: [:specs]

require 'bundler/gem_tasks'
require 'rubocop/rake_task'

RuboCop::RakeTask.new

desc 'run specs'
task :specs do
$LOAD_PATH << 'specs'
Expand All @@ -10,24 +15,3 @@ task :specs do
require File.basename(f.sub(/.rb$/, ''))
end
end

task :headers do
require 'copyright_header'

s = Gem::Specification.load(Dir['*gemspec'].first)

args = {
license: s.license,
copyright_software: s.name,
copyright_software_description: s.description,
copyright_holders: s.authors,
copyright_years: [Time.now.year],
add_path: 'lib',
output_dir: './'
}

command_line = CopyrightHeader::CommandLine.new(args)
command_line.execute
end

# vim: syntax=Ruby
2 changes: 1 addition & 1 deletion Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ during installation.

If you do not want to vendor jars into a gem then **jar-dependency** gem can vendor
them when you install the gem. In that case do not use
`Jars::JarInstaller.install_jars` from the above rake tasks.
`Jars::Installer.install_jars` from the above rake tasks.

**NOTE**: Recent JRuby comes with **jar-dependencies** as default gem, for older
versions for the feature to work you need to gem install **jar-dependencies** first
Expand Down
27 changes: 27 additions & 0 deletions bin/rake
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/usr/bin/env ruby
# frozen_string_literal: true

#
# This file was generated by Bundler.
#
# The application 'rake' is installed as part of a gem, and
# this file is here to facilitate running it.
#

ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)

bundle_binstub = File.expand_path('bundle', __dir__)

if File.file?(bundle_binstub)
if File.read(bundle_binstub, 300).include?('This file was generated by Bundler')
load(bundle_binstub)
else
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
end
end

require 'rubygems'
require 'bundler/setup'

load Gem.bin_path('rake', 'rake')
27 changes: 27 additions & 0 deletions bin/rubocop
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/usr/bin/env ruby
# frozen_string_literal: true

#
# This file was generated by Bundler.
#
# The application 'rubocop' is installed as part of a gem, and
# this file is here to facilitate running it.
#

ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)

bundle_binstub = File.expand_path('bundle', __dir__)

if File.file?(bundle_binstub)
if File.read(bundle_binstub, 300).include?('This file was generated by Bundler')
load(bundle_binstub)
else
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
end
end

require 'rubygems'
require 'bundler/setup'

load Gem.bin_path('rubocop', 'rubocop')
2 changes: 2 additions & 0 deletions example/Gemfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

# bundle install will download and install the jar dependencies
# as well create the lib/example_jars.rb which loads the jars at
# runtime
Expand Down
13 changes: 5 additions & 8 deletions example/Rakefile
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
#-*- mode: ruby -*-
# frozen_string_literal: true

require 'rspec/core/rake_task'
require 'jars/classpath'
require 'rake/javaextensiontask'

require 'jars/installer'
task :install_jars do
Jars::JarInstaller.new.vendor_jars
# Jars::JarInstaller.new.install_jars
Jars::Installer.new.vendor_jars
end

desc 'Compiles extension and run specs'
task default: [:compile, :spec]
task default: %i[compile spec]

spec = eval File.read('example.gemspec')
spec = eval File.read('example.gemspec') # rubocop:disable Security/Eval

desc 'compile src/main/java/** into lib/example.jar'
Rake::JavaExtensionTask.new('example', spec) do |ext|
Expand All @@ -26,10 +25,8 @@ end
require 'rubygems/package_task'
Gem::PackageTask.new(spec) do
desc 'Pack gem'
task package: [:install_jars, :compile]
task package: %i[install_jars compile]
end

desc 'Run specs'
RSpec::Core::RakeTask.new

# vim: syntax=Ruby
7 changes: 4 additions & 3 deletions example/example.gemspec
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#-*- mode: ruby -*-
# frozen_string_literal: true

Gem::Specification.new do |s|
# this is only needed to retrieve the latest version of jar-dependencies
Expand All @@ -21,6 +21,8 @@ Gem::Specification.new do |s|
s.files << Dir['*file']
s.files << 'example.gemspec'

s.required_ruby_version = '>= 2.6'

# constrain the version of jar-dependencies itself
s.add_runtime_dependency 'jar-dependencies', "~> #{version}"

Expand Down Expand Up @@ -51,6 +53,5 @@ Gem::Specification.new do |s|

# avoids to install it on the fly when jar-dependencies needs it
s.add_development_dependency 'ruby-maven', '~> 3.3', '>= 3.3.8'
s.metadata['rubygems_mfa_required'] = 'true'
end

# vim: syntax=Ruby
2 changes: 2 additions & 0 deletions example/lib/example.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

# this require will load ALL dependent jars or the jars from Jars.lock if
# the lock file exeists
require 'example_jars'
Expand Down
Loading