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

Migrate to actions #8

Merged
merged 3 commits into from Jan 12, 2022
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
28 changes: 28 additions & 0 deletions .github/workflows/ci.yml
@@ -0,0 +1,28 @@
name: Ruby CI

on:
push:

jobs:
test:
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
ruby-version: [3.1.0, 3.0.0, 2.7.5]

steps:
- uses: actions/checkout@v2

- name: Set up Ruby ${{ matrix.ruby-version }}
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby-version }}
bundler-cache: true

- name: Install dependencies
run: bundle install

- name: Run tests
run: bundle exec rake spec
17 changes: 17 additions & 0 deletions .github/workflows/lint.yml
@@ -0,0 +1,17 @@
name: Linting

on:
push:

jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: ruby/setup-ruby@v1
with:
ruby-version: 3.0
bundler-cache: true
- run: bundle install
- name: Rubocop
run: bundle exec rake rubocop
14 changes: 6 additions & 8 deletions .gitignore
@@ -1,10 +1,4 @@
# File generated by script/bootstrap
/.bundle/
/bin
/vendor/ruby
/vendor/gems/
/vendor/cache/ruby/

*.gem
*.rbc
.bundle
.config
Expand All @@ -17,6 +11,7 @@ spec/reports
test/tmp
test/version_tmp
tmp
vendor/cache

Gemfile.lock
out/
Expand All @@ -28,5 +23,8 @@ docs/
# YARD artifacts
.yardoc
_yardoc
doc/

.DS_Store
.idea
.byebug_history
.vscode
6 changes: 6 additions & 0 deletions .rubocop.yml
@@ -0,0 +1,6 @@
inherit_gem:
rubocop-standard:
- config/default.yml

Naming/FileName:
Enabled: false
18 changes: 0 additions & 18 deletions .travis.yml

This file was deleted.

2 changes: 2 additions & 0 deletions Gemfile
@@ -1,3 +1,5 @@
# frozen_string_literal: true

source 'http://rubygems.org'

gemspec
File renamed without changes.
2 changes: 0 additions & 2 deletions README.md
@@ -1,7 +1,5 @@
# ecma-re-validator

[![Build Status](https://travis-ci.org/gjtorikian/ecma-re-validator.svg?branch=master)](https://travis-ci.org/gjtorikian/ecma-re-validator)

Pass in a string to validate if it would work in ECMA-262, aka JavaScript.

The information for what is valid and what isn't comes from <http://www.regular-expressions.info/javascript.html>.
Expand Down
8 changes: 7 additions & 1 deletion Rakefile
@@ -1,8 +1,14 @@
# frozen_string_literal: true

require 'bundler'
Bundler::GemHelper.install_tasks

require 'rspec/core/rake_task'

RSpec::Core::RakeTask.new(:spec)

task :default => [:spec]
task default: [:spec]

require 'rubocop/rake_task'

RuboCop::RakeTask.new(:rubocop)
13 changes: 9 additions & 4 deletions ecma-re-validator.gemspec
Expand Up @@ -12,14 +12,19 @@ Gem::Specification.new do |gem|
gem.summary = %(Validate a regular expression string against what ECMA-262 can actually do.)
gem.homepage = 'https://github.com/gjtorikian/ecma-re-validator'
gem.license = 'MIT'
gem.files = `git ls-files -z`.split("\x0").reject { |f| f =~ %r{^vendor/.*} }
gem.files = `git ls-files -z`.split("\x0").grep_v(%r{^vendor/.*})
gem.test_files = gem.files.grep(%r{^(spec)/})
gem.require_paths = ['lib']
gem.required_ruby_version = ['>= 2.6.0', '< 4.0']

gem.add_dependency 'regexp_parser', '~> 2.0'

gem.add_development_dependency 'rspec', '~> 3.1'
gem.add_development_dependency 'rake', '~> 13.0'
gem.add_development_dependency 'awesome_print'
gem.add_development_dependency 'pry', '~> 0.10'
gem.add_development_dependency 'rake', '~> 13.0'
gem.add_development_dependency 'rspec', '~> 3.1'

gem.add_development_dependency 'rubocop'
gem.add_development_dependency 'rubocop-rspec'
gem.add_development_dependency 'rubocop-standard'
gem.metadata['rubygems_mfa_required'] = 'true'
end
8 changes: 2 additions & 6 deletions lib/ecma-re-validator.rb
@@ -1,12 +1,8 @@
begin
require 'awesome_print'
require 'pry'
rescue LoadError; end
# frozen_string_literal: true

require 'regexp_parser'

module EcmaReValidator

# JS doesn't have Unicode matching
UNICODE_CHARACTERS = Regexp::Syntax::Token::UnicodeProperty::All

Expand All @@ -27,7 +23,7 @@ module EcmaReValidator
:condition_open,
# JS doesn't support comments
:comment
]
].freeze

