Skip to content

Commit 3ca1b2a

Browse files
committed
Gem infrastructure
1 parent e900661 commit 3ca1b2a

File tree

5 files changed

+133
-0
lines changed

5 files changed

+133
-0
lines changed

.github/dependabot.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: "bundler"
4+
directory: "/"
5+
schedule:
6+
interval: "daily"

.github/workflows/main.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Main
2+
on:
3+
- push
4+
- pull_request_target
5+
jobs:
6+
ci:
7+
name: CI
8+
runs-on: ubuntu-latest
9+
env:
10+
CI: true
11+
steps:
12+
- uses: actions/checkout@master
13+
- uses: ruby/setup-ruby@v1
14+
with:
15+
bundler-cache: true
16+
ruby-version: '3.1'
17+
- name: Test
18+
run: bundle exec rake test
19+
automerge:
20+
name: AutoMerge
21+
needs: ci
22+
runs-on: ubuntu-latest
23+
if: github.event_name == 'pull_request_target' && github.actor == 'dependabot[bot]'
24+
steps:
25+
- uses: actions/github-script@v3
26+
with:
27+
script: |
28+
github.pulls.merge({
29+
owner: context.payload.repository.owner.login,
30+
repo: context.payload.repository.name,
31+
pull_number: context.payload.pull_request.number
32+
})

Gemfile.lock

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ GEM
2323

2424
PLATFORMS
2525
x86_64-darwin-21
26+
x86_64-linux
2627

2728
DEPENDENCIES
2829
bundler

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2022-present Kevin Newton
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in
13+
all copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21+
THE SOFTWARE.

README.md

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
# SyntaxTree::CSS
2+
3+
[![Build Status](https://github.com/ruby-syntax-tree/syntax_tree-css/actions/workflows/main.yml/badge.svg)](https://github.com/ruby-syntax-tree/syntax_tree-css/actions/workflows/main.yml)
4+
[![Gem Version](https://img.shields.io/gem/v/syntax_tree-css.svg)](https://rubygems.org/gems/syntax_tree-css)
5+
6+
[Syntax Tree](https://github.com/ruby-syntax-tree/syntax_tree) support for CSS.
7+
8+
## Installation
9+
10+
Add this line to your application's Gemfile:
11+
12+
```ruby
13+
gem "syntax_tree-css"
14+
```
15+
16+
And then execute:
17+
18+
$ bundle install
19+
20+
Or install it yourself as:
21+
22+
$ gem install syntax_tree-css
23+
24+
## Usage
25+
26+
From code:
27+
28+
```ruby
29+
require "syntax_tree/css"
30+
31+
pp SyntaxTree::CSS.parse(source) # print out the AST
32+
puts SyntaxTree::CSS.format(source) # format the AST
33+
```
34+
35+
From the CLI:
36+
37+
```sh
38+
$ stree ast --plugins=css file.css
39+
(css-stylesheet
40+
(style-rule
41+
(selectors
42+
(type-selector (delim-token "*"))
43+
)
44+
(declarations
45+
(declaration hello (ident-token "world"), (semicolon-token))
46+
)
47+
)
48+
)
49+
```
50+
51+
or
52+
53+
```sh
54+
$ stree format --plugins=css file.css
55+
* {
56+
hello: world;
57+
}
58+
```
59+
60+
or
61+
62+
```sh
63+
$ stree write --plugins=css file.css
64+
file.css 1ms
65+
```
66+
67+
## Contributing
68+
69+
Bug reports and pull requests are welcome on GitHub at https://github.com/ruby-syntax-tree/syntax_tree-css.
70+
71+
## License
72+
73+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).

0 commit comments

Comments
 (0)