diff --git a/.gitignore b/.gitignore index bb909eb6..677c4659 100644 --- a/.gitignore +++ b/.gitignore @@ -1,12 +1 @@ .bundle -db/*.sqlite3 -log/*.log -tmp/ -.sass-cache/ -*.rbc -.DS_Store -*.swp -.redcar -bin/ -coverage -config/config.yml diff --git a/.rspec b/.rspec deleted file mode 100644 index 53607ea5..00000000 --- a/.rspec +++ /dev/null @@ -1 +0,0 @@ ---colour diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index a9a71640..00000000 --- a/.travis.yml +++ /dev/null @@ -1,12 +0,0 @@ -language: ruby -script: "bundle exec rake spec cucumber" -rvm: 1.9.3 -services: mongodb -notifications: - email: - - tobias.pfeiffer@student.hpi.uni-potsdam.de - - james+travis-ci-broken@jamesrgifford.com - - kh@kalonhinds.com - - steven+travis-ci@nuclearsandwich.com - irc: "irc.freenode.org#hacketyhack" - diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md deleted file mode 100644 index 049e26d1..00000000 --- a/CONTRIBUTING.md +++ /dev/null @@ -1,24 +0,0 @@ -# Thanks for helping! # - -## Questions ## - -If you're asking a question about Hackety Hack itself, check out the [Hackety -Hack repository][hh]. -Otherwise, go ahead and open an [issue][issues] and let us know! - -## Bugs ## - -If you notice a bug in Hackety-Hack.com, this is the place to let us know. -Please tell us: - -- Which url the bug occurred at -- What steps we can take to reproduce this bug -- If the bug is visual, including a screenshot is really helpful. - -## Pull Requests ## - -We :heart: pull requests; We :heart::blue_heart::green_heart: Pull Requests with tests. In fact, we don't want to accept pull requests without relevant tests. If you're not sure if the feature you want is welcome and you want to check with us, feel free to create [an issue][issues] or if you're just totally driven to make it happen, spike it out and open a pull request, but we'll ask you to add tests before it's merged. - - -[hh]: https://github.com/hacketyhack/hacketyhack -[issues]: https://github.com/hacketyhack/hackety-hack.com/issues diff --git a/Gemfile b/Gemfile deleted file mode 100644 index 0e9edb9f..00000000 --- a/Gemfile +++ /dev/null @@ -1,65 +0,0 @@ -source 'http://rubygems.org' - -#ruby=1.9.3-p448 -#ruby-gemset=hackety-hack.com - -ruby '1.9.3' - -gem 'rails', '3.2.17' -gem 'json' - -gem 'hackety_hack-lessons', '~> 1.1', :require => 'hackety_hack/lessons' - -gem 'haml-rails' -gem 'jquery-rails' -gem 'mongo_mapper' -gem 'bson_ext' - -gem "letter_opener", group: :development - -gem "devise", "~> 2.2.2" -gem 'mm-devise', '~> 2.0' -gem 'cancan' - -gem 'inherited_resources' -gem 'simple_form', git: "https://github.com/bitzesty/bootstrap_form.git" -gem "semantic_menu", git: "git://github.com/michaek/semantic_menu.git" - -gem 'will_paginate' # Pagination -gem 'redcarpet', '~> 3.0' # Markdown - -# Gems used only for assets and not required -# in production environments by default. -group :assets do - gem 'sass-rails' - gem 'coffee-rails' - gem 'uglifier' -end - -group :development do - # Use unicorn as the web server - gem 'unicorn' -end - -group :development, :test do - gem 'debugger' - gem 'fabrication' - gem 'rspec-rails' - gem 'capybara' - gem 'cucumber-rails', require: false - gem "faker" - gem 'pry' - gem 'sqlite3' -end - -group :production do - gem 'pg' # ugh heroku -end - -group :test do - gem "simplecov", :require => false - gem "coveralls" - gem "mocha" - gem "database_cleaner" - gem "launchy" -end diff --git a/Gemfile.lock b/Gemfile.lock deleted file mode 100644 index 98ac5970..00000000 --- a/Gemfile.lock +++ /dev/null @@ -1,285 +0,0 @@ -GIT - remote: git://github.com/michaek/semantic_menu.git - revision: 5298f586467cc9a91e85befcca673b8406c8846f - specs: - semantic_menu (0.1.0) - -GIT - remote: https://github.com/bitzesty/bootstrap_form.git - revision: 1b33bf01c7daf56bb42e3f944d745ee25d620cca - specs: - simple_form (1.5.0.dev) - actionpack (~> 3.0) - activemodel (~> 3.0) - -GEM - remote: http://rubygems.org/ - specs: - actionmailer (3.2.17) - actionpack (= 3.2.17) - mail (~> 2.5.4) - actionpack (3.2.17) - activemodel (= 3.2.17) - activesupport (= 3.2.17) - builder (~> 3.0.0) - erubis (~> 2.7.0) - journey (~> 1.0.4) - rack (~> 1.4.5) - rack-cache (~> 1.2) - rack-test (~> 0.6.1) - sprockets (~> 2.2.1) - activemodel (3.2.17) - activesupport (= 3.2.17) - builder (~> 3.0.0) - activerecord (3.2.17) - activemodel (= 3.2.17) - activesupport (= 3.2.17) - arel (~> 3.0.2) - tzinfo (~> 0.3.29) - activeresource (3.2.17) - activemodel (= 3.2.17) - activesupport (= 3.2.17) - activesupport (3.2.17) - i18n (~> 0.6, >= 0.6.4) - multi_json (~> 1.0) - addressable (2.3.5) - arel (3.0.3) - bcrypt-ruby (3.1.2) - bson (1.9.2) - bson_ext (1.9.2) - bson (~> 1.9.2) - builder (3.0.4) - cancan (1.6.10) - capybara (2.2.1) - mime-types (>= 1.16) - nokogiri (>= 1.3.3) - rack (>= 1.0.0) - rack-test (>= 0.5.4) - xpath (~> 2.0) - coderay (1.1.0) - coffee-rails (3.2.2) - coffee-script (>= 2.2.0) - railties (~> 3.2.0) - coffee-script (2.2.0) - coffee-script-source - execjs - coffee-script-source (1.7.0) - columnize (0.9.0) - coveralls (0.7.0) - multi_json (~> 1.3) - rest-client - simplecov (>= 0.7) - term-ansicolor - thor - cucumber (1.3.10) - builder (>= 2.1.2) - diff-lcs (>= 1.1.3) - gherkin (~> 2.12) - multi_json (>= 1.7.5, < 2.0) - multi_test (>= 0.0.2) - cucumber-rails (1.4.0) - capybara (>= 1.1.2) - cucumber (>= 1.2.0) - nokogiri (>= 1.5.0) - rails (>= 3.0.0) - database_cleaner (1.2.0) - debugger (1.6.8) - columnize (>= 0.3.1) - debugger-linecache (~> 1.2.0) - debugger-ruby_core_source (~> 1.3.5) - debugger-linecache (1.2.0) - debugger-ruby_core_source (1.3.8) - devise (2.2.8) - bcrypt-ruby (~> 3.0) - orm_adapter (~> 0.1) - railties (~> 3.1) - warden (~> 1.2.1) - diff-lcs (1.2.5) - docile (1.1.3) - erubis (2.7.0) - execjs (2.0.2) - fabrication (2.9.8) - faker (1.2.0) - i18n (~> 0.5) - gherkin (2.12.2) - multi_json (~> 1.3) - hackety_hack-lessons (1.1.2) - metadown - haml (4.0.5) - tilt - haml-rails (0.4) - actionpack (>= 3.1, < 4.1) - activesupport (>= 3.1, < 4.1) - haml (>= 3.1, < 4.1) - railties (>= 3.1, < 4.1) - has_scope (0.6.0.rc) - actionpack (>= 3.2, < 5) - activesupport (>= 3.2, < 5) - hike (1.2.3) - i18n (0.6.9) - inherited_resources (1.4.1) - has_scope (~> 0.6.0.rc) - responders (~> 1.0.0.rc) - journey (1.0.4) - jquery-rails (3.1.0) - railties (>= 3.0, < 5.0) - thor (>= 0.14, < 2.0) - json (1.8.1) - kgio (2.9.2) - launchy (2.4.2) - addressable (~> 2.3) - letter_opener (1.2.0) - launchy (~> 2.2) - mail (2.5.4) - mime-types (~> 1.16) - treetop (~> 1.4.8) - metaclass (0.0.3) - metadown (1.0.1) - redcarpet - method_source (0.8.2) - mime-types (1.25.1) - mini_portile (0.5.2) - mm-devise (2.0) - devise (>= 1.2) - mongo_mapper (>= 0.9.0) - mocha (1.0.0) - metaclass (~> 0.0.1) - mongo (1.9.2) - bson (~> 1.9.2) - mongo_mapper (0.12.0) - activemodel (~> 3.0) - activesupport (~> 3.0) - plucky (~> 0.5.2) - multi_json (1.8.4) - multi_test (0.0.3) - nokogiri (1.6.1) - mini_portile (~> 0.5.0) - orm_adapter (0.5.0) - pg (0.17.1) - plucky (0.5.2) - mongo (~> 1.5) - polyglot (0.3.4) - pry (0.9.12.6) - coderay (~> 1.0) - method_source (~> 0.8) - slop (~> 3.4) - rack (1.4.5) - rack-cache (1.2) - rack (>= 0.4) - rack-ssl (1.3.3) - rack - rack-test (0.6.2) - rack (>= 1.0) - rails (3.2.17) - actionmailer (= 3.2.17) - actionpack (= 3.2.17) - activerecord (= 3.2.17) - activeresource (= 3.2.17) - activesupport (= 3.2.17) - bundler (~> 1.0) - railties (= 3.2.17) - railties (3.2.17) - actionpack (= 3.2.17) - activesupport (= 3.2.17) - rack-ssl (~> 1.3.2) - rake (>= 0.8.7) - rdoc (~> 3.4) - thor (>= 0.14.6, < 2.0) - raindrops (0.13.0) - rake (10.1.1) - rdoc (3.12.2) - json (~> 1.4) - redcarpet (3.1.1) - responders (1.0.0) - railties (>= 3.2, < 5) - rest-client (1.6.7) - mime-types (>= 1.16) - rspec-core (2.14.7) - rspec-expectations (2.14.5) - diff-lcs (>= 1.1.3, < 2.0) - rspec-mocks (2.14.5) - rspec-rails (2.14.1) - actionpack (>= 3.0) - activemodel (>= 3.0) - activesupport (>= 3.0) - railties (>= 3.0) - rspec-core (~> 2.14.0) - rspec-expectations (~> 2.14.0) - rspec-mocks (~> 2.14.0) - sass (3.2.14) - sass-rails (3.2.6) - railties (~> 3.2.0) - sass (>= 3.1.10) - tilt (~> 1.3) - simplecov (0.8.2) - docile (~> 1.1.0) - multi_json - simplecov-html (~> 0.8.0) - simplecov-html (0.8.0) - slop (3.4.7) - sprockets (2.2.2) - hike (~> 1.2) - multi_json (~> 1.0) - rack (~> 1.0) - tilt (~> 1.1, != 1.3.0) - sqlite3 (1.3.8) - term-ansicolor (1.3.0) - tins (~> 1.0) - thor (0.18.1) - tilt (1.4.1) - tins (1.0.0) - treetop (1.4.15) - polyglot - polyglot (>= 0.3.1) - tzinfo (0.3.38) - uglifier (2.4.0) - execjs (>= 0.3.0) - json (>= 1.8.0) - unicorn (4.8.2) - kgio (~> 2.6) - rack - raindrops (~> 0.7) - warden (1.2.3) - rack (>= 1.0) - will_paginate (3.0.5) - xpath (2.0.0) - nokogiri (~> 1.3) - -PLATFORMS - ruby - -DEPENDENCIES - bson_ext - cancan - capybara - coffee-rails - coveralls - cucumber-rails - database_cleaner - debugger - devise (~> 2.2.2) - fabrication - faker - hackety_hack-lessons (~> 1.1) - haml-rails - inherited_resources - jquery-rails - json - launchy - letter_opener - mm-devise (~> 2.0) - mocha - mongo_mapper - pg - pry - rails (= 3.2.17) - redcarpet (~> 3.0) - rspec-rails - sass-rails - semantic_menu! - simple_form! - simplecov - sqlite3 - uglifier - unicorn - will_paginate diff --git a/README.md b/README.md index d9ae1f62..d3532812 100644 --- a/README.md +++ b/README.md @@ -1,48 +1,5 @@ -# hackety-hack.com # +# Hackety-Hack.com Generated Documentation -[![Build status](https://img.shields.io/travis/hacketyhack/hackety-hack.com.svg)](http://travis-ci.org/#!/hacketyhack/hackety-hack.com)[![Code Climate](https://img.shields.io/codeclimate/github/hacketyhack/hackety-hack.com.svg)](https://codeclimate.com/github/hacketyhack/hackety-hack.com)[![Coverage Status](https://img.shields.io/coveralls/hacketyhack/hackety-hack.com/master.svg)](https://coveralls.io/r/hacketyhack/hackety-hack.com?branch=master) +This is the automatically generated documentation for [the hackety-hack.com repository](http://github.com/hacketyhack/hackety-hack.com/). It's generated by running `rake dox` from the master branch. -[hackety-hack.com][hh.com] is the web backend powering the collaborative features of [Hackety Hack][hh]. It is written in Rails 3 and continues to be under active development (see 'Helping Out'), the switch to Rails 3 happened quite recently so there's still lots to be done. - -### Helping Out ### - -If you have any experience writing Rails apps, feel free to help out, we're open to pull requests as long as you follow a few conditions. - -+ **Test your code**, we really can't stress this enough, ideally you should be practicing [TDD][tdd] and writing tests before you even write your code. If you don't test your code, we have no way of knowing if it works properly so please do test. -+ **If it's a major feature, file an issue**, if you file an issue we can discuss certain aspects of the new feature with you and ensure it's a good fit for hackety-hack.com. - -## Translations ## - -Hello everyone! - -We are in the process of translating Hackety Hack into as many foreign languages as possible so that people around the world would be able to use the site with ease. If you are bilingual and interested in helping us make Hackety Hack a truly global phenomenon, accessible by all regardless of location or nationality, and make learning Ruby even more fun! then please sign up here http://crowdin.net/project/hackety-hackcom/invite - -## Getting Started ## - -Once you've cloned this repository, running `script/bootstrap` should tell you everything you need to know. - -In case you prefer gems to be managed entirely by bundler run this before bootstrapping: - - bundle config --global path .bundle - bundle config --global binstubs bin - export PATH="$PWD/bin:$PATH" - -Be careful with using `bin` in `$PATH` it is very risky when used with public projects. - -Dependencies for the curious: - -- Ruby: 1.9.3 is preferred. -- MongoDB: 2.2.x or 2.4.x - -As long as you have those things, the script will handle the rest as best it can, including installing the gem dependencies with Bundler. - -If the tests aren't passing when you clone, open [an issue][issues] or drop into -[#hacketyhack on freenode][irc]. - -Additionally, if you're _not_ a developer and you have a feature you'd really like to see on the site, file [an issue][issues] and we'll be sure to look into it on your behalf. - -[hh.com]: http://hackety-hack.com/ -[hh]: https://github.com/hacketyhack/hacketyhack -[irc]: http://webchat.freenode.net/?channels=#hacketyhack -[issues]: https://github.com/hacketyhack/hackety-hack.com/issues -[tdd]: http://en.wikipedia.org/wiki/Test-driven_development +We use [docco](https://github.com/jashkenas/docco) to do this, which is pretty cool. diff --git a/Rakefile b/Rakefile deleted file mode 100644 index ca5f6c5c..00000000 --- a/Rakefile +++ /dev/null @@ -1,7 +0,0 @@ -#!/usr/bin/env rake -# Add your own tasks in files placed in lib/tasks ending in .rake, -# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake. - -require File.expand_path('../config/application', __FILE__) - -HacketyHackCom::Application.load_tasks diff --git a/app/assets/images/accepted.png b/app/assets/images/accepted.png deleted file mode 100644 index eeddca80..00000000 Binary files a/app/assets/images/accepted.png and /dev/null differ diff --git a/app/assets/images/ask.png b/app/assets/images/ask.png deleted file mode 100644 index 770cc1b2..00000000 Binary files a/app/assets/images/ask.png and /dev/null differ diff --git a/app/assets/images/asked.png b/app/assets/images/asked.png deleted file mode 100644 index 595867cb..00000000 Binary files a/app/assets/images/asked.png and /dev/null differ diff --git a/app/assets/images/download.png b/app/assets/images/download.png deleted file mode 100644 index 11ff2b3f..00000000 Binary files a/app/assets/images/download.png and /dev/null differ diff --git a/app/assets/images/explore.png b/app/assets/images/explore.png deleted file mode 100644 index 6c17b310..00000000 Binary files a/app/assets/images/explore.png and /dev/null differ diff --git a/app/assets/images/feed_icon.png b/app/assets/images/feed_icon.png deleted file mode 100644 index d384eac7..00000000 Binary files a/app/assets/images/feed_icon.png and /dev/null differ diff --git a/app/assets/images/felt.png b/app/assets/images/felt.png deleted file mode 100644 index 434220b0..00000000 Binary files a/app/assets/images/felt.png and /dev/null differ diff --git a/app/assets/images/logo-star.png b/app/assets/images/logo-star.png deleted file mode 100644 index f8652a81..00000000 Binary files a/app/assets/images/logo-star.png and /dev/null differ diff --git a/app/assets/images/moon.png b/app/assets/images/moon.png deleted file mode 100644 index f8ad66e3..00000000 Binary files a/app/assets/images/moon.png and /dev/null differ diff --git a/app/assets/images/rubyplusshoes.png b/app/assets/images/rubyplusshoes.png deleted file mode 100644 index 0e247186..00000000 Binary files a/app/assets/images/rubyplusshoes.png and /dev/null differ diff --git a/app/assets/images/screenshots/lesson.png b/app/assets/images/screenshots/lesson.png deleted file mode 100644 index b6b0783d..00000000 Binary files a/app/assets/images/screenshots/lesson.png and /dev/null differ diff --git a/app/assets/images/screenshots/new_program.png b/app/assets/images/screenshots/new_program.png deleted file mode 100644 index ec59d581..00000000 Binary files a/app/assets/images/screenshots/new_program.png and /dev/null differ diff --git a/app/assets/images/splash.jpg b/app/assets/images/splash.jpg deleted file mode 100644 index 403451c3..00000000 Binary files a/app/assets/images/splash.jpg and /dev/null differ diff --git a/app/assets/images/square_bg.png b/app/assets/images/square_bg.png deleted file mode 100644 index dfb30831..00000000 Binary files a/app/assets/images/square_bg.png and /dev/null differ diff --git a/app/assets/images/star.png b/app/assets/images/star.png deleted file mode 100644 index fd578472..00000000 Binary files a/app/assets/images/star.png and /dev/null differ diff --git a/app/assets/javascripts/answers.js.coffee b/app/assets/javascripts/answers.js.coffee deleted file mode 100644 index 76156794..00000000 --- a/app/assets/javascripts/answers.js.coffee +++ /dev/null @@ -1,3 +0,0 @@ -# Place all the behaviors and hooks related to the matching controller here. -# All this logic will automatically be available in application.js. -# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/ diff --git a/app/assets/javascripts/api/rels.js.coffee b/app/assets/javascripts/api/rels.js.coffee deleted file mode 100644 index 76156794..00000000 --- a/app/assets/javascripts/api/rels.js.coffee +++ /dev/null @@ -1,3 +0,0 @@ -# Place all the behaviors and hooks related to the matching controller here. -# All this logic will automatically be available in application.js. -# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/ diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js deleted file mode 100644 index 37c7bfcd..00000000 --- a/app/assets/javascripts/application.js +++ /dev/null @@ -1,9 +0,0 @@ -// This is a manifest file that'll be compiled into including all the files listed below. -// Add new JavaScript/Coffee code in separate files in this directory and they'll automatically -// be included in the compiled file accessible from http://example.com/assets/application.js -// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the -// the compiled file. -// -//= require jquery -//= require jquery_ujs -//= require_tree . diff --git a/app/assets/javascripts/blog.js.coffee b/app/assets/javascripts/blog.js.coffee deleted file mode 100644 index 76156794..00000000 --- a/app/assets/javascripts/blog.js.coffee +++ /dev/null @@ -1,3 +0,0 @@ -# Place all the behaviors and hooks related to the matching controller here. -# All this logic will automatically be available in application.js. -# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/ diff --git a/app/assets/javascripts/lessons.js.coffee b/app/assets/javascripts/lessons.js.coffee deleted file mode 100644 index 76156794..00000000 --- a/app/assets/javascripts/lessons.js.coffee +++ /dev/null @@ -1,3 +0,0 @@ -# Place all the behaviors and hooks related to the matching controller here. -# All this logic will automatically be available in application.js. -# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/ diff --git a/app/assets/javascripts/questions.js.coffee b/app/assets/javascripts/questions.js.coffee deleted file mode 100644 index 76156794..00000000 --- a/app/assets/javascripts/questions.js.coffee +++ /dev/null @@ -1,3 +0,0 @@ -# Place all the behaviors and hooks related to the matching controller here. -# All this logic will automatically be available in application.js. -# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/ diff --git a/app/assets/javascripts/static.js.coffee b/app/assets/javascripts/static.js.coffee deleted file mode 100644 index 76156794..00000000 --- a/app/assets/javascripts/static.js.coffee +++ /dev/null @@ -1,3 +0,0 @@ -# Place all the behaviors and hooks related to the matching controller here. -# All this logic will automatically be available in application.js. -# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/ diff --git a/app/assets/javascripts/users.js.coffee b/app/assets/javascripts/users.js.coffee deleted file mode 100644 index 76156794..00000000 --- a/app/assets/javascripts/users.js.coffee +++ /dev/null @@ -1,3 +0,0 @@ -# Place all the behaviors and hooks related to the matching controller here. -# All this logic will automatically be available in application.js. -# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/ diff --git a/app/assets/stylesheets/application.css.scss b/app/assets/stylesheets/application.css.scss deleted file mode 100644 index 39a9a87a..00000000 --- a/app/assets/stylesheets/application.css.scss +++ /dev/null @@ -1,21 +0,0 @@ -/* - * This is a manifest file that'll automatically include all the stylesheets available in this directory - * and any sub-directories. You're free to add application-wide styles to this file and they'll appear at - * the top of the compiled file, but it's generally better to create a new file per style scope. - * - *= require_self - */ - -/* We're doing our manifest file a little differently to work with bootstrap... */ -@import "lib/bootstrap/bootstrap.scss"; -@import "lib/shared.css.scss"; -@import "layout.css.scss"; -@import "forms.css.scss"; -@import "content.css.scss"; -@import "home.css.scss"; -@import "questions.css.scss"; -@import "programs.css.scss"; -@import "users.css.scss"; -@import "lessons.css.scss"; -@import "blog.css.scss"; - diff --git a/app/assets/stylesheets/blog.css.scss b/app/assets/stylesheets/blog.css.scss deleted file mode 100644 index 3b293afe..00000000 --- a/app/assets/stylesheets/blog.css.scss +++ /dev/null @@ -1,29 +0,0 @@ -.post.teaser { - h2.title { - line-height: 1; - } - - border-bottom: 1px solid #ccc; - margin-bottom: 3em; -} - -.post { - - padding-bottom: 2em; - - .created_at { - margin-bottom: 1em; - color: #888; - font-size: 1.15em; - font-style: italic; - - } - - margin-right: 3em; - .content { - p { - font-size: 1.15em; - line-height: 1.75em; - } - } -} \ No newline at end of file diff --git a/app/assets/stylesheets/content.css.scss b/app/assets/stylesheets/content.css.scss deleted file mode 100644 index 89192c0a..00000000 --- a/app/assets/stylesheets/content.css.scss +++ /dev/null @@ -1,62 +0,0 @@ -p { - margin-bottom: 1em; -} - -h1 { - -} - -h2 { - font-size: 1.75em; - margin-bottom: 0.5em; -} - -.heading { - @include clearfix; - padding: 0.75em; - background: $green; - - h3, .description { - color: white; - } - - h3 { - float: left; - margin-bottom: 0; - margin-right: 1em; - } - .description { - float: left; - margin-top: 0.2em; - } -} - - -.block-message { - margin-bottom: 0.5em; - p { - margin-bottom: 1em; - } -} - -ul.inline-menu { - @include clearfix; - list-style-type: none; - margin: 0; - li { - float: left; - padding-right: 1em; - border-right: 1px solid #ccc; - margin-right: 1em; - } - li:last-child { - border: none; - margin: 0; - padding: 0; - } -} - -.bottom-nav { - border-top: 1px solid #ccc; - padding-top: 1.5em; -} \ No newline at end of file diff --git a/app/assets/stylesheets/forms.css.scss b/app/assets/stylesheets/forms.css.scss deleted file mode 100644 index 6bf7c403..00000000 --- a/app/assets/stylesheets/forms.css.scss +++ /dev/null @@ -1,20 +0,0 @@ -form { - input, textarea { - width: 350px; - } - - input.boolean { - margin: 0.75em 0 0 1.5em; - } - - .help-inline { - display: block; - padding-top: 5px; - margin-left: 150px; - } - - textarea { - height: 200px; - } - -} \ No newline at end of file diff --git a/app/assets/stylesheets/home.css.scss b/app/assets/stylesheets/home.css.scss deleted file mode 100644 index 8a7eff79..00000000 --- a/app/assets/stylesheets/home.css.scss +++ /dev/null @@ -1,101 +0,0 @@ -@-webkit-keyframes sway { - 0% { - -webkit-transform: rotate(-2deg); - -webkit-transform-origin: 50% 0; - } - 100% { - -webkit-transform: rotate(2deg); - -webkit-transform-origin: 50% 0; - } -} - -.body-home { - #home-splash { - border-top: 1px solid $heading + #444; - .container { - padding: 0; - width: 976px; - } - } -} - -.body-home #content-wrap { - .container { - padding-top: 0; - } - - border-top: none; - section { - @include clearfix; - background: white; - padding-bottom: 1em; - - p { - font-size: 1.25em; - line-height: 1.75em; - padding-bottom: 0.75em; - } - - h1 { - font-size: 3em; - margin: 0 -18px 0.5em; - padding: 0.5em 18px; - color: white; - border-bottom: 6px solid black; - } - - } - - #download { - background: white url("download.png") 0 4em no-repeat; - h1 { - background: $green url("felt.png"); - border-color: $green - #111; - } - .btn { - @include columns(4); - @include offset(5); - text-align: center; - margin-top: 1em; - margin-bottom: 1em; - - .download { - text-transform: uppercase; - margin-bottom: 1em; - } - .version { - font-size: 0.8em; - } - } - .content { - @include columns(10); - @include offset(5); - } - } - - #explore { - background: white url("explore.png") 95% 7em no-repeat; - h1 { - background: $linkColor url("felt.png"); - border-color: $linkColor - #111; - } - .content { - @include columns(10); - margin-left: 2em; - } - } - - #ask { - background: white url("ask.png") 0 7em no-repeat; - min-height: 340px; - - h1 { - background: $orangered url("felt.png"); - border-color: $orangered; - } - .content { - @include columns(10); - @include offset(5); - } - } -} \ No newline at end of file diff --git a/app/assets/stylesheets/layout.css.scss b/app/assets/stylesheets/layout.css.scss deleted file mode 100644 index 9c52f058..00000000 --- a/app/assets/stylesheets/layout.css.scss +++ /dev/null @@ -1,161 +0,0 @@ -html { - background: $heading; -} - -body { - min-width: 976px; - color: $text-color; - background: $background url("square_bg.png") fixed; -} - -p,h1,h2,h3,h4,h5 { - color: $text-color; -} - -.topbar { - position: relative; - height: auto; - @include box-shadow(0px 1px 10px rgba(0,0,0,0.5)); - border-bottom: 1px solid $heading + #444; -} - -header .topbar-inner { - background: $heading; - .container { - padding: 0.6em 0; - } - - li a { - border-radius: 8px; - font-size: 14px; - padding: 11px 11px 10px; - text-shadow: 0 1px 1px rgba(0, 0, 0, 0.5); - } - - li a:hover { - background-color: $heading + #111; - text-shadow: none; - } - - #logo { - float: left; - margin-left: -40px; - width: 185px; - height: 40px; - - a { - position: absolute; - top: -2px; - height: 75px; - padding: 0; - width: 185px; - display: block; - background: url('/assets/logo-star.png') no-repeat; - text-indent: -9999px; - } - } -} - -#content-wrap { - border-top: 1px solid ($heading + #444); - margin: auto; - - .container { - position: relative; - } -} - -#content-wrap > .container { - background: white; - border-radius: 0 0 8px 8px; - padding: 40px 18px 18px; - @include box-shadow(0 2px 10px 0px rgba(0,0,0,0.45)); -} - -.two-column { - .page-title, #content { - @include columns(11); - h1.title { - float: left; - } - .feed { - float: right; - margin-top: 5px; - - a { - display: block; - height: 24px; - background: url('feed_icon.png') no-repeat 6px 4px; - color: #4c8acd; - font-size: 11px; - text-align: right; - border: 1px solid #eee; - line-height: 25px; - padding: 0 8px 0 25px; - @include border-radius(3px); - - &:hover { - background: #f3f3f3 url('feed_icon.png') no-repeat 6px 4px; - text-decoration: none; - } - } - } - } - - #sidebar { - @include columns(5, true); - .edit, .delete { - margin-bottom: 1em; - } - section { - @include border-radius(8px); - background: #f3f3f3; - margin-bottom: 8px; - padding: 1.5em; - - a { - color: darken($blue, 10%); - } - - a.btn { - color: white; - } - - ul { - margin: 0; - li { - list-style-type: none; - margin-bottom: 0.5em; - border-bottom: 1px solid #ddd; - padding-bottom: 0.5em; - } - li:last-child { - border: none; - } - } - } - } - -} - - -.alert-message { - margin-top: -18px; - margin-bottom: 30px; -} - -footer { - background: $heading; - padding: 0.5em 0; - - .pills { - margin: 0; - a { - color: white; - text-shadow: 0 1px 1px rgba(0, 0, 0, 0.25); - } - a:hover { - background-color: #444; - } - } -} diff --git a/app/assets/stylesheets/lessons.css.scss b/app/assets/stylesheets/lessons.css.scss deleted file mode 100644 index 20d8b18c..00000000 --- a/app/assets/stylesheets/lessons.css.scss +++ /dev/null @@ -1,82 +0,0 @@ -/* Lessons menu */ -ul#lessons { - list-style-type: none; - margin: 0; - > li { - @include clearfix; - padding-bottom: 1em; - border-bottom: 1px solid #ccc; - margin-bottom: 1em; - .info { - @include columns(7); - .title { - font-size: 1.1em; - font-weight: bold; - margin-bottom: 0.2em; - } - } - .categories { - @include columns(4, last); - li { - float: right; - } - } - } -} - -/* Lesson content styles */ -#content-wrap.lesson { - .page-title { - margin-left: 3em; - } - #lesson-content { - padding-left: 3em; - max-width: 500px; - - h2 { - margin-top: 0.75em; - border-top: 1px solid #ccc; - padding-top: 0.5em; - } - - img { - @include border-radius; - @include box-shadow; - border: 1px solid #ccc; - padding: 0.75em; - } - } -} - -/* Category pills */ -ul.lesson-categories { - @include clearfix; - list-style-type: none; - margin: 0; - font-size: 0.9em; - - li { - float: left; - @include border-radius(50px); - padding: 0.25em 0.75em; - margin-right: 0.5em; - background: #ddd; - border: 1px solid #ccc; - } - - .beginner { - background-color: $green; - border-color: darken($green, 10%); - color: white; - } - .hackety { - background-color: $blue; - border-color: darken($blue, 10%); - color: white; - } - .shoes { - background-color: $orangered; - border-color: darken($orangered, 10%); - color: white; - } -} \ No newline at end of file diff --git a/app/assets/stylesheets/lib/bootstrap/adaptive.scss b/app/assets/stylesheets/lib/bootstrap/adaptive.scss deleted file mode 100644 index ef3054d3..00000000 --- a/app/assets/stylesheets/lib/bootstrap/adaptive.scss +++ /dev/null @@ -1,57 +0,0 @@ -/* Responsive.less - * Adjusted grid styles to handle some common screen sizes - * ------------------------------------------------------- */ - - -// MOBILE PORTRAIT & LANDSCAPE -// --------------------------- -// For devices narrower than 480px -@media only screen and (max-width: 480px) { - - // Remove fixed width of containers - .container { - width: auto; - padding: 0 10px; - } - - // Undo the floating of columns - .row { - margin-left: 0; - } - .row [class^="span"] { - float: none; - width: 100%; - display: block; - margin-left: 0; - } - - // Stack form elements instead of floating them - fieldset legend { - margin-left: 0; - } - label { - float: none; - width: auto; - text-align: left; - } - div.input { - margin-left: 0; - width: 100%; - } - .input-xxlarge, - input.xxlarge, - textarea.xxlarge, - select.xxlarge { - width: 80%; - } - - // Adjust modal - .modal-backdrop { - padding: 10px; - } - .modal { - width: 100%; - margin: 0; - left: auto; - } -} \ No newline at end of file diff --git a/app/assets/stylesheets/lib/bootstrap/bootstrap.scss b/app/assets/stylesheets/lib/bootstrap/bootstrap.scss deleted file mode 100644 index ac811a4c..00000000 --- a/app/assets/stylesheets/lib/bootstrap/bootstrap.scss +++ /dev/null @@ -1,23 +0,0 @@ -/*! - * Bootstrap @VERSION - * - * Copyright 2011 Twitter, Inc - * Licensed under the Apache License v2.0 - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Designed and built with all the love in the world @twitter by @mdo and @fat. - * Date: @DATE - */ - -// CSS Reset -@import "reset.scss"; - -// Core -@import "preboot.scss"; -@import "scaffolding.scss"; - -// Styled patterns and elements -@import "type.scss"; -@import "forms.scss"; -@import "tables.scss"; -@import "patterns.scss"; diff --git a/app/assets/stylesheets/lib/bootstrap/forms.scss b/app/assets/stylesheets/lib/bootstrap/forms.scss deleted file mode 100644 index be7c4546..00000000 --- a/app/assets/stylesheets/lib/bootstrap/forms.scss +++ /dev/null @@ -1,393 +0,0 @@ -/* Forms.less - * Base styles for various input types, form layouts, and states - * ------------------------------------------------------------- */ - - -// FORM STYLES -// ----------- - -form { - margin-bottom: $baseline; -} - -// Groups of fields with labels on top (legends) -fieldset { - margin-bottom: $baseline; - padding-top: $baseline; - legend { - display: block; - margin-left: 150px; - font-size: 20px; - line-height: 1; - *margin: 0 0 5px 145px; /* IE6-7 */ - *line-height: 1.5; /* IE6-7 */ - color: $grayDark; - } -} - -// Parent element that clears floats and wraps labels and fields together -.clearfix { - margin-bottom: $baseline; -} - -// Set font for forms -label, -input, -select, -textarea { - @include font-sans-serif(normal,13px,normal); -} - -// Float labels left -label { - padding-top: 6px; - font-size: 13px; - line-height: 18px; - float: left; - width: 130px; - text-align: right; - color: $grayDark; -} - -// Shift over the inside div to align all label's relevant content -div.input { - margin-left: 150px; -} - -// Checkboxs and radio buttons -input[type=checkbox], -input[type=radio] { - cursor: pointer; -} - -// Inputs, Textareas, Selects -input, -textarea, -select, -.uneditable-input { - display: inline-block; - width: 210px; - height: $baseline; - padding: 4px; - font-size: 13px; - line-height: $baseline; - color: $gray; - border: 1px solid #ccc; - @include border-radius(3px); -} - -/* mini reset for non-html5 file types */ -input[type=checkbox], -input[type=radio] { - width: auto; - height: auto; - padding: 0; - margin: 3px 0; - *margin-top: 0; /* IE6-7 */ - line-height: normal; - border: none; -} - -input[type=file] { - background-color: #fff; - padding: initial; - border: initial; - line-height: initial; - @include box-shadow(none); -} - -input[type=button], -input[type=reset], -input[type=submit] { - width: auto; - height: auto; -} - -select, -input[type=file] { - height: $baseline * 1.5; - line-height: $baseline * 1.5; -} - -textarea { - height: auto; -} - -.uneditable-input { - background-color: #eee; - display: block; - border-color: #ccc; - @include box-shadow(inset 0 1px 2px rgba(0,0,0,.075)); -} - -// Placeholder text gets special styles; can't be bundled together though for some reason -:-moz-placeholder { - color: $grayLight; -} -::-webkit-input-placeholder { - color: $grayLight; -} - -// Focus states -input, -select, textarea { - $transition: border linear .2s, box-shadow linear .2s; - @include transition($transition); - @include box-shadow(inset 0 1px 3px rgba(0,0,0,.1)); -} -input:focus, -textarea:focus { - outline: none; - border-color: rgba(82,168,236,.8); - $shadow: inset 0 1px 3px rgba(0,0,0,.1), 0 0 8px rgba(82,168,236,.6); - @include box-shadow($shadow); -} - -// Error styles -form div.error { - background: lighten($red, 57%); - padding: 10px 0; - margin: -10px 0 10px; - @include border-radius(4px); - $error-text: desaturate(lighten($red, 25%), 25%); - > label, - span.help-inline, - span.help-block { - color: $red; - } - input, - textarea { - border-color: $error-text; - @include box-shadow(0 0 3px rgba(171,41,32,.25)); - &:focus { - border-color: darken($error-text, 10%); - @include box-shadow(0 0 6px rgba(171,41,32,.5)); - } - } - .input-prepend, - .input-append { - span.add-on { - background: lighten($red, 50%); - border-color: $error-text; - color: darken($error-text, 10%); - } - } -} - -// Form element sizes -.input-mini, input.mini, textarea.mini, select.mini { - width: 60px; -} -.input-small, input.small, textarea.small, select.small { - width: 90px; -} -.input-medium, input.medium, textarea.medium, select.medium { - width: 150px; -} -.input-large, input.large, textarea.large, select.large { - width: 210px; -} -.input-xlarge, input.xlarge, textarea.xlarge, select.xlarge { - width: 270px; -} -.input-xxlarge, input.xxlarge, textarea.xxlarge, select.xxlarge { - width: 530px; -} -textarea.xxlarge { - overflow-y: scroll; -} - -// Turn off focus for disabled (read-only) form elements -input[readonly]:focus, -textarea[readonly]:focus, -input.disabled { - background: #f5f5f5; - border-color: #ddd; - @include box-shadow(none); -} - -// Actions (the buttons) -.actions { - background: #f5f5f5; - margin-top: $baseline; - margin-bottom: $baseline; - padding: ($baseline - 1) 20px $baseline 150px; - border-top: 1px solid #ddd; - @include border-radius(0 0 3px 3px); - .secondary-action { - float: right; - a { - line-height: 30px; - &:hover { - text-decoration: underline; - } - } - } -} - -// Help Text -.help-inline, -.help-block { - font-size: 12px; - line-height: $baseline; - color: $grayLight; -} -.help-inline { - padding-left: 5px; - *position: relative; /* IE6-7 */ - *top: -5px; /* IE6-7 */ -} - -// Big blocks of help text -.help-block { - display: block; - max-width: 600px; -} - -// Inline Fields (input fields that appear as inline objects -.inline-inputs { - color: $gray; - span, input { - display: inline-block; - } - input.mini { - width: 60px; - } - input.small { - width: 90px; - } - span { - padding: 0 2px 0 1px; - } -} - -// Allow us to put symbols and text within the input field for a cleaner look -.input-prepend, -.input-append { - input { - @include border-radius(0 3px 3px 0); - } - .add-on { - background: #f5f5f5; - float: left; - display: block; - width: auto; - min-width: 16px; - padding: 4px 4px 4px 5px; - color: $grayLight; - font-weight: normal; - line-height: 18px; - height: 18px; - text-align: center; - text-shadow: 0 1px 0 #fff; - border: 1px solid #ccc; - border-right-width: 0; - @include border-radius(3px 0 0 3px); - } - .active { - background: lighten($green, 30); - border-color: $green; - } -} -.input-prepend { - .add-on { - *margin-top: 1px; /* IE6-7 */ - } -} -.input-append { - input { - float: left; - @include border-radius(3px 0 0 3px); - } - .add-on { - @include border-radius(0 3px 3px 0); - border-right-width: 1px; - border-left-width: 0; - } -} - -// Stacked options for forms (radio buttons or checkboxes) -.inputs-list { - margin: 0 0 5px; - width: 100%; - li { - display: block; - padding: 0; - width: 100%; - label { - display: block; - float: none; - width: auto; - padding: 0; - line-height: $baseline; - text-align: left; - white-space: normal; - strong { - color: $gray; - } - small { - font-size: 12px; - font-weight: normal; - } - } - ul.inputs-list { - margin-left: 25px; - margin-bottom: 10px; - padding-top: 0; - } - &:first-child { - padding-top: 5px; - } - } - input[type=radio], - input[type=checkbox] { - margin-bottom: 0; - } -} - -// Stacked forms -.form-stacked { - padding-left: 20px; - fieldset { - padding-top: $baseline / 2; - } - legend { - margin-left: 0; - } - label { - display: block; - float: none; - width: auto; - font-weight: bold; - text-align: left; - line-height: 20px; - padding-top: 0; - } - .clearfix { - margin-bottom: $baseline / 2; - div.input { - margin-left: 0; - } - } - .inputs-list { - margin-bottom: 0; - li { - padding-top: 0; - label { - font-weight: normal; - padding-top: 0; - } - } - } - div.error { - padding-top: 10px; - padding-bottom: 10px; - padding-left: 10px; - margin-top: 0; - margin-left: -10px; - } - .actions { - margin-left: -20px; - padding-left: 20px; - } -} diff --git a/app/assets/stylesheets/lib/bootstrap/patterns.scss b/app/assets/stylesheets/lib/bootstrap/patterns.scss deleted file mode 100644 index 2a6ae7fd..00000000 --- a/app/assets/stylesheets/lib/bootstrap/patterns.scss +++ /dev/null @@ -1,816 +0,0 @@ -/* Patterns.less - * Repeatable UI elements outside the base styles provided from the scaffolding - * ---------------------------------------------------------------------------- */ - - -// TOPBAR -// ------ - -// Topbar for Branding and Nav -.topbar { - height: 40px; - position: fixed; - top: 0; - left: 0; - right: 0; - z-index: 10000; - overflow: visible; - - // Links get text shadow - a { - color: $grayLight; - text-shadow: 0 -1px 0 rgba(0,0,0,.25); - } - - // Hover and active states - a:hover, - ul .active a { - background-color: #333; - background-color: rgba(255,255,255,.05); - color: $white; - text-decoration: none; - } - - // Website name - h3 { - position: relative; - a { - float: left; - display: block; - padding: 8px 20px 12px; - margin-left: -20px; // negative indent to left-align the text down the page - color: $white; - font-size: 20px; - font-weight: 200; - line-height: 1; - } - } - - // Search Form - form { - float: left; - margin: 5px 0 0 0; - position: relative; - @include opacity(100); - } - input { - background-color: #444; - background-color: rgba(255,255,255,.3); - @include font-sans-serif(13px, normal, 1); - padding: 4px 9px; - color: #fff; - color: rgba(255,255,255,.75); - border: 1px solid #111; - @include border-radius(4px); - $shadow: inset 0 1px 2px rgba(0,0,0,.1), 0 1px 0px rgba(255,255,255,.25); - @include box-shadow($shadow); - @include transition(none); - - // Placeholder text gets special styles; can't be bundled together though for some reason - &:-moz-placeholder { - color: $grayLighter; - } - &::-webkit-input-placeholder { - color: $grayLighter; - } - // Hover states - &:hover { - background-color: $grayLight; - background-color: rgba(255,255,255,.5); - color: #fff; - } - // Focus states (we use .focused since IE8 and down doesn't support :focus) - &:focus, - &.focused { - outline: none; - background-color: #fff; - color: $grayDark; - text-shadow: 0 1px 0 #fff; - border: 0; - padding: 5px 10px; - @include box-shadow(0 0 3px rgba(0,0,0,.15)); - } - } -} - -// gradient is applied to it's own element because overflow visible is not honored by ie when filter is present -// For backwards compatability, include .topbar .fill -.topbar-inner, -.topbar .fill { - background-color: #222; - @include gradient-vertical(#333, #222); - $shadow: 0 1px 3px rgba(0,0,0,.25), inset 0 -1px 0 rgba(0,0,0,.1); - @include box-shadow($shadow); -} - -// NAVIGATION -// ---------- - -// Topbar Nav -// ul.nav for all topbar based navigation to avoid inheritance issues and over-specificity -// For backwards compatibility, leave in .topbar div > ul -.topbar div > ul, -.nav { - display: block; - float: left; - margin: 0 10px 0 0; - position: relative; - left: 0; - > li { - display: block; - float: left; - } - a { - display: block; - float: none; - padding: 10px 10px 11px; - line-height: 19px; - text-decoration: none; - &:hover { - color: #fff; - text-decoration: none; - } - } - .active a { - background-color: #222; - background-color: rgba(0,0,0,.5); - } - - // Secondary (floated right) nav in topbar - &.secondary-nav { - float: right; - margin-left: 10px; - margin-right: 0; - // backwards compatibility - .menu-dropdown, - .dropdown-menu { - right: 0; - } - } - // Dropdowns within the .nav - // a.menu:hover and li.open .menu for backwards compatibility - a.menu:hover, - li.open .menu, - .dropdown-toggle:hover, - .dropdown.open .dropdown-toggle { - background: #444; - background: rgba(255,255,255,.05); - } - // .menu-dropdown for backwards compatibility - .menu-dropdown, - .dropdown-menu { - background-color: #333; - // a.menu for backwards compatibility - a.menu, - .dropdown-toggle { - color: #fff; - &.open { - background: #444; - background: rgba(255,255,255,.05); - } - } - li a { - color: #999; - text-shadow: 0 1px 0 rgba(0,0,0,.5); - &:hover { - @include gradient-vertical(#292929,#191919); - color: #fff; - } - } - .divider { - background-color: #222; - border-color: #444; - } - } -} - -// For backwards compatability with new dropdowns, redeclare dropdown link padding -.topbar ul .menu-dropdown li a, -.topbar ul .dropdown-menu li a { - padding: 4px 15px; -} - -// Dropdown Menus -// Use the .menu class on any
  • element within the topbar or ul.tabs and you'll get some superfancy dropdowns -// li.menu for backwards compatibility -li.menu, -.dropdown { - position: relative; -} -// The link that is clicked to toggle the dropdown -// a.menu for backwards compatibility -a.menu:after, -.dropdown-toggle:after { - width: 0; - height: 0; - display: inline-block; - content: "↓"; - text-indent: -99999px; - vertical-align: top; - margin-top: 8px; - margin-left: 4px; - border-left: 4px solid transparent; - border-right: 4px solid transparent; - border-top: 4px solid #fff; - @include opacity(50); -} -// The dropdown menu (ul) -// .menu-dropdown for backwards compatibility -.menu-dropdown, -.dropdown-menu { - background-color: #fff; - float: left; - display: none; // None by default, but block on "open" of the menu - position: absolute; - top: 40px; - min-width: 160px; - max-width: 220px; - _width: 160px; - margin-left: 0; // override default ul styles - margin-right: 0; - padding: 6px 0; - zoom: 1; // do we need this? - border-color: #999; - border-color: rgba(0,0,0,.2); - border-style: solid; - border-width: 0 1px 1px; - @include border-radius(0 0 6px 6px); - @include box-shadow(0 2px 4px rgba(0,0,0,.2)); - @include background-clip(padding-box); - - // Unfloat any li's to make them stack - li { - float: none; - display: block; - background-color: none; - } - // Dividers (basically an hr) within the dropdown - .divider { - height: 1px; - margin: 5px 0; - overflow: hidden; - background-color: #eee; - border-bottom: 1px solid #fff; - } -} - -.topbar .dropdown-menu, .dropdown-menu { - // Links within the dropdown menu - a { - display: block; - padding: 4px 15px; - clear: both; - font-weight: normal; - line-height: 18px; - color: $gray; - text-shadow: 0 1px 0 #fff; - // Hover state - &:hover { - @include gradient-vertical(#eeeeee, #dddddd); - color: $grayDark; - text-decoration: none; - $shadow: inset 0 1px 0 rgba(0,0,0,.025), inset 0 -1px rgba(0,0,0,.025); - @include box-shadow($shadow); - } - } -} - -// Open state for the dropdown -// .open for backwards compatibility -.open, -.dropdown.open { - // .menu for backwards compatibility - .menu, - .dropdown-toggle { - color: #fff; - background: #ccc; - background: rgba(0,0,0,.3); - } - // .menu-dropdown for backwards compatibility - .menu-dropdown, - .dropdown-menu { - display: block; - } -} - - -// Tabs and Pills -.tabs, -.pills { - margin: 0 0 20px; - padding: 0; - list-style: none; - @include clearfix; - > li { - float: left; - > a { - display: block; - } - } -} - -// Basic Tabs -.tabs { - width: 100%; - border-bottom: 1px solid #ddd; - > li { - position: relative; // For the dropdowns mostly - top: 1px; - > a { - margin-right: 2px; - padding: 0 15px; - line-height: ($baseline * 2) - 1; - @include border-radius(4px 4px 0 0); - &:hover { - background-color: #eee; - border-bottom: 1px solid #ddd; - text-decoration: none; - } - } - &.active > a { - background-color: #fff; - padding: 0 14px; - border: 1px solid #ddd; - border-bottom: 0; - color: $gray; - } - } - // first one for backwards compatibility - .menu-dropdown, - .dropdown-menu { - top: 35px; - border-width: 1px; - @include border-radius(0 6px 6px 6px); - } - // first one for backwards compatibility - a.menu:after, - .dropdown-toggle:after { - border-top-color: #999; - margin-top: 15px; - margin-left: 5px; - } - // first one for backwards compatibility - li.open a.menu:after, - .dropdown.open .dropdown-toggle:after { - border-top-color: #555; - } -} - -// Basic pill nav -.pills { - a { - margin: 5px 3px 5px 0; - padding: 0 15px; - text-shadow: 0 1px 1px #fff; - line-height: 30px; - @include border-radius(15px); - &:hover { - background: $linkColorHover; - color: #fff; - text-decoration: none; - text-shadow: 0 1px 1px rgba(0,0,0,.25); - } - } - .active a { - background: $linkColor; - color: #fff; - text-shadow: 0 1px 1px rgba(0,0,0,.25); - } -} - - -// PAGE HEADERS -// ------------ - -.hero-unit { - background-color: #f5f5f5; - margin-top: 60px; - margin-bottom: 30px; - padding: 60px; - @include border-radius(6px); - h1 { - margin-bottom: 0; - font-size: 60px; - line-height: 1; - letter-spacing: -1px; - } - p { - font-size: 18px; - font-weight: 200; - line-height: $baseline * 1.5; - } -} -footer { - margin-top: $baseline - 1; - padding-top: $baseline - 1; - border-top: 1px solid #ddd; -} - - -// PAGE HEADERS -// ------------ - -.page-header { - margin-bottom: $baseline - 1; - border-bottom: 1px solid #ddd; - @include box-shadow(0 1px 0 rgba(255,255,255,.5)); - h1 { - margin-bottom: ($baseline / 2) - 1px; - } -} - - -// BUTTON STYLES -// ------------- - -// Base .btn styles -.btn { - // Button Base - cursor: pointer; - display: inline-block; - @include gradient-vertical-three-colors(#ffffff, #ffffff, 25%, darken(#ffffff, 10%)); // Don't use .gradientbar() here since it does a three-color gradient - padding: 5px 14px 6px; - text-shadow: 0 1px 1px rgba(255,255,255,.75); - color: #333; - font-size: 13px; - line-height: normal; - border: 1px solid #ccc; - border-bottom-color: #bbb; - @include border-radius(4px); - $shadow: inset 0 1px 0 rgba(255,255,255,.2), 0 1px 2px rgba(0,0,0,.05); - @include box-shadow($shadow); - - &:hover { - background-position: 0 -15px; - color: #333; - text-decoration: none; - } - - // Primary Button Type - &.primary { - color:#fff; - @include gradient-bar($green, $green - #333) - } - - // Transitions - @include transition(.1s linear all); - - // Active and Disabled states - &:active { - $shadow: inset 0 2px 4px rgba(0,0,0,.25), 0 1px 2px rgba(0,0,0,.05); - @include box-shadow($shadow); - } - &.disabled { - cursor: default; - background-image: none; - @include reset-filter; - @include opacity(65); - @include box-shadow(none); - } - &[disabled] { - // disabled pseudo can't be included with .disabled - // def because IE8 and below will drop it ;_; - cursor: default; - background-image: none; - @include reset-filter; - @include opacity(65); - @include box-shadow(none); - } - - // Button Sizes - &.large { - font-size: 16px; - line-height: normal; - padding: 9px 14px 9px; - @include border-radius(6px); - } - &.small { - padding: 7px 9px 7px; - font-size: 11px; - } -} -// Super jank hack for removing border-radius from IE9 so we can keep filter gradients on alerts and buttons -:root .alert-message, -:root .btn { - border-radius: 0 \0; -} - -// Help Firefox not be a jerk about adding extra padding to buttons -button.btn, -input[type=submit].btn { - &::-moz-focus-inner { - padding: 0; - border: 0; - } -} - - -// ERROR STYLES -// ------------ - -// Base alert styles -.alert-message { - @include gradient-bar(#fceec1, #eedc94); // warning by default - margin-bottom: $baseline; - padding: 7px 14px; - color: $grayDark; - text-shadow: 0 1px 0 rgba(255,255,255,.5); - border-width: 1px; - border-style: solid; - @include border-radius(4px); - @include box-shadow(inset 0 1px 0 rgba(255,255,255,.25)); - - // Remove extra margin from content - h5 { - line-height: $baseline; - } - p { - margin-bottom: 0; - } - div { - margin-top: 5px; - margin-bottom: 2px; - line-height: 28px; - } - .btn { - // Provide actions with buttons - @include box-shadow(0 1px 0 rgba(255,255,255,.25)); - } - .close { - float: right; - margin-top: -2px; - color: $black; - font-size: 20px; - font-weight: bold; - text-shadow: 0 1px 0 rgba(255,255,255,1); - @include opacity(20); - &:hover { - color: $black; - text-decoration: none; - @include opacity(40); - } - } - &.block-message { - background-image: none; - background-color: lighten(#fceec1, 5%); - @include reset-filter; - padding: 14px; - border-color: #fceec1; - @include box-shadow(none); - - p { - margin-right: 30px; - } - .alert-actions { - margin-top: 5px; - } - &.error, - &.success, - &.info { - color: $grayDark; - text-shadow: 0 1px 0 rgba(255,255,255,.5); - } - &.error { - background-color: lighten(#f56a66, 25%); - border-color: lighten(#f56a66, 20%); - } - &.success { - background-color: lighten(#62c462, 30%); - border-color: lighten(#62c462, 25%); - } - &.info { - background-color: lighten(#6bd0ee, 25%); - border-color: lighten(#6bd0ee, 20%); - } - } -} - - -// PAGINATION -// ---------- - -.pagination { - height: $baseline * 2; - margin: $baseline 0; - ul { - float: left; - margin: 0; - border: 1px solid #ddd; - border: 1px solid rgba(0,0,0,.15); - @include border-radius(3px); - @include box-shadow(0 1px 2px rgba(0,0,0,.05)); - } - li { - display: inline; - } - a, em, .disabled { - float: left; - padding: 0 14px; - font-style: normal; - line-height: ($baseline * 2) - 2; - border-right: 1px solid; - border-right-color: #ddd; - border-right-color: rgba(0,0,0,.15); - *border-right-color: #ddd; /* IE6-7 */ - text-decoration: none; - } - a:hover, - &.active a { - background-color: lighten($blue, 45%); - } - &.disabled a, - &.disabled a:hover { - background-color: transparent; - color: $grayLight; - } - &.next a { - border: 0; - } -} - - -// WELLS -// ----- - -.well { - background-color: #f5f5f5; - margin-bottom: 20px; - padding: 19px; - min-height: 20px; - border: 1px solid #eee; - border: 1px solid rgba(0,0,0,.05); - @include border-radius(4px); - @include box-shadow(inset 0 1px 1px rgba(0,0,0,.05)); -} - - -// MODALS -// ------ - -.modal-backdrop { - background-color: rgba(0,0,0,.5); - position: fixed; - top: 0; - left: 0; - right: 0; - bottom: 0; - z-index: 1000; -} -.modal { - position: fixed; - top: 50%; - left: 50%; - z-index: 2000; - width: 560px; - margin: -280px 0 0 -250px; - background-color: $white; - border: 1px solid #999; - border: 1px solid rgba(0,0,0,.3); - *border: 1px solid #999; /* IE6-7 */ - @include border-radius(6px); - @include box-shadow(0 3px 7px rgba(0,0,0,0.3)); - @include background-clip(padding-box); -} -.modal-header { - border-bottom: 1px solid #eee; - padding: 5px 20px; - .close { - position: absolute; - right: 10px; - top: 10px; - color: #999; - line-height:10px; - font-size: 18px; - } -} -.modal-body { - padding: 20px; -} -.modal-footer { - background-color: #f5f5f5; - padding: 14px 20px 15px; - border-top: 1px solid #ddd; - @include border-radius(0 0 6px 6px); - @include box-shadow(inset 0 1px 0 #fff); - @include clearfix; - margin-bottom: 0; - .btn { - float: right; - margin-left: 10px; - } -} - - -// POPOVER ARROWS -// -------------- - -@mixin popover-arrow-above($arrowWidth: 5px) { - bottom: 0; - left: 50%; - margin-left: -$arrowWidth; - border-left: $arrowWidth solid transparent; - border-right: $arrowWidth solid transparent; - border-top: $arrowWidth solid #000; -} -@mixin popover-arrow-left($arrowWidth: 5px) { - top: 50%; - right: 0; - margin-top: -$arrowWidth; - border-top: $arrowWidth solid transparent; - border-bottom: $arrowWidth solid transparent; - border-left: $arrowWidth solid #000; -} -@mixin popover-arrow-below($arrowWidth: 5px) { - top: 0; - left: 50%; - margin-left: -$arrowWidth; - border-left: $arrowWidth solid transparent; - border-right: $arrowWidth solid transparent; - border-bottom: $arrowWidth solid #000; -} -@mixin popover-arrow-right($arrowWidth: 5px) { - top: 50%; - left: 0; - margin-top: -$arrowWidth; - border-top: $arrowWidth solid transparent; - border-bottom: $arrowWidth solid transparent; - border-right: $arrowWidth solid #000; -} - -// TWIPSY -// ------ - -.twipsy { - display: block; - position: absolute; - visibility: visible; - padding: 5px; - font-size: 11px; - z-index: 1000; - @include opacity(80); - &.above .twipsy-arrow { @include popover-arrow-above; } - &.left .twipsy-arrow { @include popover-arrow-left; } - &.below .twipsy-arrow { @include popover-arrow-below; } - &.right .twipsy-arrow { @include popover-arrow-right; } -} -.twipsy-inner { - padding: 3px 8px; - background-color: #000; - color: white; - text-align: center; - max-width: 200px; - text-decoration: none; - @include border-radius(4px); -} -.twipsy-arrow { - position: absolute; - width: 0; - height: 0; -} - - -// POPOVERS -// -------- - -.popover { - position: absolute; - top: 0; - left: 0; - z-index: 1000; - padding: 5px; - display: none; - &.above .arrow { @include popover-arrow-above; } - &.right .arrow { @include popover-arrow-right; } - &.below .arrow { @include popover-arrow-below; } - &.left .arrow { @include popover-arrow-left; } - .arrow { - position: absolute; - width: 0; - height: 0; - } - .inner { - background: #333; - background: rgba(0,0,0,.8); - padding: 3px; - overflow: hidden; - width: 280px; - @include border-radius(6px); - @include box-shadow(0 3px 7px rgba(0,0,0,0.3)); - } - .title { - background-color: #f5f5f5; - padding: 9px 15px; - line-height: 1; - @include border-radius(3px 3px 0 0); - border-bottom:1px solid #eee; - } - .content { - background-color: $white; - padding: 14px; - @include border-radius(0 0 3px 3px); - @include background-clip(padding-box); - p, ul, ol { - margin-bottom: 0; - } - } -} diff --git a/app/assets/stylesheets/lib/bootstrap/preboot.scss b/app/assets/stylesheets/lib/bootstrap/preboot.scss deleted file mode 100644 index 82af2bae..00000000 --- a/app/assets/stylesheets/lib/bootstrap/preboot.scss +++ /dev/null @@ -1,290 +0,0 @@ -/* Preboot.less - * Variables and mixins to pre-ignite any new web development project - * ------------------------------------------------------------------ */ - - -// VARIABLES -// --------- - -// Links -$linkColor: #04BFBF; -$linkColorHover: darken($linkColor, 10); - -// Grays -$black: #000; -$grayDark: lighten($black, 25%); -$gray: lighten($black, 50%); -$grayLight: lighten($black, 75%); -$grayLighter: lighten($black, 90%); -$white: #fff; - -// Accent Colors -$blue: #04BFBF; -$blueDark: #008a8a; -$green: #C0D966 - #111; -$red: #9d261d; -$yellow: #ffc40d; -$orange: #f89406; -$pink: #c3325f; -$purple: #7a43b6; - -// Baseline grid -$basefont: 13px; -$baseline: 18px; - -// Griditude -$gridColumns: 16; -$gridColumnWidth: 40px; -$gridGutterWidth: 20px; -$extraSpace: ($gridGutterWidth * 2); // For our grid calculations -$siteWidth: ($gridColumns * $gridColumnWidth) + ($gridGutterWidth * ($gridColumns - 1)); - -// Color Scheme -$baseColor: $blue; // Set a base color -$complement: spin($baseColor, 180); // Determine a complementary color -$split1: spin($baseColor, 158); // Split complements -$split2: spin($baseColor, -158); -$triad1: spin($baseColor, 135); // Triads colors -$triad2: spin($baseColor, -135); -$tetra1: spin($baseColor, 90); // Tetra colors -$tetra2: spin($baseColor, -90); -$analog1: spin($baseColor, 22); // Analogs colors -$analog2: spin($baseColor, -22); - - -// MIXINS -// ------ - -// Clearfix for clearing floats like a boss h5bp.com/q -@mixin clearfix { - zoom: 1; - &:before, &:after { - display: table; - content: ""; - } - &:after { - clear: both; - } -} - -.clearfix { - @include clearfix; -} - -// Center-align a block level element -.center-block { - display: block; - margin: 0 auto; -} - -// Sizing shortcuts -@mixin size($height: 5px, $width: 5px) { - height: $height; - width: $width; -} -@mixin square($size: 5px) { - @include size($size, $size); -} - -// Input placeholder text -@mixin placeholder($color: $grayLight) { - :-moz-placeholder { - color: $color; - } - ::-webkit-input-placeholder { - color: $color; - } -} - -// Font Stacks -@mixin font-shorthand($weight: normal, $size: 14px, $lineHeight: 20px) { - font-size: $size; - font-weight: $weight; - line-height: $lineHeight; -} -@mixin font-sans-serif($weight: normal, $size: 14px, $lineHeight: 20px) { - font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; - font-size: $size; - font-weight: $weight; - line-height: $lineHeight; -} -@mixin font-serif($weight: normal, $size: 14px, $lineHeight: 20px) { - font-family: "Georgia", Times New Roman, Times, serif; - font-size: $size; - font-weight: $weight; - line-height: $lineHeight; -} -@mixin font-monospace($weight: normal, $size: 12px, $lineHeight: 20px) { - font-family: "Monaco", Courier New, monospace; - font-size: $size; - font-weight: $weight; - line-height: $lineHeight; -} - -// Grid System -.container { - width: $siteWidth; - margin: 0 auto; - @include clearfix; -} -@mixin columns($columnSpan: 1, $last: false) { - width: ($gridColumnWidth * $columnSpan) + ($gridGutterWidth * ($columnSpan - 1)); - display: inline; - float: left; - - @if $last { - margin-right: 0; - } - @else { - margin-right: $gridGutterWidth; - } -} - -@mixin offset($columnOffset: 1) { - margin-left: ($gridColumnWidth * $columnOffset) + ($gridGutterWidth * ($columnOffset - 1)) + $extraSpace; -} - -// Border Radius -@mixin border-radius($radius: 5px) { - -webkit-border-radius: $radius; - -moz-border-radius: $radius; - border-radius: $radius; -} - -// Drop shadows -@mixin box-shadow($shadow: 0 1px 3px rgba(0,0,0,.25)) { - -webkit-box-shadow: $shadow; - -moz-box-shadow: $shadow; - box-shadow: $shadow; -} - -// Transitions -@mixin transition($transition) { - -webkit-transition: $transition; - -moz-transition: $transition; - transition: $transition; -} - -// Background clipping -@mixin background-clip($clip) { - -webkit-background-clip: $clip; - -moz-background-clip: $clip; - background-clip: $clip; -} - -// CSS3 Content Columns -@mixin content-columns($columnCount, $columnGap: 20px) { - -webkit-column-count: $columnCount; - -moz-column-count: $columnCount; - column-count: $columnCount; - -webkit-column-gap: $columnGap; - -moz-column-gap: $columnGap; - column-gap: $columnGap; -} - - -// Add an alphatransparency value to any background or border color (via Elyse Holladay) -@mixin translucent-background($color: $white, $alpha: 1) { - background-color: hsla(hue($color), saturation($color), lightness($color), $alpha); -} -@mixin translucent-border($color: $white, $alpha: 1) { - border-color: hsla(hue($color), saturation($color), lightness($color), $alpha); - background-clip: padding-box; -} - -// Gradients -@mixin gradient-horizontal ($startColor: #555, $endColor: #333) { - background-color: $endColor; - background-repeat: repeat-x; - background-image: -khtml-gradient(linear, left top, right top, from($startColor), to($endColor)); // Konqueror - background-image: -moz-linear-gradient(left, $startColor, $endColor); // FF 3.6+ - background-image: -ms-linear-gradient(left, $startColor, $endColor); // IE10 - background-image: -webkit-gradient(linear, left top, right top, color-stop(0%, $startColor), color-stop(100%, $endColor)); // Safari 4+, Chrome 2+ - background-image: -webkit-linear-gradient(left, $startColor, $endColor); // Safari 5.1+, Chrome 10+ - background-image: -o-linear-gradient(left, $startColor, $endColor); // Opera 11.10 - background-image: linear-gradient(left, $startColor, $endColor); // Le standard - filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#{$startColor}', endColorstr='#{$endColor}', GradientType=1); // IE9 and down -} -@mixin gradient-vertical ($startColor: #555, $endColor: #333) { - background-color: $endColor; - background-repeat: repeat-x; - background-image: -khtml-gradient(linear, left top, left bottom, from($startColor), to($endColor)); // Konqueror - background-image: -moz-linear-gradient(top, $startColor, $endColor); // FF 3.6+ - background-image: -ms-linear-gradient(top, $startColor, $endColor); // IE10 - background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0%, $startColor), color-stop(100%, $endColor)); // Safari 4+, Chrome 2+ - background-image: -webkit-linear-gradient(top, $startColor, $endColor); // Safari 5.1+, Chrome 10+ - background-image: -o-linear-gradient(top, $startColor, $endColor); // Opera 11.10 - background-image: linear-gradient(top, $startColor, $endColor); // The standard - filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#{$startColor}', endColorstr='#{$endColor}', GradientType=0); // IE9 and down -} -@mixin gradient-directional ($startColor: #555, $endColor: #333, $deg: 45deg) { - background-color: $endColor; - background-repeat: repeat-x; - background-image: -moz-linear-gradient($deg, $startColor, $endColor); // FF 3.6+ - background-image: -ms-linear-gradient($deg, $startColor, $endColor); // IE10 - background-image: -webkit-linear-gradient($deg, $startColor, $endColor); // Safari 5.1+, Chrome 10+ - background-image: -o-linear-gradient($deg, $startColor, $endColor); // Opera 11.10 - background-image: linear-gradient($deg, $startColor, $endColor); // The standard -} -@mixin gradient-vertical-three-colors($startColor: #00b3ee, $midColor: #7a43b6, $colorStop: 50%, $endColor: #c3325f) { - background-color: $endColor; - background-repeat: no-repeat; - background-image: -webkit-gradient(linear, 0 0, 0 100%, from($startColor), color-stop($colorStop, $midColor), to($endColor)); - background-image: -webkit-linear-gradient($startColor, $midColor $colorStop, $endColor); - background-image: -moz-linear-gradient($startColor, $midColor $colorStop, $endColor); - background-image: -ms-linear-gradient($startColor, $midColor $colorStop, $endColor); - background-image: -o-linear-gradient($startColor, $midColor $colorStop, $endColor); - background-image: linear-gradient($startColor, $midColor $colorStop, $endColor); - filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#{$startColor}', endColorstr='#{$endColor}', GradientType=0); // IE9 and down, gets no color-stop at all for proper fallback -} - -// Gradient Bar Colors for buttons and allerts -@mixin gradient-bar($primaryColor, $secondaryColor) { - @include gradient-vertical($primaryColor, $secondaryColor); - text-shadow: 0 -1px 0 rgba(0,0,0,.25); - border-color: $secondaryColor $secondaryColor darken($secondaryColor, 15%); - border-color: rgba(0,0,0,.1) rgba(0,0,0,.1) fadein(rgba(0,0,0,.1), 15%); -} - -// Shared colors for buttons and alerts -.btn, -.alert-message { - // Set text color - &.danger, - &.danger:hover, - &.error, - &.error:hover, - &.success, - &.success:hover, - &.info, - &.info:hover { - color: $white - } - // Danger and error appear as red - &.danger, - &.error { - @include gradient-bar(#ee5f5b, #c43c35); - } - // Success appears as green - &.success { - @include gradient-bar(#C0D966 - #111, #C0D966 - #222); - } - // Info appears as a neutral blue - &.info { - @include gradient-bar(#5bc0de, #339bb9); - } -} - - -// Reset filters for IE -@mixin reset-filter { - filter: progid:DXImageTransform.Microsoft.gradient(enabled = false); -} - -// Opacity -@mixin opacity($opacity: 100) { - filter: "alpha(opacity=#{$opacity})"; - -khtml-opacity: $opacity / 100; - -moz-opacity: $opacity / 100; - opacity: $opacity / 100; -} diff --git a/app/assets/stylesheets/lib/bootstrap/reset.scss b/app/assets/stylesheets/lib/bootstrap/reset.scss deleted file mode 100644 index 9e2c6bef..00000000 --- a/app/assets/stylesheets/lib/bootstrap/reset.scss +++ /dev/null @@ -1,136 +0,0 @@ -/* Reset.less - * Props to Eric Meyer (meyerweb.com) for his CSS reset file. We're using an adapted version here that cuts out some of the reset HTML elements we will never need here (i.e., dfn, samp, etc). - * ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- */ - - -// ERIC MEYER RESET -// -------------------------------------------------- - -html, body { margin: 0; padding: 0; } -h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, cite, code, del, dfn, em, img, q, s, samp, small, strike, strong, sub, sup, tt, var, dd, dl, dt, li, ol, ul, fieldset, form, label, legend, button, table, caption, tbody, tfoot, thead, tr, th, td { margin: 0; padding: 0; border: 0; font-weight: normal; font-style: normal; font-size: 100%; line-height: 1; font-family: inherit; } -table { border-collapse: collapse; border-spacing: 0; } -ol, ul { list-style: none; } -q:before, q:after, blockquote:before, blockquote:after { content: ""; } - - -// Normalize.css -// Pulling in select resets form the normalize.css project -// -------------------------------------------------- - -// Display in IE6-9 and FF3 -// ------------------------- -// Source: http://github.com/necolas/normalize.css -html { - overflow-y: scroll; - font-size: 100%; - -webkit-text-size-adjust: 100%; - -ms-text-size-adjust: 100%; -} -// Focus states -a:focus { - outline: thin dotted; -} - -// Display in IE6-9 and FF3 -// ------------------------- -// Source: http://github.com/necolas/normalize.css -article, -aside, -details, -figcaption, -figure, -footer, -header, -hgroup, -nav, -section { - display: block; -} - -// Display block in IE6-9 and FF3 -// ------------------------- -// Source: http://github.com/necolas/normalize.css -audio, -canvas, -video { - display: inline-block; - *display: inline; - *zoom: 1; -} - -// Prevents modern browsers from displaying 'audio' without controls -// ------------------------- -// Source: http://github.com/necolas/normalize.css -audio:not([controls]) { - display: none; -} - -// Prevents sub and sup affecting line-height in all browsers -// ------------------------- -// Source: http://github.com/necolas/normalize.css -sub, -sup { - font-size: 75%; - line-height: 0; - position: relative; - vertical-align: baseline; -} -sup { - top: -0.5em; -} -sub { - bottom: -0.25em; -} - -// Img border in a's and image quality -// ------------------------- -// Source: http://github.com/necolas/normalize.css -img { - border: 0; - -ms-interpolation-mode: bicubic; -} - -// Forms -// ------------------------- -// Source: http://github.com/necolas/normalize.css - -// Font size in all browsers, margin changes, misc consistency -button, -input, -select, -textarea { - font-size: 100%; - margin: 0; - vertical-align: baseline; - *vertical-align: middle; -} -button, -input { - line-height: normal; // FF3/4 have !important on line-height in UA stylesheet - *overflow: visible; // Inner spacing ie IE6/7 -} -button::-moz-focus-inner, -input::-moz-focus-inner { // Inner padding and border oddities in FF3/4 - border: 0; - padding: 0; -} -button, -input[type="button"], -input[type="reset"], -input[type="submit"] { - cursor: pointer; // Cursors on all buttons applied consistently - -webkit-appearance: button; // Style clicable inputs in iOS -} -input[type="search"] { // Appearance in Safari/Chrome - -webkit-appearance: textfield; - -webkit-box-sizing: content-box; - -moz-box-sizing: content-box; - box-sizing: content-box; -} -input[type="search"]::-webkit-search-decoration { - -webkit-appearance: none; // Inner-padding issues in Chrome OSX, Safari 5 -} -textarea { - overflow: auto; // Remove vertical scrollbar in IE6-9 - vertical-align: top; // Readability and alignment cross-browser -} \ No newline at end of file diff --git a/app/assets/stylesheets/lib/bootstrap/scaffolding.scss b/app/assets/stylesheets/lib/bootstrap/scaffolding.scss deleted file mode 100644 index 3a6eced9..00000000 --- a/app/assets/stylesheets/lib/bootstrap/scaffolding.scss +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Scaffolding - * Basic and global styles for generating a grid system, structural layout, and page templates - * ------------------------------------------------------------------------------------------- */ - -// STRUCTURAL LAYOUT -// ----------------- - -html, body { - background-color: #fff; -} -body { - margin: 0; - @include font-sans-serif(normal,$basefont,$baseline); - color: $gray; -} - -// Container (centered, fixed-width layouts) -.container { - width: 940px; - margin: 0 auto; -} - -// Fluid layouts (left aligned, with sidebar, min- & max-width content) -.container-fluid { - padding: 0 20px; - @include clearfix; - > .sidebar { - float: left; - width: 220px; - } - // TODO in v2: rename this and .popover .content to be more specific - > .content { - min-width: 700px; - max-width: 1180px; - margin-left: 240px; - } -} - - -// BASE STYLES -// ----------- - -// Links -a { - color: $linkColor; - text-decoration: none; - line-height: inherit; - font-weight: inherit; - &:hover { - color: $linkColorHover; - text-decoration: underline; - } -} \ No newline at end of file diff --git a/app/assets/stylesheets/lib/bootstrap/tables.scss b/app/assets/stylesheets/lib/bootstrap/tables.scss deleted file mode 100644 index deedadf2..00000000 --- a/app/assets/stylesheets/lib/bootstrap/tables.scss +++ /dev/null @@ -1,148 +0,0 @@ -/* - * Tables.less - * Tables for, you guessed it, tabular data - * ---------------------------------------- */ - - -// BASELINE STYLES -// --------------- - -table { - width: 100%; - margin-bottom: $baseline; - padding: 0; - border-collapse: separate; - font-size: 13px; - th, td { - padding: 10px 10px 9px; - line-height: $baseline * .75; - text-align: left; - vertical-align: middle; - border-bottom: 1px solid #ddd; - } - th { - padding-top: 9px; - font-weight: bold; - border-bottom-width: 2px; - } -} - - -// ZEBRA-STRIPING -// -------------- - -// Default zebra-stripe styles (alternating gray and transparent backgrounds) -.zebra-striped { - tbody { - tr:nth-child(odd) td { - background-color: #f9f9f9; - } - tr:hover td { - background-color: #f5f5f5; - } - } - - // Tablesorting styles w/ jQuery plugin - .header { - cursor: pointer; - &:after { - content: ""; - float: right; - margin-top: 7px; - border-width: 0 4px 4px; - border-style: solid; - border-color: #000 transparent; - visibility: hidden; - } - } - // Style the sorted column headers (THs) - .headerSortUp, - .headerSortDown { - background-color: rgba(141,192,219,.25); - text-shadow: 0 1px 1px rgba(255,255,255,.75); - @include border-radius(3px 3px 0 0); - } - // Style the ascending (reverse alphabetical) column header - .header:hover { - &:after { - visibility:visible; - } - } - // Style the descending (alphabetical) column header - .headerSortDown, - .headerSortDown:hover { - &:after { - visibility:visible; - @include opacity(60); - } - } - // Style the ascending (reverse alphabetical) column header - .headerSortUp { - &:after { - border-bottom: none; - border-left: 4px solid transparent; - border-right: 4px solid transparent; - border-top: 4px solid #000; - visibility:visible; - @include box-shadow(none); //can't add boxshadow to downward facing arrow :( - @include opacity(60); - } - } -} - -table { - // Blue Table Headings - .blue { - color: $blue; - border-bottom-color: $blue; - } - .headerSortUp.blue, - .headerSortDown.blue { - background-color: lighten($blue, 40%); - } - // Green Table Headings - .green { - color: $green; - border-bottom-color: $green; - } - .headerSortUp.green, - .headerSortDown.green { - background-color: lighten($green, 40%); - } - // Red Table Headings - .red { - color: $red; - border-bottom-color: $red; - } - .headerSortUp.red, - .headerSortDown.red { - background-color: lighten($red, 50%); - } - // Yellow Table Headings - .yellow { - color: $yellow; - border-bottom-color: $yellow; - } - .headerSortUp.yellow, - .headerSortDown.yellow { - background-color: lighten($yellow, 40%); - } - // Orange Table Headings - .orange { - color: $orange; - border-bottom-color: $orange; - } - .headerSortUp.orange, - .headerSortDown.orange { - background-color: lighten($orange, 40%); - } - // Purple Table Headings - .purple { - color: $purple; - border-bottom-color: $purple; - } - .headerSortUp.purple, - .headerSortDown.purple { - background-color: lighten($purple, 40%); - } -} diff --git a/app/assets/stylesheets/lib/bootstrap/type.scss b/app/assets/stylesheets/lib/bootstrap/type.scss deleted file mode 100644 index 6a201131..00000000 --- a/app/assets/stylesheets/lib/bootstrap/type.scss +++ /dev/null @@ -1,191 +0,0 @@ -/* Typography.less - * Headings, body text, lists, code, and more for a versatile and durable typography system - * ---------------------------------------------------------------------------------------- */ - - -// BODY TEXT -// --------- - -p { - @include font-shorthand(normal,$basefont,$baseline); - margin-bottom: $baseline / 2; - small { - font-size: $basefont - 2; - color: $grayLight; - } -} - - -// HEADINGS -// -------- - -h1, h2, h3, h4, h5, h6 { - font-weight: bold; - color: $grayDark; - small { - color: $grayLight; - } -} -h1 { - margin-bottom: $baseline; - font-size: 30px; - line-height: $baseline * 2; - small { - font-size: 18px; - } -} -h2 { - font-size: 24px; - line-height: $baseline * 2; - small { - font-size: 14px; - } -} - -h3, h4, h5, h6 { -/* line-height: $baseline * 2;*/ - margin-bottom: 0.5em; -} - -h3 { - font-size: 18px; - small { - font-size: 14px; - } -} -h4 { - font-size: 16px; - small { - font-size: 12px; - } -} -h5 { - font-size: 14px; -} -h6 { - font-size: 13px; - color: $grayLight; - text-transform: uppercase; -} - - -// COLORS -// ------ - -// Unordered and Ordered lists -ul, ol { - margin: 0 0 $baseline 25px; -} -ul ul, -ul ol, -ol ol, -ol ul { - margin-bottom: 0; -} -ul { - list-style: disc; -} -ol { - list-style: decimal; -} -li { - line-height: $baseline; - color: $gray; -} -ul.unstyled { - list-style: none; - margin-left: 0; -} - -// Description Lists -dl { - margin-bottom: $baseline; - dt, dd { - line-height: $baseline; - } - dt { - font-weight: bold; - } - dd { - margin-left: $baseline / 2; - } -} - -// MISC -// ---- - -// Horizontal rules -hr { - margin: 0 0 19px; - border: 0; - border-bottom: 1px solid #eee; -} - -// Emphasis -strong { - font-style: inherit; - font-weight: bold; - line-height: inherit; -} -em { - font-style: italic; - font-weight: inherit; - line-height: inherit; -} -.muted { - color: $grayLight; -} - -// Blockquotes -blockquote { - margin-bottom: $baseline; - border-left: 5px solid #eee; - padding-left: 15px; - p { - @include font-shorthand(300,14px,$baseline); - margin-bottom: 0; - } - small { - display: block; - @include font-shorthand(300,12px,$baseline); - color: $grayLight; - &:before { - content: '\2014 \00A0'; - } - } -} - -// Addresses -address { - display: block; - line-height: $baseline; - margin-bottom: $baseline; -} - -// Inline and block code styles -code, pre { - padding: 0 3px 2px; - font-family: Monaco, Andale Mono, Courier New, monospace; - font-size: 12px; - @include border-radius(3px); -} -code { - background-color: lighten($orange, 40%); - color: rgba(0,0,0,.75); - padding: 1px 3px; -} -pre { - background-color: #f5f5f5; - display: block; - padding: $baseline - 1; - margin: 0 0 $baseline; - line-height: $baseline; - font-size: 12px; - border: 1px solid #ccc; - border: 1px solid rgba(0,0,0,.15); - @include border-radius(3px); - white-space: pre; - white-space: pre-wrap; - word-wrap: break-word; - -} \ No newline at end of file diff --git a/app/assets/stylesheets/lib/shared.css.scss b/app/assets/stylesheets/lib/shared.css.scss deleted file mode 100644 index 679cc2d0..00000000 --- a/app/assets/stylesheets/lib/shared.css.scss +++ /dev/null @@ -1,11 +0,0 @@ -$heading: #253E59; -$background: $heading + #999; -$text-color: #555; - -$orangered: #BF4904; - -@mixin container { - width: 940px; - padding: 0 18px; - margin: auto; -} \ No newline at end of file diff --git a/app/assets/stylesheets/programs.css.scss b/app/assets/stylesheets/programs.css.scss deleted file mode 100644 index 84b3a897..00000000 --- a/app/assets/stylesheets/programs.css.scss +++ /dev/null @@ -1,36 +0,0 @@ -.programs { - - margin-bottom: 2em; - - ul { - @include clearfix; - margin: 0; - padding-top: 1em; - - li { - @include columns(5); - padding: 0.75em 0; - border-top: 1px solid #ddd; - - .title { - font-weight: bold; - margin-bottom: 0.1em; - } - - .author { - a, & { - color: lighten($text-color, 40%); - } - } - } - li:nth-child(3n+1) { - clear: both; - } - } -} - -#featured { - .heading { - background: $orangered; - } -} \ No newline at end of file diff --git a/app/assets/stylesheets/questions.css.scss b/app/assets/stylesheets/questions.css.scss deleted file mode 100644 index 67a61796..00000000 --- a/app/assets/stylesheets/questions.css.scss +++ /dev/null @@ -1,114 +0,0 @@ -.questions, .question { - h1 { - line-height: 1.1; - margin-bottom: 0.15em; - } - .meta { - a { - font-style: italic; - } - font-style: italic; - padding-bottom: 0.75em; - } -} - -.questions { - margin: 0; - li { - @include clearfix; - list-style-type: none; - padding-left: 2.5em; - padding-bottom: 1em; - border-bottom: 1px solid #ddd; - margin-bottom: 1em; - background: url("asked.png") 0 6px no-repeat; - - .answer-count { - text-align: center; - font-size: 0.85em; - h3 { - margin: 0; - font-size: 2em; - } - @include columns(1); - padding: 6px - } - .summary { - @include columns(9, last); - - h2 { - line-height: 1; - margin-bottom: 0.15em; - } - .description { - padding-right: 3em; - } - } - } - - .unanswered { - .answer-count, .answer-count h3 { - color: $orangered; - } - } - .answered, .accepted { - .answer-count, .answer-count h3 { - color: $green - #333; - } - } - .accepted { - background-image: url("accepted.png"); - } - -} - -.question { - p { - font-size: 1.15em; - line-height: 1.5; - margin-bottom: 1.25em; - } - - h2 { - margin-top: 0.5em; - padding-bottom: 0.5em; - border-bottom: 1px solid #bbb; - } - - .answers { - margin: 0 0 2em 0; - .answer { - @include clearfix; - position: relative; - list-style-type: none; - padding: 1em 1em; - border-bottom: 1px solid #ddd; - - .choose { - float: left; - opacity: 0.5; - } - .links { - float: right; - padding-top: 0.75em; - a { - margin-left: 0.5em; - } - } - } - .answer:hover { - background-color: #f3f3f3; - .choose { - opacity: 1; - } - } - } - .selected-answer { - background: rgba(158, 183,68, 0.1) url("accepted.png") 99% 0.5em no-repeat; - } -} - -.move_question { - float:right; - padding-top:4px; -} diff --git a/app/assets/stylesheets/users.css.scss b/app/assets/stylesheets/users.css.scss deleted file mode 100644 index cd972aa5..00000000 --- a/app/assets/stylesheets/users.css.scss +++ /dev/null @@ -1,38 +0,0 @@ -.user-questions, .user-answers { - ul { - margin: 0; - list-style-type: none; - padding: 1em 0; - - li { - @include clearfix; - padding-bottom: 0.5em; - border-bottom: 1px solid #ddd; - margin-bottom: 0.5em; - - .title, .description { - @include columns(8); - } - - .meta { - @include columns(3, true); - text-align: right; - } - } - } -} - -.title { - display: inline; - margin-right: 10px; - margin: 0px; -} - -#user-list { - li { - list-style-type: none; - padding-bottom: 3px; - padding-top: 3px; - } -} - diff --git a/app/controllers/answers_controller.rb b/app/controllers/answers_controller.rb deleted file mode 100644 index 0761042d..00000000 --- a/app/controllers/answers_controller.rb +++ /dev/null @@ -1,23 +0,0 @@ -class AnswersController < InheritedController - load_and_authorize_resource - - belongs_to :question - - def create - @answer = Answer.create params[:answer] - @answer.question = @question - @answer.user = current_user - - Notification.new_answer(@question).deliver - - create!(:notice => "Answer Posted!"){ question_url(params[:question_id]) } - end - - def update - # inherited resorces (gem) magic - super do |format| - format.html { redirect_to question_url(resource.question) } - end - end -end - diff --git a/app/controllers/api/programs_controller.rb b/app/controllers/api/programs_controller.rb deleted file mode 100644 index b1d80e55..00000000 --- a/app/controllers/api/programs_controller.rb +++ /dev/null @@ -1,2 +0,0 @@ -class Api::ProgramsController < InheritedResources::Base -end diff --git a/app/controllers/api/rels_controller.rb b/app/controllers/api/rels_controller.rb deleted file mode 100644 index 00894e2e..00000000 --- a/app/controllers/api/rels_controller.rb +++ /dev/null @@ -1,9 +0,0 @@ -class Api::RelsController < ApiController - def index - @rels = Rel.all - end - - def show - @rel = Rel.first(:slug => params[:id]) - end -end \ No newline at end of file diff --git a/app/controllers/api_controller.rb b/app/controllers/api_controller.rb deleted file mode 100644 index 76354fd9..00000000 --- a/app/controllers/api_controller.rb +++ /dev/null @@ -1,2 +0,0 @@ -class ApiController < ApplicationController -end diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb deleted file mode 100644 index 68f1059c..00000000 --- a/app/controllers/application_controller.rb +++ /dev/null @@ -1,7 +0,0 @@ -class ApplicationController < ActionController::Base - protect_from_forgery - - rescue_from CanCan::AccessDenied do |exception| - redirect_to login_url, :alert => exception.message - end -end diff --git a/app/controllers/blog_controller.rb b/app/controllers/blog_controller.rb deleted file mode 100644 index 7f06d3be..00000000 --- a/app/controllers/blog_controller.rb +++ /dev/null @@ -1,23 +0,0 @@ -class BlogController < ApplicationController - before_filter :authenticate_user!, :only => [:admin, :create] - - def index - @posts = BlogPost.all.reverse - end - - def show - @post = BlogPost.find(params[:id]) - end - - def admin - redirect_to blog_index_path unless current_user.blog_poster - @post = BlogPost.new - @posts = BlogPost.all.reverse - end - - def create - redirect_to blog_index_path and return unless current_user.blog_poster - @post = BlogPost.create(params[:blog_post]) - redirect_to admin_blog_index_path, :notice => "Blog Post created!" - end -end diff --git a/app/controllers/inherited_controller.rb b/app/controllers/inherited_controller.rb deleted file mode 100644 index 7d62cc9b..00000000 --- a/app/controllers/inherited_controller.rb +++ /dev/null @@ -1,31 +0,0 @@ -class InheritedController < ApplicationController - inherit_resources - - before_filter :form_url, :only => [:new, :create, :edit, :update] - - # Set form url instance variable correctly depending on action - def form_url - - # this line is to fix a bug that I was getting. - # if you remove it, maybe try commenting it out instead. - # if you get this bug: - # undefined method `model_name' for NilClass:Class - # ... - # app/controllers/inherited_controller.rb:39:in `form_url' - # - # etc, then try adding it back in. - begin - resource.inspect - rescue - end - # end of bug fix. - - - if ['new','create'].include? params[:action] - @form_url = collection_path - elsif - @form_url = resource_path - end - end - -end diff --git a/app/controllers/lessons_controller.rb b/app/controllers/lessons_controller.rb deleted file mode 100644 index 3f3ac02c..00000000 --- a/app/controllers/lessons_controller.rb +++ /dev/null @@ -1,9 +0,0 @@ -class LessonsController < ApplicationController - def index - @lessons = HacketyHack::Lessons.all - end - - def show - @lesson = HacketyHack::Lessons.find_by_slug(params[:id]) - end -end diff --git a/app/controllers/mailer_controller.rb b/app/controllers/mailer_controller.rb deleted file mode 100644 index 19e8eaba..00000000 --- a/app/controllers/mailer_controller.rb +++ /dev/null @@ -1,22 +0,0 @@ -class MailerController < ApplicationController - load_and_authorize_resource class: Message - - def new - @users = Array(params[:user]) - @emails = User.where(:username => @users).all.map(&:email) - @message = Message.new - end - - def create - @message = Message.new(params[:message]) - - if @message.valid? - @message.email.each do |email| - MessageMailer.new_message(@message, email).deliver - end - redirect_to users_index_path, :notice => "Email sent correctly" - else - render :new, notice: "There was an error" - end - end -end diff --git a/app/controllers/programs_controller.rb b/app/controllers/programs_controller.rb deleted file mode 100644 index f4e306df..00000000 --- a/app/controllers/programs_controller.rb +++ /dev/null @@ -1,25 +0,0 @@ -class ProgramsController < InheritedController - load_and_authorize_resource - - belongs_to :user, :optional => true - respond_to :html, :only => [:index, :show] - - def index - @featured = Program.featured - index! - end - - ################# - - def begin_of_association_chain - if params[:user_id] - @user = User.find_by_username params[:user_id] - @user - end - end - - def resource - @program ||= end_of_association_chain.find_by_slug(params[:id]) - end - -end diff --git a/app/controllers/questions_controller.rb b/app/controllers/questions_controller.rb deleted file mode 100644 index 8038f468..00000000 --- a/app/controllers/questions_controller.rb +++ /dev/null @@ -1,70 +0,0 @@ -class QuestionsController < InheritedController - load_and_authorize_resource - prepend_before_filter :set_presenter - prepend_before_filter :set_support - - respond_to :atom, :only => :index - - def create - @question = Question.create params[:question] - @question.user = current_user - create!(:notice => "Question Asked!") { collection_url } - end - - def show - @answer = Answer.new - show! - end - - def update - params[:question][:solution_id] != @question.solution_id ? update!(:notice => "Okay! We've selected that answer") : update! - end - - def collection - @questions = @presenter.apply_scope(end_of_association_chain).newest_first.paginate(:page => params[:page]) - end - - def collection_url - collection_path - end - - def collection_path - @presenter.collection_path - end - - def new_resource_path - @presenter.new_resource_path - end - - def resource_url(*params) - resource_path(params) - end - - def resource_path(*other) - if other[0] - @presenter.resource_path(other) - else - @presenter.resource_path(resource) - end - end - - def edit_resource_path - @support ? edit_support_question_path : edit_question_path - end - - def set_support - @support = request.env['PATH_INFO'].include?('support') || params[:support] - if @support && params[:question] - params[:question][:support] = true - end - end - - def set_presenter - if @support - @presenter = SupportPresenter.new(resource) - else - @presenter = QuestionPresenter.new(resource) - end - end - -end diff --git a/app/controllers/static_controller.rb b/app/controllers/static_controller.rb deleted file mode 100644 index 60acc47c..00000000 --- a/app/controllers/static_controller.rb +++ /dev/null @@ -1,39 +0,0 @@ -class StaticController < ApplicationController - def root - @platform = platform - end - - def download - @platform = params[:platform] - unless @platform - redirect_to downloads_path(platform) - return - end - - @download_url = case @platform - when 'mac' then 'https://github.com/downloads/hacketyhack/hacketyhack/hacketyhack-1.0.1.dmg' - when 'windows' then 'https://github.com/downloads/hacketyhack/hacketyhack/hacketyhack-1.0.0.exe.zip' - when 'linux' then 'https://github.com/downloads/hacketyhack/hacketyhack/hacketyhack-1.0.1.run' - else 'https://github.com/downloads/hacketyhack/hacketyhack/hacketyhack-1.0.1.dmg' - end - @locals = { - :resource => User.new, - :resource_name => "user" - } - @other_platforms = ["mac", "windows", "linux"] - [@platform] - end - - def api_root - render :layout => "api" - end - - def newest_version - render :json => {:version => "1.0.0"} - end - - protected - - def platform - request.user_agent.nil? ? nil : request.user_agent.downcase - end -end diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb deleted file mode 100644 index b53d2ba9..00000000 --- a/app/controllers/users_controller.rb +++ /dev/null @@ -1,50 +0,0 @@ -class UsersController < InheritedController - load_and_authorize_resource - skip_authorize_resource :only => [:following, :followers, :deleted_user] #anyone can perform these read-only actions - require 'will_paginate/array' - - def index - redirect_to root_path unless can? :manage, @users - @users = User.all.paginate(:page => params[:page], :per_page => 10) - end - - def follow - followee = User.first(:id => params[:user][:followee]) - policy = FollowingPolicy.new(current_user) - if policy.can_follow? followee - current_user.follow! followee - notice = "You're following #{followee.username} now" - elsif policy.following_self? followee - notice = "You can't follow yourself silly!" - elsif policy.already_following? followee - notice = "You're already following #{followee.username}" - end - redirect_to resource_path(followee), :notice=> notice - end - - def unfollow - followee = User.first(:id => params[:user][:followee]) - current_user.unfollow! followee - redirect_to resource_path(followee), :notice=> "You're no longer following #{followee.username}" - end - - def following - @user = User.first(:username => params[:user_id]) - end - - def followers - @user = User.first(:username => params[:user_id]) - end - - def deleted_user - @user = DeletedUser.new - end - - ################# - - def resource - @user ||= end_of_association_chain.find_by_username(params[:id]) - end - -end - diff --git a/app/helpers/answers_helper.rb b/app/helpers/answers_helper.rb deleted file mode 100644 index b7cdb294..00000000 --- a/app/helpers/answers_helper.rb +++ /dev/null @@ -1,2 +0,0 @@ -module AnswersHelper -end diff --git a/app/helpers/api/programs_helper.rb b/app/helpers/api/programs_helper.rb deleted file mode 100644 index a1a091c7..00000000 --- a/app/helpers/api/programs_helper.rb +++ /dev/null @@ -1,2 +0,0 @@ -module Api::ProgramsHelper -end diff --git a/app/helpers/api/rels_helper.rb b/app/helpers/api/rels_helper.rb deleted file mode 100644 index ac4da97a..00000000 --- a/app/helpers/api/rels_helper.rb +++ /dev/null @@ -1,2 +0,0 @@ -module Api::RelsHelper -end diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb deleted file mode 100644 index eb35501b..00000000 --- a/app/helpers/application_helper.rb +++ /dev/null @@ -1,5 +0,0 @@ -module ApplicationHelper - def markdown(text) - Redcarpet::Markdown.new(Redcarpet::Render::HTML.new(hard_wrap: true), autolink: true).render(text).html_safe - end -end diff --git a/app/helpers/blog_helper.rb b/app/helpers/blog_helper.rb deleted file mode 100644 index 77a397e9..00000000 --- a/app/helpers/blog_helper.rb +++ /dev/null @@ -1,2 +0,0 @@ -module BlogHelper -end diff --git a/app/helpers/lessons_helper.rb b/app/helpers/lessons_helper.rb deleted file mode 100644 index f024005f..00000000 --- a/app/helpers/lessons_helper.rb +++ /dev/null @@ -1,11 +0,0 @@ -module LessonsHelper - - def lesson_categories lesson - output = content_tag :ul, :class => "lesson-categories" do - lesson.metadata["categories"].reduce('') { |c, x| - c << content_tag(:li, x, :class => x) - }.html_safe - end - end - -end diff --git a/app/helpers/programs_helper.rb b/app/helpers/programs_helper.rb deleted file mode 100644 index 3ec6d832..00000000 --- a/app/helpers/programs_helper.rb +++ /dev/null @@ -1,21 +0,0 @@ -module ProgramsHelper - def program_link program - if program.author_username.present? - "#{link_to(program.title.titleize, user_program_path(program.author_username, program))}".html_safe - else - "#{link_to(program.title.titleize, url_for(:controller => '/programs', :action => 'show', :id => program.slug))}".html_safe - end - end - - def author_link username, program = nil - return nil unless username - output = "" - output += link_to(username, user_path(username)) - - if program - output += ", #{program.created_at.strftime('%m/%d/%y')}" unless program.created_at.nil? - end - - output.html_safe - end -end diff --git a/app/helpers/questions_helper.rb b/app/helpers/questions_helper.rb deleted file mode 100644 index 2eaab4ab..00000000 --- a/app/helpers/questions_helper.rb +++ /dev/null @@ -1,2 +0,0 @@ -module QuestionsHelper -end diff --git a/app/helpers/static_helper.rb b/app/helpers/static_helper.rb deleted file mode 100644 index 8cfc9af4..00000000 --- a/app/helpers/static_helper.rb +++ /dev/null @@ -1,2 +0,0 @@ -module StaticHelper -end diff --git a/app/helpers/users_helper.rb b/app/helpers/users_helper.rb deleted file mode 100644 index 721d80ec..00000000 --- a/app/helpers/users_helper.rb +++ /dev/null @@ -1,6 +0,0 @@ -module UsersHelper - def gravatar_url email - require 'digest/md5' - "http://www.gravatar.com/avatar/#{Digest::MD5.hexdigest(email.downcase)}" - end -end diff --git a/app/mailers/.gitkeep b/app/mailers/.gitkeep deleted file mode 100644 index e69de29b..00000000 diff --git a/app/mailers/message_mailer.rb b/app/mailers/message_mailer.rb deleted file mode 100644 index 790550b3..00000000 --- a/app/mailers/message_mailer.rb +++ /dev/null @@ -1,9 +0,0 @@ -class MessageMailer < ActionMailer::Base - default from: "steve@hackety.com" - - def new_message message, email - @message = message - @email = email - mail(:to => @email, :subject => @message.subject) - end -end diff --git a/app/mailers/notification.rb b/app/mailers/notification.rb deleted file mode 100644 index 24e91128..00000000 --- a/app/mailers/notification.rb +++ /dev/null @@ -1,10 +0,0 @@ -class Notification < ActionMailer::Base - default from: "steve@hackety.com" - default_url_options[:host] = "hackety.com" - - def new_answer(question) - @question = question - @url = question_url(question, :host => "hackety.com") - mail(:to => question.user.email, :subject => "New Answer on Hackety.com!") - end -end diff --git a/app/models/.gitkeep b/app/models/.gitkeep deleted file mode 100644 index e69de29b..00000000 diff --git a/app/models/ability.rb b/app/models/ability.rb deleted file mode 100644 index 16b37006..00000000 --- a/app/models/ability.rb +++ /dev/null @@ -1,43 +0,0 @@ -class Ability - include CanCan::Ability - - def initialize(user) - user ||= User.new - - if user.moderator? - can :manage, :all - else - can :read, :all - end - - unless user.new_record? - can :create, [Question, Answer] - can :manage, [Question, Answer], :user => user - can :update, user - can [:follow,:unfollow], :all - end - - # Define abilities for the passed in user here. For example: - # - # user ||= User.new # guest user (not logged in) - # if user.admin? - # can :manage, :all - # else - # can :read, :all - # end - # - # The first argument to `can` is the action you are giving the user permission to do. - # If you pass :manage it will apply to every action. Other common actions here are - # :read, :create, :update and :destroy. - # - # The second argument is the resource the user can perform the action on. If you pass - # :all it will apply to every resource. Otherwise pass a Ruby class of the resource. - # - # The third argument is an optional hash of conditions to further filter the objects. - # For example, here the user can only update published articles. - # - # can :update, Article, :published => true - # - # See the wiki for details: https://github.com/ryanb/cancan/wiki/Defining-Abilities - end -end diff --git a/app/models/answer.rb b/app/models/answer.rb deleted file mode 100644 index bfed4f8a..00000000 --- a/app/models/answer.rb +++ /dev/null @@ -1,12 +0,0 @@ -class Answer - include MongoMapper::Document - - key :description, String - timestamps! - - validates_presence_of :description - - belongs_to :question - belongs_to :user - -end diff --git a/app/models/blog_post.rb b/app/models/blog_post.rb deleted file mode 100644 index 5b50f9b6..00000000 --- a/app/models/blog_post.rb +++ /dev/null @@ -1,8 +0,0 @@ -class BlogPost - include MongoMapper::Document - - key :title, String, :required => true - key :content, String, :required => true - - timestamps! -end diff --git a/app/models/deleted_user.rb b/app/models/deleted_user.rb deleted file mode 100644 index 373029ed..00000000 --- a/app/models/deleted_user.rb +++ /dev/null @@ -1,13 +0,0 @@ -class DeletedUser - def username - 'Deleted User' - end - - def email - 'none' - end - - def to_param - 'deleted_user' - end -end diff --git a/app/models/following_policy.rb b/app/models/following_policy.rb deleted file mode 100644 index b691d239..00000000 --- a/app/models/following_policy.rb +++ /dev/null @@ -1,17 +0,0 @@ -class FollowingPolicy - def initialize(follower) - @follower = follower - end - - def can_follow?(followee) - !following_self?(followee) && !already_following?(followee) - end - - def already_following?(followee) - @follower.following? followee - end - - def following_self?(followee) - @follower == followee - end -end diff --git a/app/models/message.rb b/app/models/message.rb deleted file mode 100644 index 2c00d8ba..00000000 --- a/app/models/message.rb +++ /dev/null @@ -1,11 +0,0 @@ -class Message - include MongoMapper::Document - key :email, Array - key :subject, String - key :body, String - validates_presence_of :email, :body - - def to_param - {email: email, subject: subject, body: body} - end -end \ No newline at end of file diff --git a/app/models/program.rb b/app/models/program.rb deleted file mode 100644 index 3fb65f5e..00000000 --- a/app/models/program.rb +++ /dev/null @@ -1,29 +0,0 @@ -class Program - include MongoMapper::Document - - key :author_username, String - key :slug, String - key :title, String - key :description, String - key :source_code, String - key :featured, Boolean - timestamps! - - scope :by_username, lambda { |username| where(:author_username => username) } - scope :featured, where(:featured => true) - - before_create :make_slug - - def make_slug - if slug.blank? - all_slugs = Program.where(:author_username => author_username).map(&:slug) - self.slug = Sluggifier.generate(title, all_slugs) - end - end - - def to_param - slug - end - - -end diff --git a/app/models/question.rb b/app/models/question.rb deleted file mode 100644 index 70ea09fd..00000000 --- a/app/models/question.rb +++ /dev/null @@ -1,27 +0,0 @@ -class Question - include MongoMapper::Document - - key :title, String - key :description, String - key :solution_id, ObjectId - key :support, Boolean - timestamps! - - belongs_to :user - many :answers - - validates_presence_of :title, :description - - scope :newest_first, sort(:created_at.desc) - scope :supports, where(:support => true ) - scope :no_supports, where('$or' => [{:support=> false}, {:support => nil}]) - - def user - asker = super - if asker.nil? - DeletedUser.new - else - asker - end - end -end diff --git a/app/models/rel.rb b/app/models/rel.rb deleted file mode 100644 index f08a0e4c..00000000 --- a/app/models/rel.rb +++ /dev/null @@ -1,10 +0,0 @@ -class Rel - include MongoMapper::Document - - key :slug, String - key :description, String - - def to_param - slug - end -end diff --git a/app/models/user.rb b/app/models/user.rb deleted file mode 100644 index d03c5668..00000000 --- a/app/models/user.rb +++ /dev/null @@ -1,95 +0,0 @@ -class User - include MongoMapper::Document - # Include default devise modules. Others available are: - # :token_authenticatable, :encryptable, :confirmable, :lockable, :timeoutable and :omniauthable - devise :database_authenticatable, :registerable, - :recoverable, :rememberable, :trackable, :validatable - - key :username, String - key :email, String - key :about, String - key :moderator, Boolean - key :blog_poster, Boolean - - ## Database authenticatable - key :email, :type => String, :null => false - key :encrypted_password, :type => String, :null => false - - ## Recoverable - key :reset_password_token, :type => String - key :reset_password_sent_at, :type => Time - - ## Rememberable - key :remember_created_at, :type => Time - - ## Trackable - key :sign_in_count, :type => Integer - key :current_sign_in_at, :type => Time - key :last_sign_in_at, :type => Time - key :current_sign_in_ip, :type => String - key :last_sign_in_ip, :type => String - - many :questions - many :answers - - validates_format_of :username, :with => /^[\w\.]+$/, - :message => "Make your username from letters, numbers, underscores('_'), and dots('.')." - validates_length_of :username, :in => (1..32), - :message => "Your username needs at least 1 character but no more than 32." - validates_uniqueness_of :username, - :message => "User name has been taken already. Please try another" - - def to_param - self.username - end - - def programs - Program.by_username self.username - end - - #the list of hackers this hacker is following - key :following_ids, Array - many :following, :in => :following_ids, :class_name => 'User' - - #the list of hackers that are following this hacker - key :followers_ids, Array - many :followers, :in => :followers_ids, :class_name => 'User' - - #after we create a hacker, we want to have them follow steve, and vice versa! - after_create :follow_steve - - # this method makes the hacker follow the followee - def follow! followee - return if following? followee - following << followee - save - followee.followers << self - followee.save - end - - # this method makes the hacker unfollow the followee - def unfollow! followee - return if !following? followee - following_ids.delete(followee.id) - save - followee.followers_ids.delete(id) - followee.save - end - - # this method returns true if we're following the given Hacker, and - # false otherwise - def following? hacker - following.include? hacker - end - - # Everyone should have at least one follower. And steve would like to follow - # everyone. So let's do that. This runs after_create. - def follow_steve - return if username == "steve" - steve = User.first(:username => 'steve') - return if steve.nil? - - follow! steve - steve.follow! self - end -end diff --git a/app/presenters/question_presenter.rb b/app/presenters/question_presenter.rb deleted file mode 100644 index 265a653e..00000000 --- a/app/presenters/question_presenter.rb +++ /dev/null @@ -1,35 +0,0 @@ -class QuestionPresenter - include Rails.application.routes.url_helpers - - def initialize(q) - @question = q - end - - def resource_path(question) - if question - question_path(question) - else - question_path(@question) - end - end - - def new_resource_path - new_question_path - end - - def collection_path - questions_path - end - - def edit_resource_path - edit_question_path(@question) - end - - def apply_scope(chain) - chain.no_supports - end - - def answers_path - question_answers_path(@question) - end -end diff --git a/app/presenters/support_presenter.rb b/app/presenters/support_presenter.rb deleted file mode 100644 index acb871c5..00000000 --- a/app/presenters/support_presenter.rb +++ /dev/null @@ -1,35 +0,0 @@ -class SupportPresenter - include Rails.application.routes.url_helpers - - def initialize(sq) - @support_question = sq - end - - def page_title - "Support Questions" - end - - def new_resource_path - new_support_question_path - end - - def collection_path - support_questions_path - end - - def edit_resource_path - edit_support_question_path(@support_question) - end - - def resource_path(question) - if question - support_question_path(question) - else - support_question_path(@support_question) - end - end - - def apply_scope(chain) - chain.supports - end -end diff --git a/app/views/answers/_form.html.haml b/app/views/answers/_form.html.haml deleted file mode 100644 index 53549aa9..00000000 --- a/app/views/answers/_form.html.haml +++ /dev/null @@ -1,3 +0,0 @@ -= simple_form_for(resource, :url => @form_url) do |f| - = render 'form_content', :f => f - diff --git a/app/views/answers/_form_content.html.haml b/app/views/answers/_form_content.html.haml deleted file mode 100644 index 9974bd1e..00000000 --- a/app/views/answers/_form_content.html.haml +++ /dev/null @@ -1,9 +0,0 @@ -= f.error_notification - -.inputs - = f.input :description, :as => :text, :label => "Answer", - :hint => "You can format your input with Markdown".html_safe - -.actions - = f.button :submit, :value => "Post Answer", :class => "primary btn" - diff --git a/app/views/answers/_list.html.haml b/app/views/answers/_list.html.haml deleted file mode 100644 index 41ddaea3..00000000 --- a/app/views/answers/_list.html.haml +++ /dev/null @@ -1,18 +0,0 @@ -%li.answer{:class => list.id == @question.solution_id && 'selected-answer'} - - if list.user - .meta - #{link_to list.user.username, user_path(list.user)} says - .description - =markdown(list.description) - - .links - - if can? :update, list - = link_to 'Edit', edit_question_answer_path(@question, list) - - if can? :destroy, list - = link_to 'Delete', question_answer_path(@question, list), :confirm => 'Are you sure?', :method => :delete - - - if can?(:update, @question) && (@question.solution_id != list.id) - .choose - = simple_form_for(@question, :url => question_path(@question)) do |f| - = f.hidden_field :solution_id, :value => list.id - = f.button :submit, :value => "This answers my question!", :class => "primary btn" diff --git a/app/views/answers/_short_answer.html.haml b/app/views/answers/_short_answer.html.haml deleted file mode 100644 index 33d8b788..00000000 --- a/app/views/answers/_short_answer.html.haml +++ /dev/null @@ -1,3 +0,0 @@ -= simple_form_for(@answer, :url => question_answers_path(@question)) do |f| - = render 'answers/form_content', :f => f - diff --git a/app/views/answers/edit.html.haml b/app/views/answers/edit.html.haml deleted file mode 100644 index 53544a89..00000000 --- a/app/views/answers/edit.html.haml +++ /dev/null @@ -1,5 +0,0 @@ -- content_for :title do - = "Editing your answer" - -= render 'form' - diff --git a/app/views/answers/index.html.haml b/app/views/answers/index.html.haml deleted file mode 100644 index ff963033..00000000 --- a/app/views/answers/index.html.haml +++ /dev/null @@ -1,9 +0,0 @@ -- content_for :title do - Answers - -- content_for :links do - - if can? :create, Answer - = link_to "New answer", new_resource_path - -%ul.answers - = render :partial => "list", :collection => collection diff --git a/app/views/answers/new.html.haml b/app/views/answers/new.html.haml deleted file mode 100644 index 91eb2701..00000000 --- a/app/views/answers/new.html.haml +++ /dev/null @@ -1,4 +0,0 @@ -- content_for :title do - New answer - -= render 'form' \ No newline at end of file diff --git a/app/views/answers/show.html.haml b/app/views/answers/show.html.haml deleted file mode 100644 index 73d827b6..00000000 --- a/app/views/answers/show.html.haml +++ /dev/null @@ -1,14 +0,0 @@ -- content_for :title do - = resource - -- content_for :links do - - if can? :update, resource - = link_to 'Edit', edit_resource_path - - if can? :destroy, resource - = link_to 'Delete', resource_path, :confirm => 'Are you sure?', :method => :delete - -%dl - %dt Description - %dd= resource.description - %dt User - %dd= resource.user diff --git a/app/views/api/programs/edit.html.haml b/app/views/api/programs/edit.html.haml deleted file mode 100644 index e05dd7e9..00000000 --- a/app/views/api/programs/edit.html.haml +++ /dev/null @@ -1,4 +0,0 @@ -- content_for :title do - = "Editing #{resource}" - -= render 'form' diff --git a/app/views/api/programs/index.html.haml b/app/views/api/programs/index.html.haml deleted file mode 100644 index 40b1665c..00000000 --- a/app/views/api/programs/index.html.haml +++ /dev/null @@ -1,7 +0,0 @@ -- title "All Programs" - -%p Here's a list of all of the programs we have: - -%ul - - @programs.each do |program| - %li= link_to "#{program.author_username}/#{program.slug}", program diff --git a/app/views/api/programs/new.html.haml b/app/views/api/programs/new.html.haml deleted file mode 100644 index 6e3c84e6..00000000 --- a/app/views/api/programs/new.html.haml +++ /dev/null @@ -1,12 +0,0 @@ -= simple_form_for(resource, :url => @form_url) do |f| - = f.error_notification - - .inputs - = f.input :author_username - = f.input :slug - = f.input :title - = f.input :source_code, :as => :text - - .actions - = f.button :submit - diff --git a/app/views/api/programs/show.html.haml b/app/views/api/programs/show.html.haml deleted file mode 100644 index 1344bdc5..00000000 --- a/app/views/api/programs/show.html.haml +++ /dev/null @@ -1,6 +0,0 @@ -- title @program.title - -%p= @program.title -%p By #{@program.author_username} - -%p= link_to "Back to list of all programs", programs_path, :rel => "/rels/program-index" diff --git a/app/views/api/rels/index.html.haml b/app/views/api/rels/index.html.haml deleted file mode 100644 index 60d8d15f..00000000 --- a/app/views/api/rels/index.html.haml +++ /dev/null @@ -1,7 +0,0 @@ -- title "All rels" - -%p Here's a list of all of the relations the API supports: - -%ul - - @rels.each do |rel| - %li= link_to rel.slug, rel diff --git a/app/views/api/rels/show.html.haml b/app/views/api/rels/show.html.haml deleted file mode 100644 index a63a579e..00000000 --- a/app/views/api/rels/show.html.haml +++ /dev/null @@ -1,5 +0,0 @@ -- title "The '#{@rel.slug}' Relation" - -%p= @rel.description - -%p= link_to "Back to list of all rels", rels_path, :rel => "/rels/rel-index" diff --git a/app/views/blog/admin.html.haml b/app/views/blog/admin.html.haml deleted file mode 100644 index 03c9bea9..00000000 --- a/app/views/blog/admin.html.haml +++ /dev/null @@ -1,16 +0,0 @@ -%h1 Blog Admin - -%h2 New Post -= simple_form_for @post, :url => blog_index_path do |f| - .inputs - = f.input :title - = f.input :content, :as => :text - - .actions - = f.button :submit, :value => "Create Blog post", :class => "primary btn" - -%h2 All Posts -%ul - - @posts.each do |post| - %li= post.title - diff --git a/app/views/blog/index.html.haml b/app/views/blog/index.html.haml deleted file mode 100644 index aa4ebada..00000000 --- a/app/views/blog/index.html.haml +++ /dev/null @@ -1,17 +0,0 @@ -- content_for :title do - The Hackety Blog! - -- content_for :sidebar do - = render :partial => "shared/ask" - = render :partial => "shared/lessons" - -- @posts.each do |post| - .post.teaser - %h2.title= link_to post.title, blog_path(post) - - .created_at - = post.created_at.strftime("Posted %B %d, %Y at %l:%M %p") - - .content - =markdown(post.content) - diff --git a/app/views/blog/show.html.haml b/app/views/blog/show.html.haml deleted file mode 100644 index cd66825c..00000000 --- a/app/views/blog/show.html.haml +++ /dev/null @@ -1,14 +0,0 @@ -- content_for :title do - = @post.title - -- content_for :sidebar do - = render :partial => "shared/recent" - = render :partial => "shared/ask" - = render :partial => "shared/lessons" - -.post - .created_at - = @post.created_at.strftime("Posted %B %d, %Y at %l:%M %p") - - .content - =markdown(@post.content) diff --git a/app/views/devise/confirmations/new.html.erb b/app/views/devise/confirmations/new.html.erb deleted file mode 100644 index f4ce3cb5..00000000 --- a/app/views/devise/confirmations/new.html.erb +++ /dev/null @@ -1,17 +0,0 @@ -<% content_for :title do %> - Resend confirmation instructions -<% end %> - -<%= simple_form_for(resource, :as => resource_name, :url => confirmation_path(resource_name), :html => { :method => :post }) do |f| %> - <%= f.error_notification %> - -
    - <%= f.input :email, :required => true %> -
    - -
    - <%= f.button :submit, "Resend confirmation instructions" %> -
    -<% end %> - -<%= render :partial => "devise/shared/links" %> \ No newline at end of file diff --git a/app/views/devise/mailer/confirmation_instructions.html.erb b/app/views/devise/mailer/confirmation_instructions.html.erb deleted file mode 100644 index a6ea8ca1..00000000 --- a/app/views/devise/mailer/confirmation_instructions.html.erb +++ /dev/null @@ -1,5 +0,0 @@ -

    Welcome <%= @resource.email %>!

    - -

    You can confirm your account through the link below:

    - -

    <%= link_to 'Confirm my account', confirmation_url(@resource, :confirmation_token => @resource.confirmation_token) %>

    diff --git a/app/views/devise/mailer/reset_password_instructions.html.erb b/app/views/devise/mailer/reset_password_instructions.html.erb deleted file mode 100644 index ae9e888a..00000000 --- a/app/views/devise/mailer/reset_password_instructions.html.erb +++ /dev/null @@ -1,8 +0,0 @@ -

    Hello <%= @resource.email %>!

    - -

    Someone has requested a link to change your password, and you can do this through the link below.

    - -

    <%= link_to 'Change my password', edit_password_url(@resource, :reset_password_token => @resource.reset_password_token) %>

    - -

    If you didn't request this, please ignore this email.

    -

    Your password won't change until you access the link above and create a new one.

    diff --git a/app/views/devise/mailer/unlock_instructions.html.erb b/app/views/devise/mailer/unlock_instructions.html.erb deleted file mode 100644 index 2263c219..00000000 --- a/app/views/devise/mailer/unlock_instructions.html.erb +++ /dev/null @@ -1,7 +0,0 @@ -

    Hello <%= @resource.email %>!

    - -

    Your account has been locked due to an excessive amount of unsuccessful sign in attempts.

    - -

    Click the link below to unlock your account:

    - -

    <%= link_to 'Unlock my account', unlock_url(@resource, :unlock_token => @resource.unlock_token) %>

    diff --git a/app/views/devise/passwords/edit.html.erb b/app/views/devise/passwords/edit.html.erb deleted file mode 100644 index 542bc445..00000000 --- a/app/views/devise/passwords/edit.html.erb +++ /dev/null @@ -1,21 +0,0 @@ -<% content_for :title do %> - Change Your Password -<% end %> - -<%= simple_form_for(resource, :as => resource_name, :url => password_path(resource_name), :html => { :method => :put }) do |f| %> - <%= f.error_notification %> - - <%= f.input :reset_password_token, :as => :hidden %> - <%= f.full_error :reset_password_token %> - -
    - <%= f.input :password, :label => "New password", :required => true %> - <%= f.input :password_confirmation, :label => "Confirm your new password", :required => true %> -
    - -
    - <%= f.button :submit, "Change my password" %> -
    -<% end %> - -<%= render :partial => "devise/shared/links" %> \ No newline at end of file diff --git a/app/views/devise/passwords/new.html.erb b/app/views/devise/passwords/new.html.erb deleted file mode 100644 index a5a2a3f8..00000000 --- a/app/views/devise/passwords/new.html.erb +++ /dev/null @@ -1,17 +0,0 @@ -<% content_for :title do %> - Forgot Your Password? -<% end %> - -<%= simple_form_for(resource, :as => resource_name, :url => password_path(resource_name), :html => { :method => :post }) do |f| %> - <%= f.error_notification %> - -
    - <%= f.input :email, :required => true %> -
    - -
    - <%= f.button :submit, "Send me reset password instructions" %> -
    -<% end %> - -<%= render :partial => "devise/shared/links" %> \ No newline at end of file diff --git a/app/views/devise/registrations/edit.html.haml b/app/views/devise/registrations/edit.html.haml deleted file mode 100644 index d945daa0..00000000 --- a/app/views/devise/registrations/edit.html.haml +++ /dev/null @@ -1,10 +0,0 @@ -- content_for :title do - Edit #{resource_name.to_s.humanize} - -= render :partial => "users/form", :locals => {:submit_label => "Update"} - -- content_for :sidebar do - %section - %h2 Cancel my account - %p - Unhappy? #{link_to "Cancel my account", registration_path(resource_name), :confirm => "Are you sure?", :method => :delete}. diff --git a/app/views/devise/registrations/new.html.erb b/app/views/devise/registrations/new.html.erb deleted file mode 100644 index 0167dca8..00000000 --- a/app/views/devise/registrations/new.html.erb +++ /dev/null @@ -1,7 +0,0 @@ -<% content_for :title do %> - Sign Up -<% end %> - -<%= render :partial => "users/form", :locals => {:submit_label => "Sign up"} %> - -<%= render :partial => "devise/shared/links" %> diff --git a/app/views/devise/sessions/new.html.haml b/app/views/devise/sessions/new.html.haml deleted file mode 100644 index 315fecab..00000000 --- a/app/views/devise/sessions/new.html.haml +++ /dev/null @@ -1,13 +0,0 @@ -- content_for :title do - Sign In - -.sign-in - = simple_form_for(resource, :as => resource_name, :url => session_path(resource_name)) do |f| - .inputs - = f.input :username, :required => false, :autofocus => true - = f.input :password, :required => false - = f.input :remember_me, :as => :boolean if devise_mapping.rememberable? - .actions - = f.button :submit, "Sign in", :class => "btn primary" -.other - = render :partial => "devise/shared/links" \ No newline at end of file diff --git a/app/views/devise/shared/_links.html.haml b/app/views/devise/shared/_links.html.haml deleted file mode 100644 index 1e969ccd..00000000 --- a/app/views/devise/shared/_links.html.haml +++ /dev/null @@ -1,14 +0,0 @@ -= semantic_menu :class => "pills devise" do |root| - - if controller_name != 'sessions' - - root.add "Sign in", new_session_path(resource_name) - - if devise_mapping.registerable? && controller_name != 'registrations' - - root.add "Sign up", new_registration_path(resource_name) - - if devise_mapping.recoverable? && controller_name != 'passwords' - - root.add "Forgot your password?", new_password_path(resource_name) - - if devise_mapping.confirmable? && controller_name != 'confirmations' - - root.add "Didn't receive confirmation instructions?", new_confirmation_path(resource_name) - - if devise_mapping.lockable? && resource_class.unlock_strategy_enabled?(:email) && controller_name != 'unlocks' - - root.add "Didn't receive unlock instructions?", new_unlock_path(resource_name) - - if devise_mapping.omniauthable? - - resource_class.omniauth_providers.each do |provider| - - root.add "Sign in with #{provider.to_s.titleize}", omniauth_authorize_path(resource_name, provider) diff --git a/app/views/devise/unlocks/new.html.erb b/app/views/devise/unlocks/new.html.erb deleted file mode 100644 index efb87a14..00000000 --- a/app/views/devise/unlocks/new.html.erb +++ /dev/null @@ -1,17 +0,0 @@ -<% content_for :title do %> - Resend unlock instructions -<% end %> - -<%= simple_form_for(resource, :as => resource_name, :url => unlock_path(resource_name), :html => { :method => :post }) do |f| %> - <%= f.error_notification %> - -
    - <%= f.input :email, :required => true %> -
    - -
    - <%= f.button :submit, "Resend unlock instructions" %> -
    -<% end %> - -<%= render :partial => "devise/shared/links" %> \ No newline at end of file diff --git a/app/views/layouts/api.html.haml b/app/views/layouts/api.html.haml deleted file mode 100644 index e7067271..00000000 --- a/app/views/layouts/api.html.haml +++ /dev/null @@ -1,9 +0,0 @@ -!!! 5 -%html - %head - %title Hackety Hack API: #{title} - %body - %h1 Hackety Hack API: #{title} - = yield - %footer - You can go #{link_to "back to the API root", root_path} diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml deleted file mode 100644 index bad870f4..00000000 --- a/app/views/layouts/application.html.haml +++ /dev/null @@ -1,74 +0,0 @@ -- @page_class ||= "page" -!!! -%html - %head - - title = yield :title - %title=(title.blank? ? "" : title.gsub("\n", "")) + " | Hackety Hack!" - - - / - - = stylesheet_link_tag "application" - = javascript_include_tag "application" - = csrf_meta_tags - - if Rails.env.production? - :javascript - var _gaq = _gaq || []; - _gaq.push(['_setAccount', 'UA-10499799-1']); - _gaq.push(['_trackPageview']); - - (function() { - var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; - ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; - (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(ga); - })(); - - - - - - = yield(:head) - - %body{:class => "body-#{@page_class}"} - %header.topbar - .topbar-inner - .container - #logo - = link_to "Hackety Hack", root_path - = render "shared/menu/main" - = render "shared/menu/user" - - = yield :top - - - sidebar = yield :sidebar - - #content-wrap{:class => @page_class} - .container{:class => sidebar.empty? ? "one-column" : "two-column"} - - if flash[:notice] - .alert-message.success - #{flash[:notice]} - - if flash[:alert] - .alert-message.alert - #{flash[:alert]} - - = yield :alert - - - unless title.empty? - .page-title - %h1.title - = title - %small= yield :subtitle - .feed - = yield :feed - - #content{:class => @content_class} - = yield - - - unless sidebar.empty? - #sidebar - = sidebar - - %footer - .container - = render "shared/menu/footer" - diff --git a/app/views/lessons/index.html.haml b/app/views/lessons/index.html.haml deleted file mode 100644 index bb1efa39..00000000 --- a/app/views/lessons/index.html.haml +++ /dev/null @@ -1,20 +0,0 @@ -- content_for :title do - Lessons - -- content_for :sidebar do - = render :partial => "shared/ask" - = render :partial => "shared/lessons" - -%p Want to learn programming? Here are some lessons that we've put online. - -%ul#lessons - - @lessons.each do |lesson| - %li - .info - .title - = link_to lesson.metadata["title"], lesson_path(lesson.metadata["slug"]) - = lesson.metadata["blurb"] - .categories - = lesson_categories lesson - - diff --git a/app/views/lessons/show.html.haml b/app/views/lessons/show.html.haml deleted file mode 100644 index 27f26e1e..00000000 --- a/app/views/lessons/show.html.haml +++ /dev/null @@ -1,13 +0,0 @@ -- @page_class = "lesson" - -- content_for :title do - = @lesson.metadata["title"] - -- content_for :sidebar do - = render :partial => "shared/ask" - = render :partial => "shared/lessons" - -#lesson-content - = lesson_categories @lesson - - =markdown(@lesson.output) diff --git a/app/views/mailer/_form.html.haml b/app/views/mailer/_form.html.haml deleted file mode 100644 index 52e95c84..00000000 --- a/app/views/mailer/_form.html.haml +++ /dev/null @@ -1,11 +0,0 @@ -=simple_form_for(@message, :url => mailer_path) do |f| - =f.error_notification - .inputs - =f.input :subject, :hint => "Write the subject here!" - =f.input :body, :as => :text - - -@emails.each do |email| - =f.input "email[#{email}]", :as => :text, :as => :hidden, :input_html => { :value => ""} - - .actions - =f.button :submit , 'Send Email', :class => "primary btn" \ No newline at end of file diff --git a/app/views/mailer/new.html.haml b/app/views/mailer/new.html.haml deleted file mode 100644 index c9f04e11..00000000 --- a/app/views/mailer/new.html.haml +++ /dev/null @@ -1,7 +0,0 @@ -%h1 Send an Email! -= render "form" - -This email will send to: --@emails.each do |email| - = email - = " " \ No newline at end of file diff --git a/app/views/message_mailer/new_message.html.haml b/app/views/message_mailer/new_message.html.haml deleted file mode 100644 index df3f577a..00000000 --- a/app/views/message_mailer/new_message.html.haml +++ /dev/null @@ -1 +0,0 @@ -=@message.body \ No newline at end of file diff --git a/app/views/notification/new_answer.html.haml b/app/views/notification/new_answer.html.haml deleted file mode 100644 index 0c38fe81..00000000 --- a/app/views/notification/new_answer.html.haml +++ /dev/null @@ -1,3 +0,0 @@ -Hey there! You asked a question on Hackety.com: "" - -Someone has replied with an answer! Check it out here: #{@url} diff --git a/app/views/programs/index.html.haml b/app/views/programs/index.html.haml deleted file mode 100644 index 46f0a890..00000000 --- a/app/views/programs/index.html.haml +++ /dev/null @@ -1,34 +0,0 @@ -- content_for :title do - - if @user - #{@user.username}'s Programs - - else - Programs - -- unless @featured.blank? or @user - #featured.programs - .heading - %h3 Featured - .description Our favorite selection of projects. - - %ul - - @featured.each do |program| - %li - .title= program_link program - .author= author_link program.author_username, program - -#all-programs.programs - - unless @user - .heading - %h3 All Programs - .description Every program uploaded by our users! - - %ul - - @programs.each do |program| - %li - .title= program_link program - .author= author_link program.author_username, program - -- if @user - %ul.inline-menu.bottom-nav - %li= link_to "All Programs", programs_path - %li= link_to "#{@user.username}'s profile", user_path(@user) diff --git a/app/views/programs/show.html.haml b/app/views/programs/show.html.haml deleted file mode 100644 index b5ff2b1b..00000000 --- a/app/views/programs/show.html.haml +++ /dev/null @@ -1,30 +0,0 @@ -- unless current_user - - content_for :alert do - .alert-message.block-message.info - %p - = author_link @program.author_username - and many others are using - %strong Hackety Hack - to learn how to code. - %p Hackety Hack is a free program for Windows, Mac OS X and Linux that can teach you how to make games, applications and more and share those programs with your friends. You can ask other budding programmers questions and follow them to see what code they're working on through the Hackety Hack website. - - = link_to "Sign up", new_user_registration_path, :class => "btn primary" - = link_to "Learn More", root_path, :class => "btn" - -- content_for :title do - = @program.title - -- content_for :subtitle do - %small - by - = link_to @program.author_username, user_path(@program.author_username) - -.description - %p= @program.description - -#program - %pre.prettyprint= @program.source_code - - %ul.inline-menu.bottom-nav - %li= link_to "#{@program.author_username}'s programs", user_programs_path(@program.author_username) - %li= link_to "All Programs", programs_path diff --git a/app/views/questions/_form.html.haml b/app/views/questions/_form.html.haml deleted file mode 100644 index de4eec3f..00000000 --- a/app/views/questions/_form.html.haml +++ /dev/null @@ -1,12 +0,0 @@ -= simple_form_for(resource, :url => @form_url) do |f| - = f.error_notification - - .inputs - = f.input :title, :hint => "What's your question?" - - if @support - = f.hidden_field :support, :value => true - = f.input :description, :as => :text, - :hint => "Provide some details about your problem to help diagnose it You can format your input with Markdown".html_safe - - .actions - = f.button :submit , 'Ask Everyone', :class => "primary btn" diff --git a/app/views/questions/_list.html.haml b/app/views/questions/_list.html.haml deleted file mode 100644 index fe52303d..00000000 --- a/app/views/questions/_list.html.haml +++ /dev/null @@ -1,15 +0,0 @@ -%li.item{:id=>question.id, :class => question.answers.count > 0 ? (question.solution_id.nil? ? "answered" : "accepted") : "unanswered"} - .answer-count - %h3= question.answers.count - #{question.answers.count == 1 ? "answer" : "answers"} - .summary - %h2.title= link_to question.title, resource_path(question) - .meta - Asked by - %span.name= link_to question.user.username, user_path(question.user) - - %span.date= time_ago_in_words(question.created_at) - ago - .description= truncate(question.description, :length => 150) - - if current_user && current_user.moderator? - %div.move_question= link_to "Move to #{question.support? ? 'Questions' : 'Support'} »", question_path(question, :question => { :support => (question.support? ? "false" : "true") }), :method => :put, :class => "btn small info" diff --git a/app/views/questions/edit.html.haml b/app/views/questions/edit.html.haml deleted file mode 100644 index 76006cdd..00000000 --- a/app/views/questions/edit.html.haml +++ /dev/null @@ -1,4 +0,0 @@ -- content_for :title do - = "Editing #{resource.title}" - -= render 'form' diff --git a/app/views/questions/index.atom.builder b/app/views/questions/index.atom.builder deleted file mode 100644 index 09f14748..00000000 --- a/app/views/questions/index.atom.builder +++ /dev/null @@ -1,19 +0,0 @@ -atom_feed :language => 'en-US' do |feed| - feed.title "Hackety Hack Questions" - feed.updated @updated - - @questions.each do |question| - feed.entry( question ) do |entry| - entry.url question_url(question) - entry.title question.title - entry.content question.description - - # the strftime is needed to work with Google Reader. - entry.updated(question.updated_at.strftime("%Y-%m-%dT%H:%M:%SZ")) - - entry.author do |author| - author.name question.user.username - end - end - end -end \ No newline at end of file diff --git a/app/views/questions/index.html.haml b/app/views/questions/index.html.haml deleted file mode 100644 index 41739204..00000000 --- a/app/views/questions/index.html.haml +++ /dev/null @@ -1,29 +0,0 @@ -- content_for :head do - - if @support - = auto_discovery_link_tag :atom, support_questions_url(format: :atom) - - else - = auto_discovery_link_tag :atom, questions_url(format: :atom) - -- content_for :title do - -if @support - Support Questions - -else - Questions - -- content_for :sidebar do - = render :partial => "shared/ask" - - if @support - = render :partial => "shared/questions_blurb" - - else - = render :partial => "shared/support_blurb" - -- content_for :feed do - - if @support - = link_to "Feed", support_questions_url(format: :atom) - - else - = link_to "Feed", questions_url(format: :atom) - -%ul.questions - = render :partial => "list", :collection => collection, :as => :question - -= will_paginate(@questions, renderer: @support ? PrefixLinkRenderer.new('/support') : nil) diff --git a/app/views/questions/new.html.haml b/app/views/questions/new.html.haml deleted file mode 100644 index fc5dcc8a..00000000 --- a/app/views/questions/new.html.haml +++ /dev/null @@ -1,4 +0,0 @@ -- content_for :title do - New Question - -= render 'form' diff --git a/app/views/questions/show.html.haml b/app/views/questions/show.html.haml deleted file mode 100644 index b53a34b1..00000000 --- a/app/views/questions/show.html.haml +++ /dev/null @@ -1,37 +0,0 @@ -- @content_class = "question" -- content_for :title do - = resource.title - -- content_for :sidebar do - - if can? :update, resource - = link_to 'Edit', edit_resource_path, :class => "edit btn" - - if can? :destroy, resource - = link_to 'Delete', resource_path, :class => "delete btn", :confirm => 'Are you sure?', :method => :delete - - - = render :partial => "shared/ask" - - if @support - = render :partial => "shared/questions_blurb" - - else - = render :partial => "shared/support_blurb" - -.meta - Asked - - if resource.user - by - %span.name= link_to resource.user.username, user_path(resource.user) - - %span.date= time_ago_in_words(resource.created_at) - ago - - -.description - =markdown(resource.description) - -%h2= pluralize(resource.answers.count, "response") -%ul.answers - = render :partial => "answers/list", :collection => resource.answers - -- if can? :create, Answer - = render :partial => "answers/short_answer" - diff --git a/app/views/shared/_ask.html.haml b/app/views/shared/_ask.html.haml deleted file mode 100644 index 7f7efda5..00000000 --- a/app/views/shared/_ask.html.haml +++ /dev/null @@ -1,11 +0,0 @@ -%section.ask - %h2 Have A Question? - %p Ask away! No question is too big or too small. - - if current_user - - if @support - = link_to "Ask a Question", new_question_path(:support => true), :class => "btn success" - - else - = link_to "Ask a Question", new_question_path, :class => "btn success" - - else - %p Log in to ask a question - = link_to "Log In", login_path, :class => "btn success" diff --git a/app/views/shared/_lessons.html.haml b/app/views/shared/_lessons.html.haml deleted file mode 100644 index 93419a2d..00000000 --- a/app/views/shared/_lessons.html.haml +++ /dev/null @@ -1,4 +0,0 @@ -%section.lessons - %h2 Want to help? - %p Help us create new lessons, or update existing ones. Check out the Lessons project on Github below: - = link_to "Hackety Hack Lessons on Github", "https://github.com/hacketyhack/hackety_hack-lessons" \ No newline at end of file diff --git a/app/views/shared/_questions_blurb.html.haml b/app/views/shared/_questions_blurb.html.haml deleted file mode 100644 index fdd9f1f0..00000000 --- a/app/views/shared/_questions_blurb.html.haml +++ /dev/null @@ -1,3 +0,0 @@ -%section.support - %h2 Ruby Questions - %p Programming problem got you stumped? Find Ruby a bit confusing? Check out the #{link_to "questions section", questions_path}. diff --git a/app/views/shared/_recent.html.haml b/app/views/shared/_recent.html.haml deleted file mode 100644 index 9a7460aa..00000000 --- a/app/views/shared/_recent.html.haml +++ /dev/null @@ -1,6 +0,0 @@ -%section.recent - %h2 Recent Posts - %ul - - BlogPost.sort("created_at DESC").limit(5).each do |post| - %li - = link_to post.title, blog_path(post) diff --git a/app/views/shared/_support_blurb.html.haml b/app/views/shared/_support_blurb.html.haml deleted file mode 100644 index 2c526e65..00000000 --- a/app/views/shared/_support_blurb.html.haml +++ /dev/null @@ -1,3 +0,0 @@ -%section.support - %h2 Support - %p Having a problem running Hackety Hack? Found a bug? Check out the #{link_to "support section", support_questions_path} diff --git a/app/views/shared/menu/_footer.html.haml b/app/views/shared/menu/_footer.html.haml deleted file mode 100644 index 2cd33abe..00000000 --- a/app/views/shared/menu/_footer.html.haml +++ /dev/null @@ -1,8 +0,0 @@ -= semantic_menu :class => "pills" do |root| - - root.add "Home", root_path - - root.add "Blog", blog_index_path - - root.add "Questions", questions_path - - root.add "Programs", programs_path - - root.add "FAQ", faq_path - - root.add "Support", support_questions_path - diff --git a/app/views/shared/menu/_main.html.haml b/app/views/shared/menu/_main.html.haml deleted file mode 100644 index 41130bc5..00000000 --- a/app/views/shared/menu/_main.html.haml +++ /dev/null @@ -1,8 +0,0 @@ -= semantic_menu :class => "nav" do |root| - - root.add "Blog", blog_index_path - - root.add "Questions", questions_path - - root.add "Lessons", lessons_path - - root.add "Programs", programs_path - - root.add "FAQ", faq_path - - root.add "Support", support_questions_path - - root.add "Contribute", contribute_path diff --git a/app/views/shared/menu/_user.html.haml b/app/views/shared/menu/_user.html.haml deleted file mode 100644 index 2e4de22e..00000000 --- a/app/views/shared/menu/_user.html.haml +++ /dev/null @@ -1,9 +0,0 @@ -= semantic_menu :class => "nav secondary-nav" do |root| - - if current_user - - if current_user.moderator - - root.add "Send an Email", users_index_path - - root.add current_user.username, user_path(current_user) - - root.add "Log Out", logout_path - - else - - root.add "Log In", login_path - - root.add "Sign Up", new_user_registration_path diff --git a/app/views/static/api_root.html.haml b/app/views/static/api_root.html.haml deleted file mode 100644 index d4895c46..00000000 --- a/app/views/static/api_root.html.haml +++ /dev/null @@ -1,10 +0,0 @@ -= title "Welcome" - -%p For a list of the relations we've defined for this API, go #{link_to("here", rels_path, :rel => "/rels/rel-index")}. -%p You can find the latest released version of Hackety Hack #{link_to("here", newest_version_path, :rel => "/rels/current-application-version")}. - -%h2 Programs - -%p For a list of programs our users have made, go #{link_to("here", programs_path, :rel => "/rels/program-index")}. -%p To make a new program, you can find a form #{link_to("here", new_program_path, :rel => "/rels/program-new")}. - diff --git a/app/views/static/contribute.html.haml b/app/views/static/contribute.html.haml deleted file mode 100644 index bac61372..00000000 --- a/app/views/static/contribute.html.haml +++ /dev/null @@ -1,26 +0,0 @@ -- content_for :sidebar do - = render :partial => "shared/ask" - = render :partial => "shared/support_blurb" - -- content_for :title do - Contribute - -#Contribute - :markdown - Volunteers build Hackty Hack - want to help and join us to improve Hackety Hack? - - ## Want to help developing Hackety Hack? - - Both this web application and the Hackety Hack program itself are open source projects. This means volunteers build them, but it also means that you can jump in and help out! How cool would that be, right? - - You can help out with the development of this web application [here](https://github.com/hacketyhack/hackety-hack.com) and with the the development of the Hackety Hack program [here](https://github.com/hacketyhack/hacketyhack). - - Every contribution is very welcome! It can be a fixed typo, an issue report or an entirely new feature - that is up to you! Thanks in advance! - - ## Want to help us translate Hackety Hack? - - Hello everyone! - - We are in the process of translating Hackety Hack into as many foreign languages as possible so that people around the world can use the site with ease. - - If you are bilingual and interested in helping us make Hackety Hack a truly global phenomenon, accessible by all regardless of location or nationality and make learning Ruby even more fun, then please [sign up here!](http://crowdin.net/project/hackety-hackcom/invite) diff --git a/app/views/static/download.html.haml b/app/views/static/download.html.haml deleted file mode 100644 index 45181315..00000000 --- a/app/views/static/download.html.haml +++ /dev/null @@ -1,20 +0,0 @@ -%h2 Download - -%p Click the big green button below to start your download. - -%p - %a.btn.primary.large{:href => @download_url} - %b.download Download Now - %br - %span.version - Version 1.0.1 for #{@platform} - -%p Not on #{@platform}? Click #{link_to "here", downloads_path(@other_platforms.first)} for #{@other_platforms.first} and #{link_to "here", downloads_path(@other_platforms.second)} for #{@other_platforms.second}. -%br/ - -%h3 Sign up - -%p Once you've got that going, you should sign up for the web site. You can use the site to get help, share your programs with others, and other fun stuff! - -%br/ -= render :partial => "users/form", :locals => @locals diff --git a/app/views/static/faq.html.haml b/app/views/static/faq.html.haml deleted file mode 100644 index 8c2bbcb7..00000000 --- a/app/views/static/faq.html.haml +++ /dev/null @@ -1,85 +0,0 @@ -- content_for :sidebar do - = render :partial => "shared/ask" - = render :partial => "shared/support_blurb" - -- content_for :title do - Frequently Asked Questions - -#faq - :markdown - ##My install of Hackety-Hack crashes? - - Yes, we noticed that. Sorry. Multi-platform weirdness and all that. There are some known problems with HH on Windows Vista and XP, and they are being worked on. - - Always check you have the latest updates at the [Hackety Hack Downloads page](http://hackety-hack.com/downloads) just in case something has been fixed. - - Also, some Windows users have found that moving HH to C:\apps instead of C:\Programs.... makes HH a little happier. - - ##What tutorials are available after I finish 'Beyond Shoes'? - - There will be more Tutorials added in the future. Meanwhile may I direct your curious minds to the following excellent resources on learning more about Shoes, Ruby and programming: - - + [Shoes website](http://shoesrb.com "Shoooooes!") : links to several things Shoes-y, some repeated below. - + [Shoes Manual](http://shoesrb.com/manual/Hello.html "Shoes Manual!") : a light waltz through Shoes. This is available through Hackety Hack's 'Help' menu; - + [Nobody Knows Shoes](http://cloud.github.com/downloads/shoes/shoes/nks.pdf "Nobody Knows Shoes, with Midas") : _why's tutorial on Shoes and all the useful bits in it. Many, many, bits. - + Chris Pine's [Learn to program](http://pine.fm/LearnToProgram "Learn to program 1st Ed") : 1st Edition is online for free. 2nd Edition Book it as [Pragmatic Programmers](pragprog.com/LearnToProgram "Pragprog - Learn to Program 2nd Ed") is bigger, better and has many more examples) - + Poignant Guide to Ruby : the delightful exploration of ruby with some foxes, chunky bacon, and more of _why's stylish examples. [get it here](http://cloud.github.com/downloads/devyn/shoes-web/whys-poignant-guide-to-ruby.pdf "Poignant guide to Ruby") - + [Learn Ruby the Hard Way](http://ruby.learncodethehardway.org/book/) : Don't let the title scare you. This book does not assume any programming skills and yet it's great for novices. - - ##Why can't I see the Turtle? - - The tutorial on Turtle graphics uses `Turtle.draw` which gives the Turtle super-speed: it does the job and hides the turtle before you even see it. Turtles can be surprisingly fast. - - Change `Turtle.draw` to `Turtle.start` to see the turtle (whom I have nicknamed 'Chell') perform each of your commands. You can also do things like saying 'Chell! I command thee!' before each step, although it will not change the program outcome. But you might enjoy it. - - ##Where are my programs and samples stored? - - *Linux* - - + My Programs: your home directory, in the hidden folder '.hacketyhack' (eg: \users\jsmith\\.hacketyhack). - + Samples are in the 'samples' directory in the My Programs directory. - - *Mac OS X* - - + My Programs: your home directory, in the hidden folder '.hacketyhack' (eg: \Users\jsmith\\.hacketyhack). Quickest way to get there using the Finder menus > Go > Go to Folder > type `~/.hacketyhack/` then click 'Go'. The files are plain text and can be opened in any text editor. - + Samples are in the Hackety Hack Package (/Applications then right-click on Hackety Hack > Show Package Contents > Contents > MacOS > app > samples) - - *Windows Vista / XP* - - + My Programs: In your _username_ 'Documents and Settings' folder (eg: C:\Documents and Settings\jsmith\\.hacketyhack). For the interested, the '.' at the start is left over from Linux and Mac and would otherwise make this folder hidden. But it's not on Windows. - + Samples are under the Shoes folder in 'Program Files' (eg: C:\Program Files\Common Files\Shoes\0.r1514\samples) - - ##How do I upload my programs to hackety-hack.com - - 1. Create an account on hackety-hack.com. Start by clicking #{link_to 'here', new_user_registration_path} - 2. In the HH application look for the 'Preferences' icon on the lower left side of the window - 3. Enter your hackety-hack.com account name and password then click 'Save' - 4. Now, when you create or edit a program, the 'Upload' button will be available to automatically upload the program to your page. - - ##What is the 'Preferences' page and the 2 text boxes? - - The 'Preferences' are for you to type your Hackety-hack.com account details, for uploading files to your hackety-hack.com profile page. - This is a way for you to show others what you are doing, and a way of sharing code if you are having problems. - When you enter any programs there will be an 'Upload' button in the editor (next to Run) which you can use to, well, *upload* the program to your Hackety-Hack.com profile page (on the hackety-hack.com site, click 'My Page' at top-right) - - ##Where is my page on hackety-hack.com? - - Check the upper right hand side of the page: when you're logged in, it has your username. Click it to go to your page. - - You can usually click on another user's name to get to their page, if you're elsewhere on the site. - - ##If I change a sample, does it change the original? - - No. When you click on a Sample program, it is loaded into the Editor and you can change as much of it as you like. When you exit, the sample is not changed. - - You can also click the 'Copy' button in the Editor (next to 'Run') then give it a new name and it will become one of your programs. You can then edit your version as much as you wish. - - (**NOTE**: _There is a small bug you might experience - after the 'Copy', Hackety Hack temporarily renames the sample program as well. The sample reverts to it's correct name after HH is closed/reopened_) - - ## Where'd you get the sweet icons? - - [Raindropmemory](http://raindropmemory.deviantart.com/#/d1xzrog) on Deviant Art made them. They're super great, aren't they? - - ## Thanks! - - Special thanks goes out to Eric Affleck for writing this FAQ. \ No newline at end of file diff --git a/app/views/static/root.html.haml b/app/views/static/root.html.haml deleted file mode 100644 index 6271f045..00000000 --- a/app/views/static/root.html.haml +++ /dev/null @@ -1,33 +0,0 @@ -- @page_class = "home" - -- content_for :top do - #home-splash - .container - = image_tag "splash.jpg" - -%section#download - %h1 Start Here! - .content - %p - Hackety Hack will teach you the absolute basics of programming from the ground up. No previous programming experience is needed! - %p - With Hackety Hack, you'll learn the Ruby programming language. Ruby is used for all kinds of programs, including desktop applications and websites. - %a.btn.primary.large{:href => "/downloads/latest/#{@platform}"} - %b.download Download Now - %br - %span.version - Version 1.0.1 - - if @platform - for #{@platform} - -%section#explore - %h1 Learn and Explore - .content - %p Hackety Hack uses the #{link_to "Shoes", "http://shoesrb.com/"} toolkit to make it really easy and fun to build graphical interfaces. Several lessons and example programs are provided, showing you how to make all kinds of fun things! - %p Check out what other people are doing with Hackety Hack! The #{link_to "Programs", programs_path} section is chock full of fun projects from other Hackety users. You can even upload your own! Put your account information into the Hackety Hack app, and you'll be able to share all the programs you create. - -%section#ask - %h1 Help is Here - .content - %p Got a question about Hackety Hack? Check out our #{link_to "FAQ", "faq"}. If that doesn't cover it ask for support #{link_to "here", support_questions_path}. - %p Got a question about programming in general? Ask away in the #{link_to "Questions", questions_path} section. No question to big or small, the community is here to help you out. diff --git a/app/views/users/_form.html.haml b/app/views/users/_form.html.haml deleted file mode 100644 index 49e9154b..00000000 --- a/app/views/users/_form.html.haml +++ /dev/null @@ -1,17 +0,0 @@ -- submit_label ||= "Update" -= simple_form_for(resource, :as => resource_name, :url => registration_path(resource_name)) do |f| - = f.error_notification - .inputs - = f.input :username, :autofocus => true - = f.input :email - .inputs - - pwd_options = resource.new_record? ? {} : {:hint => "Leave it blank if you don't want to change it"} - = f.input :password, pwd_options.merge({:required => false}) - = f.input :password_confirmation, :required => false - .inputs - = f.input :about, :as => :text - - unless resource.new_record? - .inputs - = f.input :current_password, :required => true, :hint => "We need your password to update your account." - .actions - = f.button :submit, submit_label, :class => "btn primary" diff --git a/app/views/users/deleted_user.html.haml b/app/views/users/deleted_user.html.haml deleted file mode 100644 index 10721f64..00000000 --- a/app/views/users/deleted_user.html.haml +++ /dev/null @@ -1 +0,0 @@ -%h2 This user has been deleted, sorry \ No newline at end of file diff --git a/app/views/users/followers.html.haml b/app/views/users/followers.html.haml deleted file mode 100644 index 61b43f7c..00000000 --- a/app/views/users/followers.html.haml +++ /dev/null @@ -1,5 +0,0 @@ -%h1 #{resource.username}'s followers: -%ul -- resource.followers.each do |follower| - %li - %a{:href=> resource_path(follower)}= follower.username \ No newline at end of file diff --git a/app/views/users/following.html.haml b/app/views/users/following.html.haml deleted file mode 100644 index 0f8fc492..00000000 --- a/app/views/users/following.html.haml +++ /dev/null @@ -1,5 +0,0 @@ -%h1 #{resource.username} is following: -%ul -- resource.following.each do |followee| - %li - %a{:href=> resource_path(followee)}= followee.username \ No newline at end of file diff --git a/app/views/users/index.html.haml b/app/views/users/index.html.haml deleted file mode 100644 index 2a365243..00000000 --- a/app/views/users/index.html.haml +++ /dev/null @@ -1,8 +0,0 @@ -=link_to "Create a diffusion", mailer_path(:user => User.all) -%ul#user-list - - @users.each do |user| - %li - .title= user.username - = link_to "Email him", mailer_path(:user => user), :class => "btn small info" - -= will_paginate @users \ No newline at end of file diff --git a/app/views/users/show.html.haml b/app/views/users/show.html.haml deleted file mode 100644 index d4a79eb7..00000000 --- a/app/views/users/show.html.haml +++ /dev/null @@ -1,55 +0,0 @@ -- content_for :title do - = "#{resource.username}'s Profile" - --content_for :sidebar do - %section.about-user - %img{:src => gravatar_url(resource.email)} - - if current_user && current_user != resource - -if current_user.following?(resource) - = simple_form_for(resource, :url => resource_path(current_user) + '/unfollow', :method=>:post) do |f| - = f.hidden_field :followee, :value => resource.id - = f.button :submit, :value => "Unfollow", :class => "primary btn" - - else - = simple_form_for(resource, :url => resource_path(current_user) + '/follow', :method=>:post) do |f| - = f.hidden_field :followee, :value => resource.id - = f.button :submit, :value => "Follow", :class => "primary btn" - - - unless resource.about.blank? - %p= resource.about - %p - = link_to pluralize(resource.programs.count, "Program"), user_programs_path(resource), :class => "user-programs" - %p - Following: - =link_to resource.following.count, resource_path(resource) + "/following", :class => 'user-following' - %p - Followers: - = link_to resource.followers.count, resource_path(resource) + "/followers", :class => 'user-followers' - %hr - - if can? :update, resource - = link_to "Change My Settings", edit_registration_path(resource), :class => "btn success" - - -- unless @user.questions.empty? - %section.user-questions - .heading - %h3= pluralize(@user.questions.count, "Question") - %ul - - @user.questions.each do |question| - %li - .title - = link_to question.title, question_path(question) - .meta - asked #{question.created_at.strftime("%b %e, %l:%M %p")} - -- unless @user.answers.empty? - %section.user-answers - .heading - %h3= pluralize(@user.answers.count, "Answer") - %ul - - @user.answers.each do |answer| - %li - .description - = answer.description.truncate(100) - .meta - = link_to("View Answer", answer.question) - diff --git a/config.ru b/config.ru deleted file mode 100644 index 3879ea33..00000000 --- a/config.ru +++ /dev/null @@ -1,4 +0,0 @@ -# This file is used by Rack-based servers to start the application. - -require ::File.expand_path('../config/environment', __FILE__) -run HacketyHackCom::Application diff --git a/config/application.rb b/config/application.rb deleted file mode 100644 index d2382e0a..00000000 --- a/config/application.rb +++ /dev/null @@ -1,31 +0,0 @@ -require File.expand_path('../boot', __FILE__) - -require 'rails/all' - -if defined?(Bundler) - # If you precompile assets before deploying to production, use this line - #Bundler.require *Rails.groups(:assets => %w(development test)) - # If you want your assets lazily compiled in production, use this line - Bundler.require(:default, :assets, Rails.env) -end - -module HacketyHackCom - class Application < Rails::Application - config.autoload_paths << "#{config.root}/lib" << "#{config.root}/presenters" - - config.encoding = "utf-8" - - config.filter_parameters += [:password] - - config.assets.enabled = true - - config.generators do |g| - g.template_engine :haml - - # you can also specify a different test framework or ORM here - g.test_framework :rspec, :fixture => true - g.fixture_replacement :fabrication - g.orm :mongo_mapper - end - end -end diff --git a/config/boot.rb b/config/boot.rb deleted file mode 100644 index 4489e586..00000000 --- a/config/boot.rb +++ /dev/null @@ -1,6 +0,0 @@ -require 'rubygems' - -# Set up gems listed in the Gemfile. -ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) - -require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE']) diff --git a/config/config.yml.sample b/config/config.yml.sample deleted file mode 100644 index 2ef60a26..00000000 --- a/config/config.yml.sample +++ /dev/null @@ -1,9 +0,0 @@ -# encoding: utf-8 -development: - # Your secret key for verifying the integrity of signed cookies. - # If you change this key, all old signed cookies will become invalid! - # Make sure the secret is at least 30 characters and all random, - # no regular words or you'll be exposed to dictionary attacks. - # Used in config/initializers/secret_token.rb. - # You can generate a good value for this by running `rake secret`. - SECRET_TOKEN: \ No newline at end of file diff --git a/config/cucumber.yml b/config/cucumber.yml deleted file mode 100644 index 67669be1..00000000 --- a/config/cucumber.yml +++ /dev/null @@ -1,8 +0,0 @@ -<% -rerun = File.file?('rerun.txt') ? IO.read('rerun.txt') : "" -rerun_opts = rerun.to_s.strip.empty? ? "--color --format #{ENV['CUCUMBER_FORMAT'] || 'progress'} features" : "--format #{ENV['CUCUMBER_FORMAT'] || 'pretty'} #{rerun}" -std_opts = "--color --format #{ENV['CUCUMBER_FORMAT'] || 'pretty'} --strict --tags ~@wip" -%> -default: <%= std_opts %> features -wip: --tags @wip:3 --wip features -rerun: <%= rerun_opts %> --format rerun --out rerun.txt --strict --tags ~@wip diff --git a/config/database.yml b/config/database.yml deleted file mode 100644 index 09cc85a2..00000000 --- a/config/database.yml +++ /dev/null @@ -1,28 +0,0 @@ -# SQLite version 3.x -# gem install sqlite3 -# -# Ensure the SQLite 3 gem is defined in your Gemfile -# gem 'sqlite3' -development: - adapter: sqlite3 - database: db/development.sqlite3 - pool: 5 - timeout: 5000 - -# Warning: The database defined as "test" will be erased and -# re-generated from your development database when you run "rake". -# Do not set this db to the same as development or production. -test: &test - adapter: sqlite3 - database: db/test.sqlite3 - pool: 5 - timeout: 5000 - -production: - adapter: sqlite3 - database: db/production.sqlite3 - pool: 5 - timeout: 5000 - -cucumber: - <<: *test \ No newline at end of file diff --git a/config/environment.rb b/config/environment.rb deleted file mode 100644 index 0fb2941c..00000000 --- a/config/environment.rb +++ /dev/null @@ -1,5 +0,0 @@ -# Load the rails application -require File.expand_path('../application', __FILE__) - -# Initialize the rails application -HacketyHackCom::Application.initialize! diff --git a/config/environments/development.rb b/config/environments/development.rb deleted file mode 100644 index e1189b93..00000000 --- a/config/environments/development.rb +++ /dev/null @@ -1,30 +0,0 @@ -HacketyHackCom::Application.configure do - # Settings specified here will take precedence over those in config/application.rb - - # In the development environment your application's code is reloaded on - # every request. This slows down response time but is perfect for development - # since you don't have to restart the web server when you make code changes. - config.cache_classes = false - - # Log error messages when you accidentally call methods on nil. - config.whiny_nils = true - - # Show full error reports and disable caching - config.consider_all_requests_local = true - config.action_controller.perform_caching = false - - # Don't care if the mailer can't send - config.action_mailer.raise_delivery_errors = false - - # Print deprecation notices to the Rails logger - config.active_support.deprecation = :log - - # Only use best-standards-support built into browsers - config.action_dispatch.best_standards_support = :builtin - - # Do not compress assets - config.assets.compress = false - - config.action_mailer.default_url_options = { :host => 'localhost:3000' } - config.action_mailer.delivery_method = :letter_opener -end diff --git a/config/environments/production.rb b/config/environments/production.rb deleted file mode 100644 index 9562087c..00000000 --- a/config/environments/production.rb +++ /dev/null @@ -1,64 +0,0 @@ -HacketyHackCom::Application.configure do - # Settings specified here will take precedence over those in config/application.rb - - # Code is not reloaded between requests - config.cache_classes = true - - # Full error reports are disabled and caching is turned on - config.consider_all_requests_local = false - config.action_controller.perform_caching = true - - # Disable Rails's static asset server (Apache or nginx will already do this) - config.serve_static_assets = false - - # Compress JavaScripts and CSS - config.assets.compress = true - - # Specifies the header that your server uses for sending files - # config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache - # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx - - # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies. - # config.force_ssl = true - - # See everything in the log (default is :info) - # config.log_level = :debug - - # Use a different logger for distributed setups - # config.logger = SyslogLogger.new - - # Use a different cache store in production - # config.cache_store = :mem_cache_store - - # Enable serving of images, stylesheets, and JavaScripts from an asset server - # config.action_controller.asset_host = "http://assets.example.com" - - # Precompile additional assets (application.js, application.css, and all non-JS/CSS are already added) - # config.assets.precompile += %w( search.js ) - - # Disable delivery errors, bad email addresses will be ignored - # config.action_mailer.raise_delivery_errors = false - config.action_mailer.default_url_options = { :host => "hackety-hack.com" } - - # Enable threaded mode - # config.threadsafe! - - # Enable locale fallbacks for I18n (makes lookups for any locale fall back to - # the I18n.default_locale when a translation can not be found) - config.i18n.fallbacks = true - - # Send deprecation notices to registered listeners - config.active_support.deprecation = :notify -end - -ActionMailer::Base.smtp_settings = { - :address => 'smtp.sendgrid.net', - :port => '587', - :authentication => :plain, - :user_name => ENV['SENDGRID_USERNAME'], - :password => ENV['SENDGRID_PASSWORD'], - :domain => 'hackety.com' -} -ActionMailer::Base.delivery_method = :smtp - - diff --git a/config/environments/test.rb b/config/environments/test.rb deleted file mode 100644 index a2dc3c74..00000000 --- a/config/environments/test.rb +++ /dev/null @@ -1,39 +0,0 @@ -HacketyHackCom::Application.configure do - # Settings specified here will take precedence over those in config/application.rb - - # The test environment is used exclusively to run your application's - # test suite. You never need to work with it otherwise. Remember that - # your test database is "scratch space" for the test suite and is wiped - # and recreated between test runs. Don't rely on the data there! - config.cache_classes = true - - # Configure static asset server for tests with Cache-Control for performance - config.serve_static_assets = true - config.static_cache_control = "public, max-age=3600" - - # Log error messages when you accidentally call methods on nil - config.whiny_nils = true - - # Show full error reports and disable caching - config.consider_all_requests_local = true - config.action_controller.perform_caching = false - - # Raise exceptions instead of rendering exception templates - config.action_dispatch.show_exceptions = false - - # Disable request forgery protection in test environment - config.action_controller.allow_forgery_protection = false - - # Tell Action Mailer not to deliver emails to the real world. - # The :test delivery method accumulates sent emails in the - # ActionMailer::Base.deliveries array. - config.action_mailer.delivery_method = :test - - # Use SQL instead of Active Record's schema dumper when creating the test database. - # This is necessary if your schema can't be completely dumped by the schema dumper, - # like if you have constraints or database-specific column types - # config.active_record.schema_format = :sql - - # Print deprecation notices to the stderr - config.active_support.deprecation = :stderr -end diff --git a/config/initializers/backtrace_silencers.rb b/config/initializers/backtrace_silencers.rb deleted file mode 100644 index 59385cdf..00000000 --- a/config/initializers/backtrace_silencers.rb +++ /dev/null @@ -1,7 +0,0 @@ -# Be sure to restart your server when you modify this file. - -# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces. -# Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ } - -# You can also remove all the silencers if you're trying to debug a problem that might stem from framework code. -# Rails.backtrace_cleaner.remove_silencers! diff --git a/config/initializers/cve_fix.rb b/config/initializers/cve_fix.rb deleted file mode 100644 index f8788d01..00000000 --- a/config/initializers/cve_fix.rb +++ /dev/null @@ -1,2 +0,0 @@ -ActionDispatch::ParamsParser::DEFAULT_PARSERS.delete(Mime::XML) - diff --git a/config/initializers/devise.rb b/config/initializers/devise.rb deleted file mode 100644 index 0b2e519b..00000000 --- a/config/initializers/devise.rb +++ /dev/null @@ -1,193 +0,0 @@ -# Use this hook to configure devise mailer, warden hooks and so forth. The first -# four configuration values can also be set straight in your models. -Devise.setup do |config| - # ==> Mailer Configuration - # Configure the e-mail address which will be shown in DeviseMailer. - config.mailer_sender = "do-not-reply@hackety-hack.com" - - # Configure the class responsible to send e-mails. - # config.mailer = "Devise::Mailer" - - # ==> ORM configuration - # Load and configure the ORM. Supports :active_record (default) and - # :mongoid (bson_ext recommended) by default. Other ORMs may be - # available as additional gems. - require 'devise/orm/mongo_mapper' - - # ==> Configuration for any authentication mechanism - # Configure which keys are used when authenticating a user. The default is - # just :email. You can configure it to use [:username, :subdomain], so for - # authenticating a user, both parameters are required. Remember that those - # parameters are used only when authenticating and not when retrieving from - # session. If you need permissions, you should implement that in a before filter. - # You can also supply a hash where the value is a boolean determining whether - # or not authentication should be aborted when the value is not present. - config.authentication_keys = [ :username ] - - # Configure parameters from the request object used for authentication. Each entry - # given should be a request method and it will automatically be passed to the - # find_for_authentication method and considered in your model lookup. For instance, - # if you set :request_keys to [:subdomain], :subdomain will be used on authentication. - # The same considerations mentioned for authentication_keys also apply to request_keys. - # config.request_keys = [] - - # Configure which authentication keys should be case-insensitive. - # These keys will be downcased upon creating or modifying a user and when used - # to authenticate or find a user. Default is :email. - config.case_insensitive_keys = [ :email, :username ] - - # Configure which authentication keys should have whitespace stripped. - # These keys will have whitespace before and after removed upon creating or - # modifying a user and when used to authenticate or find a user. Default is :email. - config.strip_whitespace_keys = [ :email, :username ] - - # Tell if authentication through request.params is enabled. True by default. - # config.params_authenticatable = true - - # Tell if authentication through HTTP Basic Auth is enabled. False by default. - # config.http_authenticatable = false - - # If http headers should be returned for AJAX requests. True by default. - # config.http_authenticatable_on_xhr = true - - # The realm used in Http Basic Authentication. "Application" by default. - # config.http_authentication_realm = "Application" - - # It will change confirmation, password recovery and other workflows - # to behave the same regardless if the e-mail provided was right or wrong. - # Does not affect registerable. - # config.paranoid = true - - # ==> Configuration for :database_authenticatable - # For bcrypt, this is the cost for hashing the password and defaults to 10. If - # using other encryptors, it sets how many times you want the password re-encrypted. - config.stretches = 10 - - # Setup a pepper to generate the encrypted password. - # config.pepper = "4a818140cd08e18cc871b1e36509f6f9066975bdf9ffa2e26c02d6bcd46b9e17614108a411c88c7dfd0aa83a864dde63a84fc27becf32d02ff194f2abd235138" - - # ==> Configuration for :confirmable - # The time you want to give your user to confirm his account. During this time - # he will be able to access your application without confirming. Default is 0.days - # When confirm_within is zero, the user won't be able to sign in without confirming. - # You can use this to let your user access some features of your application - # without confirming the account, but blocking it after a certain period - # (ie 2 days). - # config.allow_unconfirmed_access_for = 2.days - - # Defines which key will be used when confirming an account - # config.confirmation_keys = [ :email ] - - # ==> Configuration for :rememberable - # The time the user will be remembered without asking for credentials again. - # config.remember_for = 2.weeks - - # If true, extends the user's remember period when remembered via cookie. - # config.extend_remember_period = false - - # Options to be passed to the created cookie. For instance, you can set - # :secure => true in order to force SSL only cookies. - # config.cookie_options = {} - - # ==> Configuration for :validatable - # Range for password length. Default is 6..128. - # config.password_length = 6..128 - - # Regex to use to validate the email address - config.email_regexp = /([\w\.%\+\-]+)@([\w\-]+\.)+([\w]{2,})/i - - # ==> Configuration for :timeoutable - # The time you want to timeout the user session without activity. After this - # time the user will be asked for credentials again. Default is 30 minutes. - # config.timeout_in = 30.minutes - - # ==> Configuration for :lockable - # Defines which strategy will be used to lock an account. - # :failed_attempts = Locks an account after a number of failed attempts to sign in. - # :none = No lock strategy. You should handle locking by yourself. - # config.lock_strategy = :failed_attempts - - # Defines which key will be used when locking and unlocking an account - # config.unlock_keys = [ :email ] - - # Defines which strategy will be used to unlock an account. - # :email = Sends an unlock link to the user email - # :time = Re-enables login after a certain amount of time (see :unlock_in below) - # :both = Enables both strategies - # :none = No unlock strategy. You should handle unlocking by yourself. - # config.unlock_strategy = :both - - # Number of authentication tries before locking an account if lock_strategy - # is failed attempts. - # config.maximum_attempts = 20 - - # Time interval to unlock the account if :time is enabled as unlock_strategy. - # config.unlock_in = 1.hour - - # ==> Configuration for :recoverable - # - # Defines which key will be used when recovering the password for an account - # config.reset_password_keys = [ :email ] - - # Time interval you can reset your password with a reset password key. - # Don't put a too small interval or your users won't have the time to - # change their passwords. - config.reset_password_within = 2.hours - - # ==> Configuration for :encryptable - # Allow you to use another encryption algorithm besides bcrypt (default). You can use - # :sha1, :sha512 or encryptors from others authentication tools as :clearance_sha1, - # :authlogic_sha512 (then you should set stretches above to 20 for default behavior) - # and :restful_authentication_sha1 (then you should set stretches to 10, and copy - # REST_AUTH_SITE_KEY to pepper) - # config.encryptor = :sha512 - - # ==> Configuration for :token_authenticatable - # Defines name of the authentication token params key - # config.token_authentication_key = :auth_token - - # ==> Scopes configuration - # Turn scoped views on. Before rendering "sessions/new", it will first check for - # "users/sessions/new". It's turned off by default because it's slower if you - # are using only default views. - # config.scoped_views = false - - # Configure the default scope given to Warden. By default it's the first - # devise role declared in your routes (usually :user). - # config.default_scope = :user - - # Configure sign_out behavior. - # Sign_out action can be scoped (i.e. /users/sign_out affects only :user scope). - # The default is true, which means any logout action will sign out all active scopes. - # config.sign_out_all_scopes = true - - # ==> Navigation configuration - # Lists the formats that should be treated as navigational. Formats like - # :html, should redirect to the sign in page when the user does not have - # access, but formats like :xml or :json, should return 401. - # - # If you have any extra navigational formats, like :iphone or :mobile, you - # should add them to the navigational formats lists. - # - # The :"*/*" and "*/*" formats below is required to match Internet - # Explorer requests. - # config.navigational_formats = [:"*/*", "*/*", :html] - - # The default HTTP method used to sign out a resource. Default is :delete. - config.sign_out_via = :delete - - # ==> OmniAuth - # Add a new OmniAuth provider. Check the wiki for more information on setting - # up on your models and hooks. - # config.omniauth :github, 'APP_ID', 'APP_SECRET', :scope => 'user,public_repo' - - # ==> Warden configuration - # If you want to use other strategies, that are not supported by Devise, or - # change the failure app, you can configure them inside the config.warden block. - # - # config.warden do |manager| - # manager.failure_app = AnotherApp - # manager.intercept_401 = false - # manager.default_strategies(:scope => :user).unshift :some_external_strategy - # end -end diff --git a/config/initializers/inflections.rb b/config/initializers/inflections.rb deleted file mode 100644 index 9e8b0131..00000000 --- a/config/initializers/inflections.rb +++ /dev/null @@ -1,10 +0,0 @@ -# Be sure to restart your server when you modify this file. - -# Add new inflection rules using the following format -# (all these examples are active by default): -# ActiveSupport::Inflector.inflections do |inflect| -# inflect.plural /^(ox)$/i, '\1en' -# inflect.singular /^(ox)en/i, '\1' -# inflect.irregular 'person', 'people' -# inflect.uncountable %w( fish sheep ) -# end diff --git a/config/initializers/mime_types.rb b/config/initializers/mime_types.rb deleted file mode 100644 index 72aca7e4..00000000 --- a/config/initializers/mime_types.rb +++ /dev/null @@ -1,5 +0,0 @@ -# Be sure to restart your server when you modify this file. - -# Add new mime types for use in respond_to blocks: -# Mime::Type.register "text/richtext", :rtf -# Mime::Type.register_alias "text/html", :iphone diff --git a/config/initializers/mongo_mapper.rb b/config/initializers/mongo_mapper.rb deleted file mode 100644 index 0d1f648e..00000000 --- a/config/initializers/mongo_mapper.rb +++ /dev/null @@ -1,9 +0,0 @@ -if ENV['MONGOHQ_URL'] - MongoMapper.config = { - Rails.env => { 'uri' => ENV['MONGOHQ_URL'] } - } - - MongoMapper.connect(Rails.env) -else - MongoMapper.database = "hackety-hack-com-#{Rails.env}" -end diff --git a/config/initializers/pry.rb b/config/initializers/pry.rb deleted file mode 100644 index 648b3dd8..00000000 --- a/config/initializers/pry.rb +++ /dev/null @@ -1,9 +0,0 @@ -if Rails.env.development? - silence_warnings do - begin - require 'pry' - IRB = Pry - rescue LoadError - end - end -end diff --git a/config/initializers/secret_token.rb b/config/initializers/secret_token.rb deleted file mode 100644 index 5e4aedfb..00000000 --- a/config/initializers/secret_token.rb +++ /dev/null @@ -1,20 +0,0 @@ -if ENV["SECRET_TOKEN"].blank? - if Rails.env.production? - raise "You must set ENV[\"SECRET_TOKEN\"] in your app's config vars" - elsif Rails.env.test? - # Generate the key and test away - ENV["SECRET_TOKEN"] = HacketyHackCom::Application.config.secret_token = SecureRandom.hex(30) - else - config_file = File.expand_path(File.join(Rails.root, '/config/config.yml')) - unless File.exist? config_file - require 'fileutils' - FileUtils.cp config_file + '.sample', config_file - end - config = YAML.load_file(config_file) - # Generate the key, set it for the current environment, update the yaml file and move on - ENV["SECRET_TOKEN"] = config[Rails.env]['SECRET_TOKEN'] = SecureRandom.hex(30) - File.open(config_file, 'w') { |file| file.write(config.to_yaml) } - end -end - -HacketyHackCom::Application.config.secret_token = ENV["SECRET_TOKEN"] diff --git a/config/initializers/session_store.rb b/config/initializers/session_store.rb deleted file mode 100644 index 840e5772..00000000 --- a/config/initializers/session_store.rb +++ /dev/null @@ -1,8 +0,0 @@ -# Be sure to restart your server when you modify this file. - -HacketyHackCom::Application.config.session_store :cookie_store, :key => '_hackety-hack.com_session' - -# Use the database for sessions instead of the cookie-based default, -# which shouldn't be used to store highly confidential information -# (create the session table with "rails generate session_migration") -# HacketyHackCom::Application.config.session_store :active_record_store diff --git a/config/initializers/simple_form.rb b/config/initializers/simple_form.rb deleted file mode 100644 index 7cfda7fd..00000000 --- a/config/initializers/simple_form.rb +++ /dev/null @@ -1,103 +0,0 @@ -# Use this setup block to configure all options available in SimpleForm. -SimpleForm.setup do |config| - # Components used by the form builder to generate a complete input. You can remove - # any of them, change the order, or even add your own components to the stack. - # config.components = [ :placeholder, :label_input, :hint, :error ] - config.components = [ :placeholder, :label_input, :hint, :error ] - - # Default tag used on hints. - # config.hint_tag = :span - - # CSS class to add to all hint tags. - # config.hint_class = :hint - config.hint_class = "help-inline" - - # CSS class used on errors. - # config.error_class = :error - config.error_class = "help-inline" - - # Default tag used on errors. - # config.error_tag = :span - - # Method used to tidy up errors. - # config.error_method = :first - - # Default tag used for error notification helper. - # config.error_notification_tag = :p - - # CSS class to add for error notification helper. - # config.error_notification_class = :error_notification - - # ID to add for error notification helper. - # config.error_notification_id = nil - - # You can wrap all inputs in a pre-defined tag. - # config.wrapper_tag = :div - config.wrapper_tag = :div - - config.input_wrapper_tag = :div - config.input_wrapper_class = 'input' - - # CSS class to add to all wrapper tags. - # config.wrapper_class = :input - config.wrapper_class = :clearfix - - # CSS class to add to the wrapper if the field has errors. - # config.wrapper_error_class = :field_with_errors - config.wrapper_error_class = :error - - # You can wrap a collection of radio/check boxes in a pre-defined tag, defaulting to none. - # config.collection_wrapper_tag = nil - - # You can wrap each item in a collection of radio/check boxes with a tag, defaulting to span. - # config.item_wrapper_tag = :span - - # Series of attempts to detect a default label method for collection. - # config.collection_label_methods = [ :to_label, :name, :title, :to_s ] - - # Series of attempts to detect a default value method for collection. - # config.collection_value_methods = [ :id, :to_s ] - - # How the label text should be generated altogether with the required text. - # config.label_text = lambda { |label, required| "#{required} #{label}" } - config.label_text = lambda { |label, required| "#{label} #{required}" } - - # You can define the class to use on all labels. Default is nil. - # config.label_class = nil - - # You can define the class to use on all forms. Default is simple_form. - # config.form_class = :simple_form - - # Whether attributes are required by default (or not). Default is true. - # config.required_by_default = true - - # Tell browsers whether to use default HTML5 validations (novalidate option). - # Default is enabled. - # config.browser_validations = true - - # Determines whether HTML5 types (:email, :url, :search, :tel) and attributes - # (e.g. required) are used or not. True by default. - # Having this on in non-HTML5 compliant sites can cause odd behavior in - # HTML5-aware browsers such as Chrome. - # config.html5 = true - - # Custom mappings for input types. This should be a hash containing a regexp - # to match as key, and the input type that will be used when the field name - # matches the regexp as value. - # config.input_mappings = { /count/ => :integer } - - # Collection of methods to detect if a file type was given. - # config.file_methods = [ :mounted_as, :file?, :public_filename ] - - # Default priority for time_zone inputs. - # config.time_zone_priority = nil - - # Default priority for country inputs. - # config.country_priority = nil - - # Default size for text inputs. - # config.default_input_size = 50 - - # When false, do not use translations for labels, hints or placeholders. - # config.translate = true -end diff --git a/config/initializers/wrap_parameters.rb b/config/initializers/wrap_parameters.rb deleted file mode 100644 index da4fb076..00000000 --- a/config/initializers/wrap_parameters.rb +++ /dev/null @@ -1,14 +0,0 @@ -# Be sure to restart your server when you modify this file. -# -# This file contains settings for ActionController::ParamsWrapper which -# is enabled by default. - -# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array. -ActiveSupport.on_load(:action_controller) do - wrap_parameters :format => [:json] -end - -# Disable root element in JSON by default. -ActiveSupport.on_load(:active_record) do - self.include_root_in_json = false -end diff --git a/config/locales/devise.en.yml b/config/locales/devise.en.yml deleted file mode 100644 index 93016092..00000000 --- a/config/locales/devise.en.yml +++ /dev/null @@ -1,53 +0,0 @@ -# Additional translations at http://github.com/plataformatec/devise/wiki/I18n - -en: - errors: - messages: - expired: "has expired, please request a new one" - not_found: "not found" - already_confirmed: "was already confirmed, please try signing in" - not_locked: "was not locked" - not_saved: - one: "1 error prohibited this %{resource} from being saved:" - other: "%{count} errors prohibited this %{resource} from being saved:" - - devise: - failure: - already_authenticated: 'You are already signed in.' - unauthenticated: 'You need to sign in or sign up before continuing.' - unconfirmed: 'You have to confirm your account before continuing.' - locked: 'Your account is locked.' - not_found_in_database: 'Invalid email or password.' - invalid: 'Invalid email or password.' - invalid_token: 'Invalid authentication token.' - timeout: 'Your session expired, please sign in again to continue.' - inactive: 'Your account was not activated yet.' - sessions: - signed_in: 'Signed in successfully.' - signed_out: 'Signed out successfully.' - passwords: - send_instructions: 'You will receive an email with instructions about how to reset your password in a few minutes.' - updated: 'Your password was changed successfully. You are now signed in.' - send_paranoid_instructions: "If your e-mail exists on our database, you will receive a password recovery link on your e-mail" - confirmations: - send_instructions: 'You will receive an email with instructions about how to confirm your account in a few minutes.' - send_paranoid_instructions: 'If your e-mail exists on our database, you will receive an email with instructions about how to confirm your account in a few minutes.' - confirmed: 'Your account was successfully confirmed. You are now signed in.' - registrations: - 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.' - signed_up_but_inactive: 'You have signed up successfully. However, we could not sign you in because your account is not yet activated.' - signed_up_but_locked: 'You have signed up successfully. However, we could not sign you in because your account is locked.' - unlocks: - send_instructions: 'You will receive an email with instructions about how to unlock your account in a few minutes.' - unlocked: 'Your account was successfully unlocked. You are now signed in.' - send_paranoid_instructions: 'If your account exists, you will receive an email with instructions about how to unlock it in a few minutes.' - omniauth_callbacks: - success: 'Successfully authorized from %{kind} account.' - failure: 'Could not authorize you from %{kind} because "%{reason}".' - mailer: - confirmation_instructions: - subject: 'Confirmation instructions' - reset_password_instructions: - subject: 'Reset password instructions' - unlock_instructions: - subject: 'Unlock Instructions' diff --git a/config/locales/en.yml b/config/locales/en.yml deleted file mode 100644 index 179c14ca..00000000 --- a/config/locales/en.yml +++ /dev/null @@ -1,5 +0,0 @@ -# Sample localization file for English. Add more files in this directory for other locales. -# See https://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale for starting points. - -en: - hello: "Hello world" diff --git a/config/locales/simple_form.en.yml b/config/locales/simple_form.en.yml deleted file mode 100644 index 409e2651..00000000 --- a/config/locales/simple_form.en.yml +++ /dev/null @@ -1,24 +0,0 @@ -en: - simple_form: - "yes": 'Yes' - "no": 'No' - required: - text: 'required' - mark: '*' - # You can uncomment the line below if you need to overwrite the whole required html. - # When using html, text and mark won't be used. - # html: '*' - error_notification: - default_message: "Some errors were found, please take a look:" - # Labels and hints examples - # labels: - # password: 'Password' - # user: - # new: - # email: 'E-mail para efetuar o sign in.' - # edit: - # email: 'E-mail.' - # hints: - # username: 'User name to sign in.' - # password: 'No special characters, please.' - diff --git a/config/routes.rb b/config/routes.rb deleted file mode 100644 index e46d05dc..00000000 --- a/config/routes.rb +++ /dev/null @@ -1,61 +0,0 @@ -HacketyHackCom::Application.routes.draw do - - get "users/index" - - match 'mailer' => 'mailer#new', :as => 'mailer', :via => :get - match 'mailer' => 'mailer#create', :as => 'mailer', :via => :post - get 'users/deleted_user', :to => 'users#deleted_user' - - resources :lessons, :only => [:index, :show] - - resources :questions do - resources :answers - end - - resources :blog, :controller => "blog" do - match "admin", :on => :collection, :controller => "blog", :action => "admin" - end - - get "/downloads/latest/:platform", :to => "static#download", :as => 'downloads' - get "/downloads/latest", :to => "static#download", :as => 'download' - match "/download" => redirect("/downloads/latest") - - scope '/support', :as => 'support' do - resources :questions, :controller => 'questions' do - resources :answers - end - end - - constraints(ApiConstraint) do - match '/' => 'static#api_root' - match '/versions/newest' => 'static#newest_version', :as => "newest_version" - scope :module => "Api" do - resources :rels, :only => [:index, :show] - resources :programs - end - end - - resources :programs, :only => [:index, :show] - - devise_for :users - devise_scope :user do - get "login" => "devise/sessions#new", :as => "login" - get "logout" => "devise/sessions#destroy", :as => "logout" - end - - resources :users, :constraints => { :id => /.*/ }, :only => :show do - get "following" => "users#following", :as => :following - get "followers" => "users#followers", :as => :followers - post "follow" => "users#follow", :as => :follow - post "unfollow" => "users#unfollow", :as => :unfollow - - resources :programs - end - - # match ':user_id/:slug', :to => "programs#show", :as => :program - - match 'faq' => 'static#faq' - match 'contribute' => 'static#contribute' - root :to => "static#root" - -end diff --git a/controllers/.content_controller.rb.swp b/controllers/.content_controller.rb.swp new file mode 100644 index 00000000..d90b42c7 Binary files /dev/null and b/controllers/.content_controller.rb.swp differ diff --git a/controllers/content_controller.html b/controllers/content_controller.html new file mode 100644 index 00000000..aaddf303 --- /dev/null +++ b/controllers/content_controller.html @@ -0,0 +1,102 @@ + + + + + content_controller.rb + + + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + +

    content_controller.rb

    +
    + # +
    +

    This is the controller that handles all of the different kinds of Content + posted to the site.

    +
    +
    +
    +
    + # +
    +

    We need a simple GET action that displays the given Content.

    +
    +
    get "/content/:id" do
    +  @content = Content.find(params[:id])
    +  haml :"content/show"
    +end
    +
    +
    + # +
    +

    We also need a simple POST that will create content.

    +
    +
    post "/content" do
    +  require_login!
    +
    +  params[:content][:author] = current_user.username
    +  params[:content][:author_email] = current_user.email
    +  @content = Content.create(params[:content])
    +  flash[:notice] = "Thanks for your post!"
    +  redirect "/stream"
    +end
    +
    +
    + # +
    +

    We’re allowing comments to be made on posts, so we need a route for that as + well.

    + +
    +
    post "/content/:id/comment" do
    +  require_login!
    +  @content = Content.first(:id => params[:id])
    +
    +  params[:comment][:author] = current_user.username
    +  params[:comment][:author_email] = current_user.email
    +  @content.comments << Comment.new(params[:comment])
    +  @content.save
    +
    +  flash[:notice] = "Replied!"
    +  redirect "/content/#{@content.id}"
    +end
    +
    +
    + diff --git a/controllers/hackers_controller.html b/controllers/hackers_controller.html new file mode 100644 index 00000000..20c55730 --- /dev/null +++ b/controllers/hackers_controller.html @@ -0,0 +1,219 @@ + + + + + hackers_controller.rb + + + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

    hackers_controller.rb

    +
    + # +
    +

    This is the ‘hackers’ controller. “Hackers” are what we call “Users” in HH.

    +
    +
    +
    +
    + # +
    +

    We want to give our Hackers a profile page.

    +
    +
    get '/hackers/:name' do
    +  @hacker = Hacker.first(:username => params[:name])
    +
    +  haml :"hackers/show"
    +end
    +
    +
    + # +
    +

    People need to be able to update their information. Of course, this means + that they need to be logged in.

    +
    +
    post '/hackers/update' do
    +  require_login! :return => "/hackers/update"
    +
    +
    + # +
    +

    If they’re trying to update their password, let’s take care of that. If we + don’t, then we wouldn’t want to set their password to nil! That’d be bad.

    +
    +
      unless params[:password].nil?
    +    if params[:password][:new] == params[:password][:confirm]
    +      current_user.password = params[:password][:new]
    +      current_user.save
    +      flash[:notice] = "Password updated!"
    +    else
    +      flash[:notice] = "Password confirmation didn't match!"
    +    end
    +  else
    +    current_user.update_attributes(:about => params[:hacker][:about])
    +    current_user.save
    +    flash[:notice] = "About information updated!"
    +  end
    +
    +  redirect "/hackers/#{current_user.username}"
    +
    +end
    +
    +
    + # +
    +

    Hackers can follow each other, and this route takes care of it!

    +
    +
    get '/hackers/:name/follow' do
    +  require_login! :return => "/hackers/#{params[:name]}/follow"
    +
    +  @hacker = Hacker.first(:username => params[:name])
    +
    +
    + # +
    +

    make sure we’re not following them already

    +
    +
      if current_user.following? @hacker
    +    flash[:notice] = "You're already following #{params[:name]}."
    +    redirect "/hackers/#{current_user.username}"
    +    return
    +  end
    +
    +
    + # +
    +

    then follow them!

    +
    +
      current_user.follow! @hacker
    +
    +  flash[:notice] = "Now following #{params[:name]}."
    +  redirect "/hackers/#{current_user.username}"
    +end
    +
    +
    + # +
    +

    this lets you unfollow a Hacker

    +
    +
    get '/hackers/:name/unfollow' do
    +  require_login! :return => "/hackers/#{params[:name]}/unfollow"
    +
    +  @hacker = Hacker.first(:username => params[:name])
    +
    +
    + # +
    +

    make sure we’re following them already

    +
    +
      unless current_user.following? @hacker
    +    flash[:notice] = "You're already not following #{params[:name]}."
    +    redirect "/hackers/#{current_user.username}"
    +    return
    +  end
    +
    +
    + # +
    +

    unfollow them!

    +
    +
      current_user.unfollow! @hacker
    +
    +  flash[:notice] = "No longer following #{params[:name]}."
    +  redirect "/hackers/#{current_user.username}"
    +end
    +
    +
    + # +
    +

    this lets us see followers.

    +
    +
    get '/hackers/:name/followers' do
    +  @hacker = Hacker.first(:username => params[:name])
    +
    +  haml :"hackers/followers"
    +end
    +
    +
    + # +
    +

    This lets us see who is following.

    + +
    +
    get '/hackers/:name/following' do
    +  @hacker = Hacker.first(:username => params[:name])
    +
    +  haml :"hackers/following"
    +end
    +
    +
    + diff --git a/controllers/messages_controller.html b/controllers/messages_controller.html new file mode 100644 index 00000000..221c56a6 --- /dev/null +++ b/controllers/messages_controller.html @@ -0,0 +1,107 @@ + + + + + messages_controller.rb + + + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

    messages_controller.rb

    +
    + # +
    +

    This is the new message form.

    +
    +
    get "/messages/new/to/:username" do
    +  require_login!
    +
    +  @username = params[:username]
    +  haml :"messages/new"
    +end
    +
    +
    + # +
    +

    This route actually creates the messages.

    +
    +
    post "/messages" do
    +  require_login!
    +
    +
    + # +
    +

    We wouldn’t want anyone forging who messages are sent from!

    +
    +
      params[:message][:sender] = current_user.username
    +
    +  message = Message.create(params[:message])
    +
    +  flash[:notice] = "Message sent."
    +
    +  redirect "/hackers/#{message.recipient}"
    +end
    +
    +
    + # +
    +

    This is the page where you can see your messages.

    +
    +
    get "/messages" do
    +  require_login!
    +
    +
    + # +
    +

    Let’s sort them in descending order.

    + +
    +
      @messages = Message.all({"recipient" => current_user.username}).sort do |a, b|
    +    b.created_at <=> a.created_at
    +  end
    +  haml :"messages/index"
    +end
    +
    +
    + diff --git a/controllers/programs_controller.html b/controllers/programs_controller.html new file mode 100644 index 00000000..de82fe12 --- /dev/null +++ b/controllers/programs_controller.html @@ -0,0 +1,216 @@ + + + + + programs_controller.rb + + + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

    programs_controller.rb

    +
    + # +
    +

    We’d like to let people show their programs. The routes in this file let us + do this.

    +
    +
    +
    +
    + # +
    +

    We’re also going to let people write programs in the browser, just in case + they’d like to share something, but the upload doesn’t work, or they want to + copy on part of their program, or anything else.

    +
    +
    get "/programs/new" do
    +  require_login!
    +  haml :"programs/new"
    +end
    +
    +
    + # +
    +

    One of the best features of GitHub is the Explore page + . It shows off some neat repositories that people have made. So let’s do + that, as well. We want to show both the last 10 programs that have been + updated, as well as some featured programs.

    +
    +
    get "/programs" do
    +  @programs = Program.all.sort{|a, b| b.updated_at <=> a.updated_at }.first(10)
    +  haml :"programs/index"
    +end
    +
    +
    + # +
    +

    We need to let people upload programs, so here it is! We want to allow API + access for this particular route, since we’ll be uploading programs from the + desktop application as well.

    +
    +
    post "/programs" do
    +  require_login_or_api! :username => params[:username], :password => params[:password]
    +
    +
    + # +
    +

    Forging who made the program would be bad!

    +
    +
      params[:program]['creator_username'] = current_user.username
    +  program = Program.create(params[:program])
    +
    +  flash[:notice] = "Program created!"
    +  redirect "/programs/#{program.creator_username}/#{program.slug}"
    +end
    +
    +
    + # +
    +

    People should be able to comment on programs, and this route lets us do it.

    +
    +
    post "/programs/:username/:slug/comment" do
    +  @program = Program.first(:creator_username => params[:username], :slug => params[:slug])
    +
    +
    + # +
    +

    Good old anonymous comments need special care and attention.

    +
    +
      if current_user
    +    params[:comment][:author] = current_user.username
    +    params[:comment][:author_email] = current_user.email
    +  else 
    +    params[:comment][:author] = "Anonymous"
    +    params[:comment][:author_email] = "anonymous@example.com"
    +  end
    +
    +  @program.comments << Comment.new(params[:comment])
    +  @program.save
    +
    +  flash[:notice] = "Replied!"
    +  redirect "/programs/#{params[:username]}/#{params[:slug]}"
    +end
    +
    +
    + # +
    +

    JSON is a really great way to share information that’s intended to be + consumed by someone else. This shows all of the programs a particular user + has made.

    +
    +
    get "/programs/:username.json" do
    +  programs = Program.all(:creator_username => params[:username])
    +  programs.to_json
    +end
    +
    +
    + # +
    +

    Each program that a user has created has its own page.

    +
    +
    get "/programs/:username/:slug" do
    +  @program = Program.first(:creator_username => params[:username], :slug => params[:slug])
    +  haml :"programs/show"
    +end
    +
    +
    + # +
    +

    If your program is revised, you’ll need to update it on the site too. We need + this to be API accessable, so that the desktop program can do it too!

    + +
    +
    put "/programs/:username/:slug.json" do
    +  require_login_or_api! :username => params[:username], :password => params[:password]
    +  if current_user.username != params[:username]
    +    halt 401
    +  end
    +  program = Program.first(:creator_username => params[:username], :slug => params[:slug])
    +  if program.nil?
    +    program = Program.create(params)
    +  else
    +    program.update_attributes(params)
    +    program.save
    +  end
    +
    +  flash[:notice] = "Program updated!"
    +  redirect "/programs/#{program.creator_username}/#{program.slug}"
    +end
    +
    +put "/programs/:username/:slug" do
    +  require_login_or_api! :username => params[:username], :password => params[:password]
    +  if current_user.username != params[:username]
    +    flash[:notice] = "Sorry, buddy"
    +    redirect "/"
    +  end
    +  program = Program.first(:creator_username => params[:username], :slug => params[:slug])
    +  program.update_attributes(params[:program])
    +  program.save
    +
    +  flash[:notice] = "Program updated!"
    +  redirect "/programs/#{program.creator_username}/#{program.slug}"
    +end
    +
    +
    + diff --git a/controllers/sessions_controller.html b/controllers/sessions_controller.html new file mode 100644 index 00000000..b106340b --- /dev/null +++ b/controllers/sessions_controller.html @@ -0,0 +1,247 @@ + + + + + sessions_controller.rb + + + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

    sessions_controller.rb

    +
    + # +
    +

    The session controller deals with users loggin in, logging out, and +signing up. An important part of the site!

    +
    +
    +
    +
    + # +
    +

    New users sign up at /signup

    +
    +
    get '/signup' do
    +  haml :"sessions/signup", :layout => :plain
    +end
    +
    +
    + # +
    +

    The form for /signup sends a POST to /signup!

    +
    +
    post '/signup' do
    +  @hacker = Hacker.create(params[:user])
    +
    +  if @hacker && @hacker.valid?
    +
    +
    + # +
    +

    let’s log them in, too.

    +
    +
        session[:hacker_id] = @hacker.id
    +
    +    flash[:notice] = "Account created."
    +    redirect '/'
    +  else
    +
    +    flash[:notice] = 'There were some problems creating your account. Please be sure you\'ve entered all your information correctly.'
    +
    +    redirect '/download'
    +  end
    +end
    +
    +
    + # +
    +

    People can log in by going to /login

    +
    +
    get '/login' do
    +  haml :"sessions/login", :layout => :plain
    +end
    +
    +
    + # +
    +

    The form at /login sends a POST request to /login

    +
    +
    post '/login' do
    +
    +
    + # +
    +

    let’s see if we got a correct username/password:

    +
    +
      if hacker = Hacker.authenticate(params[:username], params[:password])
    +
    +    session[:hacker_id] = hacker.id
    +
    +    flash[:notice] = "Login successful."
    +
    +    if session[:return_to]
    +
    +
    + # +
    +

    Let’s return back to where we were before.

    +
    +
          redirect_url = session[:return_to]
    +      session[:return_to] = false
    +      redirect redirect_url
    +    else
    +
    +
    + # +
    +

    If we didn’t go somewhere special, let’s just go to the stream

    +
    +
          redirect '/stream'
    +    end
    +  else
    +    flash[:notice] = "The username or password you entered is incorrect."
    +    redirect '/login'
    +  end
    +end
    +
    +
    + # +
    +

    Users can logout by going to /logout

    +
    +
    get '/logout' do
    +
    +
    + # +
    +

    we need to remove our id from the session

    +
    +
      session[:hacker_id] = nil
    +
    +  flash[:notice] = "Logout successful."
    +  redirect '/'
    +end
    +
    +
    + # +
    +

    This method allows people to check their credentials. This is primarily used + by the desktop app to see if you’ve entered correct information.

    +
    +
    post '/check_credentials' do
    +
    +
    + # +
    +

    let’s see if we got a correct username/password:

    +
    +
      if Hacker.authenticate(params[:username], params[:password])
    +    "Success"
    +  else
    +    halt 401
    +  end
    +end
    +
    +
    + # +
    +

    This method will let people sign up from within the app. Frankly this is + a really bad way to do it, but I’m not sure what the best way is. It should + be combined with the signup method above. The issue is that signup via the + API should really just throw the message rather than redirect, but the site + should redirect. This probably should be managed via content negotiation. I’m + doing it the dirty way now, and when I look at exposing a Real Api I’ll worry + about making it 100% nice.

    + +
    +
    post '/signup_via_api' do
    +  @hacker = Hacker.create(:username => params[:username],
    +                          :email => params[:email],
    +                          :password => params[:password])
    +
    +  if @hacker && @hacker.valid?
    +    "Success"
    +  else
    +    404 #is this right?
    +  end
    +end
    +
    +
    + diff --git a/db/schema.rb b/db/schema.rb deleted file mode 100644 index b5e6a796..00000000 --- a/db/schema.rb +++ /dev/null @@ -1,16 +0,0 @@ -# encoding: UTF-8 -# This file is auto-generated from the current state of the database. Instead -# of editing this file, please use the migrations feature of Active Record to -# incrementally modify your database, and then regenerate this schema definition. -# -# Note that this schema.rb definition is the authoritative source for your -# database schema. If you need to create the application database on another -# system, you should be using db:schema:load, not running all the migrations -# from scratch. The latter is a flawed and unsustainable approach (the more migrations -# you'll amass, the slower it'll run and the greater likelihood for issues). -# -# It's strongly recommended to check this file into your version control system. - -ActiveRecord::Schema.define(:version => 0) do - -end diff --git a/db/seeds.rb b/db/seeds.rb deleted file mode 100644 index 8c03291a..00000000 --- a/db/seeds.rb +++ /dev/null @@ -1,95 +0,0 @@ -require 'faker' - -users = (0..5).to_a.collect do - username = Faker::Internet.user_name - user = User.create!(:username => username, - :email => "#{username}@example.com", - :password => (0...50).map{ ('a'..'z').to_a[rand(26)] }.join[0,12] - ) - user -end - -titles = [ -%Q{Variables?}, -%Q{What is Rails?}, -%Q{Shoes help!}, -%Q{Other programs?}, -%Q{Reading list question...}] - -questions = [] -questions << %Q{Hello! I have a question! How come I can do this: - a = 5 -a = "hello" - -Shouldn't that not work? Why can a be five and then a String? -} -questions << %Q{What is 'ruby on rails?' I've seen stuff about it when I google for Ruby. -} -questions << %Q{I have a program that looks like this: - - edit_line - button "Repeat" do - alert("You said '#{??}'") - end - -What do I do for the ??s? -} -questions << %Q{Does anyone have some programs to share? -} -questions << %Q{I've done all the Lessons! What should I check out next? -} - -answers = [] -answers << [%Q{Ruby is really flexible, it doesn't care what kind of thing your variables are! Don't worry about it.}] -answers << [%Q{It's a way to make websites with Ruby.}] -answers << [%Q{Try this: - - line = edit_line - -and then - - alert("You said '\#{line.text}'")}, %Q{Hmm, I think you need a variable...}] -answers << [%Q{Check out [the programs page](/programs).}] -answers << [%Q{I like [_why's poignant guide to ruby](http://mislav.uniqpath.com/poignant-guide/).}, - %Q{Check out [Learn To Program](http://pine.fm/LearnToProgram/)!!!}, - %Q{There's a bunch of things [on Google](http://www.google.com/search?client=safari&rls=en&q=ruby+tutorial&ie=UTF-8&oe=UTF-8), explore them and try a bunch!}, - %Q{I love [Try Ruby](http://tryruby.org).}] - -5.times do |i| - question = Question.new( - :title => titles[i], - :description => questions[i] - ) - question.user = users[i] - question.save! - answers[i].collect! do |answer| - answer = Answer.new(:description => answer) - answer.question = question - answer.user = users[(i + 1) % 5] - answer.save - answer - end - question.solution_id = answers[i].first.id - question.save! - questions[i] = question -end - -program_code = " -Turtle.draw do - background maroon - pencolor honeydew - 450.times do - forward 100 - turnright 70 - end -end -" - -5.times do |i| - program = Program.new(:author_username => users[i].username, - :title => Faker::Lorem.sentence, - :description => Faker::Lorem.sentences.join(" "), - :source_code => program_code) - program.save! -end - diff --git a/doc/README_FOR_APP b/doc/README_FOR_APP deleted file mode 100644 index fe41f5cc..00000000 --- a/doc/README_FOR_APP +++ /dev/null @@ -1,2 +0,0 @@ -Use this README file to introduce your application and point to useful places in the API for learning more. -Run "rake doc:app" to generate API documentation for your models, controllers, helpers, and libraries. diff --git a/features/answers.feature b/features/answers.feature deleted file mode 100644 index d647cebe..00000000 --- a/features/answers.feature +++ /dev/null @@ -1,18 +0,0 @@ -Feature: CRUD actions for answers - - As a user of the site, I can perform standard CRUD actions on answers - - Scenario: Create an answer - And a question exists - And I answer that question - Then I should be notified that my answer was submitted - And an email should be sent to the author - And I should be able to see my answer - And my answer should show on my profile page - - Scenario: Edit an answer - And a question exists - And I answer that question - When I edit that answer - Then I should see the updated answer - diff --git a/features/blog.feature b/features/blog.feature deleted file mode 100644 index 4c538602..00000000 --- a/features/blog.feature +++ /dev/null @@ -1,22 +0,0 @@ -Feature: Hackety Blog - - As an admin, I can post to the hackety blog. - - Scenario: Read the blog - Given a blog post exists - When I visit the blog - Then I should see the title of that post - And I should see the content of that post - - Scenario: Read a post - Given a blog post exists - When I visit a blog post - Then I should see the title of that post - And I should see the content of that post - - Scenario: Post to the blog - Given I'm logged in as someone who can post to the blog - When I visit the blog admin page - And I fill out the new blog form - And I press "Create Blog post" - Then I should see that my post has been created diff --git a/features/lessons.feature b/features/lessons.feature deleted file mode 100644 index 0f3b92ad..00000000 --- a/features/lessons.feature +++ /dev/null @@ -1,13 +0,0 @@ -Feature: Hackety Lessons - - As a user of the site, I can visit lessons page - - Scenario: View the lessons - When I visit lessons path - Then I should see the list of lessons - - Scenario: View specific lesson - When I visit lessons path - When I click on lesson's title - Then I should see lesson content - diff --git a/features/moderator.feature b/features/moderator.feature deleted file mode 100644 index 2071f212..00000000 --- a/features/moderator.feature +++ /dev/null @@ -1,15 +0,0 @@ -Feature: Moderate questions - - As a moderator, I should be able to delete questions from the site. - - Background: - Given there is a question from someone else - - Scenario: Delete a question - Given I am a moderator - Then I can delete that question - - Scenario: Normal users cannot moderate - Given I am not a moderator - Then I cannot delete that question - diff --git a/features/programs.feature b/features/programs.feature deleted file mode 100644 index f2ead8ec..00000000 --- a/features/programs.feature +++ /dev/null @@ -1,29 +0,0 @@ -Feature: Access Programs - - As a user of the site, I want to access users' programs - - Scenario: View a featured program - Given there is a featured program - Then I should be able to view a highlighted program - - Scenario: View my programs - Given a logged in user - And I have uploaded a program - Then I should be able to view my programs - - Scenario: View another user's programs - Given a user has uploaded a program - Then I should be able to view their programs - - Scenario: View an individual program - Given a user has uploaded a program - And I should be able to view their programs - When I click the first program link - Then I should see the program source - - Scenario: View a program with a description - Given a user has uploaded a program - And they have given their program a description - And I should be able to view their programs - When I click the first program link - Then I should see the description of their program diff --git a/features/questions.feature b/features/questions.feature deleted file mode 100644 index ac233e90..00000000 --- a/features/questions.feature +++ /dev/null @@ -1,15 +0,0 @@ -Feature: CRUD actions for question - - As a user of the site, I can perform standard CRUD actions on questions - - Scenario: Create a question - When I create a new question - Then I should be told the question was created - And I should be able to see the new question - And I should be able to see the question on my profile page - - Scenario: Update a question - Given I am a user that has created a question - When I edit that question - Then I should be told the question was updated - And I should see that the question was updated diff --git a/features/questions_pagination.feature b/features/questions_pagination.feature deleted file mode 100644 index 3b0f35d6..00000000 --- a/features/questions_pagination.feature +++ /dev/null @@ -1,13 +0,0 @@ -Feature: Pagination for different types of questions - - As a user of the site, I can view pages of different types of questions - - Scenario: View support questions - Given support questions exist - When I visit the support questions page - Then I should see a link to the next page of support questions - - Scenario: View non-support questions - Given questions exist - When I visit the questions page - Then I should see a link to the next page of questions diff --git a/features/signup.feature b/features/signup.feature deleted file mode 100644 index 442dd0bd..00000000 --- a/features/signup.feature +++ /dev/null @@ -1,11 +0,0 @@ -Feature: Sign up for an account - - As a new Hackety user, I want to create a new account and log in with it - - Scenario: Create an account via the signup form - When I register a new account - Then I should be logged in with my new account - - Scenario: Try to sign up using existing user name - When I register a duplicate account - Then I should see validation errors diff --git a/features/statics.feature b/features/statics.feature deleted file mode 100644 index 37294c25..00000000 --- a/features/statics.feature +++ /dev/null @@ -1,19 +0,0 @@ -Feature: Detect user's platform and provide download link - - As a fresh Hackety user, I want to download software for my current OS - - Scenario: MacOS User - Given "Mac" user agent - Then I should be able to download "mac" software - - Scenario: Windows User - Given "Windows" user agent - Then I should be able to download "windows" software - - Scenario: Linux User - Given "Linux" user agent - Then I should be able to download "linux" software - - Scenario: Android User - Given "android" user agent - Then I should be able to download "android" software diff --git a/features/step_definitions/answer_steps.rb b/features/step_definitions/answer_steps.rb deleted file mode 100644 index 515e2099..00000000 --- a/features/step_definitions/answer_steps.rb +++ /dev/null @@ -1,42 +0,0 @@ -Given /^a question exists$/ do - login_user - create_question_for(@user) -end - -Given /^I answer that question$/ do - visit new_question_answer_path(@question) - fill_in "Answer", with: "Have you tried turning it off and on again?" - click_button "Post Answer" -end - -Then /^I should be notified that my answer was submitted$/ do - page.should have_content("Answer Posted") -end - -Then /^I should be able to see my answer$/ do - page.should have_content("#{@user.username} says") - page.should have_content("Have you tried turning it off and on again?") -end - -Then /^my answer should show on my profile page$/ do - visit user_path(@user) - page.should have_content(@question.title) - page.should have_content("Have you tried turning it off and on again?") -end - -Then /^an email should be sent to the author$/ do - ActionMailer::Base.deliveries.should_not be_empty -end - -When /^I edit that answer$/ do - visit question_path(@question) - page.find('.answer > .links').click_link('Edit') - fill_in 'Answer', with: 'Edit: Did you try magic?' - click_button 'Post Answer' -end - -Then /^I should see the updated answer$/ do - page.should have_content("#{@user.username} says") - page.should have_content('Edit: Did you try magic?') -end - diff --git a/features/step_definitions/blog_steps.rb b/features/step_definitions/blog_steps.rb deleted file mode 100644 index a200644e..00000000 --- a/features/step_definitions/blog_steps.rb +++ /dev/null @@ -1,47 +0,0 @@ -Given /^a blog post exists$/ do - @post = Fabricate(:blog_post) -end - -When /^I visit the blog$/ do - visit "/blog" -end - -Then /^I should see the content of that post$/ do - page.should have_content(@post.content) -end - -Then /^I should see the title of that post$/ do - page.should have_content(@post.title) -end - -Given /^I'm logged in as someone who can post to the blog$/ do - step %{a logged in user} - @user.blog_poster = true - @user.save -end - -When /^I visit the blog admin page$/ do - visit "/blog/admin" -end - -When /^I fill out the new blog form$/ do - #this is silly - @post = OpenStruct.new - @post.title = "A title" - - fill_in :blog_post_title, :with => "A title" - fill_in :blog_post_content, :with => "Some content" -end - -When /^I press "([^"]*)"$/ do |name| - click_button name -end - -Then /^I should see that my post has been created$/ do - page.should have_content("Post created!") -end - -When /^I visit a blog post$/ do - visit blog_path(@post) -end - diff --git a/features/step_definitions/lesson_steps.rb b/features/step_definitions/lesson_steps.rb deleted file mode 100644 index d7355def..00000000 --- a/features/step_definitions/lesson_steps.rb +++ /dev/null @@ -1,17 +0,0 @@ -When(/^I visit lessons path$/) do - visit lessons_path -end - -Then(/^I should see the list of lessons$/) do - page.should have_content("Lessons") - page.should have_content("A Tour of Hackety Hack") -end - -When(/^I click on lesson's title$/) do - click_link("A Tour of Hackety Hack") -end - -Then(/^I should see lesson content$/) do - expect(page).to have_title "A Tour of Hackety Hack" - page.should have_content("Welcome to the Hackety Hack tour!") -end diff --git a/features/step_definitions/program_steps.rb b/features/step_definitions/program_steps.rb deleted file mode 100644 index 619e275c..00000000 --- a/features/step_definitions/program_steps.rb +++ /dev/null @@ -1,71 +0,0 @@ - Given /^there is a featured program$/ do - @program = Program.create!(:author_username => "username", - :slug => "slug", - :title => "My Featured Program", - :featured => true) -end - -Then /^I should be able to view a highlighted program$/ do - visit programs_path - within "#featured" do - page.should have_content("My Featured Program") - end -end - -def upload_program(user) - @program = Program.create!(:author_username => user.username, - :slug => "slug", - :title => "#{user.username}'s program", - :source_code => "puts 'Hello world'") -end - -Given /^I have uploaded a program$/ do - upload_program(@user) -end - -Given /^a user has uploaded a program$/ do - @user = User.create!(:username => "some_user", - :password => "password", - :password_confirmation => "password", - :email => "some_user@example.com") - upload_program(@user) -end - -Given /^they have given their program a description$/ do - @program = Program.last - @program.description = "A really cool program!" - @program.save -end - - -def visit_user_programs_page - visit user_path(@user) - within ".about-user" do - find(".user-programs").click() - end - page.should have_content(@program.title.titleize) -end - -Then /^I should be able to view my programs$/ do - visit_user_programs_page -end - -Then /^I should be able to view their programs$/ do - visit_user_programs_page -end - -When /^I click the first program link$/ do - within "#all-programs ul" do - first("li:first-child a").click() - end -end - -Then /^I should see the program source$/ do - within("#program") do - page.should have_content("puts 'Hello world'") - end -end - -Then /^I should see the description of their program$/ do - page.should have_content("A really cool program!") -end diff --git a/features/step_definitions/question_steps.rb b/features/step_definitions/question_steps.rb deleted file mode 100644 index 385d208e..00000000 --- a/features/step_definitions/question_steps.rb +++ /dev/null @@ -1,94 +0,0 @@ -def create_question_for(user) - @question = Question.new(:title => "A question", - :description => "The description") - @question.user = user - @question.save -end - -When /^I create a new question$/ do - step %{a logged in user} - visit new_question_path - fill_in("Title", with: "My Question") - fill_in("Description", with: "My Description") - click_button "Ask Everyone" -end - -Then /^I should be told the question was created$/ do - page.should have_content("Question Asked") -end - -Then /^I should be able to see the new question$/ do - click_link("My Question") - page.should have_content("My Question") - page.should have_content("My Description") -end - -Given /^I am a user that has created a question$/ do - step %{a logged in user} - create_question_for(@user) -end - -When /^I edit that question$/ do - visit edit_question_path(@question) - fill_in "Title", with: "An edited question" - fill_in "Description", with: "Just a quick edit" - click_button "Ask Everyone" -end - -Then /^I should be told the question was updated$/ do - page.should have_content("successfully updated") -end - -Then /^I should see that the question was updated$/ do - page.should have_content('An edited question') - page.should have_content('Just a quick edit') -end - -Then /^I should be able to see the question on my profile page$/ do - visit user_path(@user) - page.should have_content("My Question") -end - -Given /^I am a moderator$/ do - step %{a logged in user} - @user.moderator = true - @user.save -end - -Given /^I am not a moderator$/ do - step %{a logged in user} - @user.moderator = false - @user.save -end - -Given /^there is a question from someone else$/ do - @question = Question.create(:title => "A question to delete", - :description => "moderator should delete me!", - :user => Fabricate(:user)) -end - -Then /^I can delete that question$/ do - visit question_path(@question) - page.should have_content('Delete') -end - -Then /^I cannot delete that question$/ do - visit question_path(@question) - page.should_not have_content('Delete') -end - -Given /^(\w*)\s?questions exist$/ do |type| - 30.times do - Question.create(title: 'Test', description: 'Test', - support: type == 'support' ? true : false) - end -end - -When /^I visit the (\w*)\s?questions page$/ do |type| - visit(type == 'support' ? support_questions_path : questions_path) -end - -Then /^I should see a link to the next page of (\w*)\s?questions$/ do |type| - href = type == 'support' ? '/support/questions?page=2' : '/questions?page=2' - page.should have_link '2', href: href -end diff --git a/features/step_definitions/signup_steps.rb b/features/step_definitions/signup_steps.rb deleted file mode 100644 index 9d1cdb15..00000000 --- a/features/step_definitions/signup_steps.rb +++ /dev/null @@ -1,31 +0,0 @@ -def register_user(user) - visit new_user_registration_path - fill_in("Username", :with => user[:username]) - fill_in("Email", :with => user[:email]) - fill_in("Password", :with => user[:password]) - fill_in("Password confirmation", :with => user[:password]) - - click_button "Sign up" -end - -When /^I register a new account$/ do - @new_user = {:username => "username", :password => "password", :email => "test@example.com"} - register_user @new_user -end - -When /^I register a duplicate account$/ do - @existing_user = User.create!(username: "existing_user", - email: "existing_user@example.com", - password: "foobar", - password_confirmation: "foobar") - register_user @existing_user -end - -When /^I should be logged in with my new account$/ do - page.should have_content("You have signed up successfully") - page.should have_content(@new_user[:username]) -end - -Then /^I should see validation errors$/ do - page.should have_selector(".error_notification") -end diff --git a/features/step_definitions/static_steps.rb b/features/step_definitions/static_steps.rb deleted file mode 100644 index b09a519a..00000000 --- a/features/step_definitions/static_steps.rb +++ /dev/null @@ -1,8 +0,0 @@ -Given(/^"(.*?)" user agent$/) do |agent| - page.driver.header('User-Agent', agent) -end - -Then(/^I should be able to download "(.*?)" software$/) do |system| - visit download_path - page.should have_content("Version 1.0.1 for #{system}") -end \ No newline at end of file diff --git a/features/step_definitions/user_steps.rb b/features/step_definitions/user_steps.rb deleted file mode 100644 index dafb78b1..00000000 --- a/features/step_definitions/user_steps.rb +++ /dev/null @@ -1,86 +0,0 @@ -def login_user - @user = User.create!(username: "test_user", - email: "test_user@example.com", - password: "foobar", - password_confirmation: "foobar") - visit login_path - fill_in("Username", :with => @user.username) - fill_in("Password", :with => @user.password) - click_button("Sign in") -end - -def create_other_user - @other_user = User.create!(username: "other_user", - email: "other_user@example.com", - password: "123456", - password_confirmation: "123456") -end - -Given /^a logged in user$/ do - login_user unless @user -end - -Given /^a steve exists$/ do - @steve = User.create!(username: "steve", - email: "steve_user@example.com", - password: "foobar", - password_confirmation: "foobar") -end - -When /^I go to look at my profile page$/ do - visit user_path(@user) -end - -Then /^it should have the right information$/ do - page.should have_title("#{@user.username}'s Profile\n | Hackety Hack!") - page.should have_content("#{@user.username}'s Profile") -end - -When /^I edit my profile$/ do - visit('/users/edit') - fill_in("About", with: "Test user likes to edit his profile|") - fill_in("Current password", with: @user.password) - click_button "Update" -end - -When /^I have a follower$/ do - create_other_user - @other_user.follow! @user -end - -When /^I am following someone$/ do - create_other_user - @user.follow! @other_user -end - -When /^I click on the number of followers on my profile$/ do - step 'I go to look at my profile page' - first('.user-followers').click -end - -When /^I click on the number of people I am following on my profile$/ do - step 'I go to look at my profile page' - first('.user-following').click -end - -Then /^I should see someone I'm following$/ do - page.should have_link @other_user.username -end - -Then /^I should see my follower$/ do - page.should have_link @other_user.username -end - -Then /^I should be notified that my profile was updated$/ do - page.should have_content("updated your account") -end - -Then /^I should see my changes reflected on my profile page$/ do - visit("/users/#{@user.username}") - page.should have_content("Test user likes to edit his profile") -end - -Then(/^I should see 'Steve'$/) do - @user.following?(@steve).should == true - page.should have_link @steve.username -end diff --git a/features/support/env.rb b/features/support/env.rb deleted file mode 100644 index 25e027c5..00000000 --- a/features/support/env.rb +++ /dev/null @@ -1,55 +0,0 @@ -# IMPORTANT: This file is generated by cucumber-rails - edit at your own peril. -# It is recommended to regenerate this file in the future when you upgrade to a -# newer version of cucumber-rails. Consider adding your own code to a new file -# instead of editing this one. Cucumber will automatically load all features/**/*.rb -# files. -# - -require_relative '../../spec/code_coverage' - -require 'cucumber/rails' -require 'ruby-debug' - -# Capybara defaults to XPath selectors rather than Webrat's default of CSS3. In -# order to ease the transition to Capybara we set the default here. If you'd -# prefer to use XPath just remove this line and adjust any selectors in your -# steps to use the XPath syntax. -Capybara.default_selector = :css - -# By default, any exception happening in your Rails application will bubble up -# to Cucumber so that your scenario will fail. This is a different from how -# your application behaves in the production environment, where an error page will -# be rendered instead. -# -# Sometimes we want to override this default behaviour and allow Rails to rescue -# exceptions and display an error page (just like when the app is running in production). -# Typical scenarios where you want to do this is when you test your error pages. -# There are two ways to allow Rails to rescue exceptions: -# -# 1) Tag your scenario (or feature) with @allow-rescue -# -# 2) Set the value below to true. Beware that doing this globally is not -# recommended as it will mask a lot of errors for you! -# -ActionController::Base.allow_rescue = false - -# Remove/comment out the lines below if your app doesn't have a database. -# For some databases (like MongoDB and CouchDB) you may need to use :truncation instead. -DatabaseCleaner.orm = "mongo_mapper" -DatabaseCleaner[:mongo_mapper].strategy = :truncation - -Before do - DatabaseCleaner[:mongo_mapper].clean -end - -# You may also want to configure DatabaseCleaner to use different strategies for certain features and scenarios. -# See the DatabaseCleaner documentation for details. Example: -# -# Before('@no-txn,@selenium,@culerity,@celerity,@javascript') do -# DatabaseCleaner.strategy = :truncation, {:except => %w[widgets]} -# end -# -# Before('~@no-txn', '~@selenium', '~@culerity', '~@celerity', '~@javascript') do -# DatabaseCleaner.strategy = :transaction -# end -# diff --git a/features/support/mailer.rb b/features/support/mailer.rb deleted file mode 100644 index 8cdfb2f1..00000000 --- a/features/support/mailer.rb +++ /dev/null @@ -1,3 +0,0 @@ -Before do - ActionMailer::Base.deliveries.clear -end diff --git a/features/users.feature b/features/users.feature deleted file mode 100644 index 2d67ae5d..00000000 --- a/features/users.feature +++ /dev/null @@ -1,30 +0,0 @@ -Feature: Manage account - - As a user of this site, I can view and update my profile, see my followers - - Background: - Given a steve exists - And a logged in user - - Scenario: View my profile - When I go to look at my profile page - Then it should have the right information - - Scenario: Edit my profile - When I edit my profile - Then I should be notified that my profile was updated - And I should see my changes reflected on my profile page - - Scenario: See my followers - When I have a follower - And I click on the number of followers on my profile - Then I should see my follower - - Scenario: See who I am following - When I am following someone - And I click on the number of people I am following on my profile - Then I should see someone I'm following - - Scenario: I should always follow steve and vice versa - When I click on the number of people I am following on my profile - Then I should see 'Steve' diff --git a/hackety.html b/hackety.html new file mode 100644 index 00000000..9eed1d84 --- /dev/null +++ b/hackety.html @@ -0,0 +1,448 @@ + + + + + hackety.rb + + + +
    +
    +
    + Jump To … + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

    hackety.rb

    +
    + # +
    +

    encoding: utf-8

    +
    +
    +
    +
    + # +
    +

    This is the source code for the Hackety Hack website. Hackety Hack is + the easiest way to learn programming, and so our documentation should be + top-notch.

    + +

    To get started, you’ll need to install some prerequisite software:

    + +

    Ruby is used to power the site. We’re currently using ruby 1.9.2p0. I + highly reccomend that you use rvm to install and manage your Rubies. + It’s a fantastic tool. If you do decide to use rvm, you can install the + appropriate Ruby and create a gemset by simply cd-ing into the root project + directory; I have a magical .rvmrc file that’ll set you up.

    + +

    MongoDB is a really awesome document store. We use it to persist all of + the data on the website. To get MongoDB, please visit their + downloads page to find a package for your + system.

    + +

    After installing Ruby and MongoDB, you need to aquire all of the Ruby gems + that we use. This is pretty easy, since we’re using bundler. Just do + this:

    + +
     $ gem install bundler
    + $ bundle install
    +
    + +

    That’ll set it all up! Then, you need to make sure you’re running MongoDB. + I have to open up another tab in my terminal and type

    + +
     $ mongod
    +
    + +

    to get this to happen. When you’re done hacking, you can hit ^-c to stop + mongod from running.

    + +

    To actually start up the site, just

    + +
     $ rackup
    +
    + +

    and then visit http://localhost:9292/. You’re good + to go!

    +
    +
    +
    +
    + # +
    +

    About hackety.rb

    + +

    This file is the main entry point to the application. It has three main + purposes:

    + +
      +
    1. Include all relevant gems and library code.
    2. +
    3. Configure all settings based on our environment.
    4. +
    5. Set up a few basic routes.
    6. +
    + + +

    Everything else is handled by code that’s included from this file.

    +
    +
    +
    +
    + # +
    +

    Including gems

    +
    +
    +
    +
    + # +
    +

    We need to require rubygems and bundler to get things going. Then we call + Bundler.setup to get all of the magic started.

    +
    +
    require 'rubygems'
    +require 'bundler'
    +Bundler.setup
    +
    +
    + # +
    +

    We use sinatra for our web framework. Sinatra is + very light and simple. Good stuff.

    +
    +
    require 'sinatra'
    +
    +
    + # +
    +

    Pony is used to send emails, just like the Pony express. Also, running gem install pony is really satisfying.

    +
    +
    require 'pony'
    +
    +
    + # +
    +

    haml creates all of our templates. haml is concise + and expressive. I really enjoy it.

    +
    +
    require 'haml'
    +
    +
    + # +
    +

    MongoMapper is a library we use to make it easy to + store our model classes into MongoDB.

    +
    +
    require 'mongo_mapper'
    +
    +
    + # +
    +

    We need a secret for our sessions. This is set via an environment variable so + that we don’t have to give it away in the source code. Heroku makes it really + easy to keep environment variables set up, so this ends up being pretty nice. + This also has to be included before rack-flash, or it blows up.

    +
    +
    use Rack::Session::Cookie, :secret => ENV['COOKIE_SECRET']
    +
    +
    + # +
    +

    If you’ve used Rails' flash messages, you know how convenient they are. + rack-flash lets us use them.

    +
    +
    require 'rack-flash'
    +use Rack::Flash
    +
    +
    + # +
    +

    rdiscount is a fast implementation + of the Markdown markup language. The web site renders most user submitted + comment with Markdown.

    +
    +
    require 'rdiscount'
    +
    +
    + # +
    +

    Rails has a content_for helper that lets you place different parts of your + view into different places in your template. This helps a lot with + javascript, and conditional stylesheets or other includes. It’s so nice that + foca has written + a Sinatra version.

    +
    +
    require 'sinatra/content_for'
    +
    +
    + # +
    +

    We moved lots of helpers into a separate file. These are all things that are + useful throughout the rest of the application. This file

    +
    +
    require_relative 'helpers'
    +
    +
    + # +
    +

    Configure settings

    +
    +
    +
    +
    + # +
    +

    We use Exceptional to keep track of errors + that happen. This code is from their + example documentation + for Sinatra. It might be better off inside of a config block, but I haven’t + tested it in that role yet.

    +
    +
    if ENV['RACK_ENV'] == 'production'
    +  set :raise_errors, true
    +
    +  require 'exceptional'
    +  use Rack::Exceptional, ENV['EXCEPTIONAL_API_KEY']
    +end
    +
    +
    + # +
    +

    This makes Haml escape any html by default.

    +
    +
    set :haml, :escape_html => true
    +
    +
    + # +
    +

    The PONY_VIA_OPTIONS hash is used to configure pony. Basically, we only + want to actually send mail if we’re in the production environment. So we set + the hash to just be {}, except when we want to send mail.

    +
    +
    configure :test do
    +  PONY_VIA_OPTIONS = {}
    +end
    +
    +configure :development do
    +  PONY_VIA_OPTIONS = {}
    +end
    +
    +
    + # +
    +

    We’re using SendGrid to send our emails. It’s really + easy; the Heroku addon sets us up with environment variables with all of the + configuration options that we need.

    +
    +
    configure :production do
    +  PONY_VIA_OPTIONS =  {
    +    :address        => "smtp.sendgrid.net",
    +    :port           => "25",
    +    :authentication => :plain,
    +    :user_name      => ENV['SENDGRID_USERNAME'],
    +    :password       => ENV['SENDGRID_PASSWORD'],
    +    :domain         => ENV['SENDGRID_DOMAIN']
    +  }
    +  
    +end
    +
    +
    + # +
    +

    We don’t want to bother with running our own MongoDB server in production; + that’s what The Cloud ™ is for! So we want to double check our environment + variables, and if it appears that we’d like to connect to + MongoHQ, let’s do that. Otherwise, just connect to + our local server running on localhost.

    +
    +
    configure do
    +  if ENV['MONGOHQ_URL']
    +    MongoMapper.connection = Mongo::Connection.new(ENV['MONGOHQ_HOST'], ENV['MONGOHQ_PORT'])
    +    MongoMapper.database = ENV['MONGOHQ_DATABASE']
    +    MongoMapper.database.authenticate(ENV['MONGOHQ_USER'],ENV['MONGOHQ_PASSWORD'])
    +    
    +    MongoMapper.database = ENV['MONGOHQ_DATABASE']
    +  else
    +    MongoMapper.connection = Mongo::Connection.new('localhost')
    +    MongoMapper.database = "hackety-development"
    +  end
    +end
    +
    +
    + # +
    +

    Since Sinatra doesn’t automatically load anything, we have to do it + ourselves. Remember that helpers.rb file? Well, we made a handy + require_directory method that, well, requires a whole directory. So let’s + include both of our models as well as our controllers.

    +
    +
    require_directory "models"
    +require_directory "controllers"
    +
    +
    + # +
    +

    Set up basic routes

    +
    +
    +
    +
    + # +
    +

    The first thing you’ll ever see when going to the website is here. It all + starts with /. If we’re logged in, we want to just redirect to the main + activity stream. If not, let’s show that pretty splash page that sings all of + our praises.

    + +

    One small note about rendering, though: Our main layout doesn’t exactly work + for the main page, it’s an exception. So we don’t want to use our regular old + layout.haml file. So we tell Sinatra not to.

    +
    +
    get '/' do
    +  if logged_in?
    +    redirect "/stream"
    +  end
    +  haml :index, :layout => :plain
    +end
    +
    +
    + # +
    +

    Hopefully, anyone visiting the site will think that Hackety Hack sounds + pretty cool. If they do, they’ll visit the downloads page. This’ll direct + them to download Hackety, and sign up for an account.

    + +

    Similar to the home page, we also don’t want our layout here, either.

    +
    +
    get '/download' do
    +  haml :download, :layout => :plain
    +end
    +
    +
    + # +
    +

    The main activity stream is the main page for the site when a user is logged + in. It lets them share what they’re doing with others, and also view all of + the content that others have posted. So we grab it all, and sort it in the + opposite order that it’s been updated. Wouldn’t want to see old stuff!

    + +
    +
    get '/stream' do
    +  @content_list = Content.all.sort{|a, b| b.updated_at <=> a.updated_at }
    +  haml :stream
    +end
    +
    +
    + diff --git a/helpers.html b/helpers.html new file mode 100644 index 00000000..0d9a5d0b --- /dev/null +++ b/helpers.html @@ -0,0 +1,199 @@ + + + + + helpers.rb + + + +
    +
    +
    + Jump To … + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

    helpers.rb

    +
    + # +
    +

    The helpers.rb file contains all of our Sinatra helpers. This is large + enough that including it in a separate file makes it much easier to find; + otherwise, I’d be opening hackety.rb and searching for ‘helpers,’ and + that’s just stupid.

    +
    +
    helpers do
    +
    +
    + # +
    +

    A tiny bit of metaprogramming goes a long way. We want to generate three + methods (development?, production?, and test?) that let us know which + environment we happen to be in. This is useful in a few places.

    +
    +
      [:development, :production, :test].each do |environment|
    +    define_method "#{environment.to_s}?" do
    +      return settings.environment == environment.to_sym
    +    end
    +  end
    +
    +
    + # +
    +

    This incredibly useful helper gives us the currently logged in user. We + keep track of that by just setting a session variable with their id. If it + doesn’t exist, we just want to return nil.

    +
    +
      def current_user
    +    return Hacker.first(:id => session[:hacker_id]) if session[:hacker_id]
    +    nil
    +  end
    +
    +
    + # +
    +

    This very simple method checks if we’ve got a logged in user. That’s pretty + easy: just check our current_user.

    +
    +
      def logged_in?
    +    current_user != nil
    +  end
    +
    +
    + # +
    +

    Our admin_only! helper will only let admin users visit the page. If + they’re not an admin, we redirect them to either / or the page that we + specified when we called it.

    +
    +
      def admin_only!(opts = {:return => "/"})
    +    unless logged_in? && current_user.admin?
    +      flash[:error] = "Sorry, buddy"
    +      redirect opts[:return]
    +    end
    +  end
    +
    +
    + # +
    +

    Similar to admin_only!, require_login! only lets logged in users access + a particular page, and redirects them if they’re not.

    +
    +
      def require_login!(opts = {:return => "/"})
    +    unless logged_in?
    +      flash[:error] = "Sorry, buddy"
    +      redirect opts[:return]
    +    end
    +  end
    +
    +
    + # +
    +

    We also want to have a way for the desktop application to make calls to the + site. For this, we allow a username and password to be passed in, and we + authenticate directly, rather than relying on a previously logged in + session.

    +
    +
      def require_login_or_api!(opts={})
    +    return if session[:hacker_id]
    +    hacker = Hacker.authenticate(opts[:username], opts[:password])
    +    if hacker
    +      session[:hacker_id] = hacker.id
    +    else
    +      halt 401
    +    end
    +  end
    +
    +
    + # +
    +

    Gravatar is used for our avatars. Generating the + url for one is pretty simple, we just need the proper email address, and + then we make an md5 of it. No biggie.

    +
    +
      def gravatar_url_for email
    +    require 'digest/md5'
    +    "http://www.gravatar.com/avatar/#{Digest::MD5.hexdigest(email.downcase)}"
    +  end
    +
    +end
    +
    +
    + # +
    +

    This handy helper method lets us require an entire directory of rb files. + It’s much simpler than having to require them all directly.

    +
    +
    def require_directory dirname
    +  Dir.glob("#{File.expand_path(File.dirname(__FILE__))}/#{dirname}/*.rb").each do |f|
    +    require f
    +  end
    +end
    +
    +
    + # +
    +

    This method is a handy monkeypatch on String. It allows us to turn any string + into a slug that’s suitable for putting into URLs.

    + +
    +
    class String
    +  def to_slug
    +    self.gsub(/[^a-zA-Z _0-9]/, "").gsub(/\s/, "_").downcase
    +  end
    +end
    +
    +
    + diff --git a/lib/api_constraint.rb b/lib/api_constraint.rb deleted file mode 100644 index 7ac3346f..00000000 --- a/lib/api_constraint.rb +++ /dev/null @@ -1,8 +0,0 @@ -class ApiConstraint - def self.matches?(request) - request.subdomain.present? and (# do we have one? - request.subdomain == 'api' or # in production? - request.subdomain == 'api.hackety-hack') # with pow? - end -end - diff --git a/lib/assets/.gitkeep b/lib/assets/.gitkeep deleted file mode 100644 index e69de29b..00000000 diff --git a/lib/generators/.DS_Store b/lib/generators/.DS_Store deleted file mode 100644 index 5008ddfc..00000000 Binary files a/lib/generators/.DS_Store and /dev/null differ diff --git a/lib/generators/haml/scaffold/scaffold_generator.rb b/lib/generators/haml/scaffold/scaffold_generator.rb deleted file mode 100644 index 06668e1a..00000000 --- a/lib/generators/haml/scaffold/scaffold_generator.rb +++ /dev/null @@ -1,36 +0,0 @@ -require 'rails/generators/erb/scaffold/scaffold_generator' - -module Haml - module Generators - class ScaffoldGenerator < Erb::Generators::ScaffoldGenerator - source_root File.expand_path("../templates", __FILE__) - - def copy_view_files - available_views.each do |view| - filename = filename_with_extensions(view) - template "#{view}.html.haml", File.join("app/views", controller_file_path, filename) - end - end - - hook_for :form_builder, :as => :scaffold - - def copy_form_file - if options[:form_builder].nil? - filename = filename_with_extensions("_form") - template "_form.html.haml", File.join("app/views", controller_file_path, filename) - end - end - - protected - - def available_views - %w(index edit show new _list) - end - - def handler - :haml - end - - end - end -end \ No newline at end of file diff --git a/lib/generators/haml/scaffold/templates/_list.html.haml b/lib/generators/haml/scaffold/templates/_list.html.haml deleted file mode 100644 index 98dc46f8..00000000 --- a/lib/generators/haml/scaffold/templates/_list.html.haml +++ /dev/null @@ -1,9 +0,0 @@ -%tr.item -<% for attribute in attributes -%> - %td= list.<%= attribute.name %> -<% end -%> - %td= link_to "Show", resource_path(list) - - if can? :update, list - %td= link_to 'Edit', edit_resource_path(list) - - if can? :destroy, list - %td= link_to 'Delete', resource_path(list), :confirm => 'Are you sure?', :method => :delete diff --git a/lib/generators/haml/scaffold/templates/edit.html.haml b/lib/generators/haml/scaffold/templates/edit.html.haml deleted file mode 100644 index e05dd7e9..00000000 --- a/lib/generators/haml/scaffold/templates/edit.html.haml +++ /dev/null @@ -1,4 +0,0 @@ -- content_for :title do - = "Editing #{resource}" - -= render 'form' diff --git a/lib/generators/haml/scaffold/templates/index.html.haml b/lib/generators/haml/scaffold/templates/index.html.haml deleted file mode 100644 index 46ff0845..00000000 --- a/lib/generators/haml/scaffold/templates/index.html.haml +++ /dev/null @@ -1,17 +0,0 @@ -- content_for :title do - <%= plural_table_name.capitalize %> - -- content_for :links do - - if can? :create, <%= singular_table_name.classify %> - = link_to "New <%= singular_table_name %>", new_resource_path - -%table - %thead -<% for attribute in attributes -%> - %th <%= attribute.human_name %> -<% end -%> - %th - %th - %th - - = render :partial => "list", :collection => collection diff --git a/lib/generators/haml/scaffold/templates/new.html.haml b/lib/generators/haml/scaffold/templates/new.html.haml deleted file mode 100644 index eb97a604..00000000 --- a/lib/generators/haml/scaffold/templates/new.html.haml +++ /dev/null @@ -1,4 +0,0 @@ -- content_for :title do - New <%= singular_table_name %> - -= render 'form' \ No newline at end of file diff --git a/lib/generators/haml/scaffold/templates/show.html.haml b/lib/generators/haml/scaffold/templates/show.html.haml deleted file mode 100644 index b12cafbd..00000000 --- a/lib/generators/haml/scaffold/templates/show.html.haml +++ /dev/null @@ -1,14 +0,0 @@ -- content_for :title do - = resource - -- content_for :links do - - if can? :update, resource - = link_to 'Edit', edit_resource_path - - if can? :destroy, resource - = link_to 'Delete', resource_path, :confirm => 'Are you sure?', :method => :delete - -%dl -<% for attribute in attributes -%> - %dt <%= attribute.human_name %> - %dd= resource.<%= attribute.name %> -<% end -%> diff --git a/lib/prefix_link_renderer.rb b/lib/prefix_link_renderer.rb deleted file mode 100644 index 79efb238..00000000 --- a/lib/prefix_link_renderer.rb +++ /dev/null @@ -1,12 +0,0 @@ -class PrefixLinkRenderer < WillPaginate::ActionView::LinkRenderer - def initialize(prefix) - @prefix = prefix - super() - end - - protected - - def url(page) - @prefix + super - end -end diff --git a/lib/sluggifier.rb b/lib/sluggifier.rb deleted file mode 100644 index 96c31763..00000000 --- a/lib/sluggifier.rb +++ /dev/null @@ -1,24 +0,0 @@ -class Sluggifier - def self.generate(title, all_slugs=[]) - slug = title.parameterize - while self.conflict?(slug,all_slugs) - slug = self.next(slug, all_slugs) - end - slug - end - - def self.next(slug,all_slugs) - sequence = self.conflict(slug,all_slugs).split('-')[1].to_i - next_sequence = sequence == 0 ? 2 : sequence.next - "#{slug.gsub(/(\-\d+)/,'')}-#{next_sequence}" - end - - def self.conflict?(slug,all_slugs) - !! self.conflict(slug,all_slugs) - end - - def self.conflict(slug, all_slugs) - all_slugs.select { |s| s == slug }.first - end - -end diff --git a/lib/tasks/.gitkeep b/lib/tasks/.gitkeep deleted file mode 100644 index e69de29b..00000000 diff --git a/lib/tasks/cucumber.rake b/lib/tasks/cucumber.rake deleted file mode 100644 index 83f79471..00000000 --- a/lib/tasks/cucumber.rake +++ /dev/null @@ -1,65 +0,0 @@ -# IMPORTANT: This file is generated by cucumber-rails - edit at your own peril. -# It is recommended to regenerate this file in the future when you upgrade to a -# newer version of cucumber-rails. Consider adding your own code to a new file -# instead of editing this one. Cucumber will automatically load all features/**/*.rb -# files. - - -unless ARGV.any? {|a| a =~ /^gems/} # Don't load anything when running the gems:* tasks - -vendored_cucumber_bin = Dir["#{Rails.root}/vendor/{gems,plugins}/cucumber*/bin/cucumber"].first -$LOAD_PATH.unshift(File.dirname(vendored_cucumber_bin) + '/../lib') unless vendored_cucumber_bin.nil? - -begin - require 'cucumber/rake/task' - - namespace :cucumber do - Cucumber::Rake::Task.new({:ok => 'db:test:prepare'}, 'Run features that should pass') do |t| - t.binary = vendored_cucumber_bin # If nil, the gem's binary is used. - t.fork = true # You may get faster startup if you set this to false - t.profile = 'default' - end - - Cucumber::Rake::Task.new({:wip => 'db:test:prepare'}, 'Run features that are being worked on') do |t| - t.binary = vendored_cucumber_bin - t.fork = true # You may get faster startup if you set this to false - t.profile = 'wip' - end - - Cucumber::Rake::Task.new({:rerun => 'db:test:prepare'}, 'Record failing features and run only them if any exist') do |t| - t.binary = vendored_cucumber_bin - t.fork = true # You may get faster startup if you set this to false - t.profile = 'rerun' - end - - desc 'Run all features' - task :all => [:ok, :wip] - - task :statsetup do - require 'rails/code_statistics' - ::STATS_DIRECTORIES << %w(Cucumber\ features features) if File.exist?('features') - ::CodeStatistics::TEST_TYPES << "Cucumber features" if File.exist?('features') - end - end - desc 'Alias for cucumber:ok' - task :cucumber => 'cucumber:ok' - - task :default => :cucumber - - task :features => :cucumber do - STDERR.puts "*** The 'features' task is deprecated. See rake -T cucumber ***" - end - - # In case we don't have ActiveRecord, append a no-op task that we can depend upon. - task 'db:test:prepare' do - end - - task :stats => 'cucumber:statsetup' -rescue LoadError - desc 'cucumber rake task not available (cucumber not installed)' - task :cucumber do - abort 'Cucumber rake task is not available. Be sure to install cucumber as a gem or plugin' - end -end - -end diff --git a/lib/tasks/rspec.rake b/lib/tasks/rspec.rake deleted file mode 100644 index 6e78304d..00000000 --- a/lib/tasks/rspec.rake +++ /dev/null @@ -1,6 +0,0 @@ -Rake.application.instance_variable_get('@tasks').delete('spec') - -RSpec::Core::RakeTask.new(:spec) do |task| - task.rspec_opts = ["-r./spec/spec_helper.rb"] -end - diff --git a/lib/templates/haml/scaffold/_form.html.haml b/lib/templates/haml/scaffold/_form.html.haml deleted file mode 100644 index f77034cd..00000000 --- a/lib/templates/haml/scaffold/_form.html.haml +++ /dev/null @@ -1,10 +0,0 @@ -= simple_form_for(resource, :url => @form_url) do |f| - = f.error_notification - - .inputs - <%- attributes.each do |attribute| -%> - = f.<%= attribute.reference? ? :association : :input %> :<%= attribute.name %> - <%- end -%> - - .actions - = f.button :submit diff --git a/log/.gitkeep b/log/.gitkeep deleted file mode 100644 index e69de29b..00000000 diff --git a/models/comment.html b/models/comment.html new file mode 100644 index 00000000..a996c75f --- /dev/null +++ b/models/comment.html @@ -0,0 +1,57 @@ + + + + + comment.rb + + + +
    +
    +
    + Jump To … + +
    + + + + + + + + + + + + +

    comment.rb

    +
    + # +
    +

    Comments are an embedded document that’s inside of a few different things: + content, programs, and maybe other stuff in the future. They’re really + simple: Just some text, the person who said it, and their email address. The + author should be the slug. Having the email lets us show their avatar easily.

    + +
    +
    class Comment
    +  include MongoMapper::EmbeddedDocument
    +
    +  key :body, String
    +
    +  key :author, String
    +  key :author_email, String
    +
    +end
    +
    +
    + diff --git a/models/content.html b/models/content.html new file mode 100644 index 00000000..b412b4c9 --- /dev/null +++ b/models/content.html @@ -0,0 +1,94 @@ + + + + + content.rb + + + +
    +
    +
    + Jump To … + +
    + + + + + + + + + + + + + + + + + + + + + + + + +

    content.rb

    +
    + # +
    +

    Content is a model that represents the different things that can be put into + the stream.

    +
    +
    class Content
    +  include MongoMapper::Document
    +
    +
    + # +
    +

    Current type values are question, link, and post

    +
    +
      key :type, String
    +
    +  key :body, String
    +
    +  key :author, String
    +  key :author_email, String
    +
    +
    + # +
    +

    we want to embed comments.

    +
    +
      many :comments
    +
    +  timestamps!
    + 
    +
    +
    + # +
    +

    This shows the avatar of the author.

    + +
    +
      def image
    +    require 'digest/md5'
    +    "http://www.gravatar.com/avatar/#{Digest::MD5.hexdigest(author_email.downcase)}"
    +  end
    +
    +end
    +
    +
    + diff --git a/models/hacker.html b/models/hacker.html new file mode 100644 index 00000000..3c93fa1a --- /dev/null +++ b/models/hacker.html @@ -0,0 +1,335 @@ + + + + + hacker.rb + + + +
    +
    +
    + Jump To … + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

    hacker.rb

    +
    + # +
    +

    This is the Hacker class. Every user of Hackety Hack gets one! +most of the stuff in this is based off of then sinatra-authentication plugin.

    +
    +
    class Hacker
    +  include MongoMapper::Document
    +
    +  key :username, String, :unique => true, :required => true
    +  key :email, String, :unique => true, :required => true
    +
    +  key :about, String
    +
    +
    + # +
    +

    we don’t store the passwords themselves, we store a ‘hash’ of them. More about this down in password=

    +
    +
      key :hashed_password, String
    +  key :salt, String
    +
    +  key :admin, Boolean, :default => false
    +
    +
    + # +
    +

    the list of hackers this hacker is following

    +
    +
      key :following_ids, Array
    +  many :following, :in => :following_ids, :class_name => 'Hacker'
    +
    +
    + # +
    +

    the list of hackers that are following this hacker

    +
    +
      key :followers_ids, Array
    +  many :followers, :in => :followers_ids, :class_name => 'Hacker'
    +
    +
    + # +
    +

    after we create a hacker, we want to have them follow steve, and vice versa!

    +
    +
      after_create :follow_steve
    +
    +
    + # +
    +

    we don’t want to store the password (or the confirmation), so we just make an accessor

    +
    +
      attr_accessor :password, :password_confirmation
    +
    +
    + # +
    +

    This method sets our password. The first thign we need to get a ‘salt’. You + can read about salts here. + basically, we combine the password with the salt, and then encrypt it, and + store that in the database.

    + +

    The reason that we do this is because we don’t want to keep someone’s + password in the database, because you never want to write those down! + So when we go to look up a password, we can do the same procedure.

    +
    +
      def password=(pass)
    +    @password = pass
    +
    +    self.salt = random_string(10) if !self.salt
    +
    +    self.hashed_password = Hacker.encrypt(@password, self.salt)
    +  end
    +
    +
    + # +
    +

    This method lets will return the user if we’ve given the right username + and password for the user. Otherwise, it returns nil.

    +
    +
      def self.authenticate(username, pass)
    +    current_user = Hacker.first(:username => username)
    +
    +    return nil if current_user.nil?
    +
    +
    + # +
    +

    then, we do the same thing that we did when we stored the hashed password: + encrypt the password using the salt, and compare it to the one we saved + if they’re the same, we know they entered the right password.

    +
    +
        return current_user if Hacker.encrypt(pass, current_user.salt) == current_user.hashed_password
    +
    +
    + # +
    +

    if that didn’t work, well, you’re all out of luck!

    +
    +
        nil
    +  end
    +
    +
    + # +
    +

    this is just a nice helper function to see if a hacker is an admin

    +
    +
      def admin?
    +    return self.admin == true
    +  end
    +
    +
    + # +
    +

    a helper function for gravatar urls

    +
    +
      def gravatar_url
    +    require 'digest/md5'
    +    "http://www.gravatar.com/avatar/#{Digest::MD5.hexdigest(email.downcase)}"
    +  end
    +
    +
    + # +
    +

    this method makes the hacker follow the followee

    +
    +
      def follow! followee
    +    following << followee
    +    save
    +    followee.followers << self
    +    followee.save
    +  end
    +
    +
    + # +
    +

    this method makes the hacker unfollow the followee

    +
    +
      def unfollow! followee
    +    following_ids.delete(followee.id)
    +    save
    +    followee.followers_ids.delete(id)
    +    followee.save
    +  end
    +
    +
    + # +
    +

    this method returns true if we’re following the given Hacker, and + false otherwise

    +
    +
      def following? hacker
    +    following.include? hacker
    +  end
    +
    +
    + # +
    +

    this method looks up the programs for a given user

    +
    +
      def programs
    +    Program.all(:creator_username => username)
    +  end
    +
    +  private
    +
    +
    + # +
    +

    we’re going to use the SHA1 encryption method for now.

    +
    +
      def self.encrypt(password, salt)
    +    Digest::SHA1.hexdigest(password + salt)
    +  end
    +
    +
    + # +
    +

    this is a nifty little method to give us a random string of characters

    +
    +
      def random_string(len)
    +
    +
    + # +
    +

    first, we make a bunch of random characters in an array

    +
    +
        chars = ("a".."z").to_a + ("A".."Z").to_a + ("0".."9").to_a
    +    newpass = ""
    +
    +
    + # +
    +

    then we grab a random element of that array, and add it onto our newpass

    +
    +
        1.upto(len) { |i| newpass << chars[rand(chars.size-1)] }
    +    return newpass
    +  end
    +
    +
    + # +
    +

    Everyone should have at least one follower. And I’d like to follow + everyone. So let’s do that. This runs after_create.

    + +
    +
      def follow_steve
    +    return if username == "steve"
    +    steve = Hacker.first(:username => 'steve')
    +    return if steve.nil?
    +
    +    follow! steve
    +    steve.follow! self
    +  end
    +
    +end
    +
    +
    + diff --git a/models/message.html b/models/message.html new file mode 100644 index 00000000..f4090260 --- /dev/null +++ b/models/message.html @@ -0,0 +1,80 @@ + + + + + message.rb + + + +
    +
    +
    + Jump To … + +
    + + + + + + + + + + + + + + + + +

    message.rb

    +
    + # +
    +

    This is the class for inter-site messages.

    +
    +
    class Message
    +  include MongoMapper::Document
    +
    +  key :body, String
    +
    +  key :recipient, String
    +
    +  key :sender, String
    +
    +  timestamps!
    +
    +  after_create :send_notification
    +
    +  private
    +
    +
    + # +
    +

    Sending emails is a good thing. We wouldn’t want you to not realize you + have a message! Right now, we explicitly test for development mode, because + of some weirdness. I’d much rather remove that unless, but I haven’t + gotten around to figuring it out yet.

    + +
    +
      def send_notification
    +    unless development?
    +      recipient_email = Hacker.first(:username => self.recipient).email
    +      Notifier.send_message_notification(recipient_email, self.sender)
    +    end
    +  end
    +
    +end
    +
    +
    + diff --git a/models/notifier.html b/models/notifier.html new file mode 100644 index 00000000..310515e8 --- /dev/null +++ b/models/notifier.html @@ -0,0 +1,73 @@ + + + + + notifier.rb + + + +
    +
    +
    + Jump To … + +
    + + + + + + + + + + + + + + + + +

    notifier.rb

    +
    + # +
    +

    This class handles sending emails. Everything related to it should go in + here, that way it’s just as easy as + Notifier.send_message_notification(me, you) to send a message.

    +
    +
    class Notifier 
    +  def self.send_message_notification(recipient, who)
    +    Pony.mail(:to => recipient, 
    +              :subject => "Hackety Hack: New Message",
    +              :from => "steve+hackety@steveklabnik.com",
    +              :body => render_haml_template("message", who),
    +              :via => :smtp, :via_options => PONY_VIA_OPTIONS)
    +  end
    +
    +  private
    +
    +
    + # +
    +

    This was kinda crazy to figure out. We have to make our own instantiation + of the Engine, and then set local variables. Crazy.

    + +
    +
      def self.render_haml_template(template, who)
    +    engine = Haml::Engine.new(File.open("views/notifier/#{template}.haml", "rb").read)
    +    engine.render(Object.new, :who => who)
    +  end
    +end
    +
    +
    + diff --git a/models/program.html b/models/program.html new file mode 100644 index 00000000..7e5042a0 --- /dev/null +++ b/models/program.html @@ -0,0 +1,84 @@ + + + + + program.rb + + + +
    +
    +
    + Jump To … + +
    + + + + + + + + + + + + + + + + +

    program.rb

    +
    + # +
    +

    The Program class represents a program that someone’s uploaded. Right now + we only store the latest version as text, but eventually, I’d love for + programs to be backed by git.

    +
    +
    class Program
    +  include MongoMapper::Document
    +
    +  key :creator_username, String
    +  key :title, String
    +  key :slug, String
    +
    +
    + # +
    +

    this is the source code for the program.

    + +
    +
      key :code, String
    +
    +  validate_on_create :slug_check
    +  before_save :make_slug
    +
    +  many :comments
    +
    +  timestamps!
    +
    +  private
    +  def slug_check
    +    programs = Program.all(:creator_username => creator_username)
    +    unless programs.detect {|p| p.slug == title.to_slug }.nil?
    +      errors.add(:title, "Title needs to be unique")
    +    end
    +  end
    +
    +  def make_slug
    +    self.slug = self.title.to_slug
    +  end
    +end
    +
    +
    + diff --git a/public/404.html b/public/404.html deleted file mode 100644 index a663cf70..00000000 --- a/public/404.html +++ /dev/null @@ -1,44 +0,0 @@ - - - - The page you were looking for doesn't exist (404) - - - - - - - - - - -
    - -
    -
    -
    - -
    -
    -
    -

    The page you were looking for doesn't exist.

    -

    You may have mistyped the address, the page may have moved or been deleted.

    -
    -
    -
    -
    - - - diff --git a/public/422.html b/public/422.html deleted file mode 100644 index 197302a9..00000000 --- a/public/422.html +++ /dev/null @@ -1,44 +0,0 @@ - - - - The change you wanted was rejected (422) - - - - - - - - - - -
    - -
    -
    -
    - -
    -
    -
    -

    The change you wanted was rejected.

    -

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

    -
    -
    -
    -
    - - - diff --git a/public/500.html b/public/500.html deleted file mode 100644 index 4ed09672..00000000 --- a/public/500.html +++ /dev/null @@ -1,44 +0,0 @@ - - - - We're sorry, but something went wrong (500) - - - - - - - - - - -
    - -
    -
    -
    - -
    -
    -
    -

    We're sorry, but something went wrong.

    -

    We've been notified about this issue and we'll take a look at it shortly.

    -
    -
    -
    -
    - - - diff --git a/public/favicon.ico b/public/favicon.ico deleted file mode 100644 index e69de29b..00000000 diff --git a/public/robots.txt b/public/robots.txt deleted file mode 100644 index 085187fa..00000000 --- a/public/robots.txt +++ /dev/null @@ -1,5 +0,0 @@ -# See http://www.robotstxt.org/wc/norobots.html for documentation on how to use the robots.txt file -# -# To ban all spiders from the entire site uncomment the next two lines: -# User-Agent: * -# Disallow: / diff --git a/script/bootstrap b/script/bootstrap deleted file mode 100755 index de77ea4d..00000000 --- a/script/bootstrap +++ /dev/null @@ -1,58 +0,0 @@ -#!/bin/bash - -go_go_gadget_bootstrap() { - check_ruby - check_mongo - check_bundler - bail_unless_chill - good_luck_have_fun -} - -check_mongo() { - which mongo > /dev/null 2>&1 - if [ $? -ne 0 ]; then - NOMONGO="Hey, in order to remember stuff I need MongoDB" - fi -} - -check_bundler() { - if [ -z "$NORUBY" ]; then - which bundle > /dev/null 2>&1 - if [ $? -ne 0 ]; then - gem install bundler || exit 2 - fi - fi -} - -good_luck_have_fun() { - bundle install - rake spec cucumber -} - -check_ruby() { - which ruby > /dev/null 2>&1 - if [ $? -ne 0 ]; then - NORUBY="Whoa there, looks like you're missing Ruby!" - else - ruby -v | grep '^ruby 1.9.3' > /dev/null 2>&1 - if [ $? -ne 0 ]; then - NORUBY="Hrmm, your Ruby version isn't Ruby 1.9.3, that's really what I prefer." - fi - fi -} - -bail_unless_chill() { - if [ "$NORUBY" -a "$NOMONGO" ]; then - echo "$NORUBY" - echo "$NOMONGO" - exit 1 - elif [ "$NORUBY" ]; then - echo "$NORUBY" - exit 1 - elif [ "$NOMONGO" ]; then - echo "$NOMONGO" - exit 1 - fi -} - -go_go_gadget_bootstrap diff --git a/script/cucumber b/script/cucumber deleted file mode 100755 index 7fa5c920..00000000 --- a/script/cucumber +++ /dev/null @@ -1,10 +0,0 @@ -#!/usr/bin/env ruby - -vendored_cucumber_bin = Dir["#{File.dirname(__FILE__)}/../vendor/{gems,plugins}/cucumber*/bin/cucumber"].first -if vendored_cucumber_bin - load File.expand_path(vendored_cucumber_bin) -else - require 'rubygems' unless ENV['NO_RUBYGEMS'] - require 'cucumber' - load Cucumber::BINARY -end diff --git a/script/rails b/script/rails deleted file mode 100755 index f8da2cff..00000000 --- a/script/rails +++ /dev/null @@ -1,6 +0,0 @@ -#!/usr/bin/env ruby -# This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application. - -APP_PATH = File.expand_path('../../config/application', __FILE__) -require File.expand_path('../../config/boot', __FILE__) -require 'rails/commands' diff --git a/spec/code_coverage.rb b/spec/code_coverage.rb deleted file mode 100644 index 605db4e3..00000000 --- a/spec/code_coverage.rb +++ /dev/null @@ -1,13 +0,0 @@ -require 'simplecov' -require 'coveralls' - -SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[ - Coveralls::SimpleCov::Formatter, - SimpleCov::Formatter::HTMLFormatter -] -SimpleCov.start do - add_filter '/config/' - add_filter '/vendor/' - add_filter '/spec/' - add_filter '/features/' -end \ No newline at end of file diff --git a/spec/controllers/blog_controller_spec.rb b/spec/controllers/blog_controller_spec.rb deleted file mode 100644 index 8da8d9df..00000000 --- a/spec/controllers/blog_controller_spec.rb +++ /dev/null @@ -1,104 +0,0 @@ -require 'spec_helper' - -describe BlogController do - let(:blog_post) { Fabricate(:blog_post) } - let(:another_blog_post) { Fabricate(:another_blog_post) } - - describe('#index') do - it "gets index successfully" do - get :index - response.should be_successful - end - - describe("handles posts by") do - before(:each) do - blog_post - another_blog_post - get :index - @posts = assigns(:posts) - end - it "fetching posts" do - @posts.size.should == 2 - end - it "sorting them in reverse order" do - @posts.first.content[0].should > @posts.last.content[0] - end - end - end - - describe "#show" do - before(:each) do - blog_post - get :show, id: blog_post - end - it { response.should be_successful } - it { assigns(:post).should == blog_post } - end - - describe "#admin" do - context "when user is not signed in" do - before(:each) do - get :create - end - #TODO Should it not use signin_path? - it { response.should redirect_to(new_user_session_path) } - end - - context "when user is not an blog_poster" do - before(:each) do - blog_post - get :admin - end - it { response.should be_redirect } - it { assigns(:post).should be_nil } - it { assigns(:posts).should be_nil } - end - context "when user is a blog_poster" do - before(:each) do - sign_in Fabricate(:user, blog_poster: true) - blog_post - get :admin - end - it { response.should be_successful } - it { assigns(:post).should be_a_new(BlogPost) } - it { assigns(:posts).size.should == 1 } - end - end - - describe "#create" do - context "when user is not signed in" do - before(:each) do - get :create - end - #TODO Should it not use signin_path? - it { response.should redirect_to(new_user_session_path) } - end - - context "when user is not an blog_poster" do - before(:each) do - sign_in Fabricate(:user) - get :create - end - - it { response.should redirect_to(blog_index_path) } - - it { assigns(:post).should be_nil } - end - - context "when user is a blog_poster" do - before(:each) do - sign_in Fabricate(:user, blog_poster: true) - end - - it "redirects to admin_blog_index_path when user is blog_poster" do - post :create - response.should redirect_to(admin_blog_index_path) - end - - it "creates a new blogpost" do - ->{ post :create, blog_post: Fabricate.build(:blog_post).attributes } - .should change(BlogPost, :count).by(1) - end - end - end -end diff --git a/spec/controllers/mailer_controller_spec.rb b/spec/controllers/mailer_controller_spec.rb deleted file mode 100644 index 2c5f7554..00000000 --- a/spec/controllers/mailer_controller_spec.rb +++ /dev/null @@ -1,137 +0,0 @@ -require 'spec_helper' - -describe MailerController do - let(:user) { Fabricate(:user) } - let(:users) { Fabricate.sequence(:user, 5)} - let(:diffusion) { Fabricate.build(:diffusion) } - - shared_examples 'unauthorized' do - it 'redirects to the login page' do - response.should redirect_to(login_path) - end - end - - describe "GET 'new' for a single user email" do - - context 'when user is a moderator' do - before { sign_in Fabricate(:user, moderator: true) } - it "returns http success" do - get :new, user: Array(user) - response.should be_success - end - end - - context 'when user is not a moderator' do - before do - sign_in Fabricate(:user) - get :new, user: Array(user) - end - it_behaves_like 'unauthorized' - end - - context 'when user is a guest' do - before { get :new, user: Array(user) } - it_behaves_like 'unauthorized' - end - end - - describe "GET 'new' for a diffusion" do - context 'when user is a moderator' do - before { sign_in Fabricate(:user, moderator: true) } - it "returns http success" do - get :new, user: Array(users) - response.should be_success - end - end - - context 'when user is not a moderator' do - before do - sign_in Fabricate(:user) - get :new, user: Array(users) - end - it_behaves_like 'unauthorized' - end - - context 'when user is a guest' do - before { get :new, user: Array(users) } - it_behaves_like 'unauthorized' - end - end - - describe "POST 'create' for a single user email" do - before :each do - @message = Fabricate.build(:message) - end - - context 'when user is a moderator' do - before { sign_in Fabricate(:user, moderator: true) } - it 'delivers the email' do - expect { - post :create, message: @message - }.to change {ActionMailer::Base.deliveries.size}.by(1) - end - - describe 'delivered message' do - before :each do - post :create, message: @message - end - - it "returns http success" do - response.should be_redirect - end - - it 'delivers the mail with the subject that we wanted to' do - ActionMailer::Base.deliveries.last.subject.should == @message.subject - end - - it 'delivers the mail with the body that we wanted to' do - ActionMailer::Base.deliveries.last.body.to_s.should match @message.body - end - end - - describe 'empty message' do - it "returns exception" do - post :create - expect(subject).to render_template(:new) - end - end - end - - context 'when user is not a moderator' do - before do - sign_in Fabricate(:user) - post :create, message: @message - end - it_behaves_like 'unauthorized' - end - - context 'when user is a guest' do - before { post :create, message: @message } - it_behaves_like 'unauthorized' - end - end - - describe "POST 'create' for a diffusion" do - context 'when user is a moderator' do - before { sign_in Fabricate(:user, moderator: true) } - it "returns http success" do - expect { - post 'create', message: diffusion - }.to change {ActionMailer::Base.deliveries.size}.by(diffusion.email.size) - end - end - - context 'when user is not a moderator' do - before do - sign_in Fabricate(:user) - post :create, message: diffusion - end - it_behaves_like 'unauthorized' - end - - context 'when user is a guest' do - before { post :create, message: diffusion } - it_behaves_like 'unauthorized' - end - end -end diff --git a/spec/controllers/questions_controller_spec.rb b/spec/controllers/questions_controller_spec.rb deleted file mode 100644 index c6e15a89..00000000 --- a/spec/controllers/questions_controller_spec.rb +++ /dev/null @@ -1,12 +0,0 @@ -require 'spec_helper' - -describe QuestionsController do - describe "GET index" do - context "with format atom" do - it "responds with success" do - get :index, format: :atom - response.should be_success - end - end - end -end diff --git a/spec/controllers/rel_controller_spec.rb b/spec/controllers/rel_controller_spec.rb deleted file mode 100644 index ac13dba5..00000000 --- a/spec/controllers/rel_controller_spec.rb +++ /dev/null @@ -1,19 +0,0 @@ -require 'spec_helper' - -describe Api::RelsController do - let(:slug){Fabricate(:rel)} - - describe "GET index" do - it "responds with success" do - get :index - response.should be_success - end - end - - describe "GET show" do - it "responds with success" do - get :show - response.should be_success - end - end -end \ No newline at end of file diff --git a/spec/controllers/static_controller_spec.rb b/spec/controllers/static_controller_spec.rb deleted file mode 100644 index ece397af..00000000 --- a/spec/controllers/static_controller_spec.rb +++ /dev/null @@ -1,24 +0,0 @@ -require 'spec_helper' - -describe StaticController do - describe "GET root" do - it "responds with success" do - expect(:get => "/").to route_to(:controller => "static", :action => "root") - end - end - - describe "GET api_root" do - it "should render api layout" do - get :api_root - response.should render_template(:layout => "api") - end - end - - describe "GET newest_version" do - it "should render version of api" do - get :newest_version - response.header['Content-Type'].should include 'application/json' - response.body.should include "1.0.0".to_json - end - end -end \ No newline at end of file diff --git a/spec/controllers/user_controller_spec.rb b/spec/controllers/user_controller_spec.rb deleted file mode 100644 index f756c742..00000000 --- a/spec/controllers/user_controller_spec.rb +++ /dev/null @@ -1,60 +0,0 @@ -require 'spec_helper' - -describe UsersController do - let(:bob){Fabricate(:user)} - let(:mozart){Fabricate(:user)} - - describe '#index' do - context "When user is no moderator" do - it "try to get index" do - get :index - expect(response).to redirect_to(root_path) - end - end - - context "When user is moderator" do - before { sign_in Fabricate(:user, moderator: true) } - it "gets index with authorization" do - get :index - response.should be_success - end - end - end - - describe 'Following actions' do - before { sign_in bob } - it 'Try to follow himself' do - post :follow, user_id: bob, :user => {:followee => bob.id} - expect(flash[:notice]).to eq("You can't follow yourself silly!") - end - - it '#follow just once' do - post :follow, user_id: bob, :user => {:followee => mozart.id} - expect(flash[:notice]).to eq("You're following #{mozart.username} now") - post :follow, user_id: bob, :user => {:followee => mozart.id} - expect(flash[:notice]).to eq("You're already following #{mozart.username}") - end - - it '#following?' do - get :following, user_id: bob - response.should be_success - end - - it '#followers' do - get :followers, user_id: bob - response.should be_success - end - - it '#unfollow' do - post :unfollow, user_id: bob, :user => {:followee => mozart.id} - expect(flash[:notice]).to eq("You're no longer following #{mozart.username}") - end - end - - describe 'Deleted user' do - it 'should create new deleted user' do - get :deleted_user - response.should be_success - end - end -end diff --git a/spec/fabricators/answer_fabricator.rb b/spec/fabricators/answer_fabricator.rb deleted file mode 100644 index 25f90dd5..00000000 --- a/spec/fabricators/answer_fabricator.rb +++ /dev/null @@ -1,3 +0,0 @@ -Fabricator(:answer) do - description "MyString" -end \ No newline at end of file diff --git a/spec/fabricators/blog_post_fabricator.rb b/spec/fabricators/blog_post_fabricator.rb deleted file mode 100644 index ff271066..00000000 --- a/spec/fabricators/blog_post_fabricator.rb +++ /dev/null @@ -1,9 +0,0 @@ -Fabricator(:blog_post) do - content "Hello, world" - title "Title" -end - -Fabricator(:another_blog_post, from: :blog_post) do - content "World, Hello" - title "Eltit" -end diff --git a/spec/fabricators/message_fabricator.rb b/spec/fabricators/message_fabricator.rb deleted file mode 100644 index 9ec6949e..00000000 --- a/spec/fabricators/message_fabricator.rb +++ /dev/null @@ -1,11 +0,0 @@ -Fabricator(:message) do - email(count: 1) {"proof@example.com" } - subject:"Hackety-hack email" - body:"This is an email from hackety-hack.com" -end - -Fabricator(:diffusion, from: :message) do - email(count: 5) { |i| "proof#{i}@example.com" } - subject:"Hackety-hack email" - body:"This is an email from hackety-hack.com" -end diff --git a/spec/fabricators/program_fabricator.rb b/spec/fabricators/program_fabricator.rb deleted file mode 100644 index 893a756a..00000000 --- a/spec/fabricators/program_fabricator.rb +++ /dev/null @@ -1,6 +0,0 @@ -Fabricator(:program) do - author_username "MyString" - slug "MyString" - title "MyString" - source_code "MyString" -end diff --git a/spec/fabricators/question_fabricator.rb b/spec/fabricators/question_fabricator.rb deleted file mode 100644 index 74c4c5ea..00000000 --- a/spec/fabricators/question_fabricator.rb +++ /dev/null @@ -1,6 +0,0 @@ -Fabricator(:question) do - id "RandomID" - title "Title" - description "Description" - user -end \ No newline at end of file diff --git a/spec/fabricators/rel_fabricator.rb b/spec/fabricators/rel_fabricator.rb deleted file mode 100644 index 7bed38bd..00000000 --- a/spec/fabricators/rel_fabricator.rb +++ /dev/null @@ -1,4 +0,0 @@ -Fabricator(:rel) do - slug { "some_slug" } - description { "Some description" } -end \ No newline at end of file diff --git a/spec/fabricators/user_fabricator.rb b/spec/fabricators/user_fabricator.rb deleted file mode 100644 index e12217c1..00000000 --- a/spec/fabricators/user_fabricator.rb +++ /dev/null @@ -1,6 +0,0 @@ -Fabricator(:user) do - email { sequence(:email) { |i| "user#{i}@example.com"} } - password "password" - password_confirmation "password" - username { sequence(:username) { |i| "user#{i}" } } -end diff --git a/spec/following_policy_spec.rb b/spec/following_policy_spec.rb deleted file mode 100644 index 0a855bbc..00000000 --- a/spec/following_policy_spec.rb +++ /dev/null @@ -1,28 +0,0 @@ -require_relative '../app/models/following_policy' - -describe FollowingPolicy do - before(:each) do - @followee = double 'followee' - @follower = double 'follower' - end - - it 'can follow another' do - @follower.should_receive(:following?).with(@followee).and_return(false) - policy = FollowingPolicy.new(@follower) - policy.can_follow?(@followee).should be_true - end - - it "cannot follow self" do - policy = FollowingPolicy.new(@follower) - policy.following_self?(@follower).should be_true - policy.can_follow?(@follower).should be_false - end - - it "cannot follow twice" do - @follower.should_receive(:following?).twice.with(@followee).and_return(true) - policy = FollowingPolicy.new(@follower) - policy.already_following?(@followee).should be_true - policy.can_follow?(@followee).should be_false - end - -end diff --git a/spec/helpers/program_helper_spec.rb b/spec/helpers/program_helper_spec.rb deleted file mode 100644 index 8a4e4c6e..00000000 --- a/spec/helpers/program_helper_spec.rb +++ /dev/null @@ -1,20 +0,0 @@ -require "spec_helper" - -describe ProgramsHelper do - let(:simple) { Fabricate(:program) } - let(:complicated) { Fabricate(:program, :author_username => nil) } - - describe "#program_link" do - it "returns author's program path if author username exists" do - helper.program_link(simple).should == "#{link_to(simple.title.titleize, - user_program_path(simple.author_username, simple))}".html_safe - end - - it "returns url by program's slug if author username doesn't exist" do - helper.program_link(complicated).should == "#{link_to(complicated.title.titleize, - url_for(:controller => '/programs', - :action => 'show', - :id => complicated.slug))}".html_safe - end - end -end \ No newline at end of file diff --git a/spec/mailers/message_mailer_spec.rb b/spec/mailers/message_mailer_spec.rb deleted file mode 100644 index b1a567fe..00000000 --- a/spec/mailers/message_mailer_spec.rb +++ /dev/null @@ -1,21 +0,0 @@ -require "spec_helper" - -describe MessageMailer do - let(:message) { MessageMailer.new_message(Fabricate(:message), Array("proof@example.com"))} - - it "is from Steve" do - message.from.should eq(["steve@hackety.com"]) - end - - it "Correct subject" do - message.subject.should eq("Hackety-hack email") - end - - it "Correct receiver email" do - message.to.should eq(["proof@example.com"]) - end - - it "Correct body" do - message.body.encoded.should match("This is an email from hackety-hack.com") - end -end diff --git a/spec/mailers/notification_spec.rb b/spec/mailers/notification_spec.rb deleted file mode 100644 index 6fba9fb0..00000000 --- a/spec/mailers/notification_spec.rb +++ /dev/null @@ -1,24 +0,0 @@ -require "spec_helper" - -describe Notification do - describe "new_answer" do - let(:question) { Fabricate(:question) } - let(:mail) { Notification.new_answer(question) } - - it "has a link to the question" do - mail.body.encoded.should match(question_url(question, :host => "hackety.com")) - end - - it "is from Steve" do - mail.from.should eq(["steve@hackety.com"]) - end - - it "is to the question's author" do - mail.to.should eq([question.user.email]) - end - - it "has the proper subject" do - mail.subject.should eq("New Answer on Hackety.com!") - end - end -end diff --git a/spec/models/deleted_user_spec.rb b/spec/models/deleted_user_spec.rb deleted file mode 100644 index 9afc850b..00000000 --- a/spec/models/deleted_user_spec.rb +++ /dev/null @@ -1,20 +0,0 @@ -require 'spec_helper' - -describe DeletedUser do - - before do - @user = DeletedUser.new - end - - it 'has deleted username' do - @user.username.should == 'Deleted User' - end - - it 'has no email' do - @user.email.should == 'none' - end - - it 'returns deleted user param' do - @user.to_param.should == 'deleted_user' - end -end \ No newline at end of file diff --git a/spec/models/message.rb b/spec/models/message.rb deleted file mode 100644 index 5caa4eb1..00000000 --- a/spec/models/message.rb +++ /dev/null @@ -1,19 +0,0 @@ -require 'spec_helper' - -describe Message do - subject {Fabricate.build(:message)} - - describe '#to_param' do - it 'has the email attribute' do - subject.to_param[:email].should == subject.email - end - - it'has the subject attribute' do - subject.to_param[:subject].should == subject.subject - end - - it 'has the body attribute' do - subject.to_param[:body].should == subject.body - end - end -end \ No newline at end of file diff --git a/spec/models/question_spec.rb b/spec/models/question_spec.rb deleted file mode 100644 index 131fdeab..00000000 --- a/spec/models/question_spec.rb +++ /dev/null @@ -1,25 +0,0 @@ -require 'spec_helper' - -describe Question do - - let(:question){Fabricate(:question)} - - it 'can be created validly' do - question.should be_valid - end - - describe 'without a user' do - before :each do - question.user.destroy - @reloaded_question = Question.find question.id - end - - it 'does not respond with nil when asked for its user' do - @reloaded_question.user.should_not be_nil - end - - it 'responds with something when ask for user that respodns to username' do - @reloaded_question.user.should respond_to :username - end - end -end \ No newline at end of file diff --git a/spec/models/rel_spec.rb b/spec/models/rel_spec.rb deleted file mode 100644 index a614be8e..00000000 --- a/spec/models/rel_spec.rb +++ /dev/null @@ -1,14 +0,0 @@ -require 'spec_helper' - -describe Rel do - - before do - @rel = Rel.create(:slug => 'text', :description => 'some text') - end - - context 'to_param' do - it 'returns slug' do - @rel.to_param.should == 'text' - end - end -end \ No newline at end of file diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb deleted file mode 100644 index c8d70a56..00000000 --- a/spec/models/user_spec.rb +++ /dev/null @@ -1,30 +0,0 @@ -require 'spec_helper' - -describe User do - let(:bob){Fabricate(:user, :username => 'hacker')} - let(:mozart){Fabricate(:user)} - let(:hello_world){Fabricate(:program, :author_username => bob.username)} - - it 'can be created validly' do - bob.should be_valid - mozart.should be_valid - end - - it 'Users can follow and unfollow' do - bob.follow!(mozart) - bob.following?(mozart).should be_true - bob.unfollow!(mozart) - bob.reload - bob.following?(mozart).should be_false - end - - describe 'programs' do - it 'should return programs list' do - bob.programs.class.should == Plucky::Query - hello_world.author_username.should == 'hacker' - bob.username.should == 'hacker' - bob.programs.count.should == 1 - bob.programs.first.should == hello_world - end - end -end \ No newline at end of file diff --git a/spec/presenters/question_presenter_spec.rb b/spec/presenters/question_presenter_spec.rb deleted file mode 100644 index 13463fc7..00000000 --- a/spec/presenters/question_presenter_spec.rb +++ /dev/null @@ -1,46 +0,0 @@ -require 'spec_helper' - -describe QuestionPresenter do - - let(:question){Fabricate(:question)} - let(:another_question){Fabricate(:question, :id => 'AnotherID')} - let(:answer){Fabricate(:answer, :question_id => question.id)} - - before do - @qp = QuestionPresenter.new(question) - end - - context 'collection_path' do - it 'returns questions_path' do - @qp.collection_path.should == '/questions' - end - end - - context 'edit_resource_path' do - it 'returns edit_question_path' do - @qp.edit_resource_path.should == '/questions/RandomID/edit' - end - end - - context 'new_resource_path' do - it 'returns new_question_path' do - @qp.new_resource_path.should == '/questions/new' - end - end - - context 'resource_path' do - it 'returns self question path if nil' do - @qp.resource_path(nil).should == '/questions/RandomID' - end - - it 'returns question path if not nil' do - @qp.resource_path(another_question).should == '/questions/AnotherID' - end - end - - context 'answers_path' do - it 'returns questions answer path' do - @qp.answers_path.should == '/questions/RandomID/answers' - end - end -end \ No newline at end of file diff --git a/spec/presenters/support_presenter_spec.rb b/spec/presenters/support_presenter_spec.rb deleted file mode 100644 index 6dd9ac83..00000000 --- a/spec/presenters/support_presenter_spec.rb +++ /dev/null @@ -1,45 +0,0 @@ -require 'spec_helper' - -describe SupportPresenter do - - let(:question){Fabricate(:question)} - let(:another_question){Fabricate(:question, :id => 'AnotherID')} - - before do - @sp = SupportPresenter.new(question) - end - - context 'page_title' do - it 'returns support questions title' do - @sp.page_title.should == 'Support Questions' - end - end - - context 'collection_path' do - it 'returns support questions_path' do - @sp.collection_path.should == '/support/questions' - end - end - - context 'edit_resource_path' do - it 'returns edit_support_question_path' do - @sp.edit_resource_path.should == '/support/questions/RandomID/edit' - end - end - - context 'new_resource_path' do - it 'returns new_support_question_path' do - @sp.new_resource_path.should == '/support/questions/new' - end - end - - context 'resource_path' do - it 'returns self question path if nil' do - @sp.resource_path(nil).should == '/support/questions/RandomID' - end - - it 'returns question path if not nil' do - @sp.resource_path(another_question).should == '/support/questions/AnotherID' - end - end -end \ No newline at end of file diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb deleted file mode 100644 index d80bdb02..00000000 --- a/spec/spec_helper.rb +++ /dev/null @@ -1,35 +0,0 @@ -require 'code_coverage' - -ENV["RAILS_ENV"] ||= 'test' -require File.expand_path("../../config/environment", __FILE__) -require 'rspec/rails' -require 'database_cleaner' -require 'capybara/rspec' - -# Requires supporting ruby files with custom matchers and macros, etc, -# in spec/support/ and its subdirectories. -Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f} - -RSpec.configure do |config| - # == Mock Framework - # - # If you prefer to use mocha, flexmock or RR, uncomment the appropriate line: - # - # config.mock_with :mocha - # config.mock_with :flexmock - # config.mock_with :rr - config.mock_with :rspec - - DatabaseCleaner.orm = "mongo_mapper" - DatabaseCleaner[:mongo_mapper].strategy = :truncation - - config.before(:each) do - DatabaseCleaner[:mongo_mapper].clean - end - - config.include(MailerMacros) - config.before(:each) { reset_email } - - config.include Devise::TestHelpers, :type => :controller - config.include Capybara::DSL -end diff --git a/spec/support/mailer_macros.rb b/spec/support/mailer_macros.rb deleted file mode 100644 index f082fda9..00000000 --- a/spec/support/mailer_macros.rb +++ /dev/null @@ -1,10 +0,0 @@ -module MailerMacros - def last_email - ActionMailer::Base.deliveries.last - end - - def reset_email - ActionMailer::Base.deliveries = [] - end -end - diff --git a/spec/unit/program_spec.rb b/spec/unit/program_spec.rb deleted file mode 100644 index c93ba99e..00000000 --- a/spec/unit/program_spec.rb +++ /dev/null @@ -1,16 +0,0 @@ -require 'spec_helper' - -describe Program do - let(:prog) { Program.create(author_username: 'tester', title: 'test title')} - - it "sets the slug" do - prog.slug.should == 'test-title' - end - - it "makes unique slugs" do - first_prog = Program.create(author_username: 'tester', - title: 'test title #2', - slug: 'test-title') - prog.slug.should_not == first_prog.slug - end -end diff --git a/spec/unit/sluggifier_spec.rb b/spec/unit/sluggifier_spec.rb deleted file mode 100644 index 9cc71ce9..00000000 --- a/spec/unit/sluggifier_spec.rb +++ /dev/null @@ -1,25 +0,0 @@ -# encoding: utf-8 - -require 'active_support/all' -require_relative '../../lib/sluggifier' - -describe Sluggifier do - describe '.generate' do - it "makes a slug from a title" do - Sluggifier.generate('test a slug').should == 'test-a-slug' - end - - context "doesn't allow multiple slugs to be the same" do - let(:all_slugs) { ['test'] } - - it "appends a one if there is one repeated slug" do - Sluggifier.generate('test',all_slugs).should == 'test-2' - end - - it "appends the next sequential number for repeats" do - all_slugs << 'test-2' - Sluggifier.generate('test',all_slugs).should == 'test-3' - end - end - end -end diff --git a/spec/views/programs_index.rb b/spec/views/programs_index.rb deleted file mode 100644 index 55029cd4..00000000 --- a/spec/views/programs_index.rb +++ /dev/null @@ -1,12 +0,0 @@ -require 'spec_helper' - -describe 'programs/index.html.haml' do - context 'programs without a username' do - it "renders the page without error" do - programs = [Fabricate(:program, author_username: nil)] - assign(:programs, programs) - render - rendered.should have_selector('div', id: 'title', contents: 'MyString') - end - end -end diff --git a/spec/views/questions/index.atom.builder_spec.rb b/spec/views/questions/index.atom.builder_spec.rb deleted file mode 100644 index 08d0faab..00000000 --- a/spec/views/questions/index.atom.builder_spec.rb +++ /dev/null @@ -1,15 +0,0 @@ -require 'spec_helper' - -describe 'questions/index.atom.builder' do - let(:question) { Fabricate(:question) } - - before { assign(:questions, [question]) } - - it "renders the feed without error" do - render - rendered.should include(question.title) - rendered.should include(question.description) - rendered.should include(question.updated_at.strftime("%Y-%m-%dT%H:%M:%SZ")) - rendered.should include(question.user.username) - end -end diff --git a/spec/views/questions/index.html.haml_spec.rb b/spec/views/questions/index.html.haml_spec.rb deleted file mode 100644 index f371781c..00000000 --- a/spec/views/questions/index.html.haml_spec.rb +++ /dev/null @@ -1,19 +0,0 @@ -require 'spec_helper' - -describe 'questions/index.html.haml' do - let(:question) { Fabricate(:question) } - - before(:each) do - # stub the partials and test them individually - stub_template "shared/_ask" => "" - stub_template "questions/_list" => "" - - view.stub :will_paginate - end - - it "renders an autodiscovery link in for the head content" do - render :template => "questions/index.html.haml", :locals => {:collection => [question]} - - view.content_for(:head).should include(questions_url(format: :atom)) - end -end \ No newline at end of file diff --git a/vendor/assets/javascripts/prettify.js b/vendor/assets/javascripts/prettify.js deleted file mode 100644 index eef5ad7e..00000000 --- a/vendor/assets/javascripts/prettify.js +++ /dev/null @@ -1,28 +0,0 @@ -var q=null;window.PR_SHOULD_USE_CONTINUATION=!0; -(function(){function L(a){function m(a){var f=a.charCodeAt(0);if(f!==92)return f;var b=a.charAt(1);return(f=r[b])?f:"0"<=b&&b<="7"?parseInt(a.substring(1),8):b==="u"||b==="x"?parseInt(a.substring(2),16):a.charCodeAt(1)}function e(a){if(a<32)return(a<16?"\\x0":"\\x")+a.toString(16);a=String.fromCharCode(a);if(a==="\\"||a==="-"||a==="["||a==="]")a="\\"+a;return a}function h(a){for(var f=a.substring(1,a.length-1).match(/\\u[\dA-Fa-f]{4}|\\x[\dA-Fa-f]{2}|\\[0-3][0-7]{0,2}|\\[0-7]{1,2}|\\[\S\s]|[^\\]/g),a= -[],b=[],o=f[0]==="^",c=o?1:0,i=f.length;c122||(d<65||j>90||b.push([Math.max(65,j)|32,Math.min(d,90)|32]),d<97||j>122||b.push([Math.max(97,j)&-33,Math.min(d,122)&-33]))}}b.sort(function(a,f){return a[0]-f[0]||f[1]-a[1]});f=[];j=[NaN,NaN];for(c=0;ci[0]&&(i[1]+1>i[0]&&b.push("-"),b.push(e(i[1])));b.push("]");return b.join("")}function y(a){for(var f=a.source.match(/\[(?:[^\\\]]|\\[\S\s])*]|\\u[\dA-Fa-f]{4}|\\x[\dA-Fa-f]{2}|\\\d+|\\[^\dux]|\(\?[!:=]|[()^]|[^()[\\^]+/g),b=f.length,d=[],c=0,i=0;c=2&&a==="["?f[c]=h(j):a!=="\\"&&(f[c]=j.replace(/[A-Za-z]/g,function(a){a=a.charCodeAt(0);return"["+String.fromCharCode(a&-33,a|32)+"]"}));return f.join("")}for(var t=0,s=!1,l=!1,p=0,d=a.length;p=5&&"lang-"===b.substring(0,5))&&!(o&&typeof o[1]==="string"))c=!1,b="src";c||(r[f]=b)}i=d;d+=f.length;if(c){c=o[1];var j=f.indexOf(c),k=j+c.length;o[2]&&(k=f.length-o[2].length,j=k-c.length);b=b.substring(5);B(l+i,f.substring(0,j),e,p);B(l+i+j,c,C(b,c),p);B(l+i+k,f.substring(k),e,p)}else p.push(l+i,b)}a.e=p}var h={},y;(function(){for(var e=a.concat(m), -l=[],p={},d=0,g=e.length;d=0;)h[n.charAt(k)]=r;r=r[1];n=""+r;p.hasOwnProperty(n)||(l.push(r),p[n]=q)}l.push(/[\S\s]/);y=L(l)})();var t=m.length;return e}function u(a){var m=[],e=[];a.tripleQuotedStrings?m.push(["str",/^(?:'''(?:[^'\\]|\\[\S\s]|''?(?=[^']))*(?:'''|$)|"""(?:[^"\\]|\\[\S\s]|""?(?=[^"]))*(?:"""|$)|'(?:[^'\\]|\\[\S\s])*(?:'|$)|"(?:[^"\\]|\\[\S\s])*(?:"|$))/,q,"'\""]):a.multiLineStrings?m.push(["str",/^(?:'(?:[^'\\]|\\[\S\s])*(?:'|$)|"(?:[^"\\]|\\[\S\s])*(?:"|$)|`(?:[^\\`]|\\[\S\s])*(?:`|$))/, -q,"'\"`"]):m.push(["str",/^(?:'(?:[^\n\r'\\]|\\.)*(?:'|$)|"(?:[^\n\r"\\]|\\.)*(?:"|$))/,q,"\"'"]);a.verbatimStrings&&e.push(["str",/^@"(?:[^"]|"")*(?:"|$)/,q]);var h=a.hashComments;h&&(a.cStyleComments?(h>1?m.push(["com",/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,q,"#"]):m.push(["com",/^#(?:(?:define|elif|else|endif|error|ifdef|include|ifndef|line|pragma|undef|warning)\b|[^\n\r]*)/,q,"#"]),e.push(["str",/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h|[a-z]\w*)>/,q])):m.push(["com",/^#[^\n\r]*/, -q,"#"]));a.cStyleComments&&(e.push(["com",/^\/\/[^\n\r]*/,q]),e.push(["com",/^\/\*[\S\s]*?(?:\*\/|$)/,q]));a.regexLiterals&&e.push(["lang-regex",/^(?:^^\.?|[!+-]|!=|!==|#|%|%=|&|&&|&&=|&=|\(|\*|\*=|\+=|,|-=|->|\/|\/=|:|::|;|<|<<|<<=|<=|=|==|===|>|>=|>>|>>=|>>>|>>>=|[?@[^]|\^=|\^\^|\^\^=|{|\||\|=|\|\||\|\|=|~|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\s*(\/(?=[^*/])(?:[^/[\\]|\\[\S\s]|\[(?:[^\\\]]|\\[\S\s])*(?:]|$))+\/)/]);(h=a.types)&&e.push(["typ",h]);a=(""+a.keywords).replace(/^ | $/g, -"");a.length&&e.push(["kwd",RegExp("^(?:"+a.replace(/[\s,]+/g,"|")+")\\b"),q]);m.push(["pln",/^\s+/,q," \r\n\t\xa0"]);e.push(["lit",/^@[$_a-z][\w$@]*/i,q],["typ",/^(?:[@_]?[A-Z]+[a-z][\w$@]*|\w+_t\b)/,q],["pln",/^[$_a-z][\w$@]*/i,q],["lit",/^(?:0x[\da-f]+|(?:\d(?:_\d+)*\d*(?:\.\d*)?|\.\d\+)(?:e[+-]?\d+)?)[a-z]*/i,q,"0123456789"],["pln",/^\\[\S\s]?/,q],["pun",/^.[^\s\w"-$'./@\\`]*/,q]);return x(m,e)}function D(a,m){function e(a){switch(a.nodeType){case 1:if(k.test(a.className))break;if("BR"===a.nodeName)h(a), -a.parentNode&&a.parentNode.removeChild(a);else for(a=a.firstChild;a;a=a.nextSibling)e(a);break;case 3:case 4:if(p){var b=a.nodeValue,d=b.match(t);if(d){var c=b.substring(0,d.index);a.nodeValue=c;(b=b.substring(d.index+d[0].length))&&a.parentNode.insertBefore(s.createTextNode(b),a.nextSibling);h(a);c||a.parentNode.removeChild(a)}}}}function h(a){function b(a,d){var e=d?a.cloneNode(!1):a,f=a.parentNode;if(f){var f=b(f,1),g=a.nextSibling;f.appendChild(e);for(var h=g;h;h=g)g=h.nextSibling,f.appendChild(h)}return e} -for(;!a.nextSibling;)if(a=a.parentNode,!a)return;for(var a=b(a.nextSibling,0),e;(e=a.parentNode)&&e.nodeType===1;)a=e;d.push(a)}var k=/(?:^|\s)nocode(?:\s|$)/,t=/\r\n?|\n/,s=a.ownerDocument,l;a.currentStyle?l=a.currentStyle.whiteSpace:window.getComputedStyle&&(l=s.defaultView.getComputedStyle(a,q).getPropertyValue("white-space"));var p=l&&"pre"===l.substring(0,3);for(l=s.createElement("LI");a.firstChild;)l.appendChild(a.firstChild);for(var d=[l],g=0;g=0;){var h=m[e];A.hasOwnProperty(h)?window.console&&console.warn("cannot override language handler %s",h):A[h]=a}}function C(a,m){if(!a||!A.hasOwnProperty(a))a=/^\s*=o&&(h+=2);e>=c&&(a+=2)}}catch(w){"console"in window&&console.log(w&&w.stack?w.stack:w)}}var v=["break,continue,do,else,for,if,return,while"],w=[[v,"auto,case,char,const,default,double,enum,extern,float,goto,int,long,register,short,signed,sizeof,static,struct,switch,typedef,union,unsigned,void,volatile"], -"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],F=[w,"alignof,align_union,asm,axiom,bool,concept,concept_map,const_cast,constexpr,decltype,dynamic_cast,explicit,export,friend,inline,late_check,mutable,namespace,nullptr,reinterpret_cast,static_assert,static_cast,template,typeid,typename,using,virtual,where"],G=[w,"abstract,boolean,byte,extends,final,finally,implements,import,instanceof,null,native,package,strictfp,super,synchronized,throws,transient"], -H=[G,"as,base,by,checked,decimal,delegate,descending,dynamic,event,fixed,foreach,from,group,implicit,in,interface,internal,into,is,lock,object,out,override,orderby,params,partial,readonly,ref,sbyte,sealed,stackalloc,string,select,uint,ulong,unchecked,unsafe,ushort,var"],w=[w,"debugger,eval,export,function,get,null,set,undefined,var,with,Infinity,NaN"],I=[v,"and,as,assert,class,def,del,elif,except,exec,finally,from,global,import,in,is,lambda,nonlocal,not,or,pass,print,raise,try,with,yield,False,True,None"], -J=[v,"alias,and,begin,case,class,def,defined,elsif,end,ensure,false,in,module,next,nil,not,or,redo,rescue,retry,self,super,then,true,undef,unless,until,when,yield,BEGIN,END"],v=[v,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],K=/^(DIR|FILE|vector|(de|priority_)?queue|list|stack|(const_)?iterator|(multi)?(set|map)|bitset|u?(int|float)\d*)/,N=/\S/,O=u({keywords:[F,H,w,"caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END"+ -I,J,v],hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0}),A={};k(O,["default-code"]);k(x([],[["pln",/^[^]*(?:>|$)/],["com",/^<\!--[\S\s]*?(?:--\>|$)/],["lang-",/^<\?([\S\s]+?)(?:\?>|$)/],["lang-",/^<%([\S\s]+?)(?:%>|$)/],["pun",/^(?:<[%?]|[%?]>)/],["lang-",/^]*>([\S\s]+?)<\/xmp\b[^>]*>/i],["lang-js",/^]*>([\S\s]*?)(<\/script\b[^>]*>)/i],["lang-css",/^]*>([\S\s]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i]]), -["default-markup","htm","html","mxml","xhtml","xml","xsl"]);k(x([["pln",/^\s+/,q," \t\r\n"],["atv",/^(?:"[^"]*"?|'[^']*'?)/,q,"\"'"]],[["tag",/^^<\/?[a-z](?:[\w-.:]*\w)?|\/?>$/i],["atn",/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^\s"'>]*(?:[^\s"'/>]|\/(?=\s)))/],["pun",/^[/<->]+/],["lang-js",/^on\w+\s*=\s*"([^"]+)"/i],["lang-js",/^on\w+\s*=\s*'([^']+)'/i],["lang-js",/^on\w+\s*=\s*([^\s"'>]+)/i],["lang-css",/^style\s*=\s*"([^"]+)"/i],["lang-css",/^style\s*=\s*'([^']+)'/i],["lang-css", -/^style\s*=\s*([^\s"'>]+)/i]]),["in.tag"]);k(x([],[["atv",/^[\S\s]+/]]),["uq.val"]);k(u({keywords:F,hashComments:!0,cStyleComments:!0,types:K}),["c","cc","cpp","cxx","cyc","m"]);k(u({keywords:"null,true,false"}),["json"]);k(u({keywords:H,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:K}),["cs"]);k(u({keywords:G,cStyleComments:!0}),["java"]);k(u({keywords:v,hashComments:!0,multiLineStrings:!0}),["bsh","csh","sh"]);k(u({keywords:I,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}), -["cv","py"]);k(u({keywords:"caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END",hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["perl","pl","pm"]);k(u({keywords:J,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb"]);k(u({keywords:w,cStyleComments:!0,regexLiterals:!0}),["js"]);k(u({keywords:"all,and,by,catch,class,else,extends,false,finally,for,if,in,is,isnt,loop,new,no,not,null,of,off,on,or,return,super,then,true,try,unless,until,when,while,yes", -hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]);k(x([],[["str",/^[\S\s]+/]]),["regex"]);window.prettyPrintOne=function(a,m,e){var h=document.createElement("PRE");h.innerHTML=a;e&&D(h,e);E({g:m,i:e,h:h});return h.innerHTML};window.prettyPrint=function(a){function m(){for(var e=window.PR_SHOULD_USE_CONTINUATION?l.now()+250:Infinity;p=0){var k=k.match(g),f,b;if(b= -!k){b=n;for(var o=void 0,c=b.firstChild;c;c=c.nextSibling)var i=c.nodeType,o=i===1?o?b:c:i===3?N.test(c.nodeValue)?b:o:o;b=(f=o===b?void 0:o)&&"CODE"===f.tagName}b&&(k=f.className.match(g));k&&(k=k[1]);b=!1;for(o=n.parentNode;o;o=o.parentNode)if((o.tagName==="pre"||o.tagName==="code"||o.tagName==="xmp")&&o.className&&o.className.indexOf("prettyprint")>=0){b=!0;break}b||((b=(b=n.className.match(/\blinenums\b(?::(\d+))?/))?b[1]&&b[1].length?+b[1]:!0:!1)&&D(n,b),d={g:k,h:n,i:b},E(d))}}p