Skip to content

Commit 7be53a5

Browse files
authored
Merge pull request #63 from Shopify/vs/use_check_docs
Publish our documentation as static website
2 parents c9de30f + 242ba2e commit 7be53a5

File tree

8 files changed

+67
-2
lines changed

8 files changed

+67
-2
lines changed

.github/workflows/ci.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ jobs:
1414
ruby-version: '3.2'
1515
bundler-cache: true
1616

17+
- name: Check if documentation is up to date
18+
run: bundle exec rake ruby_lsp:check_docs
19+
1720
- name: Typecheck
1821
run: bundle exec srb tc
1922

.github/workflows/publish_docs.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Publish docs
2+
3+
on:
4+
push:
5+
branches: [main]
6+
7+
jobs:
8+
build:
9+
runs-on: ubuntu-latest
10+
name: Publish documentation website
11+
steps:
12+
- uses: actions/checkout@v3
13+
14+
- name: Set up Ruby
15+
uses: ruby/setup-ruby@v1
16+
with:
17+
ruby-version: 3.2
18+
bundler-cache: true
19+
20+
- name: Configure git
21+
run: |
22+
git config user.name github-actions
23+
git config user.email [email protected]
24+
25+
- name: Generate documentation
26+
run: bundle exec rake rdoc
27+
28+
- name: Commit to gh-pages
29+
run: |
30+
git add docs
31+
git commit -m "Publish website $(git log --format=format:%h -1)"
32+
git push --force origin main:gh-pages

Gemfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,6 @@ gem "rubocop-shopify", "~> 2.13", require: false
1515
gem "rubocop-minitest", "~> 0.30.0", require: false
1616
gem "rubocop-rake", "~> 0.6.0", require: false
1717
gem "rubocop-sorbet", "~> 0.7", require: false
18-
18+
gem "rdoc", require: false
1919
gem "sorbet-static-and-runtime"
2020
gem "tapioca", "~> 0.11", require: false

Gemfile.lock

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,8 @@ GEM
126126
parser (3.2.2.0)
127127
ast (~> 2.4.1)
128128
prettier_print (1.2.1)
129+
psych (5.1.0)
130+
stringio
129131
puma (6.2.2)
130132
nio4r (~> 2.0)
131133
racc (1.6.2)
@@ -165,6 +167,8 @@ GEM
165167
parser (>= 2.6.4.0)
166168
sorbet-runtime (>= 0.5.9204)
167169
unparser
170+
rdoc (6.5.0)
171+
psych (>= 4.0.0)
168172
regexp_parser (2.8.0)
169173
reline (0.3.3)
170174
io-console (~> 0.5)
@@ -210,6 +214,7 @@ GEM
210214
thor (>= 0.19.2)
211215
sqlite3 (1.6.2-arm64-darwin)
212216
sqlite3 (1.6.2-x86_64-linux)
217+
stringio (3.0.6)
213218
syntax_tree (6.1.1)
214219
prettier_print (>= 1.2.0)
215220
tapioca (0.11.5)
@@ -247,6 +252,7 @@ DEPENDENCIES
247252
debug (>= 1.7.0)
248253
mocha
249254
puma
255+
rdoc
250256
rubocop (~> 1.48)
251257
rubocop-minitest (~> 0.30.0)
252258
rubocop-rake (~> 0.6.0)

Rakefile

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,24 @@ load "rails/tasks/statistics.rake"
99

1010
require "bundler/gem_tasks"
1111
require "rake/testtask"
12+
require "ruby_lsp/check_docs"
13+
require "rdoc/task"
1214

1315
Rake::TestTask.new(:test) do |t|
1416
t.libs << "test"
1517
t.libs << "lib"
1618
t.test_files = FileList["test/**/*_test.rb"]
1719
end
1820

21+
RDoc::Task.new do |rdoc|
22+
rdoc.main = "README.md"
23+
rdoc.rdoc_files.include("*.md", "lib/**/*.rb")
24+
rdoc.rdoc_dir = "docs"
25+
rdoc.markup = "markdown"
26+
rdoc.options.push("--copy-files", "misc")
27+
rdoc.options.push("--copy-files", "LICENSE.txt")
28+
end
29+
30+
RubyLsp::CheckDocs.new(FileList["#{__dir__}/lib/ruby_lsp/ruby_lsp_rails/**/*.rb"])
31+
1932
task default: :test

lib/ruby-lsp-rails.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
require "ruby_lsp_rails/version"
88
require "ruby_lsp_rails/railtie"
99

10-
module RubyLSP
10+
module RubyLsp
1111
module Rails
1212
end
1313
end

lib/ruby_lsp/ruby_lsp_rails/hover.rb

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,17 @@
33

44
module RubyLsp
55
module Rails
6+
# ![Hover demo](../../hover.gif)
7+
#
8+
# Augment [hover](https://microsoft.github.io/language-server-protocol/specification#textDocument_hover) with
9+
# information about a model.
10+
#
11+
# # Example
12+
#
13+
# ```ruby
14+
# User.all
15+
# # ^ hovering here will show information about the User model
16+
# ```
617
class Hover < ::RubyLsp::Listener
718
extend T::Sig
819
extend T::Generic

misc/hover.gif

213 KB
Loading

0 commit comments

Comments
 (0)