Skip to content

Commit

Permalink
Merge branch 'main' into fix/spec-highlight-result
Browse files Browse the repository at this point in the history
  • Loading branch information
shortcuts authored Dec 1, 2023
2 parents 3606528 + 833b489 commit dd67449
Show file tree
Hide file tree
Showing 40 changed files with 2,551 additions and 23 deletions.
23 changes: 20 additions & 3 deletions .github/actions/restore-artifacts/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,16 @@ inputs:
required: false
dart:
description: Whether this job ran or not
required: false
required: false
python:
description: Whether this job ran or not
required: false
required: false
ruby:
description: Whether this job ran or not
required: false
scala:
description: Whether this job ran or not
required: false
required: false

runs:
using: composite
Expand Down Expand Up @@ -142,6 +145,20 @@ runs:
rm -rf clients/algoliasearch-client-python
unzip -q -o clients-python.zip && rm clients-python.zip
# Ruby
- name: Download clients-ruby artifact
if: ${{ inputs.ruby == 'true' && inputs.type == 'all' }}
uses: actions/download-artifact@v3
with:
name: clients-ruby

- name: Unzip clients-ruby artifact
if: ${{ inputs.ruby == 'true' && inputs.type == 'all' }}
shell: bash
run: |
rm -rf clients/algoliasearch-client-ruby
unzip -q -o clients-ruby.zip && rm clients-ruby.zip
# Scala
- name: Download clients-scala artifact
if: ${{ inputs.scala == 'true' && inputs.type == 'all' }}
Expand Down
30 changes: 24 additions & 6 deletions .github/actions/setup/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -138,18 +138,18 @@ runs:
run: |
echo "DART_VERSION=$(cat config/.dart-version)" >> $GITHUB_OUTPUT
- name: Install dart
- name: Install dart
if: ${{ inputs.language == 'dart' }}
uses: dart-lang/setup-dart@v1
uses: dart-lang/setup-dart@v1
with:
sdk: ${{ steps.dart-version.outputs.DART_VERSION }}

- name: Setup dart tools
if: ${{ inputs.language == 'dart' }}
shell: bash
run: dart pub global activate melos
run: dart pub global activate melos

# Python deps
# Python deps
- name: Get Python version
if: ${{ inputs.language == 'python' }}
id: python-version
Expand All @@ -173,6 +173,21 @@ runs:
working-directory: clients/algoliasearch-client-python
shell: bash

# Ruby deps
- name: Get Ruby version
if: ${{ inputs.language == 'ruby' }}
id: ruby-version
shell: bash
run: |
echo "RUBY_VERSION=$(cat config/.ruby-version)" >> $GITHUB_OUTPUT
- name: Install Ruby
if: ${{ inputs.language == 'ruby' }}
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ steps.ruby-version.outputs.RUBY_VERSION }}
bundler-cache: true

# Computing jobs that should run
- name: Setting diff outputs variables
if: inputs.type == 'matrix'
Expand Down Expand Up @@ -240,13 +255,16 @@ outputs:
value: ${{ steps.gen-matrix.outputs.RUN_GEN_KOTLIN }}
RUN_GEN_DART:
description: Indicates if we plan to run the job for this language
value: ${{ steps.gen-matrix.outputs.RUN_GEN_DART }}
value: ${{ steps.gen-matrix.outputs.RUN_GEN_DART }}
RUN_GEN_PYTHON:
description: Indicates if we plan to run the job for this language
value: ${{ steps.gen-matrix.outputs.RUN_GEN_PYTHON }}
RUN_GEN_RUBY:
description: Indicates if we plan to run the job for this language
value: ${{ steps.gen-matrix.outputs.RUN_GEN_RUBY }}
RUN_GEN_SCALA:
description: Indicates if we plan to run the job for this language
value: ${{ steps.gen-matrix.outputs.RUN_GEN_SCALA }}
value: ${{ steps.gen-matrix.outputs.RUN_GEN_SCALA }}

RUN_JS_UTILS:
description: Whether to build JS client common folders when RUN_JS is false
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ jobs:
RUN_GEN_KOTLIN: ${{ steps.setup.outputs.RUN_GEN_KOTLIN }}
RUN_GEN_DART: ${{ steps.setup.outputs.RUN_GEN_DART }}
RUN_GEN_PYTHON: ${{ steps.setup.outputs.RUN_GEN_PYTHON }}
RUN_GEN_RUBY: ${{ steps.setup.outputs.RUN_GEN_RUBY }}
RUN_GEN_SCALA: ${{ steps.setup.outputs.RUN_GEN_SCALA }}

