Skip to content

Commit

Permalink
Install Chrome in Circle CI config
Browse files Browse the repository at this point in the history
  • Loading branch information
julianguyen committed May 15, 2022
1 parent 980d954 commit 5edc552
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 24 deletions.
13 changes: 5 additions & 8 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
version: 2
orbs:
browser-tools: circleci/browser-tools@1.3
defaults: &defaults
working_directory: ~/ifmeorg/ifme
parallelism: 1
Expand All @@ -26,13 +24,7 @@ defaults: &defaults
# The default Redis port
REDIS_PORT: 6379
steps:
- browser-tools/install-browser-tools
- checkout
- run: |
ruby --version
node --version
java --version
google-chrome --version
jobs:
setup-coverage:
<<: *defaults
Expand Down Expand Up @@ -68,6 +60,11 @@ jobs:
- run: gem install bundler
- run: bundle install --path=vendor/bundle --jobs=4 --retry=3
- run: yarn install --cache-folder ~/.cache/yarn
- run:
name: Setup Chrome
command: |
wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
sudo apt install ./google-chrome-stable_current_amd64.deb
- save_cache:
key: v1-dep-{{ .Branch }}-{{ epoch }}
paths:
Expand Down
22 changes: 6 additions & 16 deletions app/services/moment_keywords.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@ def call
collect_keywords(@moment.strategies)
@moment_keywords.push(extract(@moment.name),
extract(@moment.why),
extract(@moment.fix || []))
remove_special_chars
downcase_keywords
extract(@moment.fix))
@moment_keywords = @moment_keywords.join(' ')
end

Expand All @@ -26,22 +24,14 @@ def strip_html(str)

def collect_keywords(array)
array.each do |item|
@moment_keywords.push(item['name'].split,
@moment_keywords.push(extract(item['name']),
extract(item['description']))
end
end

def extract(array)
strip_html(array).split
end

def remove_special_chars
@moment_keywords = @moment_keywords.flatten.each do |keyword|
keyword.gsub!(/[^\p{Alpha} -]/, '')
end
end

def downcase_keywords
@moment_keywords = @moment_keywords.map(&:downcase)
def extract(str)
str = str || ''
str = strip_html(str.tr('\\', '/'))
str.gsub(/[^\p{Alpha} -]/, '').split.map(&:downcase)
end
end

0 comments on commit 5edc552

Please sign in to comment.