Skip to content
This repository has been archived by the owner on Mar 28, 2020. It is now read-only.

Commit

Permalink
Merge aefbd29 into 925df0c
Browse files Browse the repository at this point in the history
  • Loading branch information
ninoseki committed Sep 3, 2019
2 parents 925df0c + aefbd29 commit f5a9089
Show file tree
Hide file tree
Showing 25 changed files with 6,523 additions and 1 deletion.
25 changes: 25 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended-requiring-type-checking",
"plugin:@typescript-eslint/recommended",
"plugin:jest/recommended",
"prettier",
"prettier/@typescript-eslint"
],
"plugins": [
"@typescript-eslint",
"jest"
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"project": "./tsconfig.json",
"tsconfigRootDir": "."
},
"rules": {
"@typescript-eslint/interface-name-prefix": 0,
"max-len": 0,
"no-console": 0
}
}
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,10 @@ typings/

# next.js build output
.next

# OS metadata
.DS_Store
Thumbs.db

# Ignore built ts files
dist/**/*
26 changes: 26 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
built
doc
Gulpfile.js
internal
jenkins.sh
lib/README.md
lib/enu
netci.groovy
scripts
src
tests
tslint.json
Jakefile.js
.editorconfig
.gitattributes
.gitmodules
.settings/
.travis.yml
.circleci
.vscode/
.parallelperf.json
test.config
package-lock.json
yarn.lock
.github/
CONTRIBUTING.md
5 changes: 5 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"singleQuote": false,
"trailingComma": "es5",
"parser": "typescript"
}
16 changes: 16 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
sudo: false

language: node_js

node_js:
- "10"
- "12"

script:
- npm run test

after_success: npm run coverage

cache:
directories:
- node_modules
52 changes: 51 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,51 @@
# gemspec-parser
# gemspec-parser

[![Build Status](https://travis-ci.org/ninoseki/gemspec-parser.svg?branch=master)](https://travis-ci.org/ninoseki/gemspec-parser)
[![Coverage Status](https://coveralls.io/repos/github/ninoseki/gemspec-parser/badge.svg?branch=WIP)](https://coveralls.io/github/ninoseki/gemspec-parser?branch=WIP)
[![CodeFactor](https://www.codefactor.io/repository/github/ninoseki/gemspec-parser/badge)](https://www.codefactor.io/repository/github/ninoseki/gemspec-parser)

A simple parser for gemspec.

Note: This is a fork of [dev-cprice/gemfile-parser](https://github.com/dev-cprice/gemfile-parser).

## Installation

```bash
npm install gemspec-parser
```

## Usage

```ts
import { parseGemspec } from "gemspec-parser";

const stringGemspec = `
lib = File.expand_path('lib', __dir__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require "example/version"
Gem::Specification.new do |spec|
spec.name = "example"
spec.version = "0.1.0"
spec.authors = ["John Doe"]
spec.add_development_dependency "bundler", "~> 2.0"
spec.add_dependency "foo", "~> 0.8"
spec.add_runtime_dependency "bar", "~> 0.19"
end
`;

const gemspec = parseGemspec(stringGemspec);
// {
// name: 'example',
// version: '0.1.0',
// summary: 'N/A',
// authors: [ 'John Doe' ],
// dependencies: [
// { name: 'foo', requirements: '~> 0.8' },
// { name: 'bar', requirements: '~> 0.19' }
// ],
// devDependencies: [ { name: 'bundler', requirements: '~> 2.0' } ]
// }
```
6 changes: 6 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module.exports = {
roots: ["<rootDir>/src"],
transform: {
"^.+\\.tsx?$": "ts-jest"
}
};

0 comments on commit f5a9089

Please sign in to comment.