Skip to content

Commit dd64ef1

Browse files
committed
Initial commit
0 parents  commit dd64ef1

25 files changed

+1916
-0
lines changed

Diff for: .discourse-compatibility

Whitespace-only changes.

Diff for: .eslintrc

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"extends": "eslint-config-discourse"
3+
}

Diff for: .github/workflows/plugin-linting.yml

+52
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: Linting
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
- main
8+
pull_request:
9+
10+
jobs:
11+
build:
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- uses: actions/checkout@v2
16+
17+
- name: Set up Node.js
18+
uses: actions/setup-node@v1
19+
with:
20+
node-version: 12
21+
22+
- name: Set up ruby
23+
uses: ruby/setup-ruby@v1
24+
with:
25+
ruby-version: 2.7
26+
bundler-cache: true
27+
28+
- name: Yarn install
29+
run: yarn install
30+
31+
- name: ESLint
32+
if: ${{ always() }}
33+
run: yarn eslint --ext .js,.js.es6 --no-error-on-unmatched-pattern {test,assets}/javascripts
34+
35+
- name: Prettier
36+
if: ${{ always() }}
37+
run: |
38+
yarn prettier -v
39+
if [ -d "assets" ]; then \
40+
yarn prettier --list-different "assets/**/*.{scss,js,es6}" ; \
41+
fi
42+
if [ -d "test" ]; then \
43+
yarn prettier --list-different "test/**/*.{js,es6}" ; \
44+
fi
45+
46+
- name: Ember template lint
47+
if: ${{ always() }}
48+
run: yarn ember-template-lint assets/javascripts
49+
50+
- name: Rubocop
51+
if: ${{ always() }}
52+
run: bundle exec rubocop .

Diff for: .github/workflows/plugin-tests.yml

