pah 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (71) hide show
  1. data/.gitignore +17 -0
  2. data/.rvmrc +1 -0
  3. data/Gemfile +4 -0
  4. data/LICENSE.txt +22 -0
  5. data/README.md +55 -0
  6. data/Rakefile +1 -0
  7. data/bin/pah +4 -0
  8. data/lib/pah/README.md +53 -0
  9. data/lib/pah/build +17 -0
  10. data/lib/pah/files/.gitignore +17 -0
  11. data/lib/pah/files/.rvmrc +48 -0
  12. data/lib/pah/files/Gemfile +52 -0
  13. data/lib/pah/files/Procfile +1 -0
  14. data/lib/pah/files/app/assets/stylesheets/reset.css +40 -0
  15. data/lib/pah/files/app/controllers/admin/contents_controller.rb +2 -0
  16. data/lib/pah/files/app/helpers/typus_helper.rb +32 -0
  17. data/lib/pah/files/app/models/content.rb +27 -0
  18. data/lib/pah/files/app/views/admin/dashboard/_sidebar.html.erb +0 -0
  19. data/lib/pah/files/app/views/layouts/application.html.haml +68 -0
  20. data/lib/pah/files/config/database.yml +22 -0
  21. data/lib/pah/files/config/initializers/omniauth.rb +4 -0
  22. data/lib/pah/files/config/initializers/requires.rb +1 -0
  23. data/lib/pah/files/config/locales/pt-BR.app.yml +16 -0
  24. data/lib/pah/files/config/locales/pt-BR.content.yml +12 -0
  25. data/lib/pah/files/config/locales/pt-BR.typus.yml +15 -0
  26. data/lib/pah/files/config/locales/pt-BR.yml +207 -0
  27. data/lib/pah/files/config/typus/content.yml +8 -0
  28. data/lib/pah/files/config/typus/content_roles.yml +4 -0
  29. data/lib/pah/files/config/unicorn.rb +27 -0
  30. data/lib/pah/files/db/migrate/20120605205337_create_contents.rb +11 -0
  31. data/lib/pah/files/db/seeds.rb +10 -0
  32. data/lib/pah/files/lib/tasks/integration.rake +14 -0
  33. data/lib/pah/files/public/index.html +1 -0
  34. data/lib/pah/files/spec/acceptance/dummy_spec.rb +9 -0
  35. data/lib/pah/files/spec/controllers/admin/contents_controller_spec.rb +5 -0
  36. data/lib/pah/files/spec/factories/content.rb +8 -0
  37. data/lib/pah/files/spec/helpers/typus_helper_spec.rb +71 -0
  38. data/lib/pah/files/spec/models/content_spec.rb +64 -0
  39. data/lib/pah/files/spec/spec_helper.rb +47 -0
  40. data/lib/pah/files/spec/support/README +1 -0
  41. data/lib/pah/files/spec/support/acceptance_helpers.rb +26 -0
  42. data/lib/pah/files/spec/support/acceptance_macros.rb +16 -0
  43. data/lib/pah/files/spec/support/capybara.rb +8 -0
  44. data/lib/pah/files/spec/support/deferred_garbage_collection.rb +35 -0
  45. data/lib/pah/files/spec/support/http_basic_auth.rb +26 -0
  46. data/lib/pah/files/spec/support/matchers.rb +5 -0
  47. data/lib/pah/files/spec/support/omniauth.rb +27 -0
  48. data/lib/pah/files/spec/support/paperclip.rb +4 -0
  49. data/lib/pah/files/spec/support/shared_connection.rb +12 -0
  50. data/lib/pah/files/spec/support/suppress_log.rb +5 -0
  51. data/lib/pah/files/spec/support/uploaded_file.rb +19 -0
  52. data/lib/pah/files/spec/support/vcr.rb +7 -0
  53. data/lib/pah/partials/_canonical_host.rb +14 -0
  54. data/lib/pah/partials/_capybara.rb +11 -0
  55. data/lib/pah/partials/_cleanup.rb +20 -0
  56. data/lib/pah/partials/_database.rb +6 -0
  57. data/lib/pah/partials/_default.rb +26 -0
  58. data/lib/pah/partials/_finish.rb +8 -0
  59. data/lib/pah/partials/_gems.rb +7 -0
  60. data/lib/pah/partials/_generators.rb +37 -0
  61. data/lib/pah/partials/_git.rb +7 -0
  62. data/lib/pah/partials/_heroku.rb +51 -0
  63. data/lib/pah/partials/_omniauth.rb +13 -0
  64. data/lib/pah/partials/_rspec.rb +13 -0
  65. data/lib/pah/partials/_rvm.rb +43 -0
  66. data/lib/pah/partials/_secure_headers.rb +12 -0
  67. data/lib/pah/setup.rb +17 -0
  68. data/lib/pah/template.rb +91 -0
  69. data/lib/pah/version.rb +3 -0
  70. data/pah.gemspec +27 -0
  71. metadata +205 -0
