aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Dockerfile3
-rw-r--r--ftdetect/ruby.vim3
-rw-r--r--ftplugin/ruby.vim10
-rw-r--r--tests/__snapshots__/formatting.test.js.snap12
-rw-r--r--tests/fixtures/foo.rb3
5 files changed, 31 insertions, 0 deletions
diff --git a/Dockerfile b/Dockerfile
index 2c8ff50..1bcd72d 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -33,6 +33,9 @@ COPY --from=builder /usr/local/share/vim /usr/local/share/vim
ENV PACKAGES="\
bash \
git \
+ ruby \
+ ruby-dev \
+ ruby-json \
python \
python3 \
py-pip \
diff --git a/ftdetect/ruby.vim b/ftdetect/ruby.vim
new file mode 100644
index 0000000..773a0d2
--- /dev/null
+++ b/ftdetect/ruby.vim
@@ -0,0 +1,3 @@
+augroup PrettierFileDetect
+ autocmd BufNewFile,BufReadPost *.rb setfiletype ruby
+augroup end
diff --git a/ftplugin/ruby.vim b/ftplugin/ruby.vim
new file mode 100644
index 0000000..c5f62fc
--- /dev/null
+++ b/ftplugin/ruby.vim
@@ -0,0 +1,10 @@
+let b:prettier_ft_default_args = {
+ \ 'parser': 'ruby',
+ \ }
+
+augroup Prettier
+ autocmd!
+ if get(g:, 'prettier#autoformat')
+ autocmd BufWritePre *.ruby call prettier#Autoformat()
+ endif
+augroup end
diff --git a/tests/__snapshots__/formatting.test.js.snap b/tests/__snapshots__/formatting.test.js.snap
index 205221b..161352f 100644
--- a/tests/__snapshots__/formatting.test.js.snap
+++ b/tests/__snapshots__/formatting.test.js.snap
@@ -174,6 +174,18 @@ def i18n_patterns(*urls, prefix_default_language=True):
pass"
`;
+exports[`Prettier formats foo.rb file with :Prettier command 1`] = `
+"[1, 2, 3].each do |i|
+ p i
+end"
+`;
+
+exports[`Prettier formats foo.rb file with :PrettierAsync command 1`] = `
+"[1, 2, 3].each do |i|
+ p i
+end"
+`;
+
exports[`Prettier formats foo.scss file with :Prettier command 1`] = `
".redClass {
background: \\"red\\";
diff --git a/tests/fixtures/foo.rb b/tests/fixtures/foo.rb
new file mode 100644
index 0000000..29a29b3
--- /dev/null
+++ b/tests/fixtures/foo.rb
@@ -0,0 +1,3 @@
+for i in [1, 2, 3] do
+ p i
+end