pah 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +34 -0
- data/CONTRIBUTING.md +47 -0
- data/README.md +7 -6
- data/lib/pah/files/Gemfile +16 -16
- data/lib/pah/partials/_generators.rb +0 -11
- data/lib/pah/partials/_letter_opener.rb +16 -0
- data/lib/pah/template.rb +3 -11
- data/lib/pah/version.rb +1 -1
- metadata +7 -23
- data/lib/pah/README.md +0 -53
- data/lib/pah/build +0 -17
- data/lib/pah/files/app/controllers/admin/contents_controller.rb +0 -2
- data/lib/pah/files/app/helpers/typus_helper.rb +0 -32
- data/lib/pah/files/app/models/content.rb +0 -27
- data/lib/pah/files/app/views/admin/dashboard/_sidebar.html.erb +0 -0
- data/lib/pah/files/config/locales/pt-BR.app.yml +0 -16
- data/lib/pah/files/config/locales/pt-BR.content.yml +0 -12
- data/lib/pah/files/config/locales/pt-BR.typus.yml +0 -15
- data/lib/pah/files/config/typus/content.yml +0 -8
- data/lib/pah/files/config/typus/content_roles.yml +0 -4
- data/lib/pah/files/db/migrate/20120605205337_create_contents.rb +0 -11
- data/lib/pah/files/db/seeds.rb +0 -10
- data/lib/pah/files/public/index.html +0 -1
- data/lib/pah/files/spec/controllers/admin/contents_controller_spec.rb +0 -5
- data/lib/pah/files/spec/factories/content.rb +0 -8
- data/lib/pah/files/spec/helpers/typus_helper_spec.rb +0 -71
- data/lib/pah/files/spec/models/content_spec.rb +0 -64
- data/lib/pah/setup.rb +0 -17
data/CHANGELOG.md
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
# Changelog
|
2
|
+
|
3
|
+
## 0.0.2 (June 20, 2013)
|
4
|
+
|
5
|
+
### features
|
6
|
+
|
7
|
+
### improvements
|
8
|
+
|
9
|
+
- Removed a lot of old stuffs
|
10
|
+
- Changed Flag on Cli to Pah
|
11
|
+
- Removed old comments
|
12
|
+
- Updated all gems
|
13
|
+
- Removed a missing README
|
14
|
+
|
15
|
+
### bug fixes
|
16
|
+
|
17
|
+
- Fixed bug on add letter\_opener
|
18
|
+
|
19
|
+
## 0.0.1 (June 17, 2013)
|
20
|
+
|
21
|
+
### features
|
22
|
+
|
23
|
+
- Changed rails-template to a gem named pah
|
24
|
+
|
25
|
+
### improvements
|
26
|
+
|
27
|
+
- Better readme
|
28
|
+
|
29
|
+
### bug fixes
|
30
|
+
|
31
|
+
## Previous
|
32
|
+
|
33
|
+
The changelog began with version 0.0.1 so any changes prior to that
|
34
|
+
can be seen by reading old git commit messages.
|
data/CONTRIBUTING.md
ADDED
@@ -0,0 +1,47 @@
|
|
1
|
+
# Contributing
|
2
|
+
|
3
|
+
We love pull requests. Here's a quick guide:
|
4
|
+
|
5
|
+
1. Fork the repo.
|
6
|
+
|
7
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
8
|
+
|
9
|
+
3. Run the tests. We only take pull requests with passing tests, and it's great
|
10
|
+
to know that you have a clean slate: `bundle && rake`
|
11
|
+
|
12
|
+
4. Add a test for your change. Only refactoring and documentation changes
|
13
|
+
require no new tests. If you are adding functionality or fixing a bug, we need
|
14
|
+
a test!
|
15
|
+
|
16
|
+
5. Make the test pass.
|
17
|
+
|
18
|
+
6. Update [CHANGELOG.md](https://github.com/Helabs/pah/blob/master/CHANGELOG.md) with a brief description of your changes under the `unreleased` heading.
|
19
|
+
|
20
|
+
7. Commit your changes (`git commit -am 'Added some feature'`)
|
21
|
+
|
22
|
+
8. Push to the branch (`git push origin my-new-feature`)
|
23
|
+
|
24
|
+
9. Create new Pull Request
|
25
|
+
|
26
|
+
At this point you're waiting on us. We like to at least comment on, if not
|
27
|
+
accept, pull requests within three business days (and, typically, one business
|
28
|
+
day). We may suggest some changes or improvements or alternatives.
|
29
|
+
|
30
|
+
Some things that will increase the chance that your pull request is accepted,
|
31
|
+
taken straight from the Ruby on Rails guide:
|
32
|
+
|
33
|
+
* Use Rails idioms and helpers
|
34
|
+
* Include tests that fail without your code, and pass with it
|
35
|
+
* Update the documentation, the surrounding one, examples elsewhere, guides,
|
36
|
+
whatever is affected by your contribution
|
37
|
+
|
38
|
+
Syntax:
|
39
|
+
|
40
|
+
* Two spaces, no tabs.
|
41
|
+
* No trailing whitespace. Blank lines should not have any space.
|
42
|
+
* Prefer &&/|| over and/or.
|
43
|
+
* my_method(my_arg) not my_method( my_arg ) or my_method my_arg.
|
44
|
+
* a = b and not a=b.
|
45
|
+
* Follow the conventions you see used in the source already.
|
46
|
+
|
47
|
+
And in case we didn't emphasize it enough: we love tests!
|
data/README.md
CHANGED
@@ -41,15 +41,16 @@ Pah follow the [Semantic Versioning](http://semver.org/).
|
|
41
41
|
|
42
42
|
## Issues
|
43
43
|
|
44
|
-
If you have problems, please create a [Github Issue](https://github.com/Helabs/
|
44
|
+
If you have problems, please create a [Github Issue](https://github.com/Helabs/pah/issues).
|
45
45
|
|
46
46
|
## Contributing
|
47
47
|
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
48
|
+
Please see [CONTRIBUTING.md](https://github.com/Helabs/pah/blob/master/CONTRIBUTING.md) for details.
|
49
|
+
|
50
|
+
## Credits
|
51
|
+
|
52
|
+
Pah is maintained and funded by [HE:labs](http://helabs.com.br/opensource/).
|
53
|
+
Thank you to all the [contributors](https://github.com/Helabs/pah/graphs/contributors).
|
53
54
|
|
54
55
|
[startupdev]: http://startupdev.com.br
|
55
56
|
[helabs]: http://helabs.com.br
|
data/lib/pah/files/Gemfile
CHANGED
@@ -3,15 +3,15 @@ ruby "1.9.3"
|
|
3
3
|
|
4
4
|
gem 'rails', '3.2.13'
|
5
5
|
gem 'unicorn', '4.6.2'
|
6
|
-
gem 'secure_headers', '0.
|
7
|
-
gem 'jquery-rails', '
|
6
|
+
gem 'secure_headers', '1.0.0'
|
7
|
+
gem 'jquery-rails', '3.0.1'
|
8
8
|
gem 'haml-rails', '0.4'
|
9
|
-
gem 'pg', '0.15.
|
9
|
+
gem 'pg', '0.15.1'
|
10
10
|
gem 'rack-canonical-host', '0.0.8'
|
11
|
-
# gem 'paperclip', '3.4.
|
12
|
-
# gem 'aws-sdk', '1.
|
11
|
+
# gem 'paperclip', '3.4.2'
|
12
|
+
# gem 'aws-sdk', '1.11.2'
|
13
13
|
# gem 'paranoia', '1.2.0'
|
14
|
-
# gem 'omniauth', '1.1.
|
14
|
+
# gem 'omniauth', '1.1.4'
|
15
15
|
# gem 'omniauth-facebook', '1.4.1'
|
16
16
|
# gem 'kaminari', '0.14.1'
|
17
17
|
# gem 'acts_as_hashed', '1.0.0'
|
@@ -19,34 +19,34 @@ gem 'rack-canonical-host', '0.0.8'
|
|
19
19
|
group :assets do
|
20
20
|
gem 'sass-rails', '3.2.6'
|
21
21
|
gem 'coffee-rails', '3.2.2'
|
22
|
-
gem 'uglifier', '1.
|
22
|
+
gem 'uglifier', '2.1.1'
|
23
23
|
end
|
24
24
|
|
25
25
|
group :development do
|
26
|
-
gem "letter_opener", '1.1.
|
27
|
-
gem 'foreman', '0.
|
26
|
+
gem "letter_opener", '1.1.1'
|
27
|
+
gem 'foreman', '0.63.0'
|
28
28
|
gem 'integration', git: 'git://github.com/mergulhao/integration.git'
|
29
|
-
gem 'heroku-deploy', '
|
29
|
+
gem 'heroku-deploy', '0.0.4'
|
30
30
|
gem 'better_errors', '0.9.0'
|
31
31
|
gem 'binding_of_caller', '0.7.2'
|
32
32
|
end
|
33
33
|
|
34
34
|
group :test do
|
35
35
|
gem 'webmock', '1.11.0'
|
36
|
-
gem 'shoulda-matchers', '
|
36
|
+
gem 'shoulda-matchers', '2.2.0'
|
37
37
|
gem 'timecop', '0.6.1'
|
38
38
|
gem 'simplecov', '0.7.1', require: false
|
39
|
-
gem 'capybara', '2.0
|
40
|
-
gem 'poltergeist', '1.
|
39
|
+
gem 'capybara', '2.1.0'
|
40
|
+
gem 'poltergeist', '1.3.0'
|
41
41
|
gem 'valid_attribute', '1.3.1'
|
42
42
|
gem 'email_spec', '1.4.0'
|
43
43
|
end
|
44
44
|
|
45
45
|
group :development, :test do
|
46
|
-
gem 'rspec-rails', '2.13.
|
46
|
+
gem 'rspec-rails', '2.13.2'
|
47
47
|
gem 'factory_girl_rails', '4.2.1'
|
48
|
-
gem 'pry-rails', '0.
|
48
|
+
gem 'pry-rails', '0.3.1'
|
49
49
|
gem 'dotenv-rails', '0.8.0'
|
50
50
|
gem 'awesome_print', '1.1.0'
|
51
|
-
# gem 'guard-rspec', '
|
51
|
+
# gem 'guard-rspec', '3.0.2'
|
52
52
|
end
|
@@ -24,14 +24,3 @@ end
|
|
24
24
|
git :add => 'config/application.rb'
|
25
25
|
git :commit => "-qm 'Adding generators.'"
|
26
26
|
|
27
|
-
letter_opener_config = <<LETTER_OPENER
|
28
|
-
config.action_mailer.delivery_method = :letter_opener
|
29
|
-
config.action_mailer.default_url_options = { :host => 'localhost:3000' }
|
30
|
-
LETTER_OPENER
|
31
|
-
|
32
|
-
in_root do
|
33
|
-
inject_into_file 'config/environments/development.rb', letter_opener_config, { before: "end", verbose: false }
|
34
|
-
end
|
35
|
-
|
36
|
-
git :add => 'config/environments/development.rb'
|
37
|
-
git :commit => "-qm 'Adding letter_opener config.'"
|
@@ -0,0 +1,16 @@
|
|
1
|
+
puts "Adding letter_opener... ".magenta
|
2
|
+
|
3
|
+
letter_opener_config = <<LETTER_OPENER
|
4
|
+
|
5
|
+
# Letter openner config
|
6
|
+
config.action_mailer.delivery_method = :letter_opener
|
7
|
+
config.action_mailer.default_url_options = { :host => 'localhost:3000' }
|
8
|
+
LETTER_OPENER
|
9
|
+
|
10
|
+
in_root do
|
11
|
+
inject_into_file 'config/environments/development.rb', letter_opener_config, { before: /^end/, verbose: false }
|
12
|
+
end
|
13
|
+
|
14
|
+
git :add => 'config/environments/development.rb'
|
15
|
+
git :commit => "-qm 'Adding letter_opener config.'"
|
16
|
+
|
data/lib/pah/template.rb
CHANGED
@@ -1,12 +1,3 @@
|
|
1
|
-
#
|
2
|
-
# startupdev-rails-template
|
3
|
-
#
|
4
|
-
# Usage:
|
5
|
-
# rails new appname -m /path/to/template.rb
|
6
|
-
#
|
7
|
-
# Also see http://textmate.rubyforge.org/thor/Thor/Actions.html
|
8
|
-
#
|
9
|
-
|
10
1
|
%w{colored}.each do |component|
|
11
2
|
if Gem::Specification.find_all_by_name(component).empty?
|
12
3
|
run "gem install #{component}"
|
@@ -54,7 +45,7 @@ def ask_unless_test(*params)
|
|
54
45
|
end
|
55
46
|
|
56
47
|
puts "\n========================================================="
|
57
|
-
puts "
|
48
|
+
puts " Pah".yellow.bold
|
58
49
|
puts "=========================================================\n"
|
59
50
|
|
60
51
|
# TODO: timezone, Add rspec extensions
|
@@ -63,12 +54,13 @@ apply_n :git
|
|
63
54
|
apply_n :cleanup
|
64
55
|
apply_n :gems
|
65
56
|
apply_n :database
|
66
|
-
apply_n :rspec
|
57
|
+
apply_n :rspec
|
67
58
|
apply_n :default
|
68
59
|
apply_n :secure_headers
|
69
60
|
apply_n :omniauth
|
70
61
|
apply_n :capybara
|
71
62
|
apply_n :generators
|
63
|
+
apply_n :letter_opener
|
72
64
|
apply_n :canonical_host
|
73
65
|
apply_n :rvm
|
74
66
|
apply_n :finish
|
data/lib/pah/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pah
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-06-
|
12
|
+
date: 2013-06-20 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
@@ -102,42 +102,26 @@ extra_rdoc_files: []
|
|
102
102
|
files:
|
103
103
|
- .gitignore
|
104
104
|
- .rvmrc
|
105
|
+
- CHANGELOG.md
|
106
|
+
- CONTRIBUTING.md
|
105
107
|
- Gemfile
|
106
108
|
- LICENSE.txt
|
107
109
|
- README.md
|
108
110
|
- Rakefile
|
109
111
|
- bin/pah
|
110
|
-
- lib/pah/README.md
|
111
|
-
- lib/pah/build
|
112
112
|
- lib/pah/files/.gitignore
|
113
113
|
- lib/pah/files/.rvmrc
|
114
114
|
- lib/pah/files/Gemfile
|
115
115
|
- lib/pah/files/Procfile
|
116
116
|
- lib/pah/files/app/assets/stylesheets/reset.css
|
117
|
-
- lib/pah/files/app/controllers/admin/contents_controller.rb
|
118
|
-
- lib/pah/files/app/helpers/typus_helper.rb
|
119
|
-
- lib/pah/files/app/models/content.rb
|
120
|
-
- lib/pah/files/app/views/admin/dashboard/_sidebar.html.erb
|
121
117
|
- lib/pah/files/app/views/layouts/application.html.haml
|
122
118
|
- lib/pah/files/config/database.yml
|
123
119
|
- lib/pah/files/config/initializers/omniauth.rb
|
124
120
|
- lib/pah/files/config/initializers/requires.rb
|
125
|
-
- lib/pah/files/config/locales/pt-BR.app.yml
|
126
|
-
- lib/pah/files/config/locales/pt-BR.content.yml
|
127
|
-
- lib/pah/files/config/locales/pt-BR.typus.yml
|
128
121
|
- lib/pah/files/config/locales/pt-BR.yml
|
129
|
-
- lib/pah/files/config/typus/content.yml
|
130
|
-
- lib/pah/files/config/typus/content_roles.yml
|
131
122
|
- lib/pah/files/config/unicorn.rb
|
132
|
-
- lib/pah/files/db/migrate/20120605205337_create_contents.rb
|
133
|
-
- lib/pah/files/db/seeds.rb
|
134
123
|
- lib/pah/files/lib/tasks/integration.rake
|
135
|
-
- lib/pah/files/public/index.html
|
136
124
|
- lib/pah/files/spec/acceptance/dummy_spec.rb
|
137
|
-
- lib/pah/files/spec/controllers/admin/contents_controller_spec.rb
|
138
|
-
- lib/pah/files/spec/factories/content.rb
|
139
|
-
- lib/pah/files/spec/helpers/typus_helper_spec.rb
|
140
|
-
- lib/pah/files/spec/models/content_spec.rb
|
141
125
|
- lib/pah/files/spec/spec_helper.rb
|
142
126
|
- lib/pah/files/spec/support/README
|
143
127
|
- lib/pah/files/spec/support/acceptance_helpers.rb
|
@@ -162,11 +146,11 @@ files:
|
|
162
146
|
- lib/pah/partials/_generators.rb
|
163
147
|
- lib/pah/partials/_git.rb
|
164
148
|
- lib/pah/partials/_heroku.rb
|
149
|
+
- lib/pah/partials/_letter_opener.rb
|
165
150
|
- lib/pah/partials/_omniauth.rb
|
166
151
|
- lib/pah/partials/_rspec.rb
|
167
152
|
- lib/pah/partials/_rvm.rb
|
168
153
|
- lib/pah/partials/_secure_headers.rb
|
169
|
-
- lib/pah/setup.rb
|
170
154
|
- lib/pah/template.rb
|
171
155
|
- lib/pah/version.rb
|
172
156
|
- pah.gemspec
|
@@ -185,7 +169,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
185
169
|
version: '0'
|
186
170
|
segments:
|
187
171
|
- 0
|
188
|
-
hash:
|
172
|
+
hash: 95633388803166914
|
189
173
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
190
174
|
none: false
|
191
175
|
requirements:
|
@@ -194,7 +178,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
194
178
|
version: '0'
|
195
179
|
segments:
|
196
180
|
- 0
|
197
|
-
hash:
|
181
|
+
hash: 95633388803166914
|
198
182
|
requirements: []
|
199
183
|
rubyforge_project:
|
200
184
|
rubygems_version: 1.8.25
|
data/lib/pah/README.md
DELETED
@@ -1,53 +0,0 @@
|
|
1
|
-
# Rails Template
|
2
|
-
|
3
|
-
A rails application template which born from [Startup DEV][startupdev] and now is used to start most projects at [HE:labs][helabs].
|
4
|
-
|
5
|
-
## Usage
|
6
|
-
|
7
|
-
1. Install heroku toolbelt.
|
8
|
-
```shell
|
9
|
-
https://toolbelt.heroku.com/
|
10
|
-
```
|
11
|
-
|
12
|
-
2. Install phantomjs.
|
13
|
-
```shell
|
14
|
-
brew install phantomjs
|
15
|
-
```
|
16
|
-
|
17
|
-
3. Clone rails-template to your home directory.
|
18
|
-
```shell
|
19
|
-
git clone git://github.com/Helabs/rails-template.git
|
20
|
-
```
|
21
|
-
|
22
|
-
4. Run rails new app command using this template.
|
23
|
-
```shell
|
24
|
-
rails new app_name -m ~/rails-template/template.rb
|
25
|
-
```
|
26
|
-
|
27
|
-
5. Be sure to set your canonical domain on Heroku:
|
28
|
-
```shell
|
29
|
-
heroku config:add CANONICAL_HOST=yourdomain.com #or www.yourdomain.com
|
30
|
-
```
|
31
|
-
|
32
|
-
6. That's it! Everything should be in place.
|
33
|
-
|
34
|
-
## Contributing
|
35
|
-
|
36
|
-
1. Fork it
|
37
|
-
2. Create your feature branch (`git checkout -b my-new-feature`)
|
38
|
-
3. Commit your changes (`git commit -am 'Added some feature'`)
|
39
|
-
4. Push to the branch (`git push origin my-new-feature`)
|
40
|
-
5. Create new Pull Request
|
41
|
-
|
42
|
-
## Development cycle
|
43
|
-
|
44
|
-
1. Make modifications
|
45
|
-
2. Run build
|
46
|
-
```
|
47
|
-
./build
|
48
|
-
```
|
49
|
-
4. It should open your browser on heroku app with message "Profit!"
|
50
|
-
5. Profit!
|
51
|
-
|
52
|
-
[startupdev]: http://startupdev.com.br
|
53
|
-
[helabs]: http://helabs.com.br
|
data/lib/pah/build
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
#!/bin/bash
|
2
|
-
|
3
|
-
rvm gemset use rails-template --create
|
4
|
-
bundle
|
5
|
-
rm -Rf ../rails_template_test123
|
6
|
-
cd ..
|
7
|
-
rvm gemset use rails-template
|
8
|
-
RAILS_TEMPLATE_TEST=true rails new rails_template_test123 -m rails-template/template.rb
|
9
|
-
read -p "Check the build. Do you want to delete temporary files and Heroku app? [Yn]" -n 1 -r
|
10
|
-
if [[ ! $REPLY =~ ^[Nn]$ ]]
|
11
|
-
then
|
12
|
-
heroku destroy railstemplatetest123 --confirm railstemplatetest123
|
13
|
-
heroku destroy railstemplatetest123-staging --confirm railstemplatetest123-staging
|
14
|
-
rm -Rf ../rails_template_test123
|
15
|
-
# Do not delete gemset to speed up compilation
|
16
|
-
# run << "rvm gemset delete test_app --force"
|
17
|
-
fi
|
@@ -1,32 +0,0 @@
|
|
1
|
-
# -*- encoding : utf-8 -*-
|
2
|
-
module TypusHelper
|
3
|
-
def display_text(item, attribute)
|
4
|
-
if attribute == 'log'
|
5
|
-
content_tag :pre, item.send(attribute)
|
6
|
-
else
|
7
|
-
super
|
8
|
-
end
|
9
|
-
end
|
10
|
-
def display_paperclip(item, attribute)
|
11
|
-
if item.send(attribute).content_type =~ /^image\/.+/
|
12
|
-
image_tag paperclip_file_url(item, attribute)
|
13
|
-
else
|
14
|
-
link_to item.send("#{attribute}_file_name"), paperclip_file_url(item, attribute)
|
15
|
-
end
|
16
|
-
end
|
17
|
-
def display_string(item, attribute)
|
18
|
-
if attribute == 'hashed_code'
|
19
|
-
item.hashed_code.nil? ? "Ainda não gerado." : link_to(item)
|
20
|
-
else
|
21
|
-
super
|
22
|
-
end
|
23
|
-
end
|
24
|
-
def table_paperclip_field(attribute, item)
|
25
|
-
link_to item.send("#{attribute}_file_name"), paperclip_file_url(item, attribute)
|
26
|
-
end
|
27
|
-
|
28
|
-
private
|
29
|
-
def paperclip_file_url(item, attribute)
|
30
|
-
(item.send(attribute).s3_permissions == :private) ? item.send(attribute).expiring_url(10.minutes) : item.send(attribute).url
|
31
|
-
end
|
32
|
-
end
|
@@ -1,27 +0,0 @@
|
|
1
|
-
class Content < ActiveRecord::Base
|
2
|
-
attr_accessible :text, as: :admin
|
3
|
-
validates :name, :slug, :text, presence: true
|
4
|
-
def self.markdown(slug)
|
5
|
-
RDiscount.new(content(slug).text).to_html.html_safe
|
6
|
-
rescue
|
7
|
-
nil
|
8
|
-
end
|
9
|
-
def self.raw(slug)
|
10
|
-
content(slug).text
|
11
|
-
rescue
|
12
|
-
nil
|
13
|
-
end
|
14
|
-
def self.ensure(slug, name, text)
|
15
|
-
return unless content(slug).nil?
|
16
|
-
content = new
|
17
|
-
content.slug = slug.to_s
|
18
|
-
content.name = name
|
19
|
-
content.text = text
|
20
|
-
content.save!
|
21
|
-
end
|
22
|
-
|
23
|
-
private
|
24
|
-
def self.content(slug)
|
25
|
-
where(slug: slug.to_s).first
|
26
|
-
end
|
27
|
-
end
|
File without changes
|
@@ -1,16 +0,0 @@
|
|
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
|
@@ -1,15 +0,0 @@
|
|
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"
|
data/lib/pah/files/db/seeds.rb
DELETED
@@ -1,10 +0,0 @@
|
|
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')
|
@@ -1 +0,0 @@
|
|
1
|
-
<h1>Profit!!!</h1>
|
@@ -1,71 +0,0 @@
|
|
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
|
@@ -1,64 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Content do
|
4
|
-
it { should allow_mass_assignment_of(:text).as(:admin) }
|
5
|
-
[:name, :slug, :text].each do |attribute|
|
6
|
-
it { should validate_presence_of(attribute) }
|
7
|
-
end
|
8
|
-
describe ".markdown" do
|
9
|
-
context "content exists" do
|
10
|
-
before do
|
11
|
-
Factory.create(:content)
|
12
|
-
end
|
13
|
-
it "should return markdown of text of content with slug" do
|
14
|
-
Content.markdown(:tagline).should == "<p>Texto <strong>legal</strong> e <em>bacana</em></p>\n"
|
15
|
-
end
|
16
|
-
end
|
17
|
-
context "content does not exists" do
|
18
|
-
it "should return nil" do
|
19
|
-
Content.markdown(:tagline).should be_nil
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
23
|
-
describe ".raw" do
|
24
|
-
context "content exists" do
|
25
|
-
before do
|
26
|
-
Factory.create(:content)
|
27
|
-
end
|
28
|
-
it "should return raw text of content with slug" do
|
29
|
-
Content.raw(:tagline).should == "Texto **legal** e <em>bacana</em>"
|
30
|
-
end
|
31
|
-
end
|
32
|
-
context "content does not exists" do
|
33
|
-
it "should return nil" do
|
34
|
-
Content.raw(:tagline).should be_nil
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|
38
|
-
describe ".ensure" do
|
39
|
-
context "content does not exists" do
|
40
|
-
it "should create content" do
|
41
|
-
expect {
|
42
|
-
Content.ensure(:tagline, 'Tagline', 'Texto legal')
|
43
|
-
}.to change(Content, :count).by(1)
|
44
|
-
end
|
45
|
-
describe "created content" do
|
46
|
-
before do
|
47
|
-
Content.ensure(:tagline, 'Tagline', 'Texto legal')
|
48
|
-
end
|
49
|
-
subject { Content.last }
|
50
|
-
its(:slug) { should == 'tagline' }
|
51
|
-
its(:name) { should == 'Tagline' }
|
52
|
-
its(:text) { should == 'Texto legal' }
|
53
|
-
end
|
54
|
-
end
|
55
|
-
context "content already exists" do
|
56
|
-
let!(:content) { Factory.create(:content) }
|
57
|
-
it "should not create content" do
|
58
|
-
expect {
|
59
|
-
Content.ensure(:tagline, 'Tagline 1', 'Texto legal 1')
|
60
|
-
}.not_to change(Content, :count)
|
61
|
-
end
|
62
|
-
end
|
63
|
-
end
|
64
|
-
end
|
data/lib/pah/setup.rb
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
@app_name = ARGV.first
|
4
|
-
FileUtils.mkdir @app_name
|
5
|
-
|
6
|
-
File.open(File.join(@app_name, ".rvmrc"),'r') do |f|
|
7
|
-
f << %{#export APP_URL=http://dev:3000/
|
8
|
-
#export AMAZON_S3_BUCKET=#{@app_name}-dev
|
9
|
-
#export AMAZON_ACCESS_KEY_ID=x
|
10
|
-
#export AMAZON_SECRET_ACCESS_KEY=x
|
11
|
-
#export FACEBOOK_APP_KEY=x
|
12
|
-
#export FACEBOOK_APP_SECRET=x
|
13
|
-
rvm 1.9.3@#{@app_name} --create
|
14
|
-
}
|
15
|
-
end
|
16
|
-
|
17
|
-
exec "cd #{@app_name}; gem install rails"
|