Skip to content

Commit

Permalink
v1.2.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Esity committed Oct 31, 2021
1 parent b1ee076 commit 34874dd
Show file tree
Hide file tree
Showing 13 changed files with 91 additions and 29 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
# Legion Changelog

## v1.2.1
* Updating LEX CLI templates
* Fixing issue with LEX schema migrator

## v1.2.0
Moving from BitBucket to GitHub inside the Optum org. All git history is reset from this point on
5 changes: 5 additions & 0 deletions lib/legion/cli/lex/templates/base/dockerfile.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
FROM legionio/legion:latest
LABEL maintainer="Matthew Iverson <matthewdiverson@gmail.com>"

RUN gem install lex-<%= config[:lex] %> legion-data --no-document --no-prerelease
CMD ruby $(which legionio)
9 changes: 8 additions & 1 deletion lib/legion/cli/lex/templates/base/gemfile.erb
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
source 'https://rubygems.org'

gemspec

group :test do
gem 'rake'
gem 'rspec'
gem 'rspec_junit_formatter'
gem 'rubocop'
gem 'simplecov'
end
22 changes: 10 additions & 12 deletions lib/legion/cli/lex/templates/base/gemspec.erb
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,22 @@ require_relative 'lib/legion/extensions/<%= config[:lex] %>/version'
Gem::Specification.new do |spec|
spec.name = 'lex-<%= config[:lex] %>'
spec.version = Legion::Extensions::<%= config[:class_name] %>::VERSION
spec.authors = ['Esity']
spec.email = ['[email protected]']
spec.authors = []
spec.email = []

spec.summary = 'LEX::<%= config[:class_name] %>'
spec.description = 'Connects Legion to <%= config[:class_name] %>'
spec.homepage = 'https://bitbucket.org/legion-io/lex-<%= config[:lex] %>'
spec.homepage = 'https://github.com/LegionIO/lex-<%= config[:lex] %>'
spec.license = 'MIT'
spec.required_ruby_version = Gem::Requirement.new('>= 2.5.0')

spec.metadata['homepage_uri'] = spec.homepage
spec.metadata['source_code_uri'] = 'https://bitbucket.org/legion-io/lex-<%= config[:lex] %>/src'
spec.metadata['documentation_uri'] = 'https://legionio.atlassian.net/wiki/spaces/LEX/pages/'
spec.metadata['changelog_uri'] = 'https://legionio.atlassian.net/wiki/spaces/LEX/pages/'
spec.metadata['bug_tracker_uri'] = 'https://bitbucket.org/legion-io/lex-<%= config[:lex] %>/issues'
spec.metadata['source_code_uri'] = 'https://github.com/LegionIO/lex-<%= config[:lex] %>/src'
spec.metadata['documentation_uri'] = 'https://github.com/LegionIO/lex-<%= config[:lex] %>/wiki'
spec.metadata['changelog_uri'] = 'https://github.com/LegionIO/lex-<%= config[:lex] %>'
spec.metadata['bug_tracker_uri'] = 'https://github.com/LegionIO/lex-<%= config[:lex] %>'
spec.files = Dir.chdir(File.expand_path(__dir__)) do
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
end
spec.require_paths = ['lib']

spec.add_development_dependency 'rake'
spec.add_development_dependency 'rspec'
spec.add_development_dependency 'rubocop'
spec.add_development_dependency 'simplecov'
end
23 changes: 23 additions & 0 deletions lib/legion/cli/lex/templates/base/github_rspec.yml.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: RSpec
on: [push, pull_request]

jobs:
rspec:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
ruby: [2.7]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true
- name: RSpec run
run: |
bash -c "
bundle exec rspec
[[ $? -ne 2 ]]
"
28 changes: 28 additions & 0 deletions lib/legion/cli/lex/templates/base/github_rubocop.yml.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Rubocop
on: [push, pull_request]
jobs:
rubocop:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
ruby: [2.7]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true
- name: Install Rubocop
run: gem install rubocop code-scanning-rubocop
- name: Rubocop run --no-doc
run: |
bash -c "
rubocop --require code_scanning --format CodeScanning::SarifFormatter -o rubocop.sarif
[[ $? -ne 2 ]]
"
- name: Upload Sarif output
uses: github/codeql-action/upload-sarif@v1
with:
sarif_file: rubocop.sarif
2 changes: 1 addition & 1 deletion lib/legion/cli/lex/templates/base/lic.erb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2020 Esity
Copyright (c) 2021

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
6 changes: 0 additions & 6 deletions lib/legion/cli/lex/templates/base/rakefile.erb