RUN_JS_UTILS: ${{ steps.setup.outputs.RUN_JS_UTILS }}
Expand Down Expand Up @@ -323,6 +324,7 @@ jobs:
kotlin: ${{ needs.setup.outputs.RUN_GEN_KOTLIN }}
dart: ${{ needs.setup.outputs.RUN_GEN_DART }}
python: ${{ needs.setup.outputs.RUN_GEN_PYTHON }}
ruby: ${{ needs.setup.outputs.RUN_GEN_RUBY }}
scala: ${{ needs.setup.outputs.RUN_GEN_SCALA }}

- name: Setup
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pr-title.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ jobs:
- name: Pull Request title rules
uses: Slashgear/[email protected]
with:
regexp: '^(docs|chore)|((?:feat|fix|docs|style|refactor|perf|test|build|ci|chore|revert)\((?:clients|generators|playground|javascript|php|java|go|kotlin|dart|python|scala|cts|specs|scripts|ci|templates|deps)\)): .+'
regexp: '^(docs|chore)|((?:feat|fix|docs|style|refactor|perf|test|build|ci|chore|revert)\((?:clients|generators|playground|javascript|php|java|go|kotlin|dart|python|ruby|scala|cts|specs|scripts|ci|templates|deps)\)): .+'
5 changes: 5 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,11 @@ ADD https://github.com/google/google-java-format/releases/download/v1.18.1/googl
# Scala
RUN sdk install sbt

# Ruby with RVM, because it's too difficult with the image, dependencies are splattered everywhere
ARG RUBY_VERSION
RUN wget -O ruby.tar.gz https://github.com/postmodern/ruby-install/releases/download/v0.9.2/ruby-install-0.9.2.tar.gz \
&& tar -xzvf ruby.tar.gz && cd ruby && make install && ruby-install ruby ${RUBY_VERSION} && gem install bundler

WORKDIR /app

CMD bash
39 changes: 39 additions & 0 deletions clients/algoliasearch-client-ruby/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Generated by: https://openapi-generator.tech
#

*.gem
*.rbc
/.config
/coverage/
/InstalledFiles
/pkg/
/spec/reports/
/spec/examples.txt
/test/tmp/
/test/version_tmp/
/tmp/

## Specific to RubyMotion:
.dat*
.repl_history
build/

## Documentation cache and generated files:
/.yardoc/
/_yardoc/
/doc/
/rdoc/

## Environment normalization:
/.bundle/
/vendor/bundle
/lib/bundler/man/

# for a library or gem, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# Gemfile.lock
# .ruby-version
# .ruby-gemset

# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
.rvmrc
147 changes: 147 additions & 0 deletions clients/algoliasearch-client-ruby/.rubocop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
# This file is based on https://github.com/rails/rails/blob/master/.rubocop.yml (MIT license)
AllCops:
TargetRubyVersion: 2.4
# RuboCop has a bunch of cops enabled by default. This setting tells RuboCop
# to ignore them, so only the ones explicitly set in this file are enabled.
DisabledByDefault: true
Exclude:
- '**/templates/**/*'
- '**/vendor/**/*'
- 'actionpack/lib/action_dispatch/journey/parser.rb'

# Prefer &&/|| over and/or.
Style/AndOr:
Enabled: true

# Align `when` with `case`.
Layout/CaseIndentation:
Enabled: true

# Align comments with method definitions.
Layout/CommentIndentation:
Enabled: true

Layout/ElseAlignment:
Enabled: true

Layout/EmptyLineAfterMagicComment:
Enabled: true

# In a regular class definition, no empty lines around the body.
Layout/EmptyLinesAroundClassBody:
Enabled: true

# In a regular method definition, no empty lines around the body.
Layout/EmptyLinesAroundMethodBody:
Enabled: true

# In a regular module definition, no empty lines around the body.
Layout/EmptyLinesAroundModuleBody:
Enabled: true

Layout/FirstArgumentIndentation:
Enabled: true

# Use Ruby >= 1.9 syntax for hashes. Prefer { a: :b } over { :a => :b }.
Style/HashSyntax:
Enabled: false

# Method definitions after `private` or `protected` isolated calls need one
# extra level of indentation.
Layout/IndentationConsistency:
Enabled: true
EnforcedStyle: indented_internal_methods

# Two spaces, no tabs (for indentation).
Layout/IndentationWidth:
Enabled: true

Layout/LeadingCommentSpace:
Enabled: true

Layout/SpaceAfterColon:
Enabled: true

Layout/SpaceAfterComma:
Enabled: true

Layout/SpaceAroundEqualsInParameterDefault:
Enabled: true

Layout/SpaceAroundKeyword:
Enabled: true

Layout/SpaceAroundOperators:
Enabled: true

Layout/SpaceBeforeComma:
Enabled: true

Layout/SpaceBeforeFirstArg:
Enabled: true

Style/DefWithParentheses:
Enabled: true

