├── .gitignore ├── .rspec ├── .ruby-version ├── Dockerfile ├── Gemfile ├── Gemfile.lock ├── MIT-LICENSE ├── Procfile ├── README.md ├── Rakefile ├── app.json ├── app ├── assets │ ├── images │ │ └── .keep │ ├── javascripts │ │ ├── application.js.coffee │ │ └── selectize.js.coffee │ └── stylesheets │ │ ├── application.scss │ │ └── selectize.css ├── controllers │ ├── application_controller.rb │ ├── concerns │ │ └── .keep │ └── statics_controller.rb ├── helpers │ └── application_helper.rb ├── inputs │ └── selectize_input.rb ├── mailers │ └── .keep ├── models │ ├── .keep │ ├── ability.rb │ ├── concerns │ │ └── .keep │ ├── role.rb │ └── user.rb └── views │ ├── application │ ├── _flash.html.erb │ ├── _navbar.html.erb │ ├── forbidden.html.erb │ └── not_found.html.erb │ ├── devise │ ├── passwords │ │ └── new.html.erb │ ├── registrations │ │ ├── edit.html.erb │ │ └── new.html.erb │ └── sessions │ │ └── new.html.erb │ ├── layouts │ └── application.html.erb │ └── statics │ └── home.html.erb ├── bin ├── autospec ├── bundle ├── bundler ├── byebug ├── dotenv ├── erubis ├── foreman ├── htmldiff ├── ldiff ├── nokogiri ├── puma ├── pumactl ├── rackup ├── rails ├── rake ├── rdoc ├── ri ├── rspec ├── ruby_parse ├── ruby_parse_extract_error ├── sass ├── sass-convert ├── scss ├── sdoc ├── sdoc-merge ├── setup ├── spring ├── sprockets ├── thor ├── tilt └── tt ├── config.ru ├── config ├── application.rb ├── boot.rb ├── database │ ├── docker.example.yml │ ├── postgresql.example.yml │ └── sqlite3.example.yml ├── environment.rb ├── environments │ ├── development.rb │ ├── production.rb │ └── test.rb ├── initializers │ ├── assets.rb │ ├── backtrace_silencers.rb │ ├── cookies_serializer.rb │ ├── devise.rb │ ├── filter_parameter_logging.rb │ ├── friendly_id.rb │ ├── gunzel.rb │ ├── inflections.rb │ ├── mime_types.rb │ ├── rolify.rb │ ├── session_store.rb │ ├── simple_form.rb │ ├── simple_form_bootstrap.rb │ └── wrap_parameters.rb ├── locales │ ├── devise.en.yml │ ├── en.yml │ └── simple_form.en.yml ├── puma.rb ├── routes.rb ├── secrets.yml └── sitemap.rb ├── db ├── migrate │ ├── 20140317050901_create_friendly_id_slugs.rb │ ├── 20140317052339_acts_as_taggable_on_migration.acts_as_taggable_on_engine.rb │ ├── 20140317052340_add_missing_unique_indices.acts_as_taggable_on_engine.rb │ ├── 20140519012208_devise_create_users.rb │ ├── 20140519020326_rolify_create_roles.rb │ ├── 20140610231308_add_taggings_counter_cache_to_tags.acts_as_taggable_on_engine.rb │ ├── 20140714053131_add_missing_taggable_index.acts_as_taggable_on_engine.rb │ ├── 20140829025406_create_versions.rb │ └── 20140829025407_add_object_changes_to_versions.rb ├── schema.rb └── seeds.rb ├── fig.yml ├── lib ├── assets │ └── .keep ├── generators │ ├── gunzel │ │ └── scaffold │ │ │ ├── scaffold_generator.rb │ │ │ └── templates │ │ │ ├── _form.html.erb │ │ │ ├── _search.html.erb │ │ │ ├── _table.html.erb │ │ │ ├── _tabs.html.erb │ │ │ ├── edit.html.erb │ │ │ ├── index.html.erb │ │ │ ├── new.html.erb │ │ │ └── show.html.erb │ └── rails │ │ └── gunzel_controller │ │ ├── gunzel_controller_generator.rb │ │ └── templates │ │ └── controller.rb ├── gunzel │ └── gem_ext │ │ └── devise │ │ └── permit_username_and_login_parameters.rb ├── tasks │ └── .keep └── templates │ ├── active_record │ └── model │ │ └── model.rb │ ├── rails │ └── helper │ │ └── helper.rb │ └── rspec │ ├── model │ └── model_spec.rb │ └── scaffold │ └── controller_spec.rb ├── log └── .keep ├── public ├── 404.html ├── 422.html ├── 500.html ├── favicon.ico └── robots.txt ├── spec ├── factories │ ├── roles.rb │ └── users.rb ├── models │ ├── role_spec.rb │ └── user_spec.rb ├── rails_helper.rb └── spec_helper.rb └── vendor └── assets ├── javascripts └── .keep └── stylesheets └── .keep /.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files for more about ignoring files. 2 | # 3 | # If you find yourself ignoring temporary files generated by your text editor 4 | # or operating system, you probably want to add a global ignore instead: 5 | # git config --global core.excludesfile '~/.gitignore_global' 6 | 7 | # Ignore bundler config. 8 | /.bundle 9 | 10 | # Ignore the default SQLite database. 11 | /db/*.sqlite3 12 | /db/*.sqlite3-journal 13 | 14 | # Ignore all logfiles and tempfiles. 15 | /log/*.log 16 | /tmp 17 | 18 | # Ignore database configuration 19 | /config/database.yml 20 | 21 | # Ingore environment-based configuration 22 | /.env 23 | 24 | # Ignore precompiled assets 25 | /public/assets 26 | -------------------------------------------------------------------------------- /.rspec: -------------------------------------------------------------------------------- 1 | --color 2 | --require spec_helper 3 | -------------------------------------------------------------------------------- /.ruby-version: -------------------------------------------------------------------------------- 1 | 2.3.1 2 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ruby:2.2.2 2 | 3 | RUN apt-get update -qq && apt-get install -y build-essential libpq-dev 4 | 5 | RUN mkdir /var/www 6 | WORKDIR /var/www 7 | 8 | ADD Gemfile /var/www/Gemfile 9 | ADD Gemfile.lock /var/www/Gemfile.lock 10 | RUN bundle install 11 | 12 | ADD . /var/www 13 | -------------------------------------------------------------------------------- /Gemfile: -------------------------------------------------------------------------------- 1 | source 'https://rubygems.org' 2 | ruby '2.3.1' 3 | 4 | # Bundle edge Rails instead: gem 'rails', github: 'rails/rails' 5 | gem 'rails', '4.2.6' 6 | # Use postgresql as the database for Active Record 7 | gem 'pg' 8 | # Use SCSS for stylesheets 9 | gem 'sass-rails', '~> 5.0' 10 | # Use Uglifier as compressor for JavaScript assets 11 | gem 'uglifier', '>= 1.3.0' 12 | # Use CoffeeScript for .coffee assets and views 13 | gem 'coffee-rails', '~> 4.1.0' 14 | # See https://github.com/sstephenson/execjs#readme for more supported runtimes 15 | # gem 'therubyracer', platforms: :ruby 16 | 17 | # Use jquery as the JavaScript library 18 | gem 'jquery-rails' 19 | # Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks 20 | gem 'turbolinks', :github => 'rails/turbolinks' 21 | # Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder 22 | gem 'jbuilder', '~> 2.0' 23 | # bundle exec rake doc:rails generates the API under doc/api. 24 | gem 'sdoc', '~> 0.4.0', group: :doc 25 | 26 | # Use ActiveModel has_secure_password 27 | # gem 'bcrypt', '~> 3.1.7' 28 | 29 | # Use Puma as the app server 30 | gem 'puma' 31 | 32 | # Use Capistrano for deployment 33 | # gem 'capistrano-rails', group: :development 34 | 35 | group :development, :test do 36 | # Call 'byebug' anywhere in the code to stop execution and get a debugger console 37 | gem 'byebug' 38 | 39 | # Access an IRB console on exception pages or by using <%= console %> in views 40 | gem 'web-console', '~> 2.0' 41 | 42 | # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring 43 | gem 'spring' 44 | end 45 | 46 | source 'https://rails-assets.org' do 47 | gem 'rails-assets-html5shiv' 48 | gem 'rails-assets-respond' 49 | gem 'rails-assets-underscore' 50 | gem 'rails-assets-selectize' 51 | end 52 | 53 | group :production do 54 | gem 'rails_12factor' 55 | gem 'heroku-deflater' 56 | end 57 | 58 | group :development, :test do 59 | gem 'rspec-rails' 60 | gem 'spring-commands-rspec' 61 | gem 'rspec-collection_matchers' 62 | gem 'rspec-its' 63 | gem 'factory_girl_rails' 64 | gem 'shoulda-matchers' 65 | gem 'capybara' 66 | end 67 | 68 | gem 'foreman' 69 | gem 'responders' 70 | gem 'has_scope' 71 | gem 'simple_form' 72 | gem 'kaminari' 73 | gem 'kaminari-bootstrap' 74 | gem 'friendly_id' 75 | gem 'acts-as-taggable-on' 76 | gem 'acts_as_list' 77 | gem 'paranoia' 78 | gem 'paper_trail' 79 | gem 'state_machine' 80 | gem 'meta-tags' 81 | gem 'awesome_nested_set' 82 | gem 'sitemap_generator' 83 | gem 'devise' 84 | gem 'rolify' 85 | gem 'cancancan' 86 | gem 'gravatar_image_tag' 87 | gem 'data-confirm-modal', :github => 'ifad/data-confirm-modal' 88 | gem 'dotenv-rails' 89 | gem 'autoprefixer-rails' 90 | gem 'ransack' 91 | gem 'bootstrap-sass' 92 | gem 'font-awesome-sass' 93 | -------------------------------------------------------------------------------- /Gemfile.lock: -------------------------------------------------------------------------------- 1 | GIT 2 | remote: git://github.com/ifad/data-confirm-modal.git 3 | revision: a2018ab8893cdeeeffaae407368ed1a20ea72b30 4 | specs: 5 | data-confirm-modal (1.1.0) 6 | railties (>= 3.0) 7 | 8 | GIT 9 | remote: git://github.com/rails/turbolinks.git 10 | revision: 37a7c296232d20a61bd1946f600da7f2009189db 11 | specs: 12 | turbolinks (3.0.0) 13 | coffee-rails 14 | 15 | GEM 16 | remote: https://rubygems.org/ 17 | remote: https://rails-assets.org/ 18 | specs: 19 | actionmailer (4.2.6) 20 | actionpack (= 4.2.6) 21 | actionview (= 4.2.6) 22 | activejob (= 4.2.6) 23 | mail (~> 2.5, >= 2.5.4) 24 | rails-dom-testing (~> 1.0, >= 1.0.5) 25 | actionpack (4.2.6) 26 | actionview (= 4.2.6) 27 | activesupport (= 4.2.6) 28 | rack (~> 1.6) 29 | rack-test (~> 0.6.2) 30 | rails-dom-testing (~> 1.0, >= 1.0.5) 31 | rails-html-sanitizer (~> 1.0, >= 1.0.2) 32 | actionview (4.2.6) 33 | activesupport (= 4.2.6) 34 | builder (~> 3.1) 35 | erubis (~> 2.7.0) 36 | rails-dom-testing (~> 1.0, >= 1.0.5) 37 | rails-html-sanitizer (~> 1.0, >= 1.0.2) 38 | activejob (4.2.6) 39 | activesupport (= 4.2.6) 40 | globalid (>= 0.3.0) 41 | activemodel (4.2.6) 42 | activesupport (= 4.2.6) 43 | builder (~> 3.1) 44 | activerecord (4.2.6) 45 | activemodel (= 4.2.6) 46 | activesupport (= 4.2.6) 47 | arel (~> 6.0) 48 | activesupport (4.2.6) 49 | i18n (~> 0.7) 50 | json (~> 1.7, >= 1.7.7) 51 | minitest (~> 5.1) 52 | thread_safe (~> 0.3, >= 0.3.4) 53 | tzinfo (~> 1.1) 54 | acts-as-taggable-on (3.5.0) 55 | activerecord (>= 3.2, < 5) 56 | acts_as_list (0.7.4) 57 | activerecord (>= 3.0) 58 | addressable (2.4.0) 59 | arel (6.0.3) 60 | autoprefixer-rails (6.3.6) 61 | execjs 62 | awesome_nested_set (3.0.3) 63 | activerecord (>= 4.0.0, < 5) 64 | bcrypt (3.1.11) 65 | binding_of_caller (0.7.2) 66 | debug_inspector (>= 0.0.1) 67 | bootstrap-sass (3.3.6) 68 | autoprefixer-rails (>= 5.2.1) 69 | sass (>= 3.3.4) 70 | builder (3.2.2) 71 | byebug (8.2.5) 72 | cancancan (1.13.1) 73 | capybara (2.7.1) 74 | addressable 75 | mime-types (>= 1.16) 76 | nokogiri (>= 1.3.3) 77 | rack (>= 1.0.0) 78 | rack-test (>= 0.5.4) 79 | xpath (~> 2.0) 80 | coffee-rails (4.1.1) 81 | coffee-script (>= 2.2.0) 82 | railties (>= 4.0.0, < 5.1.x) 83 | coffee-script (2.4.1) 84 | coffee-script-source 85 | execjs 86 | coffee-script-source (1.10.0) 87 | concurrent-ruby (1.0.2) 88 | debug_inspector (0.0.2) 89 | devise (4.1.0) 90 | bcrypt (~> 3.0) 91 | orm_adapter (~> 0.1) 92 | railties (>= 4.1.0, < 5.1) 93 | responders 94 | warden (~> 1.2.3) 95 | diff-lcs (1.2.5) 96 | dotenv (2.1.1) 97 | dotenv-rails (2.1.1) 98 | dotenv (= 2.1.1) 99 | railties (>= 4.0, < 5.1) 100 | erubis (2.7.0) 101 | execjs (2.6.0) 102 | factory_girl (4.7.0) 103 | activesupport (>= 3.0.0) 104 | factory_girl_rails (4.7.0) 105 | factory_girl (~> 4.7.0) 106 | railties (>= 3.0.0) 107 | font-awesome-sass (4.6.2) 108 | sass (>= 3.2) 109 | foreman (0.81.0) 110 | thor (~> 0.19.1) 111 | friendly_id (5.1.0) 112 | activerecord (>= 4.0.0) 113 | globalid (0.3.6) 114 | activesupport (>= 4.1.0) 115 | gravatar_image_tag (1.2.0) 116 | has_scope (0.7.0) 117 | actionpack (>= 4.1, < 5.1) 118 | activesupport (>= 4.1, < 5.1) 119 | heroku-deflater (0.6.2) 120 | rack (>= 1.4.5) 121 | i18n (0.7.0) 122 | jbuilder (2.4.1) 123 | activesupport (>= 3.0.0, < 5.1) 124 | multi_json (~> 1.2) 125 | jquery-rails (4.1.1) 126 | rails-dom-testing (>= 1, < 3) 127 | railties (>= 4.2.0) 128 | thor (>= 0.14, < 2.0) 129 | json (1.8.3) 130 | kaminari (0.16.3) 131 | actionpack (>= 3.0.0) 132 | activesupport (>= 3.0.0) 133 | kaminari-bootstrap (3.0.1) 134 | kaminari (>= 0.13.0) 135 | rails 136 | loofah (2.0.3) 137 | nokogiri (>= 1.5.9) 138 | mail (2.6.4) 139 | mime-types (>= 1.16, < 4) 140 | meta-tags (2.1.0) 141 | actionpack (>= 3.0.0) 142 | mime-types (3.0) 143 | mime-types-data (~> 3.2015) 144 | mime-types-data (3.2016.0221) 145 | mini_portile2 (2.0.0) 146 | minitest (5.8.4) 147 | multi_json (1.12.0) 148 | nokogiri (1.6.7.2) 149 | mini_portile2 (~> 2.0.0.rc2) 150 | orm_adapter (0.5.0) 151 | paper_trail (5.0.1) 152 | activerecord (>= 3.0, < 6.0) 153 | activesupport (>= 3.0, < 6.0) 154 | request_store (~> 1.1) 155 | paranoia (2.1.5) 156 | activerecord (~> 4.0) 157 | pg (0.18.4) 158 | polyamorous (1.3.0) 159 | activerecord (>= 3.0) 160 | puma (3.4.0) 161 | rack (1.6.4) 162 | rack-test (0.6.3) 163 | rack (>= 1.0) 164 | rails (4.2.6) 165 | actionmailer (= 4.2.6) 166 | actionpack (= 4.2.6) 167 | actionview (= 4.2.6) 168 | activejob (= 4.2.6) 169 | activemodel (= 4.2.6) 170 | activerecord (= 4.2.6) 171 | activesupport (= 4.2.6) 172 | bundler (>= 1.3.0, < 2.0) 173 | railties (= 4.2.6) 174 | sprockets-rails 175 | rails-assets-html5shiv (3.7.3) 176 | rails-assets-jquery (2.2.3) 177 | rails-assets-microplugin (0.0.3) 178 | rails-assets-respond (1.4.2) 179 | rails-assets-selectize (0.12.1) 180 | rails-assets-jquery (>= 1.7.0) 181 | rails-assets-microplugin (~> 0.0.0) 182 | rails-assets-sifter (~> 0.4.0) 183 | rails-assets-sifter (0.4.5) 184 | rails-assets-underscore (1.8.3) 185 | rails-deprecated_sanitizer (1.0.3) 186 | activesupport (>= 4.2.0.alpha) 187 | rails-dom-testing (1.0.7) 188 | activesupport (>= 4.2.0.beta, < 5.0) 189 | nokogiri (~> 1.6.0) 190 | rails-deprecated_sanitizer (>= 1.0.1) 191 | rails-html-sanitizer (1.0.3) 192 | loofah (~> 2.0) 193 | rails_12factor (0.0.3) 194 | rails_serve_static_assets 195 | rails_stdout_logging 196 | rails_serve_static_assets (0.0.5) 197 | rails_stdout_logging (0.0.5) 198 | railties (4.2.6) 199 | actionpack (= 4.2.6) 200 | activesupport (= 4.2.6) 201 | rake (>= 0.8.7) 202 | thor (>= 0.18.1, < 2.0) 203 | rake (11.1.2) 204 | ransack (1.7.0) 205 | actionpack (>= 3.0) 206 | activerecord (>= 3.0) 207 | activesupport (>= 3.0) 208 | i18n 209 | polyamorous (~> 1.2) 210 | rdoc (4.2.2) 211 | json (~> 1.4) 212 | request_store (1.3.1) 213 | responders (2.2.0) 214 | railties (>= 4.2.0, < 5.1) 215 | rolify (5.1.0) 216 | rspec-collection_matchers (1.1.2) 217 | rspec-expectations (>= 2.99.0.beta1) 218 | rspec-core (3.4.4) 219 | rspec-support (~> 3.4.0) 220 | rspec-expectations (3.4.0) 221 | diff-lcs (>= 1.2.0, < 2.0) 222 | rspec-support (~> 3.4.0) 223 | rspec-its (1.2.0) 224 | rspec-core (>= 3.0.0) 225 | rspec-expectations (>= 3.0.0) 226 | rspec-mocks (3.4.1) 227 | diff-lcs (>= 1.2.0, < 2.0) 228 | rspec-support (~> 3.4.0) 229 | rspec-rails (3.4.2) 230 | actionpack (>= 3.0, < 4.3) 231 | activesupport (>= 3.0, < 4.3) 232 | railties (>= 3.0, < 4.3) 233 | rspec-core (~> 3.4.0) 234 | rspec-expectations (~> 3.4.0) 235 | rspec-mocks (~> 3.4.0) 236 | rspec-support (~> 3.4.0) 237 | rspec-support (3.4.1) 238 | sass (3.4.22) 239 | sass-rails (5.0.4) 240 | railties (>= 4.0.0, < 5.0) 241 | sass (~> 3.1) 242 | sprockets (>= 2.8, < 4.0) 243 | sprockets-rails (>= 2.0, < 4.0) 244 | tilt (>= 1.1, < 3) 245 | sdoc (0.4.1) 246 | json (~> 1.7, >= 1.7.7) 247 | rdoc (~> 4.0) 248 | shoulda-matchers (3.1.1) 249 | activesupport (>= 4.0.0) 250 | simple_form (3.2.1) 251 | actionpack (> 4, < 5.1) 252 | activemodel (> 4, < 5.1) 253 | sitemap_generator (5.1.0) 254 | builder 255 | spring (1.7.1) 256 | spring-commands-rspec (1.0.4) 257 | spring (>= 0.9.1) 258 | sprockets (3.6.0) 259 | concurrent-ruby (~> 1.0) 260 | rack (> 1, < 3) 261 | sprockets-rails (3.0.4) 262 | actionpack (>= 4.0) 263 | activesupport (>= 4.0) 264 | sprockets (>= 3.0.0) 265 | state_machine (1.2.0) 266 | thor (0.19.1) 267 | thread_safe (0.3.5) 268 | tilt (2.0.2) 269 | tzinfo (1.2.2) 270 | thread_safe (~> 0.1) 271 | uglifier (3.0.0) 272 | execjs (>= 0.3.0, < 3) 273 | warden (1.2.6) 274 | rack (>= 1.0) 275 | web-console (2.3.0) 276 | activemodel (>= 4.0) 277 | binding_of_caller (>= 0.7.2) 278 | railties (>= 4.0) 279 | sprockets-rails (>= 2.0, < 4.0) 280 | xpath (2.0.0) 281 | nokogiri (~> 1.3) 282 | 283 | PLATFORMS 284 | ruby 285 | 286 | DEPENDENCIES 287 | acts-as-taggable-on 288 | acts_as_list 289 | autoprefixer-rails 290 | awesome_nested_set 291 | bootstrap-sass 292 | byebug 293 | cancancan 294 | capybara 295 | coffee-rails (~> 4.1.0) 296 | data-confirm-modal! 297 | devise 298 | dotenv-rails 299 | factory_girl_rails 300 | font-awesome-sass 301 | foreman 302 | friendly_id 303 | gravatar_image_tag 304 | has_scope 305 | heroku-deflater 306 | jbuilder (~> 2.0) 307 | jquery-rails 308 | kaminari 309 | kaminari-bootstrap 310 | meta-tags 311 | paper_trail 312 | paranoia 313 | pg 314 | puma 315 | rails (= 4.2.6) 316 | rails-assets-html5shiv! 317 | rails-assets-respond! 318 | rails-assets-selectize! 319 | rails-assets-underscore! 320 | rails_12factor 321 | ransack 322 | responders 323 | rolify 324 | rspec-collection_matchers 325 | rspec-its 326 | rspec-rails 327 | sass-rails (~> 5.0) 328 | sdoc (~> 0.4.0) 329 | shoulda-matchers 330 | simple_form 331 | sitemap_generator 332 | spring 333 | spring-commands-rspec 334 | state_machine 335 | turbolinks! 336 | uglifier (>= 1.3.0) 337 | web-console (~> 2.0) 338 | 339 | BUNDLED WITH 340 | 1.11.2 341 | -------------------------------------------------------------------------------- /MIT-LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2012-2014 Ben Caldwell 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /Procfile: -------------------------------------------------------------------------------- 1 | web: bundle exec puma -C config/puma.rb 2 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Gunzel 2 | ======== 3 | 4 | An opinionated Rails starter application that has everything you need to hit the ground running on your next project. 5 | 6 | [![Dependency Status](https://gemnasium.com/lankz/gunzel.svg)](https://gemnasium.com/lankz/gunzel) 7 | [![Deploy](https://www.herokucdn.com/deploy/button.png)](https://heroku.com/deploy) 8 | 9 | Goodies 10 | ------- 11 | 12 | * Rails 4.2 13 | * Custom view scaffold templates using [HAML](https://github.com/indirect/haml-rails), [Simple Form](https://github.com/plataformatec/simple_form), [Bootstrap](http://getbootstrap.com/) and [FontAwesome](http://fortawesome.github.io/Font-Awesome/) 14 | * Custom model and controller scaffold templates using [Responders](https://github.com/plataformatec/responders) and [Has scope](https://github.com/plataformatec/has_scope) 15 | * [Devise](https://github.com/plataformatec/devise), [CanCan](https://github.com/CanCanCommunity/cancancan) and [Rolify](https://github.com/EppO/rolify) 16 | * [RSpec](https://github.com/rspec/rspec-rails) 17 | * [Foreman](https://github.com/ddollar/foreman) and pre-configuration for deployment on [Heroku](https://www.heroku.com/) 18 | * Loads more... 19 | 20 | Usage 21 | ----- 22 | 23 | Gunzel is distributed as a customised generated Rails application scaffold (not as a [Rails application template](http://guides.rubyonrails.org/rails_application_templates.html), which would be nice but the idea of stuffing so many customisations into a single script is a little scary). 24 | 25 | As it's not a gem (yet), you'll need to work with the Git repository to get at the code. If you're starting a new project there are few different options here. The recommended approach is: 26 | 27 | ```bash 28 | # create a new project directory and switch to it 29 | mkdir my_project && cd $_ 30 | 31 | # initialise a new repository with gunzel as an upstream remote 32 | git init 33 | git remote add gunzel git@github.com:lankz/gunzel.git 34 | git pull gunzel/master 35 | ``` 36 | 37 | Gunzel is not pre-configured for any particular DBMS (please use Postgres :bowtie:) and *should* work with anything Rails does. The database configuration file `config/database.yml` is not checked into version control, so you'll need to copy an example across and customise it before you can proceed. 38 | 39 | ```bash 40 | cp config/database/postgresql.example.yml config/database.yml 41 | # edit database configuration to suit 42 | vim config/database.yml 43 | ./bin/rake db:setup --trace 44 | ``` 45 | 46 | For security reasons it's a good idea to generate a new `secret_key_base`: 47 | 48 | ```bash 49 | ./bin/rake secret | pbcopy 50 | vim config/secrets.yml 51 | ``` 52 | 53 | There are loads of other configuration options for Gunzel and it's dependencies - you'll want to check out the files in `config/initializers`. 54 | 55 | Finally, here are a few tricks for starting the Rails console and web server (if you deploy on Heroku and don't already use [foreman](https://github.com/ddollar/foreman) you should definitely familiarise yourself with it): 56 | 57 | ```bash 58 | # using foreman (recommended) 59 | ./bin/foreman run ./bin/rails console 60 | 61 | # other options (somewhat not recommended) 62 | ./bin/rails console 63 | ./bin/rails server --port 5000 64 | ./bin/unicorn --port 5000 65 | 66 | # navigate to the application in your default browser :) 67 | open 'http://localhost:5000/' 68 | ``` 69 | -------------------------------------------------------------------------------- /Rakefile: -------------------------------------------------------------------------------- 1 | # Add your own tasks in files placed in lib/tasks ending in .rake, 2 | # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake. 3 | 4 | require File.expand_path('../config/application', __FILE__) 5 | 6 | Gunzel::Application.load_tasks 7 | -------------------------------------------------------------------------------- /app.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Gunzel", 3 | "description": "Slices through the setup time for your next Rails project", 4 | "repository": "https://github.com/lankz/gunzel.git", 5 | "env": { 6 | "SECRET_KEY_BASE": { 7 | "generator": "secret" 8 | } 9 | }, 10 | "scripts": { 11 | "postdeploy": "bundle exec rake db:migrate --trace" 12 | }, 13 | "success_url": "/", 14 | "addons": [ 15 | "heroku-postgresql:hobby-dev" 16 | ] 17 | } 18 | -------------------------------------------------------------------------------- /app/assets/images/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lankz/gunzel/26e12f8ab7918423c7ac4858ce6945e6955ce1fa/app/assets/images/.keep -------------------------------------------------------------------------------- /app/assets/javascripts/application.js.coffee: -------------------------------------------------------------------------------- 1 | # This is a manifest file that'll be compiled into application.js, which will include all the files 2 | # listed below. 3 | # 4 | # Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts, 5 | # or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path. 6 | # 7 | # It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the 8 | # compiled file. 9 | # 10 | # Read Sprockets README (https://github.com/sstephenson/sprockets#sprockets-directives) for details 11 | # about supported directives. 12 | # 13 | #= require underscore 14 | #= require jquery 15 | #= require jquery_ujs 16 | #= require turbolinks 17 | #= require bootstrap-sprockets 18 | #= require data-confirm-modal 19 | #= require_tree . 20 | -------------------------------------------------------------------------------- /app/assets/javascripts/selectize.js.coffee: -------------------------------------------------------------------------------- 1 | #= require selectize/standalone/selectize 2 | 3 | $(document).on 'ready page:load', -> 4 | $('.form-control.selectize').selectize() 5 | -------------------------------------------------------------------------------- /app/assets/stylesheets/application.scss: -------------------------------------------------------------------------------- 1 | /* 2 | * This is a manifest file that'll be compiled into application.css, which will include all the files 3 | * listed below. 4 | * 5 | * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets, 6 | * or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path. 7 | * 8 | * You're free to add application-wide styles to this file and they'll appear at the top of the 9 | * compiled file, but it's generally better to create a new file per style scope. 10 | * 11 | *= require_self 12 | *= require_tree . 13 | */ 14 | 15 | @import "bootstrap-sprockets"; 16 | @import "bootstrap"; 17 | 18 | @import "font-awesome-sprockets"; 19 | @import "font-awesome"; 20 | 21 | body { padding-top: $navbar-height + $grid-gutter-width; } 22 | 23 | .alert-notice { @extend .alert-success; } 24 | .alert-alert { @extend .alert-danger; } 25 | 26 | .img-avatar { 27 | @extend .img-circle; 28 | 29 | margin: -7px ($grid-gutter-width * 0.25) -7px 0; 30 | } 31 | 32 | .page-header-actions { 33 | @extend .pull-right; 34 | 35 | padding: 4px 0; 36 | 37 | &>* { 38 | display: inline-block; 39 | } 40 | } 41 | 42 | .page-header-tabbed { 43 | border-bottom: none; 44 | 45 | .nav-tabs { 46 | margin-top: 20px; 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /app/assets/stylesheets/selectize.css: -------------------------------------------------------------------------------- 1 | /* 2 | *= require selectize/selectize.bootstrap3 3 | */ 4 | 5 | .selectize-dropdown .active { 6 | background-color: #428bca; 7 | color: #ffffff; 8 | } 9 | -------------------------------------------------------------------------------- /app/controllers/application_controller.rb: -------------------------------------------------------------------------------- 1 | class ApplicationController < ActionController::Base 2 | # extends .................................................................... 3 | # includes ................................................................... 4 | # constants .................................................................. 5 | # filters .................................................................... 6 | # helpers .................................................................... 7 | # scopes ..................................................................... 8 | # additional config .......................................................... 9 | 10 | # Prevent CSRF attacks by raising an exception. 11 | # For APIs, you may want to use :null_session instead. 12 | protect_from_forgery with: :exception 13 | 14 | check_authorization :unless => :devise_controller? 15 | 16 | rescue_from CanCan::AccessDenied, :with => :forbidden 17 | rescue_from ActiveRecord::RecordNotFound, :with => :not_found 18 | 19 | # controller actions ......................................................... 20 | # protected instance methods ................................................. 21 | 22 | protected 23 | 24 | def forbidden 25 | set_meta_tags :title => 'Forbidden' 26 | 27 | render :forbidden, 28 | :layout => 'application', 29 | :status => :forbidden 30 | end 31 | 32 | def not_found 33 | set_meta_tags :title => 'Not found' 34 | 35 | render :not_found, 36 | :layout => 'application', 37 | :status => :not_found 38 | end 39 | end 40 | -------------------------------------------------------------------------------- /app/controllers/concerns/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lankz/gunzel/26e12f8ab7918423c7ac4858ce6945e6955ce1fa/app/controllers/concerns/.keep -------------------------------------------------------------------------------- /app/controllers/statics_controller.rb: -------------------------------------------------------------------------------- 1 | class StaticsController < ApplicationController 2 | # extends .................................................................... 3 | # includes ................................................................... 4 | # constants .................................................................. 5 | # filters .................................................................... 6 | # helpers .................................................................... 7 | # scopes ..................................................................... 8 | # additional config .......................................................... 9 | 10 | respond_to :html 11 | 12 | skip_authorization_check 13 | 14 | # controller actions ......................................................... 15 | 16 | def home 17 | end 18 | end 19 | -------------------------------------------------------------------------------- /app/helpers/application_helper.rb: -------------------------------------------------------------------------------- 1 | module ApplicationHelper 2 | # extends .................................................................... 3 | # includes ................................................................... 4 | # constants .................................................................. 5 | # additional config .......................................................... 6 | # class methods .............................................................. 7 | # helper methods ............................................................. 8 | # protected instance methods ................................................. 9 | # private instance methods ................................................... 10 | end 11 | -------------------------------------------------------------------------------- /app/inputs/selectize_input.rb: -------------------------------------------------------------------------------- 1 | class SelectizeInput < SimpleForm::Inputs::CollectionSelectInput 2 | end 3 | -------------------------------------------------------------------------------- /app/mailers/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lankz/gunzel/26e12f8ab7918423c7ac4858ce6945e6955ce1fa/app/mailers/.keep -------------------------------------------------------------------------------- /app/models/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lankz/gunzel/26e12f8ab7918423c7ac4858ce6945e6955ce1fa/app/models/.keep -------------------------------------------------------------------------------- /app/models/ability.rb: -------------------------------------------------------------------------------- 1 | class Ability 2 | # extends .................................................................... 3 | # includes ................................................................... 4 | 5 | include CanCan::Ability 6 | 7 | # constants .................................................................. 8 | # additional config .......................................................... 9 | # class methods .............................................................. 10 | # instance methods ........................................................... 11 | 12 | def initialize(user) 13 | # Define abilities for the passed in user here. For example: 14 | # 15 | # user ||= User.new # guest user (not logged in) 16 | # if user.admin? 17 | # can :manage, :all 18 | # else 19 | # can :read, :all 20 | # end 21 | # 22 | # The first argument to `can` is the action you are giving the user 23 | # permission to do. 24 | # If you pass :manage it will apply to every action. Other common actions 25 | # here are :read, :create, :update and :destroy. 26 | # 27 | # The second argument is the resource the user can perform the action on. 28 | # If you pass :all it will apply to every resource. Otherwise pass a Ruby 29 | # class of the resource. 30 | # 31 | # The third argument is an optional hash of conditions to further filter the 32 | # objects. 33 | # For example, here the user can only update published articles. 34 | # 35 | # can :update, Article, :published => true 36 | # 37 | # See the wiki for details: 38 | # https://github.com/bryanrite/cancancan/wiki/Defining-Abilities 39 | 40 | can :manage, :all 41 | end 42 | 43 | # protected instance methods ................................................. 44 | # private instance methods ................................................... 45 | end 46 | -------------------------------------------------------------------------------- /app/models/concerns/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lankz/gunzel/26e12f8ab7918423c7ac4858ce6945e6955ce1fa/app/models/concerns/.keep -------------------------------------------------------------------------------- /app/models/role.rb: -------------------------------------------------------------------------------- 1 | class Role < ActiveRecord::Base 2 | # extends .................................................................... 3 | # includes ................................................................... 4 | # constants .................................................................. 5 | # associations ............................................................... 6 | 7 | belongs_to :resource, :polymorphic => true 8 | has_and_belongs_to_many :users, :join_table => :users_roles 9 | 10 | # scopes ..................................................................... 11 | # validations ................................................................ 12 | # callbacks .................................................................. 13 | # additional config .......................................................... 14 | 15 | scopify 16 | 17 | # class methods .............................................................. 18 | # instance methods ........................................................... 19 | # protected instance methods ................................................. 20 | # private instance methods ................................................... 21 | end 22 | -------------------------------------------------------------------------------- /app/models/user.rb: -------------------------------------------------------------------------------- 1 | class User < ActiveRecord::Base 2 | # extends .................................................................... 3 | # includes ................................................................... 4 | # constants .................................................................. 5 | # associations ............................................................... 6 | # scopes ..................................................................... 7 | # validations ................................................................ 8 | 9 | validates :username, 10 | :presence => true, 11 | :length => { :maximum => 255 }, 12 | :uniqueness => { 13 | :case_sensitive => false 14 | } 15 | 16 | # callbacks .................................................................. 17 | # additional config .......................................................... 18 | 19 | attr_accessor :login 20 | 21 | # Include default devise modules. Others available are: 22 | # :confirmable, :lockable, :timeoutable and :omniauthable 23 | devise :database_authenticatable, :registerable, 24 | :recoverable, :rememberable, :trackable, :validatable 25 | 26 | rolify 27 | 28 | # class methods .............................................................. 29 | 30 | def self.find_first_by_auth_conditions(warden_conditions) 31 | conditions = warden_conditions.dup 32 | 33 | if login = conditions.delete(:login) 34 | where(conditions). \ 35 | where(arel_table[:username].lower.eq(login.downcase).or( 36 | arel_table[:email].lower.eq(login.downcase))).first 37 | else 38 | super 39 | end 40 | end 41 | 42 | # instance methods ........................................................... 43 | # protected instance methods ................................................. 44 | # private instance methods ................................................... 45 | end 46 | -------------------------------------------------------------------------------- /app/views/application/_flash.html.erb: -------------------------------------------------------------------------------- 1 | <% flash.reject { |k, v| v.blank? }.each do |type, message| %> 2 |
3 | 6 | 7 | <%= message %> 8 |
9 | <% end %> 10 | -------------------------------------------------------------------------------- /app/views/application/_navbar.html.erb: -------------------------------------------------------------------------------- 1 | 58 | -------------------------------------------------------------------------------- /app/views/application/forbidden.html.erb: -------------------------------------------------------------------------------- 1 |
2 |