+131
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
1+
name: Plugin Tests
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
- main
8+
pull_request:
9+
10+
jobs:
11+
build:
12+
name: ${{ matrix.build_type }}
13+
runs-on: ubuntu-latest
14+
container: discourse/discourse_test:release
15+
timeout-minutes: 60
16+
17+
env:
18+
DISCOURSE_HOSTNAME: www.example.com
19+
RUBY_GLOBAL_METHOD_CACHE_SIZE: 131072
20+
RAILS_ENV: test
21+
PGHOST: postgres
22+
PGUSER: discourse
23+
PGPASSWORD: discourse
24+
25+
strategy:
26+
fail-fast: false
27+
28+
matrix:
29+
build_type: ["backend", "frontend"]
30+
ruby: ["2.7"]
31+
postgres: ["12"]
32+
redis: ["4.x"]
33+
34+
services:
35+
postgres:
36+
image: postgres:${{ matrix.postgres }}
37+
ports:
38+
- 5432:5432
39+
env:
40+
POSTGRES_USER: discourse
41+
POSTGRES_PASSWORD: discourse
42+
options: >-
43+
--mount type=tmpfs,destination=/var/lib/postgresql/data
44+
--health-cmd pg_isready
45+
--health-interval 10s
46+
--health-timeout 5s
47+
--health-retries 5
48+
49+
steps:
50+
- uses: actions/checkout@v2
51+
with:
52+
repository: discourse/discourse
53+
fetch-depth: 1
54+
55+
- name: Install plugin
56+
uses: actions/checkout@v2
57+
with:
58+
path: plugins/${{ github.event.repository.name }}
59+
fetch-depth: 1
60+
61+
- name: Check spec existence
62+
id: check_spec
63+
uses: andstor/file-existence-action@v1
64+
with:
65+
files: "plugins/${{ github.event.repository.name }}/spec"
66+
67+
- name: Check qunit existence
68+
id: check_qunit
69+
uses: andstor/file-existence-action@v1
70+
with:
71+
files: "plugins/${{ github.event.repository.name }}/test/javascripts"
72+
73+
- name: Setup Git
74+
run: |
75+
git config --global user.email "[email protected]"
76+
git config --global user.name "Discourse CI"
77+
78+
- name: Setup redis
79+
uses: shogo82148/actions-setup-redis@v1
80+
with:
81+
redis-version: ${{ matrix.redis }}
82+
83+
- name: Bundler cache
84+
uses: actions/cache@v2
85+
with:
86+
path: vendor/bundle
87+
key: ${{ runner.os }}-${{ matrix.ruby }}-gem-${{ hashFiles('**/Gemfile.lock') }}
88+
restore-keys: |
89+
${{ runner.os }}-${{ matrix.ruby }}-gem-
90+
91+
- name: Setup gems
92+
run: |
93+
bundle config --local path vendor/bundle
94+
bundle config --local deployment true
95+
bundle config --local without development
96+
bundle install --jobs 4
97+
bundle clean
98+
99+
- name: Lint English locale
100+
if: matrix.build_type == 'backend'
101+
run: bundle exec ruby script/i18n_lint.rb "plugins/${{ github.event.repository.name }}/locales/{client,server}.en.yml"
102+
103+
- name: Get yarn cache directory
104+
id: yarn-cache-dir
105+
run: echo "::set-output name=dir::$(yarn cache dir)"
106+
107+
- name: Yarn cache
108+
uses: actions/cache@v2
109+
id: yarn-cache
110+
with:
111+
path: ${{ steps.yarn-cache-dir.outputs.dir }}
112+
key: ${{ runner.os }}-${{ matrix.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
113+
restore-keys: |
114+
${{ runner.os }}-${{ matrix.os }}-yarn-
115+
116+
- name: Yarn install
117+
run: yarn install
118+
119+
- name: Migrate database
120+
run: |
121+
bin/rake db:create
122+
bin/rake db:migrate
123+
124+
- name: Plugin RSpec
125+
if: matrix.build_type == 'backend' && steps.check_spec.outputs.files_exists == 'true'
126+
run: bin/rake plugin:spec[${{ github.event.repository.name }}]
127+
128+
- name: Plugin QUnit
129+
if: matrix.build_type == 'frontend' && steps.check_qunit.outputs.files_exists == 'true'
130+
run: bundle exec rake plugin:qunit['${{ github.event.repository.name }}','1200000']
131+
timeout-minutes: 30

Diff for: .gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
node_modules

Diff for: .prettierrc

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{}

Diff for: .rubocop.yml

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
inherit_gem:
2+
rubocop-discourse: default.yml

Diff for: .template-lintrc.js

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
module.exports = {
2+
plugins: ["ember-template-lint-plugin-discourse"],
3+
extends: "discourse:recommended",
4+
};

Diff for: Gemfile

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# frozen_string_literal: true
2+
3+
source 'https://rubygems.org'
4+
5+
group :development do
6+
gem 'rubocop-discourse'
7+
end

Diff for: Gemfile.lock

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
GEM
2+
remote: https://rubygems.org/
3+
specs:
4+
ast (2.4.2)
5+
parallel (1.20.1)
6+
parser (3.0.0.0)
7+
ast (~> 2.4.1)
8+
rainbow (3.0.0)
9+
regexp_parser (2.1.1)
10+
rexml (3.2.4)
11+
rubocop (1.12.0)
12+
parallel (~> 1.10)
13+
parser (>= 3.0.0.0)
14+
rainbow (>= 2.2.2, < 4.0)
15+
regexp_parser (>= 1.8, < 3.0)
16+
rexml
17+
rubocop-ast (>= 1.2.0, < 2.0)
18+
ruby-progressbar (~> 1.7)
19+
unicode-display_width (>= 1.4.0, < 3.0)
20+
rubocop-ast (1.4.1)
21+
parser (>= 2.7.1.5)
22+
rubocop-discourse (2.4.1)
23+
rubocop (>= 1.1.0)
24+
rubocop-rspec (>= 2.0.0)
25+
rubocop-rspec (2.2.0)
26+
rubocop (~> 1.0)
27+
rubocop-ast (>= 1.1.0)
28+
ruby-progressbar (1.11.0)
29+
unicode-display_width (2.0.0)
30+
31+
PLATFORMS
32+
arm64-darwin-20
33+
ruby
34+
x86_64-darwin-18
35+
x86_64-darwin-19
36+
x86_64-darwin-20
37+
x86_64-linux
38+
39+
DEPENDENCIES
40+
rubocop-discourse
41+
42+
BUNDLED WITH
43+
2.2.13

Diff for: LICENSE

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2021 Civilized Discourse Construction Kit
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.

Diff for: README.md

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Plugin Name
2+
3+
TODO

Diff for: app/.gitkeep

Whitespace-only changes.

Diff for: assets/javascripts/.gitkeep

Whitespace-only changes.

Diff for: assets/stylesheets/.gitkeep

Whitespace-only changes.

Diff for: config/locales/client.en.yml

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
en:
2+
js:

Diff for: config/locales/server.en.yml

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
en:

Diff for: config/settings.yml

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
plugins:

Diff for: db/.gitkeep

Whitespace-only changes.

Diff for: package.json

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"name": "discourse-plugin-name",
3+
"version": "0.0.1",
4+
"repository": "TODO",
5+
"author": "Discourse",
6+
"license": "MIT",
7+
"devDependencies": {
8+
"eslint-config-discourse": "^1.1.8"
9+
}
10+
}

Diff for: plugin.rb

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# frozen_string_literal: true
2+
3+
# name: discourse-plugin-name
4+
# about: TODO
5+
# version: 0.0.1
6+
# authors: Discourse
7+
# url: TODO
8+
9+
enabled_site_setting :plugin_name_enabled
10+
11+
after_initialize do
12+
end

Diff for: spec/.gitkeep

Whitespace-only changes.

Diff for: test/javascripts/.gitkeep

Whitespace-only changes.

Diff for: translator.yml

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Configuration file for discourse-translator-bot
2+
3+
files:
4+
- source_path: config/locales/client.en.yml
5+
destination_path: client.yml
6+
- source_path: config/locales/server.en.yml
7+
destination_path: server.yml

0 commit comments

Comments
 (0)