This file was deleted.

1 change: 1 addition & 0 deletions lib/legion/cli/lex/templates/base/rubocop.yml.erb
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Style/Documentation:
AllCops:
TargetRubyVersion: 2.5
NewCops: enable
SuggestExtensions: false
Style/FrozenStringLiteralComment:
Enabled: false
Naming/FileName:
Expand Down
2 changes: 1 addition & 1 deletion lib/legion/cli/lex/templates/base/version.erb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module Legion
module Extensions
module <%= config[:class_name] %>
VERSION = '0.1.1'.freeze
VERSION = '0.1.0'.freeze
end
end
end
9 changes: 5 additions & 4 deletions lib/legion/extensions/data/migrator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@ module Legion
module Extensions
module Data
class Migrator < Sequel::IntegerMigrator
def initialize(path, extension, _lex_name, **)
Legion::Logging.fatal @extension
def initialize(path, extension, lex_name, **)
@path = path
@extension = extension
@lex_name = lex_name
schema_dataset
super(Legion::Data::Connection.sequel, path)
end

Expand All @@ -21,9 +22,9 @@ def default_schema_table

def schema_dataset
dataset = Legion::Data::Connection.sequel.from(default_schema_table).where(namespace: @extension)
return dataset unless dataset.count.positive?
return dataset if dataset.count.positive?

Legion::Logging.unknown Legion::Data::Model::Extension.insert(active: 1, namespace: @extension, extension: lex_name)
Legion::Data::Model::Extension.insert(active: 1, namespace: @extension, name: @lex_name)
Legion::Data::Connection.sequel.from(default_schema_table).where(namespace: @extension)
end
alias ds schema_dataset
Expand Down
7 changes: 4 additions & 3 deletions lib/legion/lex.rb
Original file line number Diff line number Diff line change
Expand Up @@ -63,16 +63,17 @@ def create(name)
template('cli/lex/templates/base/gemspec.erb', "#{filename}/#{filename}.gemspec", vars)
template('cli/lex/templates/base/gemfile.erb', "#{filename}/Gemfile", vars)
template('cli/lex/templates/base/gitignore.erb', "#{filename}/.gitignore", vars)
template('cli/lex/templates/base/lic.erb', "#{filename}/LICENSE.txt", vars)
template('cli/lex/templates/base/rakefile.erb', "#{filename}/Rakefile", vars)
template('cli/lex/templates/base/lic.erb', "#{filename}/LICENSE", vars)
template('cli/lex/templates/base/rubocop.yml.erb', "#{filename}/.rubocop.yml", vars)
template('cli/lex/templates/base/readme.md.erb', "#{filename}/README.md", **vars)
template('cli/lex/templates/base/lex.erb', "#{filename}/lib/legion/extensions/#{name}.rb", vars)
template('cli/lex/templates/base/version.erb', "#{filename}/lib/legion/extensions/#{name}/version.rb", vars)
template('cli/lex/templates/base/bitbucket.yml.erb', "#{filename}/bitbucket-pipelines.yml", vars) if options[:pipeline]
template('cli/lex/templates/base/spec_helper.rb.erb', "#{filename}/spec/spec_helper.rb", vars)
template('cli/lex/templates/base/lex_spec.erb', "#{filename}/spec/legion/#{name}_spec.rb", vars)

template('cli/lex/templates/base/github_rspec.yml.erb', "#{filename}/.github/workflows/rspec.yml", vars)
template('cli/lex/templates/base/github_rubocop.yml.erb', "#{filename}/.github/workflows/rubocop.yml", vars)

return if !options[:git_init] && !options[:bundle_install]

run("cd lex_gen-#{filename}")
Expand Down
2 changes: 1 addition & 1 deletion lib/legion/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module Legion
VERSION = '1.2.0'.freeze
VERSION = '1.2.1'.freeze
end

0 comments on commit 34874dd

Please sign in to comment.