403

3 |

…I'm sorry, Dave. I'm afraid I can't do that.

4 |
5 | -------------------------------------------------------------------------------- /app/views/application/not_found.html.erb: -------------------------------------------------------------------------------- 1 |
2 |

404

3 |

…this isn't the web page you're looking for.

4 |
5 | -------------------------------------------------------------------------------- /app/views/devise/passwords/new.html.erb: -------------------------------------------------------------------------------- 1 | 4 | 5 | <%= simple_form_for(resource, as: resource_name, url: password_path(resource_name), :wrapper => :horizontal_form, :wrapper_mappings => { :boolean => :horizontal_boolean }, :html => { :class => 'form-horizontal', :role => 'form', :method => :post }) do |f| %> 6 | <%= f.input(:login, :required => true, :autofocus => true) %> 7 | 8 |
9 |
10 | <%= f.button(:submit, 'Send me reset password instructions') %> 11 |
12 |
13 | <% end %> 14 | -------------------------------------------------------------------------------- /app/views/devise/registrations/edit.html.erb: -------------------------------------------------------------------------------- 1 | <% content_for :breadcrumbs do %> 2 | 6 | <% end %> 7 | 8 | 11 | 12 | <%= simple_form_for(resource, :as => resource_name, :url => registration_path(resource_name), :wrapper => :horizontal_form, :wrapper_mappings => { :boolean => :horizontal_boolean }, :html => { :class => 'form-horizontal', :role => 'form', :method => :put }) do |f| %> 13 | <%= f.error_notification %> 14 | 15 | <%= f.input :email, 16 | :required => true, 17 | :autofocus => true %> 18 | 19 | <% if devise_mapping.confirmable? && resource.pending_reconfirmation? %> 20 |

