ruby_leiningen 0.0.1
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.
- checksums.yaml +7 -0
- data/.circleci/config.yml +56 -0
- data/.circleci/gpg.private.enc +0 -0
- data/.envrc +5 -0
- data/.git-crypt/.gitattributes +4 -0
- data/.git-crypt/keys/default/0/41D2606F66C3FF28874362B61A16916844CE9D82.gpg +0 -0
- data/.git-crypt/keys/default/0/837D1812341A8C7F3E556D33623A196DE10A7326.gpg +0 -0
- data/.gitattributes +1 -0
- data/.gitignore +32 -0
- data/.rspec +2 -0
- data/.ruby-version +1 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +4 -0
- data/Gemfile.lock +59 -0
- data/LICENSE.txt +21 -0
- data/README.md +111 -0
- data/Rakefile +24 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/config/secrets/.unlocked +1 -0
- data/config/secrets/ci/encryption.passphrase +1 -0
- data/config/secrets/ci/gpg.private +105 -0
- data/config/secrets/ci/gpg.public +51 -0
- data/config/secrets/ci/ssh.private +51 -0
- data/config/secrets/ci/ssh.public +1 -0
- data/config/secrets/rubygems/credentials +2 -0
- data/go +56 -0
- data/lib/ruby_leiningen/commands/base.rb +53 -0
- data/lib/ruby_leiningen/commands/check.rb +17 -0
- data/lib/ruby_leiningen/commands/clean.rb +17 -0
- data/lib/ruby_leiningen/commands/deps.rb +17 -0
- data/lib/ruby_leiningen/commands/mixins/profile.rb +27 -0
- data/lib/ruby_leiningen/commands/run.rb +35 -0
- data/lib/ruby_leiningen/commands/uberjar.rb +22 -0
- data/lib/ruby_leiningen/commands/version.rb +24 -0
- data/lib/ruby_leiningen/commands.rb +57 -0
- data/lib/ruby_leiningen/version.rb +3 -0
- data/lib/ruby_leiningen.rb +36 -0
- data/ruby_leiningen.gemspec +34 -0
- data/scripts/ci/common/configure-git.sh +8 -0
- data/scripts/ci/common/configure-rubygems.sh +16 -0
- data/scripts/ci/common/install-git-crypt.sh +8 -0
- data/scripts/ci/common/install-gpg-key.sh +19 -0
- data/scripts/ci/steps/prerelease.sh +16 -0
- data/scripts/ci/steps/release.sh +18 -0
- data/scripts/ci/steps/test.sh +12 -0
- metadata +179 -0
@@ -0,0 +1 @@
|
|
1
|
+
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDeC/IOvJFbCF0omlHrq6tZmV1Z6ygJKTM1WkFs7A/xBGya/tr/WhRvkkbv2u6sa5Lxf4d3R5xlYbxVIbmiVzHEz0QofVIqYy6LyOoW98ytKTlj4QL3qzc6dWyBf4BTmlwIoowflEpQGNHDFPiOR0/A+cAabeYQ2OoBPZUl7YvqFSCLYsUdCE3drqjoZG6YkLWBjZwHM6RW50g7Hz7Rw46xGiERZbDR5HZb+j+p2D3CIxNBsESvfa9eZRiyXBO4DBRMrgkuba61VFu7kHIkU4TfnEQ+h4TagsAuOcmh9DHokHCam2YdmQqC78RD88wDb3FGUpbnjNCaAB6dLq25P7vsseYnlgzNtA+WSx01LkBoCfUP/v/YgI5anhKdmSWDIr2f+Zl5+Eq5SJuBsp/eYSN2GZyuocsmwtwzdUaKktQOXr8mpLEUwB5kuYA500CpJOnkhaANWlYDqvwbzFeWSNH/Bugo1fMbSwKy0HRDT1/lwOZyqce5TAq88yDncNzl3gtWxXdqHWs4TIeNeYFdST94eWyEBJWjn3HfoM6DRO7kcnSw56mOpR813ZNj4ORKMaoQ/HdXZtur9Hpiu72Gr95JuZMQTvIGRszWWmvvTMiTao4WhrvzhKLJNQHNECEa6/xmn0zat22diNRz8rR+1BytqOE2oncDgYO94C1QxZ8vyQ== maintainers@infrablocks.io
|
data/go
ADDED
@@ -0,0 +1,56 @@
|
|
1
|
+
#!/usr/bin/env bash
|
2
|
+
|
3
|
+
[ -n "$GO_DEBUG" ] && set -x
|
4
|
+
set -e
|
5
|
+
|
6
|
+
project_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
7
|
+
|
8
|
+
verbose="no"
|
9
|
+
skip_checks="no"
|
10
|
+
offline="no"
|
11
|
+
|
12
|
+
missing_dependency="no"
|
13
|
+
|
14
|
+
[ -n "$GO_DEBUG" ] && verbose="yes"
|
15
|
+
[ -n "$GO_SKIP_CHECKS" ] && skip_checks="yes"
|
16
|
+
[ -n "$GO_OFFLINE" ] && offline="yes"
|
17
|
+
|
18
|
+
|
19
|
+
if [[ "$skip_checks" = "no" ]]; then
|
20
|
+
echo "Checking for system dependencies."
|
21
|
+
ruby_version="$(cat "$project_dir"/.ruby-version)"
|
22
|
+
if ! type ruby >/dev/null 2>&1 || ! ruby -v | grep -q "$ruby_version"; then
|
23
|
+
echo "This codebase requires Ruby $ruby_version."
|
24
|
+
missing_dependency="yes"
|
25
|
+
fi
|
26
|
+
|
27
|
+
if [[ "$missing_dependency" = "yes" ]]; then
|
28
|
+
echo "Please install missing dependencies to continue."
|
29
|
+
exit 1
|
30
|
+
fi
|
31
|
+
|
32
|
+
echo "All system dependencies present. Continuing."
|
33
|
+
fi
|
34
|
+
|
35
|
+
if [[ "$offline" = "no" ]]; then
|
36
|
+
echo "Installing bundler."
|
37
|
+
if [[ "$verbose" = "yes" ]]; then
|
38
|
+
gem install --no-document bundler
|
39
|
+
else
|
40
|
+
gem install --no-document bundler > /dev/null
|
41
|
+
fi
|
42
|
+
|
43
|
+
echo "Installing ruby dependencies."
|
44
|
+
if [[ "$verbose" = "yes" ]]; then
|
45
|
+
bundle install
|
46
|
+
else
|
47
|
+
bundle install > /dev/null
|
48
|
+
fi
|
49
|
+
fi
|
50
|
+
|
51
|
+
echo "Starting rake."
|
52
|
+
if [[ "$verbose" = "yes" ]]; then
|
53
|
+
time bundle exec rake --verbose "$@"
|
54
|
+
else
|
55
|
+
time bundle exec rake "$@"
|
56
|
+
fi
|
@@ -0,0 +1,53 @@
|
|
1
|
+
require 'lino'
|
2
|
+
|
3
|
+
module RubyLeiningen
|
4
|
+
module Commands
|
5
|
+
class Base
|
6
|
+
attr_reader :binary
|
7
|
+
|
8
|
+
def initialize(binary: nil)
|
9
|
+
@binary = binary || RubyLeiningen.configuration.binary
|
10
|
+
end
|
11
|
+
|
12
|
+
def stdin
|
13
|
+
''
|
14
|
+
end
|
15
|
+
|
16
|
+
def stdout
|
17
|
+
STDOUT
|
18
|
+
end
|
19
|
+
|
20
|
+
def stderr
|
21
|
+
STDERR
|
22
|
+
end
|
23
|
+
|
24
|
+
def execute(opts = {})
|
25
|
+
builder = instantiate_builder
|
26
|
+
|
27
|
+
do_before(opts)
|
28
|
+
configure_command(builder, opts)
|
29
|
+
.build
|
30
|
+
.execute(
|
31
|
+
stdin: stdin,
|
32
|
+
stdout: stdout,
|
33
|
+
stderr: stderr)
|
34
|
+
do_after(opts)
|
35
|
+
end
|
36
|
+
|
37
|
+
def instantiate_builder
|
38
|
+
Lino::CommandLineBuilder
|
39
|
+
.for_command(binary)
|
40
|
+
end
|
41
|
+
|
42
|
+
def do_before(opts)
|
43
|
+
end
|
44
|
+
|
45
|
+
def configure_command(builder, opts)
|
46
|
+
builder
|
47
|
+
end
|
48
|
+
|
49
|
+
def do_after(opts)
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'lino'
|
2
|
+
|
3
|
+
require_relative 'base'
|
4
|
+
require_relative 'mixins/profile'
|
5
|
+
|
6
|
+
module RubyLeiningen
|
7
|
+
module Commands
|
8
|
+
class Check < Base
|
9
|
+
include Mixins::Profile
|
10
|
+
|
11
|
+
def configure_command(builder, opts)
|
12
|
+
builder = super(builder, opts)
|
13
|
+
builder.with_subcommand('check')
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'lino'
|
2
|
+
|
3
|
+
require_relative 'base'
|
4
|
+
require_relative 'mixins/profile'
|
5
|
+
|
6
|
+
module RubyLeiningen
|
7
|
+
module Commands
|
8
|
+
class Clean < Base
|
9
|
+
include Mixins::Profile
|
10
|
+
|
11
|
+
def configure_command(builder, opts)
|
12
|
+
builder = super(builder, opts)
|
13
|
+
builder.with_subcommand('clean')
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'lino'
|
2
|
+
|
3
|
+
require_relative 'base'
|
4
|
+
require_relative 'mixins/profile'
|
5
|
+
|
6
|
+
module RubyLeiningen
|
7
|
+
module Commands
|
8
|
+
class Deps < Base
|
9
|
+
include Mixins::Profile
|
10
|
+
|
11
|
+
def configure_command(builder, opts)
|
12
|
+
builder = super(builder, opts)
|
13
|
+
builder.with_subcommand('deps')
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module RubyLeiningen
|
2
|
+
module Commands
|
3
|
+
module Mixins
|
4
|
+
module Profile
|
5
|
+
def initialize(opts)
|
6
|
+
super(opts)
|
7
|
+
@profile = opts[:profile]
|
8
|
+
end
|
9
|
+
|
10
|
+
def for_profile(profile)
|
11
|
+
@profile = profile
|
12
|
+
self
|
13
|
+
end
|
14
|
+
|
15
|
+
def configure_command(builder, opts)
|
16
|
+
profile = opts[:profile] || @profile
|
17
|
+
if profile
|
18
|
+
builder = builder
|
19
|
+
.with_subcommand('with-profile')
|
20
|
+
.with_subcommand(profile)
|
21
|
+
end
|
22
|
+
builder
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
require 'lino'
|
2
|
+
|
3
|
+
require_relative 'base'
|
4
|
+
require_relative 'mixins/profile'
|
5
|
+
|
6
|
+
module RubyLeiningen
|
7
|
+
module Commands
|
8
|
+
class Run < Base
|
9
|
+
include Mixins::Profile
|
10
|
+
|
11
|
+
def configure_command(builder, opts)
|
12
|
+
builder = super(builder, opts)
|
13
|
+
|
14
|
+
main_function = opts[:main_function]
|
15
|
+
arguments = opts[:arguments] || []
|
16
|
+
quote_arguments = opts[:quote_arguments]
|
17
|
+
|
18
|
+
builder = builder.with_subcommand('run') do |sub|
|
19
|
+
sub = sub.with_option('-m', main_function) if main_function
|
20
|
+
sub = sub.with_flag('--quote-args') if quote_arguments
|
21
|
+
sub
|
22
|
+
end
|
23
|
+
|
24
|
+
if arguments.any?
|
25
|
+
builder = builder.with_argument("--")
|
26
|
+
builder = arguments.inject(builder) do |b, argument|
|
27
|
+
b.with_argument(argument)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
builder
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'lino'
|
2
|
+
|
3
|
+
require_relative 'base'
|
4
|
+
require_relative 'mixins/profile'
|
5
|
+
|
6
|
+
module RubyLeiningen
|
7
|
+
module Commands
|
8
|
+
class Uberjar < Base
|
9
|
+
include Mixins::Profile
|
10
|
+
|
11
|
+
def configure_command(builder, opts)
|
12
|
+
builder = super(builder, opts)
|
13
|
+
|
14
|
+
main_namespace = opts[:main_namespace]
|
15
|
+
|
16
|
+
builder = builder.with_subcommand('uberjar')
|
17
|
+
builder = builder.with_argument(main_namespace) if main_namespace
|
18
|
+
builder
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'lino'
|
2
|
+
require_relative 'base'
|
3
|
+
|
4
|
+
module RubyLeiningen
|
5
|
+
module Commands
|
6
|
+
class Version < Base
|
7
|
+
def stdout
|
8
|
+
@version_string
|
9
|
+
end
|
10
|
+
|
11
|
+
def do_before(opts)
|
12
|
+
@version_string = StringIO.new
|
13
|
+
end
|
14
|
+
|
15
|
+
def configure_command(builder, opts)
|
16
|
+
builder.with_argument('version')
|
17
|
+
end
|
18
|
+
|
19
|
+
def do_after(opts)
|
20
|
+
@version_string.string.gsub(/\n/, '')
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,57 @@
|
|
1
|
+
require 'active_support'
|
2
|
+
require 'active_support/core_ext/string/inflections'
|
3
|
+
|
4
|
+
require_relative 'commands/check'
|
5
|
+
require_relative 'commands/clean'
|
6
|
+
require_relative 'commands/deps'
|
7
|
+
require_relative 'commands/run'
|
8
|
+
require_relative 'commands/uberjar'
|
9
|
+
require_relative 'commands/version'
|
10
|
+
|
11
|
+
module RubyLeiningen
|
12
|
+
module Commands
|
13
|
+
class << self
|
14
|
+
def define_custom_command(name, options = {}, &config_block)
|
15
|
+
klass_name = name.classify
|
16
|
+
config = (config_block || lambda { |conf| conf }).call(Config.new)
|
17
|
+
|
18
|
+
klass = Class.new(Base) do
|
19
|
+
unless options[:include_profile_support] == false
|
20
|
+
include Mixins::Profile
|
21
|
+
end
|
22
|
+
|
23
|
+
define_method "configure_command" do |builder, opts|
|
24
|
+
builder = super(builder, opts)
|
25
|
+
builder = builder.with_subcommand(name) do |sub|
|
26
|
+
config.subcommand_block.call(sub, opts)
|
27
|
+
end
|
28
|
+
config.command_block.call(builder, opts)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
const_set(klass_name, klass)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
private
|
37
|
+
|
38
|
+
class Config
|
39
|
+
attr_accessor :command_block, :subcommand_block
|
40
|
+
|
41
|
+
def initialize
|
42
|
+
self.command_block = lambda { |com, _| com }
|
43
|
+
self.subcommand_block = lambda { |sub, _| sub }
|
44
|
+
end
|
45
|
+
|
46
|
+
def on_command_builder(&block)
|
47
|
+
self.command_block = block
|
48
|
+
self
|
49
|
+
end
|
50
|
+
|
51
|
+
def on_subcommand_builder(&block)
|
52
|
+
self.subcommand_block = block
|
53
|
+
self
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
require 'ruby_leiningen/version'
|
2
|
+
require 'ruby_leiningen/commands'
|
3
|
+
|
4
|
+
module RubyLeiningen
|
5
|
+
class << self
|
6
|
+
attr_accessor :configuration
|
7
|
+
|
8
|
+
def configure
|
9
|
+
@configuration ||= Configuration.new
|
10
|
+
yield(@configuration)
|
11
|
+
end
|
12
|
+
|
13
|
+
def reset!
|
14
|
+
@configuration = nil
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
module ClassMethods
|
19
|
+
def version
|
20
|
+
Commands::Version.new.execute
|
21
|
+
end
|
22
|
+
end
|
23
|
+
extend ClassMethods
|
24
|
+
|
25
|
+
def self.included(other)
|
26
|
+
other.extend(ClassMethods)
|
27
|
+
end
|
28
|
+
|
29
|
+
class Configuration
|
30
|
+
attr_accessor :binary
|
31
|
+
|
32
|
+
def initialize
|
33
|
+
@binary = 'lein'
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'ruby_leiningen/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = 'ruby_leiningen'
|
8
|
+
spec.version = RubyLeiningen::VERSION
|
9
|
+
spec.authors = ['Toby Clemson']
|
10
|
+
spec.email = ['tobyclemson@gmail.com']
|
11
|
+
|
12
|
+
spec.summary = 'A simple Ruby wrapper for invoking leiningen commands.'
|
13
|
+
spec.description = 'Wraps the leiningen CLI so that leiningen can be ' +
|
14
|
+
'invoked from a Ruby script or Rakefile.'
|
15
|
+
spec.homepage = 'https://github.com/infrablocks/ruby_leiningen'
|
16
|
+
spec.license = 'MIT'
|
17
|
+
|
18
|
+
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
19
|
+
f.match(%r{^(test|spec|features)/})
|
20
|
+
end
|
21
|
+
spec.bindir = 'exe'
|
22
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
23
|
+
spec.require_paths = ['lib']
|
24
|
+
|
25
|
+
spec.required_ruby_version = '>= 2.5'
|
26
|
+
|
27
|
+
spec.add_dependency 'lino', '~> 1.1'
|
28
|
+
spec.add_dependency 'activesupport', '~> 6.0', '>= 6.0.2'
|
29
|
+
|
30
|
+
spec.add_development_dependency 'bundler', '~> 2.0'
|
31
|
+
spec.add_development_dependency 'rake', '~> 13.0'
|
32
|
+
spec.add_development_dependency 'rspec', '~> 3.8'
|
33
|
+
spec.add_development_dependency 'gem-release', '~> 2.0'
|
34
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
#!/usr/bin/env bash
|
2
|
+
|
3
|
+
[ -n "$DEBUG" ] && set -x
|
4
|
+
set -e
|
5
|
+
set -o pipefail
|
6
|
+
|
7
|
+
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
8
|
+
PROJECT_DIR="$( cd "$SCRIPT_DIR/../../.." && pwd )"
|
9
|
+
|
10
|
+
cd "$PROJECT_DIR"
|
11
|
+
|
12
|
+
git crypt unlock
|
13
|
+
|
14
|
+
mkdir -p ~/.gem
|
15
|
+
cp config/secrets/rubygems/credentials ~/.gem/credentials
|
16
|
+
chmod 0600 ~/.gem/credentials
|
@@ -0,0 +1,19 @@
|
|
1
|
+
#!/usr/bin/env bash
|
2
|
+
|
3
|
+
[ -n "$DEBUG" ] && set -x
|
4
|
+
set -e
|
5
|
+
set -o pipefail
|
6
|
+
|
7
|
+
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
8
|
+
PROJECT_DIR="$( cd "$SCRIPT_DIR/../../.." && pwd )"
|
9
|
+
|
10
|
+
cd "$PROJECT_DIR"
|
11
|
+
|
12
|
+
set +e
|
13
|
+
openssl version
|
14
|
+
openssl aes-256-cbc \
|
15
|
+
-d \
|
16
|
+
-md sha1 \
|
17
|
+
-in ./.circleci/gpg.private.enc \
|
18
|
+
-k "${ENCRYPTION_PASSPHRASE}" | gpg --import -
|
19
|
+
set -e
|
@@ -0,0 +1,16 @@
|
|
1
|
+
#!/usr/bin/env bash
|
2
|
+
|
3
|
+
[ -n "$DEBUG" ] && set -x
|
4
|
+
set -e
|
5
|
+
set -o pipefail
|
6
|
+
|
7
|
+
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
8
|
+
PROJECT_DIR="$( cd "$SCRIPT_DIR/../../.." && pwd )"
|
9
|
+
|
10
|
+
cd "$PROJECT_DIR"
|
11
|
+
|
12
|
+
./go version:bump[pre]
|
13
|
+
./go release
|
14
|
+
|
15
|
+
git status
|
16
|
+
git push
|
@@ -0,0 +1,18 @@
|
|
1
|
+
#!/usr/bin/env bash
|
2
|
+
|
3
|
+
[ -n "$DEBUG" ] && set -x
|
4
|
+
set -e
|
5
|
+
set -o pipefail
|
6
|
+
|
7
|
+
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
8
|
+
PROJECT_DIR="$( cd "$SCRIPT_DIR/../../.." && pwd )"
|
9
|
+
|
10
|
+
cd "$PROJECT_DIR"
|
11
|
+
|
12
|
+
git pull
|
13
|
+
|
14
|
+
./go version:bump[minor]
|
15
|
+
./go release
|
16
|
+
|
17
|
+
git status
|
18
|
+
git push
|