Skip to content

Commit

Permalink
Merge branch 'master' into translate-configuring-ember-cli-page
Browse files Browse the repository at this point in the history
  • Loading branch information
mderaldo committed Sep 27, 2017
2 parents 50b0df3 + fc5940f commit 4805720
Show file tree
Hide file tree
Showing 232 changed files with 1,071 additions and 398 deletions.
6 changes: 5 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,19 @@ rvm:
addons:
apt:
packages:
- aspell-pt-br
- aspell
- aspell-en
- aspell-pt-br
cache: bundler
before_script: ./scripts/spell-check.sh
script: bundle exec rspec spec && bundle exec middleman build --verbose
deploy:
skip_cleanup: true
provider: pages
repo: ember-brasil/ember-brasil.github.io
target_branch: master
github_token: $GITHUB_TOKEN
fqdn: ember-brasil.com.br
local_dir: ./build
on:
branch: master
11 changes: 11 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,14 @@ Para manter a tradução com o mesmo padrão elevado do original, precisamos de:
Obrigado por nos ajudar!

Caso tenha alguma dúvida ou ideia relativas ao projeto, manda um ping no twitter [@aureliosaraiva](https://twitter.com/aureliosaraiva), Slack ou Telegram.

## Como adicionar uma empresa?

Para adicionar uma empresa ou projeto é bem simples.

1. Faça um `fork` deste projeto
2. Caso necessário, utilize o branch `master`.
3. Adicione as informações da empresa no final deste arquivo `data/companys.yml`
4. Adicione o logo tipo da empresa nesta pasta: `source/images/empresas`
> A imagem precisa ter uma resolução, transparente e com espaçamento nas bordas adequado.
5. Abra um pull request com o título `[EMPRESA] NOME_DA_EMPRESA`
1 change: 1 addition & 0 deletions CONTRIBUTORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,5 @@

1. Aurélio Saraiva https://github.com/aureliosaraiva
2. Danilo Vaz https://github.com/danilovaz
3. Marcelo Both https://github.com/marceloboth

1 change: 0 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
source 'https://rubygems.org'

gem 'middleman-spellcheck'
gem "redcarpet"
gem "activesupport", '~> 4.1.11'
gem "highline"
Expand Down
4 changes: 0 additions & 4 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,6 @@ GEM
rack (>= 1.4.5, < 2.0)
thor (>= 0.15.2, < 2.0)
tilt (~> 1.4.1, < 2.0)
middleman-spellcheck (0.9.2)
middleman-core (~> 3.2)
nokogiri
middleman-sprockets (3.4.2)
middleman-core (>= 3.3)
sprockets (~> 2.12.1)
Expand Down Expand Up @@ -212,7 +209,6 @@ DEPENDENCIES
listen
middleman (~> 3.0)
middleman-alias
middleman-spellcheck
neat
normalize-scss
poltergeist
Expand Down
51 changes: 49 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[![Build Status](https://travis-ci.org/ember-brasil/ember-guides.svg?branch=master)](https://travis-ci.org/ember-brasil/ember-guides)
[![Build Status](https://travis-ci.org/ember-brasil/website.svg?branch=master)](https://travis-ci.org/ember-brasil/website)

## Projeto de tradução da documentação do Ember
> Projeto não oficial
Expand Down Expand Up @@ -27,5 +27,52 @@ Se você sabe inglês ou leu alguma parte já traduzida e achou algum erro, nós

> "Comece de onde você está. Use o que você tiver. Faça o que você puder" – Arthur Ashe
## Sincronizando seu fork
Para sincronizar seu repositório (fork), siga essas instruções:
https://help.github.com/articles/syncing-a-fork/

## Executando o site

### Dependências

O site é criado com Middleman e executado em Ruby 1.9.3 or newer (2.0.0 recommended).

Os usuários de Mac devem instalar Ruby usando rbenv:

```
brew install rbenv
```
Siga as [instruções de instalação do rbenv](https://github.com/rbenv/rbenv) para instalar a versão do Ruby especificada [aqui](.Ruby-version).

Depois de instalar o Ruby, você precisará do `bundler` e do Middleman:

```
gem install bundler middleman
```

Após a instalação do ambiente, você pode iniciar o projeto:

``` sh
git clone git://github.com/ember-brasil/website.git
cd website
bundle
bundle exec middleman
```

Então acesse [http://localhost:4567/](http://localhost:4567/).

## Rodando com Docker

Para rodar com o Docker você precisa ter Docker e Docker Compose instalado na maquina.
Siga essas instruções para instalar o docker e docker-compose:
- https://docs.docker.com/engine/installation/
- https://docs.docker.com/compose/install/


``` sh
git clone git://github.com/ember-brasil/website.git
cd website
docker-compose up
```


See https://github.com/ember-brasil/ember-brasil.github.io.
10 changes: 5 additions & 5 deletions config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@
activate :alias

def current_guide(mm_instance, current_page)
path = current_page.path.gsub('.html', '')
path = current_page.path.gsub('.html', '').gsub("guides/", "")
guide_path = path.split("/")[0]

current_guide = mm_instance.data.pages.find do |guide|
current_guide = mm_instance.data.guides.find do |guide|
guide.url == guide_path
end

Expand All @@ -39,7 +39,7 @@ def current_chapter(mm_instance, current_page)
guide = current_guide(mm_instance, current_page)
return unless guide

path = current_page.path.gsub('.html', '')
path = current_page.path.gsub('.html', '').gsub("guides/", "")
chapter_path = path.split('/')[1..-1].join('/')

current_chapter = guide.pages.find do |chapter|
Expand All @@ -53,8 +53,6 @@ def current_chapter(mm_instance, current_page)
# Build
###
configure :build do
set :spellcheck_allow_file, "./data/spelling-exceptions.txt"
#activate :spellcheck, lang: "pt-br", ignore_selector: '.CodeRay', page: /^(?!.*stylesheets|.*javascript|.*fonts|.*images|.*analytics).*$/
activate :minify_css
activate :minify_javascript, ignore: /.*examples.*js/
activate :html_proofer
Expand All @@ -65,6 +63,8 @@ def current_chapter(mm_instance, current_page)
###
page '404.html', directory_index: false

page 'guides*', layout: :guides

# Don't build layouts standalone
ignore '*_layout.erb'

Expand Down
9 changes: 9 additions & 0 deletions data/companys.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
- url: http://www.creditas.com.br/
image: creditas.jpg
alt: Creditas
use: "Ember é usado em todas os serviços internos da Creditas"

- url: https://mlabs.com.br/
image: mlabs.png
alt: mLabs
use: "Ember é utilizado no produto principal da mLabs"
11 changes: 11 additions & 0 deletions data/contribuidores.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
- name: Aurélio Saraiva
github: https://github.com/aureliosaraiva
twitter: https://twitter.com/aureliosaraiva
image: aureliosaraiva.jpg
bio: Desenvolvedor full-stack com mais de 10 anos de experiência, gosta de organizar meetups e compartilhar conhecimento com a comunidade

- name: Danilo Vaz
github: https://github.com/danilovaz
twitter: https://twitter.com/_danilovaz
image: danilovaz.jpg
bio: Desenvolvedor Front-End, organizador do FrontUX - SJC e BeerJS - SJC, mentor Front-End no Training Center e um Ember Padawan.
8 changes: 4 additions & 4 deletions data/guides.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
- title: "Guides and Tutorials"
- title: "Documentação e tutorial"
url: 'index'
skip_toc: true
pages:
Expand Down Expand Up @@ -134,7 +134,7 @@
- title: "Controllers"
url: 'controllers'
pages:
- title: "Introduction"
- title: "Introdução"
url: "index"

- title: "Models"
Expand Down Expand Up @@ -257,8 +257,8 @@
- title: "Repositories"
url: "repositories"

- title: "Glossary"
- title: "Glossário"
url: "glossary"
pages:
- title: "Web Development"
- title: "Desenvolvimento WEB"
url: "web-development"
2 changes: 2 additions & 0 deletions docker-images/ember-guides
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ RUN apt-get update && apt-get install -qq -y libpq-dev ruby-all-dev build-essent
RUN curl -sL https://deb.nodesource.com/setup_6.x | bash -
RUN apt-get install -y nodejs

RUN apt-get install -y aspell aspell-pt-br

RUN rm -rf /var/lib/apt/lists/*

#keeps bundler update
Expand Down
6 changes: 3 additions & 3 deletions lib/toc.rb
Original file line number Diff line number Diff line change
Expand Up @@ -146,13 +146,13 @@ def toc_anchorify(text)
text.gsub(/&#?\w+;/, '-').gsub(/\W+/, '-').gsub(/^-|-$/, '').downcase
end

def build_toc_for(pages, level=0, base_path="", parent_current=true)
def build_toc_for(pages, level=0, base_path="/guides", parent_current=true)
buffer = "<ol class='toc-level-#{level}#{parent_current ? ' selected' : ''}'>"
# indentation below is to aid in understanding the HTML structure
pages.each do |page|
next if page.skip_toc

requested_page_url = current_page.path.gsub('.html', '').split('/')[level]
requested_page_url = current_page.path.gsub('.html', '').gsub('guides/', '').split('/')[level]
current = (parent_current && page.url == requested_page_url)

page_path = base_path + "/" + page.url
Expand Down Expand Up @@ -216,7 +216,7 @@ def current_pages
end

def current_slugs
@current_slugs ||= current_page.path.gsub(".html", "").split("/")
@current_slugs ||= current_page.path.gsub(".html", "").gsub("guides/", "").split("/")
end

def pages_for_slugs(slugs, pages=data.guides)
Expand Down
15 changes: 14 additions & 1 deletion data/spelling-exceptions.txt → scripts/aspell.en.pws
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
personal_ws-1.1 en 321
accessor
actionhttp
activesupport
Expand Down Expand Up @@ -169,7 +170,6 @@ mut
mysql
namespace
nav
naïve
normalizeresponse
npm
onerror
Expand Down Expand Up @@ -307,3 +307,16 @@ internet
plugin
krisselden
DependenciesGit
communityPropertyTypes
myHelper
propertyType
attr
findAll
findRecord
hbs
ApplicationInstance
FastBoot
statefuls
container
img
src
1 change: 1 addition & 0 deletions scripts/aspell.pt_BR.pws
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
personal_ws-1.1 pt_BR 0
77 changes: 77 additions & 0 deletions scripts/spell-check.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
#!/bin/bash
# requires apt packages: aspell, aspell-pt_BR

RED='\033[0;31m'
GREEN='\033[0;32m'
BLUE='\033[0;36m'
NC='\033[0m' # No Color

USE_LANGUAGE='pt_BR'

MARKDOWN_FILES_CHANGED=`(git diff --name-only $TRAVIS_COMMIT_RANGE || true) | grep .md`

if [ -z "$MARKDOWN_FILES_CHANGED" ]
then
echo -e "$GREEN>> No markdown file to check $NC"

exit 0;
fi

echo -e "$BLUE>> Following markdown files were changed in this pull request (commit range: $TRAVIS_COMMIT_RANGE):$NC"
echo "$MARKDOWN_FILES_CHANGED"

FOUND_LANGUAGES=`echo "$MARKDOWN_FILES_CHANGED" | xargs cat | grep "permalink: /" | sed -E 's/permalink: \/(fr|en)\/.*/\1/g'`
echo -e "$BLUE>> Languages recognized from the permalinks:$NC"
echo "$FOUND_LANGUAGES"

echo -e "$BLUE>> Will use this language as main one:$NC"
echo "$USE_LANGUAGE"

# cat all markdown files that changed
TEXT_CONTENT_WITHOUT_METADATA=`cat $(echo "$MARKDOWN_FILES_CHANGED" | sed -E ':a;N;$!ba;s/\n/ /g')`
# remove metadata tags
TEXT_CONTENT_WITHOUT_METADATA=`echo "$TEXT_CONTENT_WITHOUT_METADATA" | grep -v -E '^(layout:|permalink:|date:|date_gmt:|authors:|categories:|tags:|cover:)(.*)'`
# remove { } attributes
TEXT_CONTENT_WITHOUT_METADATA=`echo "$TEXT_CONTENT_WITHOUT_METADATA" | sed -E 's/\{:([^\}]+)\}//g'`
# remove html
TEXT_CONTENT_WITHOUT_METADATA=`echo "$TEXT_CONTENT_WITHOUT_METADATA" | sed -E 's/<([^<]+)>//g'`
# remove code blocks
TEXT_CONTENT_WITHOUT_METADATA=`echo "$TEXT_CONTENT_WITHOUT_METADATA" | sed -n '/^\`\`\`/,/^\`\`\`/ !p'`
# remove links
TEXT_CONTENT_WITHOUT_METADATA=`echo "$TEXT_CONTENT_WITHOUT_METADATA" | sed -E 's/http(s)?:\/\/([^ ]+)//g'`

echo -e "$BLUE>> Text content that will be checked (without metadata, html, and links):$NC"
echo "$TEXT_CONTENT_WITHOUT_METADATA"

echo -e "$BLUE>> Checking in 'en' (many technical words are in English anyway)...$NC"
MISSPELLED=`echo "$TEXT_CONTENT_WITHOUT_METADATA" | aspell --lang=en --encoding=utf-8 --add-extra-dicts=./scripts/aspell.en.pws list | sort -u`

echo -e "$BLUE>> Checking in '$USE_LANGUAGE' too..."
MISSPELLED=`echo "$MISSPELLED" | aspell --lang=$USE_LANGUAGE --encoding=utf-8 --add-extra-dicts=./scripts/aspell.$USE_LANGUAGE.pws list | sort -u`

NB_MISSPELLED=`echo "$MISSPELLED" | grep -Ev "^$" | wc -l`

if [ "$NB_MISSPELLED" -gt 0 ]
then
echo -e "$RED>> Words that might be misspelled, please check:$NC"
MISSPELLED=`echo "$MISSPELLED" | sed -E ':a;N;$!ba;s/\n/, /g'`
echo "$MISSPELLED"
COMMENT="$NB_MISSPELLED words might be misspelled, please check them: $MISSPELLED"

echo -e "$BLUE>> Sending results in a comment on the Github pull request #$TRAVIS_PULL_REQUEST:$NC"
curl -i -H "Authorization: token $GITHUB_TOKEN" \
-H "Content-Type: application/json" \
-X POST -d "{\"body\":\"$COMMENT\"}" \
https://api.github.com/repos/ember-brasil/website/issues/$TRAVIS_PULL_REQUEST/comments
exit 1
else
COMMENT="No spelling errors, congratulations!"
echo -e "$GREEN>> $COMMENT $NC"

echo -e "$BLUE>> Sending results in a comment on the Github pull request #$TRAVIS_PULL_REQUEST:$NC"
curl -i -H "Authorization: token $GITHUB_TOKEN" \
-H "Content-Type: application/json" \
-X POST -d "{\"body\":\"$COMMENT\"}" \
https://api.github.com/repos/ember-brasil/website/issues/$TRAVIS_PULL_REQUEST/comments
exit 0
fi
9 changes: 9 additions & 0 deletions source/_google-analytics.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<script type="text/javascript">
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');

ga('create', 'UA-105665012-1', 'auto');
ga('send', 'pageview');
</script>
Loading

0 comments on commit 4805720

Please sign in to comment.