<%= "Currently waiting confirmation for: #{resource.unconfirmed_email}" %>

21 | <% end %> 22 | 23 | <%= f.input(:password, 24 | :autocomplete => 'off', 25 | :required => false, 26 | :hint => "leave it blank if you don't want to change it") %> 27 | 28 | <%= f.input(:password_confirmation, :required => false) %> 29 | 30 | <%= f.input(:current_password, 31 | :required => true, 32 | :hint => 'we need your current password to confirm your changes') %> 33 | 34 |
35 |
36 | <%= f.button(:submit, 'Update', :class => 'btn-primary') %> 37 |
38 |
39 | <% end %> 40 | 41 |
42 | 43 |
44 |
45 |

Unhappy?

46 |
47 | 48 |
49 | <%= link_to('Cancel my account', registration_path(resource_name), 50 | :data => { :confirm => 'Are you sure?' }, 51 | :method => :delete, 52 | :class => 'btn btn-danger') %> 53 |
54 |
55 | -------------------------------------------------------------------------------- /app/views/devise/registrations/new.html.erb: -------------------------------------------------------------------------------- 1 | 4 | 5 | <%= simple_form_for(resource, :as => resource_name, :url => registration_path(resource_name), :wrapper => :horizontal_form, :wrapper_mappings => { :boolean => :horizontal_boolean }, :html => { :class => 'form-horizontal', :role => 'form' }) do |f| %> 6 | <%= f.input(:username, :required => true, :autofocus => :true) %> 7 | <%= f.input(:email, :required => true) %> 8 | <%= f.input(:password, :required => true) %> 9 | <%= f.input(:password_confirmation, :required => true) %> 10 | 11 |
12 |
13 | <%= f.button :submit, 'Sign up', :class => 'btn-primary' %> 14 |
15 |
16 | <% end %> 17 | -------------------------------------------------------------------------------- /app/views/devise/sessions/new.html.erb: -------------------------------------------------------------------------------- 1 | 4 | 5 | <%= simple_form_for(resource, :as => resource_name, :url => session_path(resource_name), :wrapper => :horizontal_form, :wrapper_mappings => { :boolean => :horizontal_boolean }, :html => { :class => 'form-horizontal', :role => 'form' }) do |f| %> 6 | <%= f.input(:login, :required => false, :autofocus => :true) %> 7 | <%= f.input(:password, :required => false) %> 8 | <%= f.input(:remember_me, :as => :boolean) if devise_mapping.rememberable? %> 9 | 10 |
11 |
12 | <%= f.button(:submit, 'Sign in', :class => 'btn-primary') %> 13 | <%= link_to('Forgot your password?', new_password_path(resource_name), :class => 'btn') %> 14 |
15 |
16 | <% end %> 17 | -------------------------------------------------------------------------------- /app/views/layouts/application.html.erb: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | <%= display_meta_tags(:site => 'Gunzel', :reverse => true, :separator => '-') %> 11 | <%= csrf_meta_tag %> 12 | 13 | <%= stylesheet_link_tag('application', :media => 'all', 'data-turbolinks-track' => true) %> 14 | <%= javascript_include_tag('application', 'data-turbolinks-track' => true) %> 15 | 16 | 20 | 21 | 22 |
23 | <%= render('navbar') %> 24 | 25 | 28 | 29 |
30 | <%= render('flash') %> 31 |
32 |
33 | 34 |
35 |
36 | <%= yield %> 37 |
38 |
39 | 40 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /app/views/statics/home.html.erb: -------------------------------------------------------------------------------- 1 |
2 |

Home

3 |

…is where your Wi-Fi connects automatically.