# Defining a method with parameters needs parentheses.
Style/MethodDefParentheses:
Enabled: true

Style/FrozenStringLiteralComment:
Enabled: false
EnforcedStyle: always

# Use `foo {}` not `foo{}`.
Layout/SpaceBeforeBlockBraces:
Enabled: true

# Use `foo { bar }` not `foo {bar}`.
Layout/SpaceInsideBlockBraces:
Enabled: true

# Use `{ a: 1 }` not `{a:1}`.
Layout/SpaceInsideHashLiteralBraces:
Enabled: true

Layout/SpaceInsideParens:
Enabled: true

# Check quotes usage according to lint rule below.
#Style/StringLiterals:
# Enabled: true
# EnforcedStyle: single_quotes

# Detect hard tabs, no hard tabs.
Layout/IndentationStyle:
Enabled: true

# Blank lines should not have any spaces.
Layout/TrailingEmptyLines:
Enabled: true

# No trailing whitespace.
Layout/TrailingWhitespace:
Enabled: false

# Use quotes for string literals when they are enough.
Style/RedundantPercentQ:
Enabled: true

# Align `end` with the matching keyword or starting expression except for
# assignments, where it should be aligned with the LHS.
Layout/EndAlignment:
Enabled: true
EnforcedStyleAlignWith: variable
AutoCorrect: true

# Use my_method(my_arg) not my_method( my_arg ) or my_method my_arg.
Lint/RequireParentheses:
Enabled: true

Style/RedundantReturn:
Enabled: true
AllowMultipleReturnValues: true

Style/Semicolon:
Enabled: true
AllowAsExpressionSeparator: true
6 changes: 6 additions & 0 deletions clients/algoliasearch-client-ruby/Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
source 'https://rubygems.org'

gemspec

group :development, :test do
end
62 changes: 62 additions & 0 deletions clients/algoliasearch-client-ruby/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
<p align="center">
<a href="https://www.algolia.com">
<img alt="Algolia for Ruby" src="https://raw.githubusercontent.com/algolia/algoliasearch-client-common/master/banners/ruby.png" >
</a>

<h4 align="center">The perfect starting point to integrate <a href="https://algolia.com" target="_blank">Algolia</a> within your Ruby project</h4>

<p align="center">
<a href="https://circleci.com/gh/algolia/algoliasearch-client-ruby"><img src="https://circleci.com/gh/algolia/algoliasearch-client-ruby.svg?style=shield" alt="CircleCI" /></a>
<a href="https://rubygems.org/gems/algolia"><img src="https://badge.fury.io/rb/algolia.svg" alt="Gem Version"></a>
<a href="https://rubygems.org/gems/algolia"><img src="https://img.shields.io/badge/licence-MIT-blue.svg" alt="License"></a>
</p>
</p>

<p align="center">
<a href="https://www.algolia.com/doc/api-client/getting-started/install/ruby/" target="_blank">Documentation</a> •
<a href="https://github.com/algolia/algoliasearch-rails" target="_blank">Rails</a> •
<a href="https://discourse.algolia.com" target="_blank">Community Forum</a> •
<a href="http://stackoverflow.com/questions/tagged/algolia" target="_blank">Stack Overflow</a> •
<a href="https://github.com/algolia/algoliasearch-client-ruby/issues" target="_blank">Report a bug</a> •
<a href="https://www.algolia.com/doc/api-client/troubleshooting/faq/ruby/" target="_blank">FAQ</a> •
<a href="https://www.algolia.com/support" target="_blank">Support</a>
</p>

## ✨ Features

Thin & minimal low-level HTTP client to interact with Algolia's API

## 💡 Getting Started

First, install Algolia Ruby API Client via the [RubyGems](https://rubygems.org/) package manager:
```bash
gem install algolia
```

Then, create objects on your index:


```ruby
client = Algolia::SearchClient.create('YourApplicationID', 'YourAPIKey')

client.save_object('your_index_name', {objectID: 1, name: 'Foo'})
```

Finally, you may begin searching a object using the `search` method:
```ruby
objects = client.search_single_index('your_index_name', 'Foo')
```

For full documentation, visit the **[Algolia Ruby API Client](https://www.algolia.com/doc/api-client/getting-started/install/ruby/)**.

## ❓ Troubleshooting

Encountering an issue? Before reaching out to support, we recommend heading to our [FAQ](https://www.algolia.com/doc/api-client/troubleshooting/faq/ruby/) where you will find answers for the most common issues and gotchas with the client.

## Upgrade from V1 to V2

If you were using the v1 and wish to update to v2, please follow our [Upgrade Guide](upgrade_guide.md)

## 📄 License

Algolia Ruby API Client is an open-sourced software licensed under the [MIT license](LICENSE.md).
Loading

0 comments on commit dd67449

Please sign in to comment.