INVALID_TOKENS = INVALID_REGEXP + UNICODE_CHARACTERS

Expand Down
2 changes: 2 additions & 0 deletions spec/anchors_spec.rb
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require 'spec_helper'

describe 'EcmaReValidator::Anchors' do
Expand Down
2 changes: 2 additions & 0 deletions spec/atomic_grouping_spec.rb
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require 'spec_helper'

describe 'EcmaReValidator::AtomicGrouping' do
Expand Down
7 changes: 4 additions & 3 deletions spec/comments_spec.rb
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require 'spec_helper'

describe 'EcmaReValidator::Comments' do
Expand All @@ -8,15 +10,14 @@
end

it 'should fail if regexp has inline comments across lines' do
re = %r{
re = /
start # some text
\s # white space char
(group) # first group
(?:alt1|alt2) # some alternation
end
}x
/x

expect(EcmaReValidator.valid?(re)).to eql(false)
end

end
2 changes: 2 additions & 0 deletions spec/conditionals_spec.rb
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require 'spec_helper'

describe 'EcmaReValidator::Conditionals' do
Expand Down
2 changes: 2 additions & 0 deletions spec/lookbehind_spec.rb
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require 'spec_helper'

describe 'EcmaReValidator::Lookbehind' do
Expand Down
2 changes: 2 additions & 0 deletions spec/mode_modifiers_spec.rb
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require 'spec_helper'

describe 'EcmaReValidator::ModeModifiers' do
Expand Down
2 changes: 2 additions & 0 deletions spec/named_capture_groups_spec.rb
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require 'spec_helper'

describe 'EcmaReValidator::NamedCaptureGroups' do
Expand Down
2 changes: 2 additions & 0 deletions spec/possesive_quantifiers_spec.rb
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require 'spec_helper'

describe 'EcmaReValidator::PossesiveQuantifiers' do
Expand Down
4 changes: 3 additions & 1 deletion spec/spec_helper.rb
@@ -1,5 +1,7 @@
# frozen_string_literal: true

require 'bundler/setup'
require_relative "../lib/ecma-re-validator"
require_relative '../lib/ecma-re-validator'

RSpec.configure do |config|
# Use color in STDOUT
Expand Down
2 changes: 2 additions & 0 deletions spec/unicode_spec.rb
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require 'spec_helper'

describe 'EcmaReValidator::Unicode' do
Expand Down
4 changes: 3 additions & 1 deletion spec/validator_spec.rb
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require 'spec_helper'

describe 'EcmaRe' do
Expand All @@ -14,7 +16,7 @@
end

it 'passes for a valid regexp string' do
re = "[Ss]mith\\\\b"
re = '[Ss]mith\\\\b'

expect(EcmaReValidator.valid?(re)).to eql(true)
end
Expand Down
Binary file removed vendor/cache/awesome_print-1.8.0.gem
Binary file not shown.
Binary file removed vendor/cache/coderay-1.1.3.gem
Binary file not shown.
Binary file removed vendor/cache/diff-lcs-1.4.4.gem
Binary file not shown.
Binary file removed vendor/cache/method_source-1.0.0.gem
Binary file not shown.
Binary file removed vendor/cache/pry-0.13.1.gem
Binary file not shown.
Binary file removed vendor/cache/rake-13.0.1.gem
Binary file not shown.
Binary file removed vendor/cache/regexp_parser-2.0.0.gem
Binary file not shown.
Binary file removed vendor/cache/rspec-3.10.0.gem
Binary file not shown.
Binary file removed vendor/cache/rspec-core-3.10.0.gem
Binary file not shown.
Binary file removed vendor/cache/rspec-expectations-3.10.0.gem
Binary file not shown.
Binary file removed vendor/cache/rspec-mocks-3.10.0.gem
Binary file not shown.
Binary file removed vendor/cache/rspec-support-3.10.0.gem
Binary file not shown.