4 |
5 | -------------------------------------------------------------------------------- /bin/autospec: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # 3 | # This file was generated by Bundler. 4 | # 5 | # The application 'autospec' is installed as part of a gem, and 6 | # this file is here to facilitate running it. 7 | # 8 | 9 | require 'pathname' 10 | ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile", 11 | Pathname.new(__FILE__).realpath) 12 | 13 | require 'rubygems' 14 | require 'bundler/setup' 15 | 16 | load Gem.bin_path('rspec-core', 'autospec') 17 | -------------------------------------------------------------------------------- /bin/bundle: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) 3 | load Gem.bin_path('bundler', 'bundle') 4 | -------------------------------------------------------------------------------- /bin/bundler: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # 3 | # This file was generated by Bundler. 4 | # 5 | # The application 'bundler' is installed as part of a gem, and 6 | # this file is here to facilitate running it. 7 | # 8 | 9 | require 'pathname' 10 | ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile", 11 | Pathname.new(__FILE__).realpath) 12 | 13 | require 'rubygems' 14 | require 'bundler/setup' 15 | 16 | load Gem.bin_path('bundler', 'bundler') 17 | -------------------------------------------------------------------------------- /bin/byebug: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # 3 | # This file was generated by Bundler. 4 | # 5 | # The application 'byebug' is installed as part of a gem, and 6 | # this file is here to facilitate running it. 7 | # 8 | 9 | require 'pathname' 10 | ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile", 11 | Pathname.new(__FILE__).realpath) 12 | 13 | require 'rubygems' 14 | require 'bundler/setup' 15 | 16 | load Gem.bin_path('byebug', 'byebug') 17 | -------------------------------------------------------------------------------- /bin/dotenv: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # 3 | # This file was generated by Bundler. 4 | # 5 | # The application 'dotenv' is installed as part of a gem, and 6 | # this file is here to facilitate running it. 7 | # 8 | 9 | require 'pathname' 10 | ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile", 11 | Pathname.new(__FILE__).realpath) 12 | 13 | require 'rubygems' 14 | require 'bundler/setup' 15 | 16 | load Gem.bin_path('dotenv', 'dotenv') 17 | -------------------------------------------------------------------------------- /bin/erubis: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # 3 | # This file was generated by Bundler. 4 | # 5 | # The application 'erubis' is installed as part of a gem, and 6 | # this file is here to facilitate running it. 7 | # 8 | 9 | require 'pathname' 10 | ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile", 11 | Pathname.new(__FILE__).realpath) 12 | 13 | require 'rubygems' 14 | require 'bundler/setup' 15 | 16 | load Gem.bin_path('erubis', 'erubis') 17 | -------------------------------------------------------------------------------- /bin/foreman: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # 3 | # This file was generated by Bundler. 4 | # 5 | # The application 'foreman' is installed as part of a gem, and 6 | # this file is here to facilitate running it. 7 | # 8 | 9 | require 'pathname' 10 | ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile", 11 | Pathname.new(__FILE__).realpath) 12 | 13 | require 'rubygems' 14 | require 'bundler/setup' 15 | 16 | load Gem.bin_path('foreman', 'foreman') 17 | -------------------------------------------------------------------------------- /bin/htmldiff: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # 3 | # This file was generated by Bundler. 4 | # 5 | # The application 'htmldiff' is installed as part of a gem, and 6 | # this file is here to facilitate running it. 7 | # 8 | 9 | require 'pathname' 10 | ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile", 11 | Pathname.new(__FILE__).realpath) 12 | 13 | require 'rubygems' 14 | require 'bundler/setup' 15 | 16 | load Gem.bin_path('diff-lcs', 'htmldiff') 17 | -------------------------------------------------------------------------------- /bin/ldiff: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # 3 | # This file was generated by Bundler. 4 | # 5 | # The application 'ldiff' is installed as part of a gem, and 6 | # this file is here to facilitate running it. 7 | # 8 | 9 | require 'pathname' 10 | ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile", 11 | Pathname.new(__FILE__).realpath) 12 | 13 | require 'rubygems' 14 | require 'bundler/setup' 15 | 16 | load Gem.bin_path('diff-lcs', 'ldiff') 17 | -------------------------------------------------------------------------------- /bin/nokogiri: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # 3 | # This file was generated by Bundler. 4 | # 5 | # The application 'nokogiri' is installed as part of a gem, and 6 | # this file is here to facilitate running it. 7 | # 8 | 9 | require 'pathname' 10 | ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile", 11 | Pathname.new(__FILE__).realpath) 12 | 13 | require 'rubygems' 14 | require 'bundler/setup' 15 | 16 | load Gem.bin_path('nokogiri', 'nokogiri') 17 | -------------------------------------------------------------------------------- /bin/puma: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # 3 | # This file was generated by Bundler. 4 | # 5 | # The application 'puma' is installed as part of a gem, and 6 | # this file is here to facilitate running it. 7 | # 8 | 9 | require 'pathname' 10 | ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile", 11 | Pathname.new(__FILE__).realpath) 12 | 13 | require 'rubygems' 14 | require 'bundler/setup' 15 | 16 | load Gem.bin_path('puma', 'puma') 17 | -------------------------------------------------------------------------------- /bin/pumactl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # 3 | # This file was generated by Bundler. 4 | # 5 | # The application 'pumactl' is installed as part of a gem, and 6 | # this file is here to facilitate running it. 7 | # 8 | 9 | require 'pathname' 10 | ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile", 11 | Pathname.new(__FILE__).realpath) 12 | 13 | require 'rubygems' 14 | require 'bundler/setup' 15 | 16 | load Gem.bin_path('puma', 'pumactl') 17 | -------------------------------------------------------------------------------- /bin/rackup: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # 3 | # This file was generated by Bundler. 4 | # 5 | # The application 'rackup' is installed as part of a gem, and 6 | # this file is here to facilitate running it. 7 | # 8 | 9 | require 'pathname' 10 | ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile", 11 | Pathname.new(__FILE__).realpath) 12 | 13 | require 'rubygems' 14 | require 'bundler/setup' 15 | 16 | load Gem.bin_path('rack', 'rackup') 17 | -------------------------------------------------------------------------------- /bin/rails: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | begin 3 | load File.expand_path("../spring", __FILE__) 4 | rescue LoadError 5 | end 6 | APP_PATH = File.expand_path('../../config/application', __FILE__) 7 | require_relative '../config/boot' 8 | require 'rails/commands' 9 | -------------------------------------------------------------------------------- /bin/rake: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | begin 3 | load File.expand_path("../spring", __FILE__) 4 | rescue LoadError 5 | end 6 | require_relative '../config/boot' 7 | require 'rake' 8 | Rake.application.run 9 | -------------------------------------------------------------------------------- /bin/rdoc: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # 3 | # This file was generated by Bundler. 4 | # 5 | # The application 'rdoc' is installed as part of a gem, and 6 | # this file is here to facilitate running it. 7 | # 8 | 9 | require 'pathname' 10 | ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile", 11 | Pathname.new(__FILE__).realpath) 12 | 13 | require 'rubygems' 14 | require 'bundler/setup' 15 | 16 | load Gem.bin_path('rdoc', 'rdoc') 17 | -------------------------------------------------------------------------------- /bin/ri: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # 3 | # This file was generated by Bundler. 4 | # 5 | # The application 'ri' is installed as part of a gem, and 6 | # this file is here to facilitate running it. 7 | # 8 | 9 | require 'pathname' 10 | ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile", 11 | Pathname.new(__FILE__).realpath) 12 | 13 | require 'rubygems' 14 | require 'bundler/setup' 15 | 16 | load Gem.bin_path('rdoc', 'ri') 17 | -------------------------------------------------------------------------------- /bin/rspec: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | begin 3 | load File.expand_path("../spring", __FILE__) 4 | rescue LoadError 5 | end 6 | # 7 | # This file was generated by Bundler. 8 | # 9 | # The application 'rspec' is installed as part of a gem, and 10 | # this file is here to facilitate running it. 11 | # 12 | 13 | require 'pathname' 14 | ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile", 15 | Pathname.new(__FILE__).realpath) 16 | 17 | require 'rubygems' 18 | require 'bundler/setup' 19 | 20 | load Gem.bin_path('rspec-core', 'rspec') 21 | -------------------------------------------------------------------------------- /bin/ruby_parse: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # 3 | # This file was generated by Bundler. 4 | # 5 | # The application 'ruby_parse' is installed as part of a gem, and 6 | # this file is here to facilitate running it. 7 | # 8 | 9 | require 'pathname' 10 | ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile", 11 | Pathname.new(__FILE__).realpath) 12 | 13 | require 'rubygems' 14 | require 'bundler/setup' 15 | 16 | load Gem.bin_path('ruby_parser', 'ruby_parse') 17 | -------------------------------------------------------------------------------- /bin/ruby_parse_extract_error: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # 3 | # This file was generated by Bundler. 4 | # 5 | # The application 'ruby_parse_extract_error' is installed as part of a gem, and 6 | # this file is here to facilitate running it. 7 | # 8 | 9 | require 'pathname' 10 | ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile", 11 | Pathname.new(__FILE__).realpath) 12 | 13 | require 'rubygems' 14 | require 'bundler/setup' 15 | 16 | load Gem.bin_path('ruby_parser', 'ruby_parse_extract_error') 17 | -------------------------------------------------------------------------------- /bin/sass: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # 3 | # This file was generated by Bundler. 4 | # 5 | # The application 'sass' is installed as part of a gem, and 6 | # this file is here to facilitate running it. 7 | # 8 | 9 | require 'pathname' 10 | ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile", 11 | Pathname.new(__FILE__).realpath) 12 | 13 | require 'rubygems' 14 | require 'bundler/setup' 15 | 16 | load Gem.bin_path('sass', 'sass') 17 | -------------------------------------------------------------------------------- /bin/sass-convert: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # 3 | # This file was generated by Bundler. 4 | # 5 | # The application 'sass-convert' is installed as part of a gem, and 6 | # this file is here to facilitate running it. 7 | # 8 | 9 | require 'pathname' 10 | ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile", 11 | Pathname.new(__FILE__).realpath) 12 | 13 | require 'rubygems' 14 | require 'bundler/setup' 15 | 16 | load Gem.bin_path('sass', 'sass-convert') 17 | -------------------------------------------------------------------------------- /bin/scss: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # 3 | # This file was generated by Bundler. 4 | # 5 | # The application 'scss' is installed as part of a gem, and 6 | # this file is here to facilitate running it. 7 | # 8 | 9 | require 'pathname' 10 | ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile", 11 | Pathname.new(__FILE__).realpath) 12 | 13 | require 'rubygems' 14 | require 'bundler/setup' 15 | 16 | load Gem.bin_path('sass', 'scss') 17 | -------------------------------------------------------------------------------- /bin/sdoc: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # 3 | # This file was generated by Bundler. 4 | # 5 | # The application 'sdoc' is installed as part of a gem, and 6 | # this file is here to facilitate running it. 7 | # 8 | 9 | require 'pathname' 10 | ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile", 11 | Pathname.new(__FILE__).realpath) 12 | 13 | require 'rubygems' 14 | require 'bundler/setup' 15 | 16 | load Gem.bin_path('sdoc', 'sdoc') 17 | -------------------------------------------------------------------------------- /bin/sdoc-merge: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # 3 | # This file was generated by Bundler. 4 | # 5 | # The application 'sdoc-merge' is installed as part of a gem, and 6 | # this file is here to facilitate running it. 7 | # 8 | 9 | require 'pathname' 10 | ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile", 11 | Pathname.new(__FILE__).realpath) 12 | 13 | require 'rubygems' 14 | require 'bundler/setup' 15 | 16 | load Gem.bin_path('sdoc', 'sdoc-merge') 17 | -------------------------------------------------------------------------------- /bin/setup: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | require 'pathname' 3 | 4 | # path to your application root. 5 | APP_ROOT = Pathname.new File.expand_path('../../', __FILE__) 6 | 7 | Dir.chdir APP_ROOT do 8 | # This script is a starting point to setup your application. 9 | # Add necessary setup steps to this file: 10 | 11 | puts "== Installing dependencies ==" 12 | system "gem install bundler --conservative" 13 | system "bundle check || bundle install" 14 | 15 | # puts "\n== Copying sample files ==" 16 | # unless File.exist?("config/database.yml") 17 | # system "cp config/database.yml.sample config/database.yml" 18 | # end 19 | 20 | puts "\n== Preparing database ==" 21 | system "bin/rake db:setup" 22 | 23 | puts "\n== Removing old logs and tempfiles ==" 24 | system "rm -f log/*" 25 | system "rm -rf tmp/cache" 26 | 27 | puts "\n== Restarting application server ==" 28 | system "touch tmp/restart.txt" 29 | end 30 | -------------------------------------------------------------------------------- /bin/spring: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | 3 | # This file loads spring without using Bundler, in order to be fast. 4 | # It gets overwritten when you run the `spring binstub` command. 5 | 6 | unless defined?(Spring) 7 | require "rubygems" 8 | require "bundler" 9 | 10 | if match = Bundler.default_lockfile.read.match(/^GEM$.*?^ (?: )*spring \((.*?)\)$.*?^$/m) 11 | Gem.paths = { "GEM_PATH" => [Bundler.bundle_path.to_s, *Gem.path].uniq } 12 | gem "spring", match[1] 13 | require "spring/binstub" 14 | end 15 | end 16 | -------------------------------------------------------------------------------- /bin/sprockets: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # 3 | # This file was generated by Bundler. 4 | # 5 | # The application 'sprockets' is installed as part of a gem, and 6 | # this file is here to facilitate running it. 7 | # 8 | 9 | require 'pathname' 10 | ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile", 11 | Pathname.new(__FILE__).realpath) 12 | 13 | require 'rubygems' 14 | require 'bundler/setup' 15 | 16 | load Gem.bin_path('sprockets', 'sprockets') 17 | -------------------------------------------------------------------------------- /bin/thor: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # 3 | # This file was generated by Bundler. 4 | # 5 | # The application 'thor' is installed as part of a gem, and 6 | # this file is here to facilitate running it. 7 | # 8 | 9 | require 'pathname' 10 | ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile", 11 | Pathname.new(__FILE__).realpath) 12 | 13 | require 'rubygems' 14 | require 'bundler/setup' 15 | 16 | load Gem.bin_path('thor', 'thor') 17 | -------------------------------------------------------------------------------- /bin/tilt: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # 3 | # This file was generated by Bundler. 4 | # 5 | # The application 'tilt' is installed as part of a gem, and 6 | # this file is here to facilitate running it. 7 | # 8 | 9 | require 'pathname' 10 | ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile", 11 | Pathname.new(__FILE__).realpath) 12 | 13 | require 'rubygems' 14 | require 'bundler/setup' 15 | 16 | load Gem.bin_path('tilt', 'tilt') 17 | -------------------------------------------------------------------------------- /bin/tt: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # 3 | # This file was generated by Bundler. 4 | # 5 | # The application 'tt' is installed as part of a gem, and 6 | # this file is here to facilitate running it. 7 | # 8 | 9 | require 'pathname' 10 | ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile", 11 | Pathname.new(__FILE__).realpath) 12 | 13 | require 'rubygems' 14 | require 'bundler/setup' 15 | 16 | load Gem.bin_path('treetop', 'tt') 17 | -------------------------------------------------------------------------------- /config.ru: -------------------------------------------------------------------------------- 1 | # This file is used by Rack-based servers to start the application. 2 | 3 | require ::File.expand_path('../config/environment', __FILE__) 4 | run Rails.application 5 | -------------------------------------------------------------------------------- /config/application.rb: -------------------------------------------------------------------------------- 1 | require File.expand_path('../boot', __FILE__) 2 | 3 | ENV['RANSACK_FORM_BUILDER'] = '::SimpleForm::FormBuilder' 4 | 5 | require 'rails/all' 6 | 7 | # Require the gems listed in Gemfile, including any gems 8 | # you've limited to :test, :development, or :production. 9 | Bundler.require(*Rails.groups) 10 | 11 | module Gunzel 12 | class Application < Rails::Application 13 | # Settings in config/environments/* take precedence over those specified here. 14 | # Application configuration should go into files in config/initializers 15 | # -- all .rb files in that directory are automatically loaded. 16 | 17 | # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone. 18 | # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC. 19 | # config.time_zone = 'Central Time (US & Canada)' 20 | 21 | # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded. 22 | # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s] 23 | # config.i18n.default_locale = :de 24 | 25 | # Do not swallow errors in after_commit/after_rollback callbacks. 26 | config.active_record.raise_in_transactional_callbacks = true 27 | 28 | # because including all helpers, all the time is a bad idea 29 | config.action_controller.include_all_helpers = false 30 | end 31 | end 32 | -------------------------------------------------------------------------------- /config/boot.rb: -------------------------------------------------------------------------------- 1 | ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) 2 | 3 | require 'bundler/setup' # Set up gems listed in the Gemfile. 4 | -------------------------------------------------------------------------------- /config/database/docker.example.yml: -------------------------------------------------------------------------------- 1 | # PostgreSQL. Versions 8.2 and up are supported. 2 | # 3 | # Install the pg driver: 4 | # gem install pg 5 | # On OS X with Homebrew: 6 | # gem install pg -- --with-pg-config=/usr/local/bin/pg_config 7 | # On OS X with MacPorts: 8 | # gem install pg -- --with-pg-config=/opt/local/lib/postgresql84/bin/pg_config 9 | # On Windows: 10 | # gem install pg 11 | # Choose the win32 build. 12 | # Install PostgreSQL and put its /bin directory on your path. 13 | # 14 | # Configure Using Gemfile 15 | # gem 'pg' 16 | # 17 | development: 18 | adapter: postgresql 19 | encoding: unicode 20 | database: gunzel_development 21 | pool: 5 22 | username: postgres 23 | password: 24 | host: db 25 | 26 | # Connect on a TCP socket. Omitted by default since the client uses a 27 | # domain socket that doesn't need configuration. Windows does not have 28 | # domain sockets, so uncomment these lines. 29 | #host: localhost 30 | 31 | # The TCP port the server listens on. Defaults to 5432. 32 | # If your server runs on a different port number, change accordingly. 33 | #port: 5432 34 | 35 | # Schema search path. The server defaults to $user,public 36 | #schema_search_path: myapp,sharedapp,public 37 | 38 | # Minimum log levels, in increasing order: 39 | # debug5, debug4, debug3, debug2, debug1, 40 | # log, notice, warning, error, fatal, and panic 41 | # Defaults to warning. 42 | #min_messages: notice 43 | 44 | # Warning: The database defined as "test" will be erased and 45 | # re-generated from your development database when you run "rake". 46 | # Do not set this db to the same as development or production. 47 | test: 48 | adapter: postgresql 49 | encoding: unicode 50 | database: gunzel_test 51 | pool: 5 52 | username: postgres 53 | password: 54 | host: db 55 | 56 | production: 57 | adapter: postgresql 58 | encoding: unicode 59 | database: gunzel_production 60 | pool: 5 61 | username: postgres 62 | password: 63 | host: db 64 | -------------------------------------------------------------------------------- /config/database/postgresql.example.yml: -------------------------------------------------------------------------------- 1 | # PostgreSQL. Versions 8.2 and up are supported. 2 | # 3 | # Install the pg driver: 4 | # gem install pg 5 | # On OS X with Homebrew: 6 | # gem install pg -- --with-pg-config=/usr/local/bin/pg_config 7 | # On OS X with MacPorts: 8 | # gem install pg -- --with-pg-config=/opt/local/lib/postgresql84/bin/pg_config 9 | # On Windows: 10 | # gem install pg 11 | # Choose the win32 build. 12 | # Install PostgreSQL and put its /bin directory on your path. 13 | # 14 | # Configure Using Gemfile 15 | # gem 'pg' 16 | # 17 | development: 18 | adapter: postgresql 19 | encoding: unicode 20 | database: gunzel_development 21 | pool: 5 22 | username: gunzel 23 | password: 24 | 25 | # Connect on a TCP socket. Omitted by default since the client uses a 26 | # domain socket that doesn't need configuration. Windows does not have 27 | # domain sockets, so uncomment these lines. 28 | #host: localhost 29 | 30 | # The TCP port the server listens on. Defaults to 5432. 31 | # If your server runs on a different port number, change accordingly. 32 | #port: 5432 33 | 34 | # Schema search path. The server defaults to $user,public 35 | #schema_search_path: myapp,sharedapp,public 36 | 37 | # Minimum log levels, in increasing order: 38 | # debug5, debug4, debug3, debug2, debug1, 39 | # log, notice, warning, error, fatal, and panic 40 | # Defaults to warning. 41 | #min_messages: notice 42 | 43 | # Warning: The database defined as "test" will be erased and 44 | # re-generated from your development database when you run "rake". 45 | # Do not set this db to the same as development or production. 46 | test: 47 | adapter: postgresql 48 | encoding: unicode 49 | database: gunzel_test 50 | pool: 5 51 | username: gunzel 52 | password: 53 | 54 | production: 55 | adapter: postgresql 56 | encoding: unicode 57 | database: gunzel_production 58 | pool: 5 59 | username: gunzel 60 | password: 61 | -------------------------------------------------------------------------------- /config/database/sqlite3.example.yml: -------------------------------------------------------------------------------- 1 | # SQLite version 3.x 2 | # gem install sqlite3 3 | # 4 | # Ensure the SQLite 3 gem is defined in your Gemfile 5 | # gem 'sqlite3' 6 | development: 7 | adapter: sqlite3 8 | database: db/development.sqlite3 9 | pool: 5 10 | timeout: 5000 11 | 12 | # Warning: The database defined as "test" will be erased and 13 | # re-generated from your development database when you run "rake". 14 | # Do not set this db to the same as development or production. 15 | test: 16 | adapter: sqlite3 17 | database: db/test.sqlite3 18 | pool: 5 19 | timeout: 5000 20 | 21 | production: 22 | adapter: sqlite3 23 | database: db/production.sqlite3 24 | pool: 5 25 | timeout: 5000 26 | -------------------------------------------------------------------------------- /config/environment.rb: -------------------------------------------------------------------------------- 1 | # Load the Rails application. 2 | require File.expand_path('../application', __FILE__) 3 | 4 | # Initialize the Rails application. 5 | Rails.application.initialize! 6 | -------------------------------------------------------------------------------- /config/environments/development.rb: -------------------------------------------------------------------------------- 1 | Rails.application.configure do 2 | # Settings specified here will take precedence over those in config/application.rb. 3 | 4 | # In the development environment your application's code is reloaded on 5 | # every request. This slows down response time but is perfect for development 6 | # since you don't have to restart the web server when you make code changes. 7 | config.cache_classes = false 8 | 9 | # Do not eager load code on boot. 10 | config.eager_load = false 11 | 12 | # Show full error reports and disable caching. 13 | config.consider_all_requests_local = true 14 | config.action_controller.perform_caching = false 15 | 16 | # Don't care if the mailer can't send. 17 | config.action_mailer.raise_delivery_errors = false 18 | 19 | # Mailer should generate links back to the development server 20 | config.action_mailer.default_url_options = { :host => 'localhost:5000' } 21 | 22 | # Print deprecation notices to the Rails logger. 23 | config.active_support.deprecation = :log 24 | 25 | # Raise an error on page load if there are pending migrations. 26 | config.active_record.migration_error = :page_load 27 | 28 | # Debug mode disables concatenation and preprocessing of assets. 29 | # This option may cause significant delays in view rendering with a large 30 | # number of complex assets. 31 | config.assets.debug = true 32 | 33 | # Asset digests allow you to set far-future HTTP expiration dates on all assets, 34 | # yet still be able to expire them through the digest params. 35 | config.assets.digest = true 36 | 37 | # Adds additional error checking when serving assets at runtime. 38 | # Checks for improperly declared sprockets dependencies. 39 | # Raises helpful error messages. 40 | config.assets.raise_runtime_errors = true 41 | 42 | # Raises error for missing translations 43 | # config.action_view.raise_on_missing_translations = true 44 | end 45 | -------------------------------------------------------------------------------- /config/environments/production.rb: -------------------------------------------------------------------------------- 1 | Rails.application.configure do 2 | # Settings specified here will take precedence over those in config/application.rb. 3 | 4 | # Code is not reloaded between requests. 5 | config.cache_classes = true 6 | 7 | # Eager load code on boot. This eager loads most of Rails and 8 | # your application in memory, allowing both threaded web servers 9 | # and those relying on copy on write to perform better. 10 | # Rake tasks automatically ignore this option for performance. 11 | config.eager_load = true 12 | 13 | # Full error reports are disabled and caching is turned on. 14 | config.consider_all_requests_local = false 15 | config.action_controller.perform_caching = true 16 | 17 | # Enable Rack::Cache to put a simple HTTP cache in front of your application 18 | # Add `rack-cache` to your Gemfile before enabling this. 19 | # For large-scale production use, consider using a caching reverse proxy like 20 | # NGINX, varnish or squid. 21 | # config.action_dispatch.rack_cache = true 22 | 23 | # Disable serving static files from the `/public` folder by default since 24 | # Apache or NGINX already handles this. 25 | config.serve_static_files = ENV['RAILS_SERVE_STATIC_FILES'].present? 26 | 27 | # Compress JavaScripts and CSS. 28 | config.assets.js_compressor = :uglifier 29 | # config.assets.css_compressor = :sass 30 | 31 | # Do not fallback to assets pipeline if a precompiled asset is missed. 32 | config.assets.compile = false 33 | 34 | # Asset digests allow you to set far-future HTTP expiration dates on all assets, 35 | # yet still be able to expire them through the digest params. 36 | config.assets.digest = true 37 | 38 | # `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb 39 | 40 | # Specifies the header that your server uses for sending files. 41 | # config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache 42 | # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX 43 | 44 | # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies. 45 | # config.force_ssl = true 46 | 47 | # Use the lowest log level to ensure availability of diagnostic information 48 | # when problems arise. 49 | config.log_level = :debug 50 | 51 | # Prepend all log lines with the following tags. 52 | # config.log_tags = [ :subdomain, :uuid ] 53 | 54 | # Use a different logger for distributed setups. 55 | # config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new) 56 | 57 | # Use a different cache store in production. 58 | # config.cache_store = :mem_cache_store 59 | 60 | # Enable serving of images, stylesheets, and JavaScripts from an asset server. 61 | # config.action_controller.asset_host = 'http://assets.example.com' 62 | 63 | # Ignore bad email addresses and do not raise email delivery errors. 64 | # Set this to true and configure the email server for immediate delivery to raise delivery errors. 65 | # config.action_mailer.raise_delivery_errors = false 66 | 67 | # Enable locale fallbacks for I18n (makes lookups for any locale fall back to 68 | # the I18n.default_locale when a translation cannot be found). 69 | config.i18n.fallbacks = true 70 | 71 | # Send deprecation notices to registered listeners. 72 | config.active_support.deprecation = :notify 73 | 74 | # Use default logging formatter so that PID and timestamp are not suppressed. 75 | config.log_formatter = ::Logger::Formatter.new 76 | 77 | # Do not dump schema after migrations. 78 | config.active_record.dump_schema_after_migration = false 79 | end 80 | -------------------------------------------------------------------------------- /config/environments/test.rb: -------------------------------------------------------------------------------- 1 | Rails.application.configure do 2 | # Settings specified here will take precedence over those in config/application.rb. 3 | 4 | # The test environment is used exclusively to run your application's 5 | # test suite. You never need to work with it otherwise. Remember that 6 | # your test database is "scratch space" for the test suite and is wiped 7 | # and recreated between test runs. Don't rely on the data there! 8 | config.cache_classes = true 9 | 10 | # Do not eager load code on boot. This avoids loading your whole application 11 | # just for the purpose of running a single test. If you are using a tool that 12 | # preloads Rails for running tests, you may have to set it to true. 13 | config.eager_load = false 14 | 15 | # Configure static file server for tests with Cache-Control for performance. 16 | config.serve_static_files = true 17 | config.static_cache_control = 'public, max-age=3600' 18 | 19 | # Show full error reports and disable caching. 20 | config.consider_all_requests_local = true 21 | config.action_controller.perform_caching = false 22 | 23 | # Raise exceptions instead of rendering exception templates. 24 | config.action_dispatch.show_exceptions = false 25 | 26 | # Disable request forgery protection in test environment. 27 | config.action_controller.allow_forgery_protection = false 28 | 29 | # Tell Action Mailer not to deliver emails to the real world. 30 | # The :test delivery method accumulates sent emails in the 31 | # ActionMailer::Base.deliveries array. 32 | config.action_mailer.delivery_method = :test 33 | 34 | # Randomize the order test cases are executed. 35 | config.active_support.test_order = :random 36 | 37 | # Print deprecation notices to the stderr. 38 | config.active_support.deprecation = :stderr 39 | 40 | # Raises error for missing translations 41 | # config.action_view.raise_on_missing_translations = true 42 | end 43 | -------------------------------------------------------------------------------- /config/initializers/assets.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Version of your assets, change this if you want to expire all your assets. 4 | Rails.application.config.assets.version = '1.0' 5 | 6 | # Add additional assets to the asset load path 7 | # Rails.application.config.assets.paths << Emoji.images_path 8 | 9 | # Precompile additional assets. 10 | # application.js, application.css, and all non-JS/CSS in app/assets folder are already added. 11 | # Rails.application.config.assets.precompile += %w( search.js ) 12 | 13 | Rails.application.config.assets.precompile += 14 | %w(html5shiv.js respond.js) 15 | -------------------------------------------------------------------------------- /config/initializers/backtrace_silencers.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces. 4 | # Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ } 5 | 6 | # You can also remove all the silencers if you're trying to debug a problem that might stem from framework code. 7 | # Rails.backtrace_cleaner.remove_silencers! 8 | -------------------------------------------------------------------------------- /config/initializers/cookies_serializer.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | Rails.application.config.action_dispatch.cookies_serializer = :json 4 | -------------------------------------------------------------------------------- /config/initializers/devise.rb: -------------------------------------------------------------------------------- 1 | # Use this hook to configure devise mailer, warden hooks and so forth. 2 | # Many of these configuration options can be set straight in your model. 3 | Devise.setup do |config| 4 | # The secret key used by Devise. Devise uses this key to generate 5 | # random tokens. Changing this key will render invalid all existing 6 | # confirmation, reset password and unlock tokens in the database. 7 | # config.secret_key = '7ac132dfa675c510494895956bb6dbdca4cb51319c1aa91af8b6f928ae8732f381868b2587abf9420dc571f3aed9fa3aa3c73b2e898b1a5956ea4c0c741c7e91' 8 | 9 | # ==> Mailer Configuration 10 | # Configure the e-mail address which will be shown in Devise::Mailer, 11 | # note that it will be overwritten if you use your own mailer class 12 | # with default "from" parameter. 13 | config.mailer_sender = 'please-change-me-at-config-initializers-devise@example.com' 14 | 15 | # Configure the class responsible to send e-mails. 16 | # config.mailer = 'Devise::Mailer' 17 | 18 | # ==> ORM configuration 19 | # Load and configure the ORM. Supports :active_record (default) and 20 | # :mongoid (bson_ext recommended) by default. Other ORMs may be 21 | # available as additional gems. 22 | require 'devise/orm/active_record' 23 | 24 | # ==> Configuration for any authentication mechanism 25 | # Configure which keys are used when authenticating a user. The default is 26 | # just :email. You can configure it to use [:username, :subdomain], so for 27 | # authenticating a user, both parameters are required. Remember that those 28 | # parameters are used only when authenticating and not when retrieving from 29 | # session. If you need permissions, you should implement that in a before filter. 30 | # You can also supply a hash where the value is a boolean determining whether 31 | # or not authentication should be aborted when the value is not present. 32 | config.authentication_keys = [ :login ] 33 | 34 | # Configure parameters from the request object used for authentication. Each entry 35 | # given should be a request method and it will automatically be passed to the 36 | # find_for_authentication method and considered in your model lookup. For instance, 37 | # if you set :request_keys to [:subdomain], :subdomain will be used on authentication. 38 | # The same considerations mentioned for authentication_keys also apply to request_keys. 39 | # config.request_keys = [] 40 | 41 | # Configure which authentication keys should be case-insensitive. 42 | # These keys will be downcased upon creating or modifying a user and when used 43 | # to authenticate or find a user. Default is :email. 44 | config.case_insensitive_keys = [ :email ] 45 | 46 | # Configure which authentication keys should have whitespace stripped. 47 | # These keys will have whitespace before and after removed upon creating or 48 | # modifying a user and when used to authenticate or find a user. Default is :email. 49 | config.strip_whitespace_keys = [ :email ] 50 | 51 | # Tell if authentication through request.params is enabled. True by default. 52 | # It can be set to an array that will enable params authentication only for the 53 | # given strategies, for example, `config.params_authenticatable = [:database]` will 54 | # enable it only for database (email + password) authentication. 55 | # config.params_authenticatable = true 56 | 57 | # Tell if authentication through HTTP Auth is enabled. False by default. 58 | # It can be set to an array that will enable http authentication only for the 59 | # given strategies, for example, `config.http_authenticatable = [:database]` will 60 | # enable it only for database authentication. The supported strategies are: 61 | # :database = Support basic authentication with authentication key + password 62 | # config.http_authenticatable = false 63 | 64 | # If http headers should be returned for AJAX requests. True by default. 65 | # config.http_authenticatable_on_xhr = true 66 | 67 | # The realm used in Http Basic Authentication. 'Application' by default. 68 | # config.http_authentication_realm = 'Application' 69 | 70 | # It will change confirmation, password recovery and other workflows 71 | # to behave the same regardless if the e-mail provided was right or wrong. 72 | # Does not affect registerable. 73 | # config.paranoid = true 74 | 75 | # By default Devise will store the user in session. You can skip storage for 76 | # particular strategies by setting this option. 77 | # Notice that if you are skipping storage for all authentication paths, you 78 | # may want to disable generating routes to Devise's sessions controller by 79 | # passing skip: :sessions to `devise_for` in your config/routes.rb 80 | config.skip_session_storage = [:http_auth] 81 | 82 | # By default, Devise cleans up the CSRF token on authentication to 83 | # avoid CSRF token fixation attacks. This means that, when using AJAX 84 | # requests for sign in and sign up, you need to get a new CSRF token 85 | # from the server. You can disable this option at your own risk. 86 | # config.clean_up_csrf_token_on_authentication = true 87 | 88 | # ==> Configuration for :database_authenticatable 89 | # For bcrypt, this is the cost for hashing the password and defaults to 10. If 90 | # using other encryptors, it sets how many times you want the password re-encrypted. 91 | # 92 | # Limiting the stretches to just one in testing will increase the performance of 93 | # your test suite dramatically. However, it is STRONGLY RECOMMENDED to not use 94 | # a value less than 10 in other environments. Note that, for bcrypt (the default 95 | # encryptor), the cost increases exponentially with the number of stretches (e.g. 96 | # a value of 20 is already extremely slow: approx. 60 seconds for 1 calculation). 97 | config.stretches = Rails.env.test? ? 1 : 10 98 | 99 | # Setup a pepper to generate the encrypted password. 100 | # config.pepper = '443dd4f8ef26700b98e101764fb9653b47e30368bce676cea8744cb265aa77ba84f06114237d220b2b58ab78b234a70637894b04cc7caf82db61ee0b5343ba2e' 101 | 102 | # ==> Configuration for :confirmable 103 | # A period that the user is allowed to access the website even without 104 | # confirming their account. For instance, if set to 2.days, the user will be 105 | # able to access the website for two days without confirming their account, 106 | # access will be blocked just in the third day. Default is 0.days, meaning 107 | # the user cannot access the website without confirming their account. 108 | # config.allow_unconfirmed_access_for = 2.days 109 | 110 | # A period that the user is allowed to confirm their account before their 111 | # token becomes invalid. For example, if set to 3.days, the user can confirm 112 | # their account within 3 days after the mail was sent, but on the fourth day 113 | # their account can't be confirmed with the token any more. 114 | # Default is nil, meaning there is no restriction on how long a user can take 115 | # before confirming their account. 116 | # config.confirm_within = 3.days 117 | 118 | # If true, requires any email changes to be confirmed (exactly the same way as 119 | # initial account confirmation) to be applied. Requires additional unconfirmed_email 120 | # db field (see migrations). Until confirmed, new email is stored in 121 | # unconfirmed_email column, and copied to email column on successful confirmation. 122 | config.reconfirmable = true 123 | 124 | # Defines which key will be used when confirming an account 125 | # config.confirmation_keys = [ :email ] 126 | 127 | # ==> Configuration for :rememberable 128 | # The time the user will be remembered without asking for credentials again. 129 | # config.remember_for = 2.weeks 130 | 131 | # If true, extends the user's remember period when remembered via cookie. 132 | # config.extend_remember_period = false 133 | 134 | # Options to be passed to the created cookie. For instance, you can set 135 | # secure: true in order to force SSL only cookies. 136 | # config.rememberable_options = {} 137 | 138 | # ==> Configuration for :validatable 139 | # Range for password length. 140 | config.password_length = 8..128 141 | 142 | # Email regex used to validate email formats. It simply asserts that 143 | # one (and only one) @ exists in the given string. This is mainly 144 | # to give user feedback and not to assert the e-mail validity. 145 | # config.email_regexp = /\A[^@]+@[^@]+\z/ 146 | 147 | # ==> Configuration for :timeoutable 148 | # The time you want to timeout the user session without activity. After this 149 | # time the user will be asked for credentials again. Default is 30 minutes. 150 | # config.timeout_in = 30.minutes 151 | 152 | # If true, expires auth token on session timeout. 153 | # config.expire_auth_token_on_timeout = false 154 | 155 | # ==> Configuration for :lockable 156 | # Defines which strategy will be used to lock an account. 157 | # :failed_attempts = Locks an account after a number of failed attempts to sign in. 158 | # :none = No lock strategy. You should handle locking by yourself. 159 | # config.lock_strategy = :failed_attempts 160 | 161 | # Defines which key will be used when locking and unlocking an account 162 | # config.unlock_keys = [ :email ] 163 | 164 | # Defines which strategy will be used to unlock an account. 165 | # :email = Sends an unlock link to the user email 166 | # :time = Re-enables login after a certain amount of time (see :unlock_in below) 167 | # :both = Enables both strategies 168 | # :none = No unlock strategy. You should handle unlocking by yourself. 169 | # config.unlock_strategy = :both 170 | 171 | # Number of authentication tries before locking an account if lock_strategy 172 | # is failed attempts. 173 | # config.maximum_attempts = 20 174 | 175 | # Time interval to unlock the account if :time is enabled as unlock_strategy. 176 | # config.unlock_in = 1.hour 177 | 178 | # Warn on the last attempt before the account is locked. 179 | # config.last_attempt_warning = false 180 | 181 | # ==> Configuration for :recoverable 182 | # 183 | # Defines which key will be used when recovering the password for an account 184 | config.reset_password_keys = [ :login ] 185 | 186 | # Time interval you can reset your password with a reset password key. 187 | # Don't put a too small interval or your users won't have the time to 188 | # change their passwords. 189 | config.reset_password_within = 6.hours 190 | 191 | # ==> Configuration for :encryptable 192 | # Allow you to use another encryption algorithm besides bcrypt (default). You can use 193 | # :sha1, :sha512 or encryptors from others authentication tools as :clearance_sha1, 194 | # :authlogic_sha512 (then you should set stretches above to 20 for default behavior) 195 | # and :restful_authentication_sha1 (then you should set stretches to 10, and copy 196 | # REST_AUTH_SITE_KEY to pepper). 197 | # 198 | # Require the `devise-encryptable` gem when using anything other than bcrypt 199 | # config.encryptor = :sha512 200 | 201 | # ==> Scopes configuration 202 | # Turn scoped views on. Before rendering "sessions/new", it will first check for 203 | # "users/sessions/new". It's turned off by default because it's slower if you 204 | # are using only default views. 205 | # config.scoped_views = false 206 | 207 | # Configure the default scope given to Warden. By default it's the first 208 | # devise role declared in your routes (usually :user). 209 | # config.default_scope = :user 210 | 211 | # Set this configuration to false if you want /users/sign_out to sign out 212 | # only the current scope. By default, Devise signs out all scopes. 213 | # config.sign_out_all_scopes = true 214 | 215 | # ==> Navigation configuration 216 | # Lists the formats that should be treated as navigational. Formats like 217 | # :html, should redirect to the sign in page when the user does not have 218 | # access, but formats like :xml or :json, should return 401. 219 | # 220 | # If you have any extra navigational formats, like :iphone or :mobile, you 221 | # should add them to the navigational formats lists. 222 | # 223 | # The "*/*" below is required to match Internet Explorer requests. 224 | # config.navigational_formats = ['*/*', :html] 225 | 226 | # The default HTTP method used to sign out a resource. Default is :delete. 227 | config.sign_out_via = :delete 228 | 229 | # ==> OmniAuth 230 | # Add a new OmniAuth provider. Check the wiki for more information on setting 231 | # up on your models and hooks. 232 | # config.omniauth :github, 'APP_ID', 'APP_SECRET', scope: 'user,public_repo' 233 | 234 | # ==> Warden configuration 235 | # If you want to use other strategies, that are not supported by Devise, or 236 | # change the failure app, you can configure them inside the config.warden block. 237 | # 238 | # config.warden do |manager| 239 | # manager.intercept_401 = false 240 | # manager.default_strategies(scope: :user).unshift :some_external_strategy 241 | # end 242 | 243 | # ==> Mountable engine configurations 244 | # When using Devise inside an engine, let's call it `MyEngine`, and this engine 245 | # is mountable, there are some extra configurations to be taken into account. 246 | # The following options are available, assuming the engine is mounted as: 247 | # 248 | # mount MyEngine, at: '/my_engine' 249 | # 250 | # The router that invoked `devise_for`, in the example above, would be: 251 | # config.router_name = :my_engine 252 | # 253 | # When using omniauth, Devise cannot automatically set Omniauth path, 254 | # so you need to do it manually. For the users scope, it would be: 255 | # config.omniauth_path_prefix = '/my_engine/users/auth' 256 | end 257 | -------------------------------------------------------------------------------- /config/initializers/filter_parameter_logging.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Configure sensitive parameters which will be filtered from the log file. 4 | Rails.application.config.filter_parameters += [:password] 5 | -------------------------------------------------------------------------------- /config/initializers/friendly_id.rb: -------------------------------------------------------------------------------- 1 | # FriendlyId Global Configuration 2 | # 3 | # Use this to set up shared configuration options for your entire application. 4 | # Any of the configuration options shown here can also be applied to single 5 | # models by passing arguments to the `friendly_id` class method or defining 6 | # methods in your model. 7 | # 8 | # To learn more, check out the guide: 9 | # 10 | # http://norman.github.io/friendly_id/file.Guide.html 11 | 12 | FriendlyId.defaults do |config| 13 | # ## Reserved Words 14 | # 15 | # Some words could conflict with Rails's routes when used as slugs, or are 16 | # undesirable to allow as slugs. Edit this list as needed for your app. 17 | config.use :reserved 18 | 19 | config.reserved_words = %w(new edit index session login logout users admin 20 | stylesheets assets javascripts images) 21 | 22 | # ## Friendly Finders 23 | # 24 | # Uncomment this to use friendly finders in all models. By default, if 25 | # you wish to find a record by its friendly id, you must do: 26 | # 27 | # MyModel.friendly.find('foo') 28 | # 29 | # If you uncomment this, you can do: 30 | # 31 | # MyModel.find('foo') 32 | # 33 | # This is significantly more convenient but may not be appropriate for 34 | # all applications, so you must explicity opt-in to this behavior. You can 35 | # always also configure it on a per-model basis if you prefer. 36 | # 37 | # Something else to consider is that using the :finders addon boosts 38 | # performance because it will avoid Rails-internal code that makes runtime 39 | # calls to `Module.extend`. 40 | # 41 | config.use :finders 42 | # 43 | # ## Slugs 44 | # 45 | # Most applications will use the :slugged module everywhere. If you wish 46 | # to do so, uncomment the following line. 47 | # 48 | config.use :slugged 49 | # 50 | # By default, FriendlyId's :slugged addon expects the slug column to be named 51 | # 'slug', but you can change it if you wish. 52 | # 53 | # config.slug_column = 'slug' 54 | # 55 | # When FriendlyId can not generate a unique ID from your base method, it appends 56 | # a UUID, separated by a single dash. You can configure the character used as the 57 | # separator. If you're upgrading from FriendlyId 4, you may wish to replace this 58 | # with two dashes. 59 | # 60 | # config.sequence_separator = '-' 61 | # 62 | # ## Tips and Tricks 63 | # 64 | # ### Controlling when slugs are generated 65 | # 66 | # As of FriendlyId 5.0, new slugs are generated only when the slug field is 67 | # nil, but if you're using a column as your base method can change this 68 | # behavior by overriding the `should_generate_new_friendly_id` method that 69 | # FriendlyId adds to your model. The change below makes FriendlyId 5.0 behave 70 | # more like 4.0. 71 | # 72 | # config.use Module.new { 73 | # def should_generate_new_friendly_id? 74 | # slug.blank? || _changed? 75 | # end 76 | # } 77 | # 78 | # FriendlyId uses Rails's `parameterize` method to generate slugs, but for 79 | # languages that don't use the Roman alphabet, that's not usually suffient. Here 80 | # we use the Babosa library to transliterate Russian Cyrillic slugs to ASCII. If 81 | # you use this, don't forget to add "babosa" to your Gemfile. 82 | # 83 | # config.use Module.new { 84 | # def normalize_friendly_id(text) 85 | # text.to_slug.normalize! :transliterations => [:russian, :latin] 86 | # end 87 | # } 88 | end 89 | -------------------------------------------------------------------------------- /config/initializers/gunzel.rb: -------------------------------------------------------------------------------- 1 | require 'gunzel/gem_ext/devise/permit_username_and_login_parameters' 2 | 3 | Gunzel::Application.config.generators do |g| 4 | g.fixture_replacement :factory_girl, :dir => 'spec/factories' 5 | 6 | # don't generate quite so much cruft when scaffolding 7 | g.javascripts false 8 | g.stylesheets false 9 | g.jbuilder false 10 | 11 | # don't go overboard with generated specs either 12 | g.test_framework :rspec, 13 | :helper_specs => false, 14 | :request_specs => false, 15 | :routing_specs => false, 16 | :view_specs => false 17 | 18 | g.scaffold_controller :gunzel_controller 19 | g.template_engine :gunzel 20 | end 21 | -------------------------------------------------------------------------------- /config/initializers/inflections.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Add new inflection rules using the following format. Inflections 4 | # are locale specific, and you may define rules for as many different 5 | # locales as you wish. All of these examples are active by default: 6 | # ActiveSupport::Inflector.inflections(:en) do |inflect| 7 | # inflect.plural /^(ox)$/i, '\1en' 8 | # inflect.singular /^(ox)en/i, '\1' 9 | # inflect.irregular 'person', 'people' 10 | # inflect.uncountable %w( fish sheep ) 11 | # end 12 | 13 | # These inflection rules are supported but not enabled by default: 14 | # ActiveSupport::Inflector.inflections(:en) do |inflect| 15 | # inflect.acronym 'RESTful' 16 | # end 17 | -------------------------------------------------------------------------------- /config/initializers/mime_types.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Add new mime types for use in respond_to blocks: 4 | # Mime::Type.register "text/richtext", :rtf 5 | -------------------------------------------------------------------------------- /config/initializers/rolify.rb: -------------------------------------------------------------------------------- 1 | Rolify.configure do |config| 2 | # By default ORM adapter is ActiveRecord. uncomment to use mongoid 3 | # config.use_mongoid 4 | 5 | # Dynamic shortcuts for User class (user.is_admin? like methods). Default is: false 6 | # Enable this feature _after_ running rake db:migrate as it relies on the roles table 7 | # config.use_dynamic_shortcuts 8 | end -------------------------------------------------------------------------------- /config/initializers/session_store.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | Rails.application.config.session_store :cookie_store, key: '_gunzel_session' 4 | -------------------------------------------------------------------------------- /config/initializers/simple_form.rb: -------------------------------------------------------------------------------- 1 | # Use this setup block to configure all options available in SimpleForm. 2 | SimpleForm.setup do |config| 3 | # Wrappers are used by the form builder to generate a 4 | # complete input. You can remove any component from the 5 | # wrapper, change the order or even add your own to the 6 | # stack. The options given below are used to wrap the 7 | # whole input. 8 | config.wrappers :default, class: :input, 9 | hint_class: :field_with_hint, error_class: :field_with_errors do |b| 10 | ## Extensions enabled by default 11 | # Any of these extensions can be disabled for a 12 | # given input by passing: `f.input EXTENSION_NAME => false`. 13 | # You can make any of these extensions optional by 14 | # renaming `b.use` to `b.optional`. 15 | 16 | # Determines whether to use HTML5 (:email, :url, ...) 17 | # and required attributes 18 | b.use :html5 19 | 20 | # Calculates placeholders automatically from I18n 21 | # You can also pass a string as f.input placeholder: "Placeholder" 22 | b.use :placeholder 23 | 24 | ## Optional extensions 25 | # They are disabled unless you pass `f.input EXTENSION_NAME => true` 26 | # to the input. If so, they will retrieve the values from the model 27 | # if any exists. If you want to enable any of those 28 | # extensions by default, you can change `b.optional` to `b.use`. 29 | 30 | # Calculates maxlength from length validations for string inputs 31 | b.optional :maxlength 32 | 33 | # Calculates pattern from format validations for string inputs 34 | b.optional :pattern 35 | 36 | # Calculates min and max from length validations for numeric inputs 37 | b.optional :min_max 38 | 39 | # Calculates readonly automatically from readonly attributes 40 | b.optional :readonly 41 | 42 | ## Inputs 43 | b.use :label_input 44 | b.use :hint, wrap_with: { tag: :span, class: :hint } 45 | b.use :error, wrap_with: { tag: :span, class: :error } 46 | 47 | ## full_messages_for 48 | # If you want to display the full error message for the attribute, you can 49 | # use the component :full_error, like: 50 | # 51 | # b.use :full_error, wrap_with: { tag: :span, class: :error } 52 | end 53 | 54 | # The default wrapper to be used by the FormBuilder. 55 | config.default_wrapper = :default 56 | 57 | # Define the way to render check boxes / radio buttons with labels. 58 | # Defaults to :nested for bootstrap config. 59 | # inline: input + label 60 | # nested: label > input 61 | config.boolean_style = :nested 62 | 63 | # Default class for buttons 64 | config.button_class = 'btn' 65 | 66 | # Method used to tidy up errors. Specify any Rails Array method. 67 | # :first lists the first message for each field. 68 | # Use :to_sentence to list all errors for each field. 69 | # config.error_method = :first 70 | 71 | # Default tag used for error notification helper. 72 | config.error_notification_tag = :div 73 | 74 | # CSS class to add for error notification helper. 75 | config.error_notification_class = 'error_notification' 76 | 77 | # ID to add for error notification helper. 78 | # config.error_notification_id = nil 79 | 80 | # Series of attempts to detect a default label method for collection. 81 | # config.collection_label_methods = [ :to_label, :name, :title, :to_s ] 82 | 83 | # Series of attempts to detect a default value method for collection. 84 | # config.collection_value_methods = [ :id, :to_s ] 85 | 86 | # You can wrap a collection of radio/check boxes in a pre-defined tag, defaulting to none. 87 | # config.collection_wrapper_tag = nil 88 | 89 | # You can define the class to use on all collection wrappers. Defaulting to none. 90 | # config.collection_wrapper_class = nil 91 | 92 | # You can wrap each item in a collection of radio/check boxes with a tag, 93 | # defaulting to :span. Please note that when using :boolean_style = :nested, 94 | # SimpleForm will force this option to be a label. 95 | # config.item_wrapper_tag = :span 96 | 97 | # You can define a class to use in all item wrappers. Defaulting to none. 98 | # config.item_wrapper_class = nil 99 | 100 | # How the label text should be generated altogether with the required text. 101 | # config.label_text = lambda { |label, required, explicit_label| "#{required} #{label}" } 102 | 103 | # You can define the class to use on all labels. Default is nil. 104 | # config.label_class = nil 105 | 106 | # You can define the class to use on all forms. Default is simple_form. 107 | # config.form_class = :simple_form 108 | 109 | # You can define which elements should obtain additional classes 110 | # config.generate_additional_classes_for = [:wrapper, :label, :input] 111 | 112 | # Whether attributes are required by default (or not). Default is true. 113 | # config.required_by_default = true 114 | 115 | # Tell browsers whether to use the native HTML5 validations (novalidate form option). 116 | # These validations are enabled in SimpleForm's internal config but disabled by default 117 | # in this configuration, which is recommended due to some quirks from different browsers. 118 | # To stop SimpleForm from generating the novalidate option, enabling the HTML5 validations, 119 | # change this configuration to true. 120 | config.browser_validations = false 121 | 122 | # Collection of methods to detect if a file type was given. 123 | # config.file_methods = [ :mounted_as, :file?, :public_filename ] 124 | 125 | # Custom mappings for input types. This should be a hash containing a regexp 126 | # to match as key, and the input type that will be used when the field name 127 | # matches the regexp as value. 128 | # config.input_mappings = { /count/ => :integer } 129 | 130 | # Custom wrappers for input types. This should be a hash containing an input 131 | # type as key and the wrapper that will be used for all inputs with specified type. 132 | # config.wrapper_mappings = { string: :prepend } 133 | 134 | # Namespaces where SimpleForm should look for custom input classes that 135 | # override default inputs. 136 | # config.custom_inputs_namespaces << "CustomInputs" 137 | 138 | # Default priority for time_zone inputs. 139 | # config.time_zone_priority = nil 140 | 141 | # Default priority for country inputs. 142 | # config.country_priority = nil 143 | 144 | # When false, do not use translations for labels. 145 | # config.translate_labels = true 146 | 147 | # Automatically discover new inputs in Rails' autoload path. 148 | # config.inputs_discovery = true 149 | 150 | # Cache SimpleForm inputs discovery 151 | # config.cache_discovery = !Rails.env.development? 152 | 153 | # Default class for inputs 154 | # config.input_class = nil 155 | 156 | # Define the default class of the input wrapper of the boolean input. 157 | config.boolean_label_class = 'checkbox' 158 | 159 | # Defines if the default input wrapper class should be included in radio 160 | # collection wrappers. 161 | # config.include_default_input_wrapper_class = true 162 | 163 | # Defines which i18n scope will be used in Simple Form. 164 | # config.i18n_scope = 'simple_form' 165 | end 166 | -------------------------------------------------------------------------------- /config/initializers/simple_form_bootstrap.rb: -------------------------------------------------------------------------------- 1 | # Use this setup block to configure all options available in SimpleForm. 2 | SimpleForm.setup do |config| 3 | config.error_notification_class = 'alert alert-danger' 4 | config.button_class = 'btn btn-default' 5 | config.boolean_label_class = nil 6 | 7 | config.wrappers :vertical_form, tag: 'div', class: 'form-group', error_class: 'has-error' do |b| 8 | b.use :html5 9 | b.use :placeholder 10 | b.optional :maxlength 11 | b.optional :pattern 12 | b.optional :min_max 13 | b.optional :readonly 14 | b.use :label, class: 'control-label' 15 | 16 | b.use :input, class: 'form-control' 17 | b.use :error, wrap_with: { tag: 'span', class: 'help-block' } 18 | b.use :hint, wrap_with: { tag: 'p', class: 'help-block' } 19 | end 20 | 21 | config.wrappers :vertical_file_input, tag: 'div', class: 'form-group', error_class: 'has-error' do |b| 22 | b.use :html5 23 | b.use :placeholder 24 | b.optional :maxlength 25 | b.optional :readonly 26 | b.use :label, class: 'control-label' 27 | 28 | b.use :input 29 | b.use :error, wrap_with: { tag: 'span', class: 'help-block' } 30 | b.use :hint, wrap_with: { tag: 'p', class: 'help-block' } 31 | end 32 | 33 | config.wrappers :vertical_boolean, tag: 'div', class: 'form-group', error_class: 'has-error' do |b| 34 | b.use :html5 35 | b.optional :readonly 36 | 37 | b.wrapper tag: 'div', class: 'checkbox' do |ba| 38 | ba.use :label_input 39 | end 40 | 41 | b.use :error, wrap_with: { tag: 'span', class: 'help-block' } 42 | b.use :hint, wrap_with: { tag: 'p', class: 'help-block' } 43 | end 44 | 45 | config.wrappers :vertical_radio_and_checkboxes, tag: 'div', class: 'form-group', error_class: 'has-error' do |b| 46 | b.use :html5 47 | b.optional :readonly 48 | b.use :label_input 49 | b.use :error, wrap_with: { tag: 'span', class: 'help-block' } 50 | b.use :hint, wrap_with: { tag: 'p', class: 'help-block' } 51 | end 52 | 53 | config.wrappers :horizontal_form, tag: 'div', class: 'form-group', error_class: 'has-error' do |b| 54 | b.use :html5 55 | b.use :placeholder 56 | b.optional :maxlength 57 | b.optional :pattern 58 | b.optional :min_max 59 | b.optional :readonly 60 | b.use :label, class: 'col-sm-3 control-label' 61 | 62 | b.wrapper tag: 'div', class: 'col-sm-9' do |ba| 63 | ba.use :input, class: 'form-control' 64 | ba.use :error, wrap_with: { tag: 'span', class: 'help-block' } 65 | ba.use :hint, wrap_with: { tag: 'p', class: 'help-block' } 66 | end 67 | end 68 | 69 | config.wrappers :horizontal_file_input, tag: 'div', class: 'form-group', error_class: 'has-error' do |b| 70 | b.use :html5 71 | b.use :placeholder 72 | b.optional :maxlength 73 | b.optional :readonly 74 | b.use :label, class: 'col-sm-3 control-label' 75 | 76 | b.wrapper tag: 'div', class: 'col-sm-9' do |ba| 77 | ba.use :input 78 | ba.use :error, wrap_with: { tag: 'span', class: 'help-block' } 79 | ba.use :hint, wrap_with: { tag: 'p', class: 'help-block' } 80 | end 81 | end 82 | 83 | config.wrappers :horizontal_boolean, tag: 'div', class: 'form-group', error_class: 'has-error' do |b| 84 | b.use :html5 85 | b.optional :readonly 86 | 87 | b.wrapper tag: 'div', class: 'col-sm-offset-3 col-sm-9' do |wr| 88 | wr.wrapper tag: 'div', class: 'checkbox' do |ba| 89 | ba.use :label_input, class: 'col-sm-9' 90 | end 91 | 92 | wr.use :error, wrap_with: { tag: 'span', class: 'help-block' } 93 | wr.use :hint, wrap_with: { tag: 'p', class: 'help-block' } 94 | end 95 | end 96 | 97 | config.wrappers :horizontal_radio_and_checkboxes, tag: 'div', class: 'form-group', error_class: 'has-error' do |b| 98 | b.use :html5 99 | b.optional :readonly 100 | 101 | b.use :label, class: 'col-sm-3 control-label' 102 | 103 | b.wrapper tag: 'div', class: 'col-sm-9' do |ba| 104 | ba.use :input 105 | ba.use :error, wrap_with: { tag: 'span', class: 'help-block' } 106 | ba.use :hint, wrap_with: { tag: 'p', class: 'help-block' } 107 | end 108 | end 109 | 110 | config.wrappers :inline_form, tag: 'div', class: 'form-group', error_class: 'has-error' do |b| 111 | b.use :html5 112 | b.use :placeholder 113 | b.optional :maxlength 114 | b.optional :pattern 115 | b.optional :min_max 116 | b.optional :readonly 117 | b.use :label, class: 'sr-only' 118 | 119 | b.use :input, class: 'form-control' 120 | b.use :error, wrap_with: { tag: 'span', class: 'help-block' } 121 | b.use :hint, wrap_with: { tag: 'p', class: 'help-block' } 122 | end 123 | 124 | # Wrappers for forms and inputs using the Bootstrap toolkit. 125 | # Check the Bootstrap docs (http://getbootstrap.com) 126 | # to learn about the different styles for forms and inputs, 127 | # buttons and other elements. 128 | config.default_wrapper = :vertical_form 129 | end 130 | -------------------------------------------------------------------------------- /config/initializers/wrap_parameters.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # This file contains settings for ActionController::ParamsWrapper which 4 | # is enabled by default. 5 | 6 | # Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array. 7 | ActiveSupport.on_load(:action_controller) do 8 | wrap_parameters format: [:json] if respond_to?(:wrap_parameters) 9 | end 10 | 11 | # To enable root element in JSON for ActiveRecord objects. 12 | # ActiveSupport.on_load(:active_record) do 13 | # self.include_root_in_json = true 14 | # end 15 | -------------------------------------------------------------------------------- /config/locales/devise.en.yml: -------------------------------------------------------------------------------- 1 | # Additional translations at https://github.com/plataformatec/devise/wiki/I18n 2 | 3 | en: 4 | devise: 5 | confirmations: 6 | confirmed: "Your account was successfully confirmed." 7 | send_instructions: "You will receive an email with instructions about how to confirm your account in a few minutes." 8 | send_paranoid_instructions: "If your email address exists in our database, you will receive an email with instructions about how to confirm your account in a few minutes." 9 | failure: 10 | already_authenticated: "You are already signed in." 11 | inactive: "Your account is not activated yet." 12 | invalid: "Invalid login or password." 13 | locked: "Your account is locked." 14 | last_attempt: "You have one more attempt before your account will be locked." 15 | not_found_in_database: "Invalid login or password." 16 | timeout: "Your session expired. Please sign in again to continue." 17 | unauthenticated: "You need to sign in or sign up before continuing." 18 | unconfirmed: "You have to confirm your account before continuing." 19 | mailer: 20 | confirmation_instructions: 21 | subject: "Confirmation instructions" 22 | reset_password_instructions: 23 | subject: "Reset password instructions" 24 | unlock_instructions: 25 | subject: "Unlock Instructions" 26 | omniauth_callbacks: 27 | failure: "Could not authenticate you from %{kind} because \"%{reason}\"." 28 | success: "Successfully authenticated from %{kind} account." 29 | passwords: 30 | no_token: "You can't access this page without coming from a password reset email. If you do come from a password reset email, please make sure you used the full URL provided." 31 | send_instructions: "You will receive an email with instructions on how to reset your password in a few minutes." 32 | send_paranoid_instructions: "If your email address exists in our database, you will receive a password recovery link at your email address in a few minutes." 33 | updated: "Your password was changed successfully. You are now signed in." 34 | updated_not_active: "Your password was changed successfully." 35 | registrations: 36 | destroyed: "Bye! Your account was successfully cancelled. We hope to see you again soon." 37 | signed_up: "Welcome! You have signed up successfully." 38 | signed_up_but_inactive: "You have signed up successfully. However, we could not sign you in because your account is not yet activated." 39 | signed_up_but_locked: "You have signed up successfully. However, we could not sign you in because your account is locked." 40 | signed_up_but_unconfirmed: "A message with a confirmation link has been sent to your email address. Please open the link to activate your account." 41 | update_needs_confirmation: "You updated your account successfully, but we need to verify your new email address. Please check your email and click on the confirm link to finalize confirming your new email address." 42 | updated: "You updated your account successfully." 43 | sessions: 44 | signed_in: "Signed in successfully." 45 | signed_out: "Signed out successfully." 46 | unlocks: 47 | send_instructions: "You will receive an email with instructions about how to unlock your account in a few minutes." 48 | send_paranoid_instructions: "If your account exists, you will receive an email with instructions about how to unlock it in a few minutes." 49 | unlocked: "Your account has been unlocked successfully. Please sign in to continue." 50 | errors: 51 | messages: 52 | already_confirmed: "was already confirmed, please try signing in" 53 | confirmation_period_expired: "needs to be confirmed within %{period}, please request a new one" 54 | expired: "has expired, please request a new one" 55 | not_found: "not found" 56 | not_locked: "was not locked" 57 | not_saved: 58 | one: "1 error prohibited this %{resource} from being saved:" 59 | other: "%{count} errors prohibited this %{resource} from being saved:" 60 | -------------------------------------------------------------------------------- /config/locales/en.yml: -------------------------------------------------------------------------------- 1 | # Files in the config/locales directory are used for internationalization 2 | # and are automatically loaded by Rails. If you want to use locales other 3 | # than English, add the necessary files in this directory. 4 | # 5 | # To use the locales, use `I18n.t`: 6 | # 7 | # I18n.t 'hello' 8 | # 9 | # In views, this is aliased to just `t`: 10 | # 11 | # <%= t('hello') %> 12 | # 13 | # To use a different locale, set it with `I18n.locale`: 14 | # 15 | # I18n.locale = :es 16 | # 17 | # This would use the information in config/locales/es.yml. 18 | # 19 | # To learn more, please read the Rails Internationalization guide 20 | # available at http://guides.rubyonrails.org/i18n.html. 21 | 22 | en: 23 | hello: "Hello world" 24 | -------------------------------------------------------------------------------- /config/locales/simple_form.en.yml: -------------------------------------------------------------------------------- 1 | en: 2 | simple_form: 3 | "yes": 'Yes' 4 | "no": 'No' 5 | required: 6 | text: 'required' 7 | mark: '*' 8 | # You can uncomment the line below if you need to overwrite the whole required html. 9 | # When using html, text and mark won't be used. 10 | # html: '*' 11 | error_notification: 12 | default_message: "Please review the problems below:" 13 | # Examples 14 | # labels: 15 | # defaults: 16 | # password: 'Password' 17 | # user: 18 | # new: 19 | # email: 'E-mail to sign in.' 20 | # edit: 21 | # email: 'E-mail.' 22 | # hints: 23 | # defaults: 24 | # username: 'User name to sign in.' 25 | # password: 'No special characters, please.' 26 | # include_blanks: 27 | # defaults: 28 | # age: 'Rather not say' 29 | # prompts: 30 | # defaults: 31 | # age: 'Select your age' 32 | -------------------------------------------------------------------------------- /config/puma.rb: -------------------------------------------------------------------------------- 1 | workers Integer(ENV['WEB_CONCURRENCY'] || 2) 2 | threads_count = Integer(ENV['MAX_THREADS'] || 5) 3 | threads threads_count, threads_count 4 | 5 | preload_app! 6 | 7 | rackup DefaultRackup 8 | port ENV['PORT'] || 3000 9 | environment ENV['RACK_ENV'] || 'development' 10 | 11 | on_worker_boot do 12 | config = 13 | ActiveRecord::Base.configurations[Rails.env] || 14 | Rails.application \ 15 | .config \ 16 | .database_configuration[Rails.env] 17 | 18 | ActiveRecord::Base.establish_connection( 19 | config.merge('pool' => ENV['MAX_THREADS'] || 5)) 20 | end 21 | -------------------------------------------------------------------------------- /config/routes.rb: -------------------------------------------------------------------------------- 1 | Rails.application.routes.draw do 2 | # The priority is based upon order of creation: first created -> highest priority. 3 | # See how all your routes lay out with "rake routes". 4 | 5 | devise_for :users 6 | 7 | # You can have the root of your site routed with "root" 8 | # root 'welcome#index' 9 | 10 | root 'statics#home' 11 | 12 | # Example of regular route: 13 | # get 'products/:id' => 'catalog#view' 14 | 15 | # Example of named route that can be invoked with purchase_url(id: product.id) 16 | # get 'products/:id/purchase' => 'catalog#purchase', as: :purchase 17 | 18 | # Example resource route (maps HTTP verbs to controller actions automatically): 19 | # resources :products 20 | 21 | # Example resource route with options: 22 | # resources :products do 23 | # member do 24 | # get 'short' 25 | # post 'toggle' 26 | # end 27 | # 28 | # collection do 29 | # get 'sold' 30 | # end 31 | # end 32 | 33 | # Example resource route with sub-resources: 34 | # resources :products do 35 | # resources :comments, :sales 36 | # resource :seller 37 | # end 38 | 39 | # Example resource route with more complex sub-resources: 40 | # resources :products do 41 | # resources :comments 42 | # resources :sales do 43 | # get 'recent', on: :collection 44 | # end 45 | # end 46 | 47 | # Example resource route with concerns: 48 | # concern :toggleable do 49 | # post 'toggle' 50 | # end 51 | # resources :posts, concerns: :toggleable 52 | # resources :photos, concerns: :toggleable 53 | 54 | # Example resource route within a namespace: 55 | # namespace :admin do 56 | # # Directs /admin/products/* to Admin::ProductsController 57 | # # (app/controllers/admin/products_controller.rb) 58 | # resources :products 59 | # end 60 | end 61 | -------------------------------------------------------------------------------- /config/secrets.yml: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Your secret key is used for verifying the integrity of signed cookies. 4 | # If you change this key, all old signed cookies will become invalid! 5 | 6 | # Make sure the secret is at least 30 characters and all random, 7 | # no regular words or you'll be exposed to dictionary attacks. 8 | # You can use `rake secret` to generate a secure secret key. 9 | 10 | # Make sure the secrets in this file are kept private 11 | # if you're sharing your code publicly. 12 | 13 | development: 14 | secret_key_base: 22cb5ab2b57a9f80b8a7ec1bae8399d655a94660d61d09d7d68bc6fb935fa0870324c3498050141550b41aa1b1a70e19d1cb621eeaaab2cc1a22dea14b356437 15 | 16 | test: 17 | secret_key_base: 4bbc4396fd0e5b7c98ee56dd854c2e33035a24dc487f16222ebeaa29936fc225417fa6a684b94c8c8e228f4a4598b04bfb30d17fbf4bf5631b773d6b14fa2b29 18 | 19 | # Do not keep production secrets in the repository, 20 | # instead read values from the environment. 21 | production: 22 | secret_key_base: <%= ENV["SECRET_KEY_BASE"] %> 23 | -------------------------------------------------------------------------------- /config/sitemap.rb: -------------------------------------------------------------------------------- 1 | # Set the host name for URL creation 2 | SitemapGenerator::Sitemap.default_host = "http://www.example.com" 3 | 4 | SitemapGenerator::Sitemap.create do 5 | # Put links creation logic here. 6 | # 7 | # The root path '/' and sitemap index file are added automatically for you. 8 | # Links are added to the Sitemap in the order they are specified. 9 | # 10 | # Usage: add(path, options={}) 11 | # (default options are used if you don't specify) 12 | # 13 | # Defaults: :priority => 0.5, :changefreq => 'weekly', 14 | # :lastmod => Time.now, :host => default_host 15 | # 16 | # Examples: 17 | # 18 | # Add '/articles' 19 | # 20 | # add articles_path, :priority => 0.7, :changefreq => 'daily' 21 | # 22 | # Add all articles: 23 | # 24 | # Article.find_each do |article| 25 | # add article_path(article), :lastmod => article.updated_at 26 | # end 27 | end 28 | -------------------------------------------------------------------------------- /db/migrate/20140317050901_create_friendly_id_slugs.rb: -------------------------------------------------------------------------------- 1 | class CreateFriendlyIdSlugs < ActiveRecord::Migration 2 | def change 3 | create_table :friendly_id_slugs do |t| 4 | t.string :slug, :null => false 5 | t.integer :sluggable_id, :null => false 6 | t.string :sluggable_type, :limit => 50 7 | t.string :scope 8 | t.datetime :created_at 9 | end 10 | add_index :friendly_id_slugs, :sluggable_id 11 | add_index :friendly_id_slugs, [:slug, :sluggable_type] 12 | add_index :friendly_id_slugs, [:slug, :sluggable_type, :scope], :unique => true 13 | add_index :friendly_id_slugs, :sluggable_type 14 | end 15 | end 16 | -------------------------------------------------------------------------------- /db/migrate/20140317052339_acts_as_taggable_on_migration.acts_as_taggable_on_engine.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from acts_as_taggable_on_engine (originally 1) 2 | class ActsAsTaggableOnMigration < ActiveRecord::Migration 3 | def self.up 4 | create_table :tags do |t| 5 | t.string :name 6 | end 7 | 8 | create_table :taggings do |t| 9 | t.references :tag 10 | 11 | # You should make sure that the column created is 12 | # long enough to store the required class names. 13 | t.references :taggable, :polymorphic => true 14 | t.references :tagger, :polymorphic => true 15 | 16 | # Limit is created to prevent MySQL error on index 17 | # length for MyISAM table type: http://bit.ly/vgW2Ql 18 | t.string :context, :limit => 128 19 | 20 | t.datetime :created_at 21 | end 22 | 23 | add_index :taggings, :tag_id 24 | add_index :taggings, [:taggable_id, :taggable_type, :context] 25 | end 26 | 27 | def self.down 28 | drop_table :taggings 29 | drop_table :tags 30 | end 31 | end 32 | -------------------------------------------------------------------------------- /db/migrate/20140317052340_add_missing_unique_indices.acts_as_taggable_on_engine.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from acts_as_taggable_on_engine (originally 2) 2 | class AddMissingUniqueIndices < ActiveRecord::Migration 3 | 4 | def self.up 5 | add_index :tags, :name, unique: true 6 | 7 | remove_index :taggings, :tag_id 8 | remove_index :taggings, [:taggable_id, :taggable_type, :context] 9 | add_index :taggings, 10 | [:tag_id, :taggable_id, :taggable_type, :context, :tagger_id, :tagger_type], 11 | unique: true, name: 'taggings_idx' 12 | end 13 | 14 | def self.down 15 | remove_index :tags, :name 16 | 17 | remove_index :taggings, name: 'tagging_idx' 18 | add_index :taggings, :tag_id 19 | add_index :taggings, [:taggable_id, :taggable_type, :context] 20 | end 21 | 22 | end 23 | -------------------------------------------------------------------------------- /db/migrate/20140519012208_devise_create_users.rb: -------------------------------------------------------------------------------- 1 | class DeviseCreateUsers < ActiveRecord::Migration 2 | def change 3 | create_table(:users) do |t| 4 | ## Database authenticatable 5 | t.string :username, null: false, default: "" 6 | t.string :email, null: false, default: "" 7 | t.string :encrypted_password, null: false, default: "" 8 | 9 | ## Recoverable 10 | t.string :reset_password_token 11 | t.datetime :reset_password_sent_at 12 | 13 | ## Rememberable 14 | t.datetime :remember_created_at 15 | 16 | ## Trackable 17 | t.integer :sign_in_count, default: 0, null: false 18 | t.datetime :current_sign_in_at 19 | t.datetime :last_sign_in_at 20 | t.string :current_sign_in_ip 21 | t.string :last_sign_in_ip 22 | 23 | ## Confirmable 24 | # t.string :confirmation_token 25 | # t.datetime :confirmed_at 26 | # t.datetime :confirmation_sent_at 27 | # t.string :unconfirmed_email # Only if using reconfirmable 28 | 29 | ## Lockable 30 | # t.integer :failed_attempts, default: 0, null: false # Only if lock strategy is :failed_attempts 31 | # t.string :unlock_token # Only if unlock strategy is :email or :both 32 | # t.datetime :locked_at 33 | 34 | 35 | t.timestamps 36 | end 37 | 38 | add_index :users, :username, unique: true 39 | add_index :users, :email, unique: true 40 | add_index :users, :reset_password_token, unique: true 41 | # add_index :users, :confirmation_token, unique: true 42 | # add_index :users, :unlock_token, unique: true 43 | end 44 | end 45 | -------------------------------------------------------------------------------- /db/migrate/20140519020326_rolify_create_roles.rb: -------------------------------------------------------------------------------- 1 | class RolifyCreateRoles < ActiveRecord::Migration 2 | def change 3 | create_table(:roles) do |t| 4 | t.string :name 5 | t.references :resource, :polymorphic => true 6 | 7 | t.timestamps 8 | end 9 | 10 | create_table(:users_roles, :id => false) do |t| 11 | t.references :user 12 | t.references :role 13 | end 14 | 15 | add_index(:roles, :name) 16 | add_index(:roles, [ :name, :resource_type, :resource_id ]) 17 | add_index(:users_roles, [ :user_id, :role_id ]) 18 | end 19 | end 20 | -------------------------------------------------------------------------------- /db/migrate/20140610231308_add_taggings_counter_cache_to_tags.acts_as_taggable_on_engine.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from acts_as_taggable_on_engine (originally 3) 2 | class AddTaggingsCounterCacheToTags < ActiveRecord::Migration 3 | def self.up 4 | add_column :tags, :taggings_count, :integer, default: 0 5 | 6 | ActsAsTaggableOn::Tag.reset_column_information 7 | ActsAsTaggableOn::Tag.find_each do |tag| 8 | ActsAsTaggableOn::Tag.reset_counters(tag.id, :taggings) 9 | end 10 | end 11 | 12 | def self.down 13 | remove_column :tags, :taggings_count 14 | end 15 | end 16 | -------------------------------------------------------------------------------- /db/migrate/20140714053131_add_missing_taggable_index.acts_as_taggable_on_engine.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from acts_as_taggable_on_engine (originally 4) 2 | class AddMissingTaggableIndex < ActiveRecord::Migration 3 | def self.up 4 | add_index :taggings, [:taggable_id, :taggable_type, :context] 5 | end 6 | 7 | def self.down 8 | remove_index :taggings, [:taggable_id, :taggable_type, :context] 9 | end 10 | end 11 | -------------------------------------------------------------------------------- /db/migrate/20140829025406_create_versions.rb: -------------------------------------------------------------------------------- 1 | class CreateVersions < ActiveRecord::Migration 2 | def change 3 | create_table :versions do |t| 4 | t.string :item_type, :null => false 5 | t.integer :item_id, :null => false 6 | t.string :event, :null => false 7 | t.string :whodunnit 8 | t.text :object 9 | t.datetime :created_at 10 | end 11 | add_index :versions, [:item_type, :item_id] 12 | end 13 | end 14 | -------------------------------------------------------------------------------- /db/migrate/20140829025407_add_object_changes_to_versions.rb: -------------------------------------------------------------------------------- 1 | class AddObjectChangesToVersions < ActiveRecord::Migration 2 | def change 3 | add_column :versions, :object_changes, :text 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/schema.rb: -------------------------------------------------------------------------------- 1 | # encoding: UTF-8 2 | # This file is auto-generated from the current state of the database. Instead 3 | # of editing this file, please use the migrations feature of Active Record to 4 | # incrementally modify your database, and then regenerate this schema definition. 5 | # 6 | # Note that this schema.rb definition is the authoritative source for your 7 | # database schema. If you need to create the application database on another 8 | # system, you should be using db:schema:load, not running all the migrations 9 | # from scratch. The latter is a flawed and unsustainable approach (the more migrations 10 | # you'll amass, the slower it'll run and the greater likelihood for issues). 11 | # 12 | # It's strongly recommended that you check this file into your version control system. 13 | 14 | ActiveRecord::Schema.define(version: 20140829025407) do 15 | 16 | # These are extensions that must be enabled in order to support this database 17 | enable_extension "plpgsql" 18 | 19 | create_table "friendly_id_slugs", force: :cascade do |t| 20 | t.string "slug", null: false 21 | t.integer "sluggable_id", null: false 22 | t.string "sluggable_type", limit: 50 23 | t.string "scope" 24 | t.datetime "created_at" 25 | end 26 | 27 | add_index "friendly_id_slugs", ["slug", "sluggable_type", "scope"], name: "index_friendly_id_slugs_on_slug_and_sluggable_type_and_scope", unique: true, using: :btree 28 | add_index "friendly_id_slugs", ["slug", "sluggable_type"], name: "index_friendly_id_slugs_on_slug_and_sluggable_type", using: :btree 29 | add_index "friendly_id_slugs", ["sluggable_id"], name: "index_friendly_id_slugs_on_sluggable_id", using: :btree 30 | add_index "friendly_id_slugs", ["sluggable_type"], name: "index_friendly_id_slugs_on_sluggable_type", using: :btree 31 | 32 | create_table "roles", force: :cascade do |t| 33 | t.string "name" 34 | t.integer "resource_id" 35 | t.string "resource_type" 36 | t.datetime "created_at" 37 | t.datetime "updated_at" 38 | end 39 | 40 | add_index "roles", ["name", "resource_type", "resource_id"], name: "index_roles_on_name_and_resource_type_and_resource_id", using: :btree 41 | add_index "roles", ["name"], name: "index_roles_on_name", using: :btree 42 | 43 | create_table "taggings", force: :cascade do |t| 44 | t.integer "tag_id" 45 | t.integer "taggable_id" 46 | t.string "taggable_type" 47 | t.integer "tagger_id" 48 | t.string "tagger_type" 49 | t.string "context", limit: 128 50 | t.datetime "created_at" 51 | end 52 | 53 | add_index "taggings", ["tag_id", "taggable_id", "taggable_type", "context", "tagger_id", "tagger_type"], name: "taggings_idx", unique: true, using: :btree 54 | add_index "taggings", ["taggable_id", "taggable_type", "context"], name: "index_taggings_on_taggable_id_and_taggable_type_and_context", using: :btree 55 | 56 | create_table "tags", force: :cascade do |t| 57 | t.string "name" 58 | t.integer "taggings_count", default: 0 59 | end 60 | 61 | add_index "tags", ["name"], name: "index_tags_on_name", unique: true, using: :btree 62 | 63 | create_table "users", force: :cascade do |t| 64 | t.string "username", default: "", null: false 65 | t.string "email", default: "", null: false 66 | t.string "encrypted_password", default: "", null: false 67 | t.string "reset_password_token" 68 | t.datetime "reset_password_sent_at" 69 | t.datetime "remember_created_at" 70 | t.integer "sign_in_count", default: 0, null: false 71 | t.datetime "current_sign_in_at" 72 | t.datetime "last_sign_in_at" 73 | t.string "current_sign_in_ip" 74 | t.string "last_sign_in_ip" 75 | t.datetime "created_at" 76 | t.datetime "updated_at" 77 | end 78 | 79 | add_index "users", ["email"], name: "index_users_on_email", unique: true, using: :btree 80 | add_index "users", ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true, using: :btree 81 | add_index "users", ["username"], name: "index_users_on_username", unique: true, using: :btree 82 | 83 | create_table "users_roles", id: false, force: :cascade do |t| 84 | t.integer "user_id" 85 | t.integer "role_id" 86 | end 87 | 88 | add_index "users_roles", ["user_id", "role_id"], name: "index_users_roles_on_user_id_and_role_id", using: :btree 89 | 90 | create_table "versions", force: :cascade do |t| 91 | t.string "item_type", null: false 92 | t.integer "item_id", null: false 93 | t.string "event", null: false 94 | t.string "whodunnit" 95 | t.text "object" 96 | t.datetime "created_at" 97 | t.text "object_changes" 98 | end 99 | 100 | add_index "versions", ["item_type", "item_id"], name: "index_versions_on_item_type_and_item_id", using: :btree 101 | 102 | end 103 | -------------------------------------------------------------------------------- /db/seeds.rb: -------------------------------------------------------------------------------- 1 | # This file should contain all the record creation needed to seed the database with its default values. 2 | # The data can then be loaded with the rake db:seed (or created alongside the db with db:setup). 3 | # 4 | # Examples: 5 | # 6 | # cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }]) 7 | # Mayor.create(name: 'Emanuel', city: cities.first) 8 | -------------------------------------------------------------------------------- /fig.yml: -------------------------------------------------------------------------------- 1 | db: 2 | image: postgres:9.3 3 | ports: 4 | - "5432" 5 | web: 6 | build: . 7 | command: bundle exec foreman start web 8 | volumes: 9 | - .:/var/www 10 | ports: 11 | - "5000:5000" 12 | links: 13 | - db 14 | -------------------------------------------------------------------------------- /lib/assets/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lankz/gunzel/26e12f8ab7918423c7ac4858ce6945e6955ce1fa/lib/assets/.keep -------------------------------------------------------------------------------- /lib/generators/gunzel/scaffold/scaffold_generator.rb: -------------------------------------------------------------------------------- 1 | require 'rails/generators/erb/scaffold/scaffold_generator' 2 | 3 | module Gunzel 4 | module Generators 5 | class ScaffoldGenerator < Erb::Generators::ScaffoldGenerator 6 | def self.source_root 7 | File.expand_path("../templates", __FILE__) 8 | end 9 | 10 | def visible_attributes 11 | attributes - hidden_attributes 12 | end 13 | 14 | def hidden_attributes 15 | attributes.index_by(&:name) \ 16 | .slice(*hidden_attribute_names) \ 17 | .values 18 | end 19 | 20 | def search_attributes 21 | attributes.select { |a| a.type == :string || a.type == :text } 22 | end 23 | 24 | def search_field 25 | "#{search_attributes.map(&:name).join('_or_')}_cont" 26 | end 27 | 28 | protected 29 | 30 | def available_views 31 | super + %w(_search _table _tabs) 32 | end 33 | 34 | def hidden_attribute_names 35 | %w(children_count deleted_at depth lft lock_version parent_id position 36 | rgt slug) 37 | end 38 | end 39 | end 40 | end 41 | -------------------------------------------------------------------------------- /lib/generators/gunzel/scaffold/templates/_form.html.erb: -------------------------------------------------------------------------------- 1 | <%%= simple_form_for(@<%= singular_table_name %>) do |f| %> 2 | <%%= f.error_notification %> 3 | 4 | <%- visible_attributes.each do |attribute| -%> 5 | <%%= f.<%= attribute.reference? ? :association : :input %>(:<%= attribute.name %>) %> 6 | <%- end -%> 7 | 8 |
9 | <%%= f.button(:submit, :class => 'btn btn-primary') %> 10 | 11 | <%%= link_to('Cancel', @<%= singular_table_name %>.persisted? ? @<%= singular_table_name %> : <%= index_helper %>_path, 12 | :class => 'btn btn-default') %> 13 |
14 | <%% end %> 15 | -------------------------------------------------------------------------------- /lib/generators/gunzel/scaffold/templates/_search.html.erb: -------------------------------------------------------------------------------- 1 | <%%= search_form_for(@search, :class => 'form-inline') do |f| %> 2 |
3 | <%%= f.input_field :<%= search_field %>, 4 | :class => 'form-control', 5 | :required => false, 6 | :placeholder => 'Search' %> 7 | 8 |
9 | <%%= button_tag :class => 'btn btn-default' do %> 10 | 11 | <%% end %> 12 |
13 |
14 | <%% end %> 15 | -------------------------------------------------------------------------------- /lib/generators/gunzel/scaffold/templates/_table.html.erb: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | <%- visible_attributes.each do |attribute| -%> 5 | 6 | <%- end -%> 7 | 8 | 9 | 10 | 11 | 12 | 13 | <%% @<%= plural_table_name %>.each do |<%= singular_table_name %>| %> 14 | 15 | <%- visible_attributes.each do |attribute| -%> 16 | 17 | <%- end -%> 18 | 19 | 24 | 31 | 32 | <%% end %> 33 | 34 |
<%%= sort_link(@search, :<%= attribute.name %>, <%= class_name%>.human_attribute_name(:<%= attribute.name %>)) %>
<%%= <%= singular_table_name %>.<%= attribute.name %> %><%%= link_to('Show', <%= singular_table_name %>) %> 20 | <%% if can?(:edit, <%= singular_table_name %>) %> 21 | <%%= link_to('Edit', edit_<%= singular_table_name %>_path(<%= singular_table_name %>)) %> 22 | <%% end %> 23 | 25 | <%% if can?(:destroy, <%= singular_table_name %>) %> 26 | <%%= link_to('Destroy', <%= "#{singular_table_name}" %>, 27 | :method => :delete, 28 | :data => { :confirm => 'Are you sure?' }) %> 29 | <%% end %> 30 |
35 | -------------------------------------------------------------------------------- /lib/generators/gunzel/scaffold/templates/_tabs.html.erb: -------------------------------------------------------------------------------- 1 | 5 | -------------------------------------------------------------------------------- /lib/generators/gunzel/scaffold/templates/edit.html.erb: -------------------------------------------------------------------------------- 1 | <%% set_meta_tags(:title => "Edit #{<%= class_name %>.model_name.human}", 2 | :noindex => true) %> 3 | 4 | <%% content_for(:breadcrumbs) do %> 5 | 11 | <%% end %> 12 | 13 | 30 | 31 | <%%= render('form') %> 32 | -------------------------------------------------------------------------------- /lib/generators/gunzel/scaffold/templates/index.html.erb: -------------------------------------------------------------------------------- 1 | <%% set_meta_tags(:title => <%= class_name %>.model_name.human.pluralize, 2 | :canonical => <%= index_helper %>_url) %> 3 | 4 | <%% content_for(:breadcrumbs) do %> 5 | 9 | <%% end %> 10 | 11 | 25 | 26 | <%%= render('table') %> 27 | <%%= paginate(@<%= plural_table_name %>) %> 28 | -------------------------------------------------------------------------------- /lib/generators/gunzel/scaffold/templates/new.html.erb: -------------------------------------------------------------------------------- 1 | <%% set_meta_tags(:title => "New #{<%= class_name %>.model_name.human}", 2 | :noindex => true) %> 3 | 4 | <%% content_for(:breadcrumbs) do %> 5 | 10 | <%% end %> 11 | 12 | 15 | 16 | <%%= render('form') %> 17 | -------------------------------------------------------------------------------- /lib/generators/gunzel/scaffold/templates/show.html.erb: -------------------------------------------------------------------------------- 1 | <%% set_meta_tags(:title => <%= class_name %>.model_name.human, 2 | :canonical => <%= singular_table_name %>_url(@<%= singular_table_name %>)) %> 3 | 4 | <%% content_for(:breadcrumbs) do %> 5 | 10 | <%% end %> 11 | 12 | 17 | 18 |
19 | <%- visible_attributes.each do |attribute| -%> 20 |
<%%= <%= class_name %>.human_attribute_name(:<%= attribute.name %>) %>
21 |
<%%= @<%= singular_table_name %>.<%= attribute.name %> %>
22 | <%- end -%> 23 |
24 | -------------------------------------------------------------------------------- /lib/generators/rails/gunzel_controller/gunzel_controller_generator.rb: -------------------------------------------------------------------------------- 1 | require 'rails/generators/rails/scaffold_controller/scaffold_controller_generator' 2 | 3 | module Rails 4 | class GunzelControllerGenerator < Rails::Generators::ScaffoldControllerGenerator 5 | def self.source_root 6 | File.expand_path('../templates', __FILE__) 7 | end 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /lib/generators/rails/gunzel_controller/templates/controller.rb: -------------------------------------------------------------------------------- 1 | <% if namespaced? -%> 2 | require_dependency "<%= namespaced_file_path %>/application_controller" 3 | 4 | <% end -%> 5 | <% module_namespacing do -%> 6 | class <%= controller_class_name %>Controller < ApplicationController 7 | # extends .................................................................... 8 | # includes ................................................................... 9 | # constants .................................................................. 10 | # filters .................................................................... 11 | 12 | # before_filter :authenticate_user! 13 | 14 | # helpers .................................................................... 15 | # scopes ..................................................................... 16 | 17 | has_scope :page, :default => 1 18 | 19 | # additional config .......................................................... 20 | 21 | respond_to :html 22 | responders :flash, :http_cache 23 | 24 | # controller actions ......................................................... 25 | 26 | def index 27 | authorize!(:index, <%= class_name %>) 28 | 29 | @search ||= <%= class_name %>.accessible_by(current_ability).ransack(params[:q]) 30 | respond_with(@<%= plural_table_name %> ||= apply_scopes(@search.result)) 31 | end 32 | 33 | def show 34 | respond_with(authorize!(:show, @<%= singular_table_name %> ||= <%= orm_class.find(class_name, "params[:id]") %>)) 35 | end 36 | 37 | def new 38 | respond_with(authorize!(:new, @<%= singular_table_name %> ||= <%= orm_class.build(class_name) %>)) 39 | end 40 | 41 | def edit 42 | respond_with(authorize!(:edit, @<%= singular_table_name %> ||= <%= orm_class.find(class_name, "params[:id]") %>)) 43 | end 44 | 45 | def create 46 | respond_with(authorize!(:create, @<%= singular_table_name %> ||= 47 | <%= orm_class.build(class_name, "#{singular_table_name}_params") %>) \ 48 | <%= ' ' * class_name.length %>.tap(&:save)) 49 | end 50 | 51 | def update 52 | respond_with(authorize!(:update, @<%= singular_table_name %> ||= 53 | <%= orm_class.find(class_name, "params[:id]") %>) \ 54 | <%= ' ' * class_name.length %>.tap { |<%= singular_table_name.first %>| <%= singular_table_name.first %>.update(<%= "#{singular_table_name}_params" %>) }) 55 | end 56 | 57 | def destroy 58 | respond_with(authorize!(:destroy, @<%= singular_table_name %> ||= 59 | <%= orm_class.find(class_name, "params[:id]") %>) \ 60 | <%= ' ' * class_name.length %>.tap(&:destroy)) 61 | end 62 | 63 | # protected instance methods ................................................. 64 | 65 | protected 66 | 67 | def <%= "#{singular_table_name}_params" %> 68 | <%- if attributes_names.empty? -%> 69 | params[<%= ":#{singular_table_name}" %>] 70 | <%- else -%> 71 | params.require(<%= ":#{singular_table_name}" %>) \ 72 | .permit(<%= attributes_names.map { |name| ":#{name}" }.join(', ') %>) 73 | <%- end -%> 74 | end 75 | 76 | # private instance methods ................................................... 77 | end 78 | <% end -%> 79 | -------------------------------------------------------------------------------- /lib/gunzel/gem_ext/devise/permit_username_and_login_parameters.rb: -------------------------------------------------------------------------------- 1 | module Gunzel 2 | module Devise 3 | module PermitUsernameAndLoginParameters 4 | # extends ................................................................ 5 | 6 | extend ActiveSupport::Concern 7 | 8 | # includes ............................................................... 9 | # constants .............................................................. 10 | # additional config ...................................................... 11 | 12 | included do 13 | before_filter :configure_permitted_parameters 14 | end 15 | 16 | # class methods .......................................................... 17 | # helper methods ......................................................... 18 | # protected instance methods ............................................. 19 | 20 | protected 21 | 22 | def configure_permitted_parameters 23 | devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(:username, :email, :password, :password_confirmation, :remember_me) } 24 | devise_parameter_sanitizer.for(:sign_in) { |u| u.permit(:login, :username, :email, :password, :remember_me) } 25 | devise_parameter_sanitizer.for(:account_update) { |u| u.permit(:username, :email, :password, :password_confirmation, :current_password) } 26 | end 27 | 28 | # private instance methods ............................................... 29 | end 30 | end 31 | end 32 | 33 | Rails.application.config.to_prepare do 34 | DeviseController.send :include, Gunzel::Devise::PermitUsernameAndLoginParameters 35 | end 36 | -------------------------------------------------------------------------------- /lib/tasks/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lankz/gunzel/26e12f8ab7918423c7ac4858ce6945e6955ce1fa/lib/tasks/.keep -------------------------------------------------------------------------------- /lib/templates/active_record/model/model.rb: -------------------------------------------------------------------------------- 1 | <% module_namespacing do -%> 2 | class <%= class_name %> < <%= parent_class_name.classify %> 3 | # extends .................................................................... 4 | # includes ................................................................... 5 | # constants .................................................................. 6 | # associations ............................................................... 7 | 8 | <% attributes.select(&:reference?).each do |attribute| -%> 9 | belongs_to :<%= attribute.name %><%= ', polymorphic: true' if attribute.polymorphic? %> 10 | <% end -%> 11 | 12 | # scopes ..................................................................... 13 | # validations ................................................................ 14 | # callbacks .................................................................. 15 | # additional config .......................................................... 16 | 17 | <% if attributes.any?(&:password_digest?) -%> 18 | has_secure_password 19 | <% end -%> 20 | 21 | # class methods .............................................................. 22 | # instance methods ........................................................... 23 | # protected instance methods ................................................. 24 | # private instance methods ................................................... 25 | end 26 | <% end -%> 27 | -------------------------------------------------------------------------------- /lib/templates/rails/helper/helper.rb: -------------------------------------------------------------------------------- 1 | <% module_namespacing do -%> 2 | module <%= class_name %>Helper 3 | # extends .................................................................... 4 | # includes ................................................................... 5 | # constants .................................................................. 6 | # additional config .......................................................... 7 | # class methods .............................................................. 8 | # helper methods ............................................................. 9 | # protected instance methods ................................................. 10 | # private instance methods ................................................... 11 | end 12 | <% end -%> 13 | -------------------------------------------------------------------------------- /lib/templates/rspec/model/model_spec.rb: -------------------------------------------------------------------------------- 1 | require 'rails_helper' 2 | 3 | <% module_namespacing do -%> 4 | RSpec.describe <%= class_name %>, :type => :model do 5 | # subject { described_class } 6 | 7 | # context 'initialized' do 8 | # subject { build(:<%= singular_table_name %>) } 9 | # end 10 | 11 | # context 'persisted' do 12 | # subject { create(:<%= singular_table_name %>) } 13 | # end 14 | 15 | pending "add some examples to (or delete) #{__FILE__}" 16 | end 17 | <% end -%> 18 | -------------------------------------------------------------------------------- /lib/templates/rspec/scaffold/controller_spec.rb: -------------------------------------------------------------------------------- 1 | require 'rails_helper' 2 | 3 | # This spec was generated by rspec-rails when you ran the scaffold generator. 4 | # It demonstrates how one might use RSpec to specify the controller code that 5 | # was generated by Rails when you ran the scaffold generator. 6 | # 7 | # It assumes that the implementation code is generated by the rails scaffold 8 | # generator. If you are using any extension libraries to generate different 9 | # controller code, this generated spec may or may not pass. 10 | # 11 | # It only uses APIs available in rails and/or rspec-rails. There are a number 12 | # of tools you can use to make these specs even more expressive, but we're 13 | # sticking to rails and rspec-rails APIs to keep things simple and stable. 14 | # 15 | # Compared to earlier versions of this generator, there is very limited use of 16 | # stubs and message expectations in this spec. Stubs are only used when there 17 | # is no simpler way to get a handle on the object needed for the example. 18 | # Message expectations are only used when there is no simpler way to specify 19 | # that an instance is receiving a specific message. 20 | 21 | <% module_namespacing do -%> 22 | RSpec.describe <%= controller_class_name %>Controller, :type => :controller do 23 | 24 | # This should return the minimal set of attributes required to create a valid 25 | # <%= class_name %>. As you add validations to <%= class_name %>, be sure to 26 | # adjust the attributes here as well. 27 | let(:valid_attributes) { 28 | attributes_for(:<%= singular_table_name %>) 29 | } 30 | 31 | let(:invalid_attributes) { 32 | skip("Add a hash of attributes invalid for your model") 33 | } 34 | 35 | # This should return the minimal set of values that should be in the session 36 | # in order to pass any filters (e.g. authentication) defined in 37 | # <%= controller_class_name %>Controller. Be sure to keep this updated too. 38 | let(:valid_session) { {} } 39 | 40 | <% unless options[:singleton] -%> 41 | describe "GET index" do 42 | it "assigns all <%= table_name.pluralize %> as @<%= table_name.pluralize %>" do 43 | <%= file_name %> = <%= class_name %>.create! valid_attributes 44 | get :index, {}, valid_session 45 | expect(assigns(:<%= table_name %>)).to eq([<%= file_name %>]) 46 | end 47 | end 48 | 49 | <% end -%> 50 | describe "GET show" do 51 | it "assigns the requested <%= ns_file_name %> as @<%= ns_file_name %>" do 52 | <%= file_name %> = <%= class_name %>.create! valid_attributes 53 | get :show, {:id => <%= file_name %>.to_param}, valid_session 54 | expect(assigns(:<%= ns_file_name %>)).to eq(<%= file_name %>) 55 | end 56 | end 57 | 58 | describe "GET new" do 59 | it "assigns a new <%= ns_file_name %> as @<%= ns_file_name %>" do 60 | get :new, {}, valid_session 61 | expect(assigns(:<%= ns_file_name %>)).to be_a_new(<%= class_name %>) 62 | end 63 | end 64 | 65 | describe "GET edit" do 66 | it "assigns the requested <%= ns_file_name %> as @<%= ns_file_name %>" do 67 | <%= file_name %> = <%= class_name %>.create! valid_attributes 68 | get :edit, {:id => <%= file_name %>.to_param}, valid_session 69 | expect(assigns(:<%= ns_file_name %>)).to eq(<%= file_name %>) 70 | end 71 | end 72 | 73 | describe "POST create" do 74 | describe "with valid params" do 75 | it "creates a new <%= class_name %>" do 76 | expect { 77 | post :create, {:<%= ns_file_name %> => valid_attributes}, valid_session 78 | }.to change(<%= class_name %>, :count).by(1) 79 | end 80 | 81 | it "assigns a newly created <%= ns_file_name %> as @<%= ns_file_name %>" do 82 | post :create, {:<%= ns_file_name %> => valid_attributes}, valid_session 83 | expect(assigns(:<%= ns_file_name %>)).to be_a(<%= class_name %>) 84 | expect(assigns(:<%= ns_file_name %>)).to be_persisted 85 | end 86 | 87 | it "redirects to the created <%= ns_file_name %>" do 88 | post :create, {:<%= ns_file_name %> => valid_attributes}, valid_session 89 | expect(response).to redirect_to(<%= class_name %>.last) 90 | end 91 | end 92 | 93 | describe "with invalid params" do 94 | it "assigns a newly created but unsaved <%= ns_file_name %> as @<%= ns_file_name %>" do 95 | post :create, {:<%= ns_file_name %> => invalid_attributes}, valid_session 96 | expect(assigns(:<%= ns_file_name %>)).to be_a_new(<%= class_name %>) 97 | end 98 | 99 | it "re-renders the 'new' template" do 100 | post :create, {:<%= ns_file_name %> => invalid_attributes}, valid_session 101 | expect(response).to render_template("new") 102 | end 103 | end 104 | end 105 | 106 | describe "PUT update" do 107 | describe "with valid params" do 108 | let(:new_attributes) { 109 | attributes_for(:<%= singular_table_name %>) 110 | } 111 | 112 | it "updates the requested <%= ns_file_name %>" do 113 | <%= file_name %> = <%= class_name %>.create! valid_attributes 114 | put :update, {:id => <%= file_name %>.to_param, :<%= ns_file_name %> => new_attributes}, valid_session 115 | <%= file_name %>.reload 116 | skip("Add assertions for updated state") 117 | end 118 | 119 | it "assigns the requested <%= ns_file_name %> as @<%= ns_file_name %>" do 120 | <%= file_name %> = <%= class_name %>.create! valid_attributes 121 | put :update, {:id => <%= file_name %>.to_param, :<%= ns_file_name %> => valid_attributes}, valid_session 122 | expect(assigns(:<%= ns_file_name %>)).to eq(<%= file_name %>) 123 | end 124 | 125 | it "redirects to the <%= ns_file_name %>" do 126 | <%= file_name %> = <%= class_name %>.create! valid_attributes 127 | put :update, {:id => <%= file_name %>.to_param, :<%= ns_file_name %> => valid_attributes}, valid_session 128 | expect(response).to redirect_to(<%= file_name %>) 129 | end 130 | end 131 | 132 | describe "with invalid params" do 133 | it "assigns the <%= ns_file_name %> as @<%= ns_file_name %>" do 134 | <%= file_name %> = <%= class_name %>.create! valid_attributes 135 | put :update, {:id => <%= file_name %>.to_param, :<%= ns_file_name %> => invalid_attributes}, valid_session 136 | expect(assigns(:<%= ns_file_name %>)).to eq(<%= file_name %>) 137 | end 138 | 139 | it "re-renders the 'edit' template" do 140 | <%= file_name %> = <%= class_name %>.create! valid_attributes 141 | put :update, {:id => <%= file_name %>.to_param, :<%= ns_file_name %> => invalid_attributes}, valid_session 142 | expect(response).to render_template("edit") 143 | end 144 | end 145 | end 146 | 147 | describe "DELETE destroy" do 148 | it "destroys the requested <%= ns_file_name %>" do 149 | <%= file_name %> = <%= class_name %>.create! valid_attributes 150 | expect { 151 | delete :destroy, {:id => <%= file_name %>.to_param}, valid_session 152 | }.to change(<%= class_name %>, :count).by(-1) 153 | end 154 | 155 | it "redirects to the <%= table_name %> list" do 156 | <%= file_name %> = <%= class_name %>.create! valid_attributes 157 | delete :destroy, {:id => <%= file_name %>.to_param}, valid_session 158 | expect(response).to redirect_to(<%= index_helper %>_url) 159 | end 160 | end 161 | 162 | end 163 | <% end -%> 164 | -------------------------------------------------------------------------------- /log/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lankz/gunzel/26e12f8ab7918423c7ac4858ce6945e6955ce1fa/log/.keep -------------------------------------------------------------------------------- /public/404.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | The page you were looking for doesn't exist (404) 5 | 48 | 49 | 50 | 51 | 52 |
53 |