@@ -0,0 +1,22 @@
1
+ development:
2
+ adapter: postgresql
3
+ encoding: unicode
4
+ database: PROJECT_development
5
+ pool: 5
6
+ username: postgres
7
+ password:
8
+ host: localhost
9
+ encoding: utf8
10
+ template: template0
11
+
12
+ test:
13
+ adapter: postgresql
14
+ encoding: unicode
15
+ database: PROJECT_test
16
+ pool: 5
17
+ username: postgres
18
+ password:
19
+ min_messages: WARNING
20
+ host: localhost
21
+ encoding: utf8
22
+ template: template0
@@ -0,0 +1,4 @@
1
+ # -*- encoding : utf-8 -*-
2
+ Rails.application.config.middleware.use OmniAuth::Builder do
3
+ provider :facebook, ENV['FACEBOOK_APP_KEY'], ENV['FACEBOOK_APP_SECRET'], :scope => "email"
4
+ end
@@ -0,0 +1 @@
1
+ # add here requires that your app needs to load
@@ -0,0 +1,16 @@
1
+ pt-BR:
2
+ models_and_attributes: &models_and_attributes
3
+ models:
4
+ admin_user: Administrador
5
+ user: Usuário
6
+ attributes:
7
+ admin_user:
8
+ role: Perfil
9
+ status: Ativo?
10
+ locale: Idioma
11
+ user:
12
+ name: Nome
13
+ activerecord:
14
+ <<: *models_and_attributes
15
+ activemodel:
16
+ <<: *models_and_attributes
@@ -0,0 +1,12 @@
1
+ pt-BR:
2
+ models_and_attributes: &models_and_attributes
3
+ models:
4
+ content: Texto
5
+ attributes:
6
+ content:
7
+ name: Nome
8
+ text: Conteúdo
9
+ activerecord:
10
+ <<: *models_and_attributes
11
+ activemodel:
12
+ <<: *models_and_attributes
@@ -0,0 +1,15 @@
1
+ pt-BR:
2
+ #typus
3
+ Trash: Excluir
4
+ All: Todos
5
+ Save: Salvar
6
+ Models: Cadastros
7
+ Applications: Menu
8
+ "Save and add another": Salvar e adicionar outro
9
+ "Save and continue editing": Salvar e continuar editando
10
+ "Show by %{attribute}": Mostrar por %{attribute}
11
+ "Add New %{resource}": "Adicionar %{resource}"
12
+ "Select an Option": "Selecione uma opção"
13
+ "All Entries": Todos
14
+ Top: "Início"
15
+ Bottom: "Final"
@@ -0,0 +1,207 @@
1
+ pt-BR:
2
+ date:
3
+ abbr_day_names:
4
+ - Dom
5
+ - Seg
6
+ - Ter
7
+ - Qua
8
+ - Qui
9
+ - Sex
10
+ - Sáb
11
+ abbr_month_names:
12
+ -
13
+ - Jan
14
+ - Fev
15
+ - Mar
16
+ - Abr
17
+ - Mai
18
+ - Jun
19
+ - Jul
20
+ - Ago
21
+ - Set
22
+ - Out
23
+ - Nov
24
+ - Dez
25
+ day_names:
26
+ - Domingo
27
+ - Segunda
28
+ - Terça
29
+ - Quarta
30
+ - Quinta
31
+ - Sexta
32
+ - Sábado
33
+ formats:
34
+ default: ! '%d/%m/%Y'
35
+ long: ! '%d de %B de %Y'
36
+ short: ! '%d de %B'
37
+ month_names:
38
+ -
39
+ - Janeiro
40
+ - Fevereiro
41
+ - Março
42
+ - Abril
43
+ - Maio
44
+ - Junho
45
+ - Julho
46
+ - Agosto
47
+ - Setembro
48
+ - Outubro
49
+ - Novembro
50
+ - Dezembro
51
+ order:
52
+ - :day
53
+ - :month
54
+ - :year
55
+ datetime:
56
+ distance_in_words:
57
+ about_x_hours:
58
+ one: aproximadamente 1 hora
59
+ other: aproximadamente %{count} horas
60
+ about_x_months:
61
+ one: aproximadamente 1 mês
62
+ other: aproximadamente %{count} meses
63
+ about_x_years:
64
+ one: aproximadamente 1 ano
65
+ other: aproximadamente %{count} anos
66
+ almost_x_years:
67
+ one: quase 1 ano
68
+ other: quase %{count} anos
69
+ half_a_minute: meio minuto
70
+ less_than_x_minutes:
71
+ one: menos de um minuto
72
+ other: menos de %{count} minutos
73
+ less_than_x_seconds:
74
+ one: menos de 1 segundo
75
+ other: menos de %{count} segundos
76
+ over_x_years:
77
+ one: mais de 1 ano
78
+ other: mais de %{count} anos
79
+ x_days:
80
+ one: 1 dia
81
+ other: ! '%{count} dias'
82
+ x_minutes:
83
+ one: 1 minuto
84
+ other: ! '%{count} minutos'
85
+ x_months:
86
+ one: 1 mês
87
+ other: ! '%{count} meses'
88
+ x_seconds:
89
+ one: 1 segundo
90
+ other: ! '%{count} segundos'
91
+ prompts:
92
+ day: Dia
93
+ hour: Hora
94
+ minute: Minuto
95
+ month: Mês
96
+ second: Segundo
97
+ year: Ano
98
+ errors: &errors
99
+ format: ! '%{attribute} %{message}'
100
+ messages:
101
+ accepted: deve ser aceito
102
+ blank: não pode ficar em branco
103
+ confirmation: não está de acordo com a confirmação
104
+ empty: não pode ficar vazio
105
+ equal_to: deve ser igual a %{count}
106
+ even: deve ser par
107
+ exclusion: não está disponível
108
+ greater_than: deve ser maior que %{count}
109
+ greater_than_or_equal_to: deve ser maior ou igual a %{count}
110
+ inclusion: não está incluído na lista
111
+ invalid: não é válido
112
+ less_than: deve ser menor que %{count}
113
+ less_than_or_equal_to: deve ser menor ou igual a %{count}
114
+ not_a_number: não é um número
115
+ not_an_integer: não é um número inteiro
116
+ odd: deve ser ímpar
117
+ record_invalid: ! 'A validação falhou: %{errors}'
118
+ taken: já está em uso
119
+ too_long: ! 'é muito longo (máximo: %{count} caracteres)'
120
+ too_short: ! 'é muito curto (mínimo: %{count} caracteres)'
121
+ wrong_length: não possui o tamanho esperado (%{count} caracteres)
122
+ template:
123
+ body: ! 'Por favor, verifique o(s) seguinte(s) campo(s):'
124
+ header:
125
+ one: ! 'Não foi possível gravar %{model}: 1 erro'
126
+ other: ! 'Não foi possível gravar %{model}: %{count} erros.'
127
+ helpers:
128
+ select:
129
+ prompt: Por favor selecione
130
+ submit:
131
+ create: Criar %{model}
132
+ submit: Salvar %{model}
133
+ update: Atualizar %{model}
134
+ number:
135
+ currency:
136
+ format:
137
+ delimiter: .
138
+ format: ! '%u %n'
139
+ precision: 2
140
+ separator: ! ','
141
+ significant: false
142
+ strip_insignificant_zeros: false
143
+ unit: R$
144
+ format:
145
+ delimiter: .
146
+ precision: 3
147
+ separator: ! ','
148
+ significant: false
149
+ strip_insignificant_zeros: false
150
+ human:
151
+ decimal_units:
152
+ format: ! '%n %u'
153
+ units:
154
+ billion:
155
+ one: bilhão
156
+ other: bilhões
157
+ million:
158
+ one: milhão
159
+ other: milhões
160
+ quadrillion:
161
+ one: quatrilhão
162
+ other: quatrilhões
163
+ thousand: mil
164
+ trillion:
165
+ one: trilhão
166
+ other: trilhões
167
+ unit: ''
168
+ format:
169
+ delimiter: .
170
+ precision: 2
171
+ significant: true
172
+ strip_insignificant_zeros: true
173
+ storage_units:
174
+ format: ! '%n %u'
175
+ units:
176
+ byte:
177
+ one: Byte
178
+ other: Bytes
179
+ gb: GB
180
+ kb: KB
181
+ mb: MB
182
+ tb: TB
183
+ percentage:
184
+ format:
185
+ delimiter: .
186
+ precision:
187
+ format:
188
+ delimiter: .
189
+ support:
190
+ array:
191
+ last_word_connector: ! ' e '
192
+ two_words_connector: ! ' e '
193
+ words_connector: ! ', '
194
+ time:
195
+ am: ''
196
+ formats:
197
+ default: ! '%A, %d de %B de %Y, %H:%M h'
198
+ long: ! '%A, %d de %B de %Y, %H:%M h'
199
+ short: ! '%d/%m, %H:%M h'
200
+ pm: ''
201
+ # remove these aliases after 'activemodel' and 'activerecord' namespaces are removed from Rails repository
202
+ activemodel:
203
+ errors:
204
+ <<: *errors
205
+ activerecord:
206
+ errors:
207
+ <<: *errors
@@ -0,0 +1,8 @@
1
+ # Use the README file as a reference to customize settings.
2
+
3
+ Content:
4
+ fields:
5
+ default: name, text
6
+ form: text
7
+ relationships:
8
+ application: Application
@@ -0,0 +1,4 @@
1
+ # Use the README file as a reference to customize settings.
2
+
3
+ admin:
4
+ Content: read, update
@@ -0,0 +1,27 @@
1
+ # config/unicorn.rb
2
+
3
+ worker_processes Integer(ENV['WEB_CONCURRENCY'] || 3)
4
+ timeout Integer(ENV['WEB_TIMEOUT'] || 15)
5
+ preload_app true
6
+
7
+ before_fork do |server, worker|
8
+
9
+ Signal.trap 'TERM' do
10
+ puts 'Unicorn master intercepting TERM and sending myself QUIT instead'
11
+ Process.kill 'QUIT', Process.pid
12
+ end
13
+
14
+ defined?(ActiveRecord::Base) and
15
+ ActiveRecord::Base.connection.disconnect!
16
+ end
17
+
18
+ after_fork do |server, worker|
19
+
20
+ Signal.trap 'TERM' do
21
+ puts 'Unicorn worker intercepting TERM and doing nothing. Wait for master to sent QUIT'
22
+ end
23
+
24
+ defined?(ActiveRecord::Base) and
25
+ ActiveRecord::Base.establish_connection
26
+ end
27
+
@@ -0,0 +1,11 @@
1
+ class CreateContents < ActiveRecord::Migration
2
+ def change
3
+ create_table :contents do |t|
4
+ t.string :name
5
+ t.string :slug
6
+ t.text :text
7
+
8
+ t.timestamps
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,10 @@
1
+ # -*- encoding : utf-8 -*-
2
+ # This file should contain all the record creation needed to seed the database with its default values.
3
+ # The data can then be loaded with the rake db:seed (or created alongside the db with db:setup).
4
+ #
5
+ # Examples:
6
+ #
7
+ # cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }])
8
+ # Mayor.create(name: 'Emanuel', city: cities.first)
9
+
10
+ Content.ensure(:call_to_action, 'Texto do Botão', 'Comprar')
@@ -0,0 +1,14 @@
1
+ # -*- encoding : utf-8 -*-
2
+ INTEGRATION_TASKS = %w(
3
+ integration:heroku:add_remote
4
+ integration:heroku:check
5
+ integration:heroku:lock
6
+ integration:start
7
+ integration:bundle_install
8
+ db:migrate
9
+ spec
10
+ integration:coverage_verify
11
+ integration:finish
12
+ heroku:deploy:production
13
+ integration:heroku:unlock
14
+ )
@@ -0,0 +1 @@
1
+ <h1>Profit!!!</h1>
@@ -0,0 +1,9 @@
1
+ # -*- encoding : utf-8 -*-
2
+ require 'spec_helper'
3
+
4
+ describe "Homepage", :type => :request do
5
+ xit {
6
+ visit root_path
7
+ page.should have_content('Copyright &copy; 2012 App')
8
+ }
9
+ end
@@ -0,0 +1,5 @@
1
+ require 'spec_helper'
2
+
3
+ describe Admin::ContentsController do
4
+
5
+ end
@@ -0,0 +1,8 @@
1
+ # -*- encoding : utf-8 -*-
2
+ FactoryGirl.define do
3
+ factory :content do
4
+ name 'Tagline'
5
+ slug 'tagline'
6
+ text 'Texto **legal** e <em>bacana</em>'
7
+ end
8
+ end
@@ -0,0 +1,71 @@
1
+ # -*- encoding : utf-8 -*-
2
+ require 'spec_helper'
3
+ class AdminUser < ActiveRecord::Base
4
+ attr_accessor :first_name, :last_name, :log, :hashed_code, :banner_content_type, :banner_file_name, :banner_file_size
5
+ has_attached_file :banner,
6
+ storage: :s3,
7
+ bucket: ENV['AMAZON_S3_BUCKET'],
8
+ path: "banners/:id.:extension",
9
+ s3_permissions: :public_read,
10
+ s3_credentials: {
11
+ access_key_id: ENV['AMAZON_ACCESS_KEY_ID'],
12
+ secret_access_key: ENV['AMAZON_SECRET_ACCESS_KEY']
13
+ }
14
+
15
+ end
16
+
17
+ describe TypusHelper do
18
+ let(:admin_user) { AdminUser.new(first_name: 'More or less', banner_file_name: 'banner.png', banner_file_size: 320) }
19
+ describe "display_text" do
20
+ context :log do
21
+ it "should return field" do
22
+ helper.display_text(admin_user, 'log').should == "<pre></pre>"
23
+ end
24
+ end
25
+ context :other do
26
+ it "should return field" do
27
+ helper.display_text(admin_user, 'last_name').should be_nil
28
+ end
29
+ end
30
+ end
31
+ describe "display_paperclip" do
32
+ context "image" do
33
+ it "should return field" do
34
+ admin_user.banner_content_type = "image/png"
35
+ helper.display_paperclip(admin_user, 'banner').should == "<img alt=\".png\" src=\"http://s3.amazonaws.com/websimulado-development/banners/.png\" />"
36
+ end
37
+ end
38
+ context "other" do
39
+ it "should return field" do
40
+ helper.display_paperclip(admin_user, 'banner').should == "<a href=\"http://s3.amazonaws.com/websimulado-development/banners/.png\">banner.png</a>"
41
+ end
42
+ end
43
+ end
44
+ describe "table_paperclip_field" do
45
+ it "should return field" do
46
+ helper.table_paperclip_field('banner', admin_user).should == "<a href=\"http://s3.amazonaws.com/websimulado-development/banners/.png\">banner.png</a>"
47
+ end
48
+ end
49
+ describe "display_string" do
50
+ context "order hashed_code" do
51
+ context "finished" do
52
+ before do
53
+ admin_user.stub!(:hashed_code).and_return('hashed_code')
54
+ end
55
+ it "should return message" do
56
+ helper.display_string(admin_user, 'hashed_code').should =~ /href/
57
+ end
58
+ end
59
+ context "new" do
60
+ it "should return message" do
61
+ helper.display_string(admin_user, 'hashed_code').should == "Ainda não gerado."
62
+ end
63
+ end
64
+ end
65
+ context "other" do
66
+ it "should return message" do
67
+ helper.display_string(admin_user, 'first_name').should == "More or less"
68
+ end
69
+ end
70
+ end
71
+ end