The page you were looking for doesn't exist.

54 |

You may have mistyped the address or the page may have moved.

55 |
56 |

If you are the application owner check the logs for more information.

57 | 58 | 59 | -------------------------------------------------------------------------------- /public/422.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | The change you wanted was rejected (422) 5 | 48 | 49 | 50 | 51 | 52 |
53 |

The change you wanted was rejected.

54 |

Maybe you tried to change something you didn't have access to.

55 |
56 |

If you are the application owner check the logs for more information.

57 | 58 | 59 | -------------------------------------------------------------------------------- /public/500.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | We're sorry, but something went wrong (500) 5 | 48 | 49 | 50 | 51 | 52 |
53 |

We're sorry, but something went wrong.

54 |
55 |

If you are the application owner check the logs for more information.

56 | 57 | 58 | -------------------------------------------------------------------------------- /public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lankz/gunzel/26e12f8ab7918423c7ac4858ce6945e6955ce1fa/public/favicon.ico -------------------------------------------------------------------------------- /public/robots.txt: -------------------------------------------------------------------------------- 1 | # See http://www.robotstxt.org/wc/norobots.html for documentation on how to use the robots.txt file 2 | # 3 | # To ban all spiders from the entire site uncomment the next two lines: 4 | # User-agent: * 5 | # Disallow: / 6 | -------------------------------------------------------------------------------- /spec/factories/roles.rb: -------------------------------------------------------------------------------- 1 | # Read about factories at https://github.com/thoughtbot/factory_girl 2 | 3 | FactoryGirl.define do 4 | factory :role do 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /spec/factories/users.rb: -------------------------------------------------------------------------------- 1 | # Read about factories at https://github.com/thoughtbot/factory_girl 2 | 3 | FactoryGirl.define do 4 | factory :user do 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /spec/models/role_spec.rb: -------------------------------------------------------------------------------- 1 | require 'rails_helper' 2 | 3 | RSpec.describe Role, :type => :model do 4 | pending "add some examples to (or delete) #{__FILE__}" 5 | end 6 | -------------------------------------------------------------------------------- /spec/models/user_spec.rb: -------------------------------------------------------------------------------- 1 | require 'rails_helper' 2 | 3 | RSpec.describe User, :type => :model do 4 | pending "add some examples to (or delete) #{__FILE__}" 5 | end 6 | -------------------------------------------------------------------------------- /spec/rails_helper.rb: -------------------------------------------------------------------------------- 1 | # This file is copied to spec/ when you run 'rails generate rspec:install' 2 | ENV["RAILS_ENV"] ||= 'test' 3 | require 'spec_helper' 4 | require File.expand_path("../../config/environment", __FILE__) 5 | require 'rspec/rails' 6 | 7 | # Requires supporting ruby files with custom matchers and macros, etc, in 8 | # spec/support/ and its subdirectories. Files matching `spec/**/*_spec.rb` are 9 | # run as spec files by default. This means that files in spec/support that end 10 | # in _spec.rb will both be required and run as specs, causing the specs to be 11 | # run twice. It is recommended that you do not name files matching this glob to 12 | # end with _spec.rb. You can configure this pattern with with the --pattern 13 | # option on the command line or in ~/.rspec, .rspec or `.rspec-local`. 14 | Dir[Rails.root.join("spec/support/**/*.rb")].each { |f| require f } 15 | 16 | # Checks for pending migrations before tests are run. 17 | # If you are not using ActiveRecord, you can remove this line. 18 | ActiveRecord::Migration.maintain_test_schema! 19 | 20 | RSpec.configure do |config| 21 | # Remove this line if you're not using ActiveRecord or ActiveRecord fixtures 22 | config.fixture_path = "#{::Rails.root}/spec/fixtures" 23 | 24 | # If you're not using ActiveRecord, or you'd prefer not to run each of your 25 | # examples within a transaction, remove the following line or assign false 26 | # instead of true. 27 | config.use_transactional_fixtures = true 28 | 29 | # RSpec Rails can automatically mix in different behaviours to your tests 30 | # based on their file location, for example enabling you to call `get` and 31 | # `post` in specs under `spec/controllers`. 32 | # 33 | # You can disable this behaviour by removing the line below, and instead 34 | # explicitly tag your specs with their type, e.g.: 35 | # 36 | # RSpec.describe UsersController, :type => :controller do 37 | # # ... 38 | # end 39 | # 40 | # The different available types are documented in the features, such as in 41 | # https://relishapp.com/rspec/rspec-rails/docs 42 | config.infer_spec_type_from_file_location! 43 | 44 | config.include FactoryGirl::Syntax::Methods 45 | config.include Devise::TestHelpers, :type => :controller 46 | end 47 | -------------------------------------------------------------------------------- /spec/spec_helper.rb: -------------------------------------------------------------------------------- 1 | # This file was generated by the `rails generate rspec:install` command. Conventionally, all 2 | # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`. 3 | # The generated `.rspec` file contains `--require spec_helper` which will cause this 4 | # file to always be loaded, without a need to explicitly require it in any files. 5 | # 6 | # Given that it is always loaded, you are encouraged to keep this file as 7 | # light-weight as possible. Requiring heavyweight dependencies from this file 8 | # will add to the boot time of your test suite on EVERY test run, even for an 9 | # individual file that may not need all of that loaded. Instead, make a 10 | # separate helper file that requires this one and then use it only in the specs 11 | # that actually need it. 12 | # 13 | # The `.rspec` file also contains a few flags that are not defaults but that 14 | # users commonly want. 15 | # 16 | # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration 17 | RSpec.configure do |config| 18 | # The settings below are suggested to provide a good initial experience 19 | # with RSpec, but feel free to customize to your heart's content. 20 | =begin 21 | # These two settings work together to allow you to limit a spec run 22 | # to individual examples or groups you care about by tagging them with 23 | # `:focus` metadata. When nothing is tagged with `:focus`, all examples 24 | # get run. 25 | config.filter_run :focus 26 | config.run_all_when_everything_filtered = true 27 | 28 | # Many RSpec users commonly either run the entire suite or an individual 29 | # file, and it's useful to allow more verbose output when running an 30 | # individual spec file. 31 | if config.files_to_run.one? 32 | # Use the documentation formatter for detailed output, 33 | # unless a formatter has already been configured 34 | # (e.g. via a command-line flag). 35 | config.default_formatter = 'doc' 36 | end 37 | 38 | # Print the 10 slowest examples and example groups at the 39 | # end of the spec run, to help surface which specs are running 40 | # particularly slow. 41 | config.profile_examples = 10 42 | =end 43 | # Run specs in random order to surface order dependencies. If you find an 44 | # order dependency and want to debug it, you can fix the order by providing 45 | # the seed, which is printed after each run. 46 | # --seed 1234 47 | config.order = :random 48 | 49 | # Seed global randomization in this process using the `--seed` CLI option. 50 | # Setting this allows you to use `--seed` to deterministically reproduce 51 | # test failures related to randomization by passing the same `--seed` value 52 | # as the one that triggered the failure. 53 | Kernel.srand config.seed 54 | =begin 55 | # rspec-expectations config goes here. You can use an alternate 56 | # assertion/expectation library such as wrong or the stdlib/minitest 57 | # assertions if you prefer. 58 | config.expect_with :rspec do |expectations| 59 | # Enable only the newer, non-monkey-patching expect syntax. 60 | # For more details, see: 61 | # - http://myronmars.to/n/dev-blog/2012/06/rspecs-new-expectation-syntax 62 | expectations.syntax = :expect 63 | end 64 | 65 | # rspec-mocks config goes here. You can use an alternate test double 66 | # library (such as bogus or mocha) by changing the `mock_with` option here. 67 | config.mock_with :rspec do |mocks| 68 | # Enable only the newer, non-monkey-patching expect syntax. 69 | # For more details, see: 70 | # - http://teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/ 71 | mocks.syntax = :expect 72 | 73 | # Prevents you from mocking or stubbing a method that does not exist on 74 | # a real object. This is generally recommended. 75 | mocks.verify_partial_doubles = true 76 | end 77 | =end 78 | end 79 | -------------------------------------------------------------------------------- /vendor/assets/javascripts/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lankz/gunzel/26e12f8ab7918423c7ac4858ce6945e6955ce1fa/vendor/assets/javascripts/.keep -------------------------------------------------------------------------------- /vendor/assets/stylesheets/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lankz/gunzel/26e12f8ab7918423c7ac4858ce6945e6955ce1fa/vendor/assets/stylesheets/.keep --------------------------------------------------------------------------------