-
Notifications
You must be signed in to change notification settings - Fork 17
a true MVP #10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
mevanoff24
wants to merge
9
commits into
sf-squirrels-2015:master
Choose a base branch
from
mevanoff24:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
a true MVP #10
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
2469f3c
set everything up including data bases
mevanoff24 cbe4805
fix associations to correct, still have comment out lines
mevanoff24 c789672
working on json parse
mevanoff24 eb88924
hope this works
mevanoff24 232b862
start parse
mevanoff24 5022ec4
parse exercise
mevanoff24 0f16fbc
workoing on single page flow
mevanoff24 061ad66
getting there delete/update check
mevanoff24 8362de3
a true MVP
mevanoff24 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Binary file not shown.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| ### v0.1.0 | ||
| * Integrate rspec | ||
| * Add rake db:reset task | ||
| * Upgrade rake to 10.1.0 | ||
| * Upgrade sinatra to 1.4.3 | ||
| * Upgrade sinatra-contrib to 1.4.1 | ||
|
|
||
| ### v.0.1.1 | ||
| * Implement a basic class and spec to exercise it | ||
| * Relocate misplaced comma set | ||
| * Convert models/README to Markdown | ||
| * Correct misusue of e.g. | ||
| * Convert helpers/README to Markdown | ||
| * Implement a "em" helper for reference; improve README |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| source 'https://rubygems.org' | ||
| ruby '2.0.0' | ||
|
|
||
| # PostgreSQL driver | ||
| gem 'pg' | ||
|
|
||
| # Sinatra driver | ||
| gem 'sinatra' | ||
| gem 'sinatra-contrib' | ||
|
|
||
| gem 'activesupport', '~>4.1' | ||
| gem 'activerecord', '~>4.1' | ||
|
|
||
| gem 'bcrypt-ruby' | ||
|
|
||
| gem 'rake' | ||
|
|
||
| gem 'shotgun' | ||
|
|
||
| gem 'rerun' | ||
|
|
||
| group :test do | ||
| gem 'shoulda-matchers' | ||
| gem 'rack-test' | ||
| gem 'rspec' | ||
| gem 'capybara' | ||
| end | ||
|
|
||
| group :test, :development do | ||
| gem 'factory_girl' | ||
| gem 'faker' | ||
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,112 @@ | ||
| GEM | ||
| remote: https://rubygems.org/ | ||
| specs: | ||
| activemodel (4.1.1) | ||
| activesupport (= 4.1.1) | ||
| builder (~> 3.1) | ||
| activerecord (4.1.1) | ||
| activemodel (= 4.1.1) | ||
| activesupport (= 4.1.1) | ||
| arel (~> 5.0.0) | ||
| activesupport (4.1.1) | ||
| i18n (~> 0.6, >= 0.6.9) | ||
| json (~> 1.7, >= 1.7.7) | ||
| minitest (~> 5.1) | ||
| thread_safe (~> 0.1) | ||
| tzinfo (~> 1.1) | ||
| arel (5.0.1.20140414130214) | ||
| backports (3.6.0) | ||
| bcrypt (3.1.7) | ||
| bcrypt-ruby (3.1.5) | ||
| bcrypt (>= 3.1.3) | ||
| builder (3.2.2) | ||
| capybara (2.2.1) | ||
| mime-types (>= 1.16) | ||
| nokogiri (>= 1.3.3) | ||
| rack (>= 1.0.0) | ||
| rack-test (>= 0.5.4) | ||
| xpath (~> 2.0) | ||
| celluloid (0.16.0) | ||
| timers (~> 4.0.0) | ||
| diff-lcs (1.2.5) | ||
| factory_girl (4.4.0) | ||
| activesupport (>= 3.0.0) | ||
| faker (1.3.0) | ||
| i18n (~> 0.5) | ||
| ffi (1.9.6) | ||
| hitimes (1.2.2) | ||
| i18n (0.6.9) | ||
| json (1.8.1) | ||
| listen (2.8.5) | ||
| celluloid (>= 0.15.2) | ||
| rb-fsevent (>= 0.9.3) | ||
| rb-inotify (>= 0.9) | ||
| mime-types (2.3) | ||
| mini_portile (0.6.0) | ||
| minitest (5.3.4) | ||
| multi_json (1.10.1) | ||
| nokogiri (1.6.2.1) | ||
| mini_portile (= 0.6.0) | ||
| pg (0.17.1) | ||
| rack (1.5.2) | ||
| rack-protection (1.5.3) | ||
| rack | ||
| rack-test (0.6.2) | ||
| rack (>= 1.0) | ||
| rake (10.3.2) | ||
| rb-fsevent (0.9.4) | ||
| rb-inotify (0.9.5) | ||
| ffi (>= 0.5.0) | ||
| rerun (0.10.0) | ||
| listen (~> 2.7, >= 2.7.3) | ||
| rspec (2.14.1) | ||
| rspec-core (~> 2.14.0) | ||
| rspec-expectations (~> 2.14.0) | ||
| rspec-mocks (~> 2.14.0) | ||
| rspec-core (2.14.8) | ||
| rspec-expectations (2.14.5) | ||
| diff-lcs (>= 1.1.3, < 2.0) | ||
| rspec-mocks (2.14.6) | ||
| shotgun (0.9) | ||
| rack (>= 1.0) | ||
| shoulda-matchers (2.6.1) | ||
| activesupport (>= 3.0.0) | ||
| sinatra (1.4.5) | ||
| rack (~> 1.4) | ||
| rack-protection (~> 1.4) | ||
| tilt (~> 1.3, >= 1.3.4) | ||
| sinatra-contrib (1.4.2) | ||
| backports (>= 2.0) | ||
| multi_json | ||
| rack-protection | ||
| rack-test | ||
| sinatra (~> 1.4.0) | ||
| tilt (~> 1.3) | ||
| thread_safe (0.3.4) | ||
| tilt (1.4.1) | ||
| timers (4.0.1) | ||
| hitimes | ||
| tzinfo (1.2.0) | ||
| thread_safe (~> 0.1) | ||
| xpath (2.0.0) | ||
| nokogiri (~> 1.3) | ||
|
|
||
| PLATFORMS | ||
| ruby | ||
|
|
||
| DEPENDENCIES | ||
| activerecord (~> 4.1) | ||
| activesupport (~> 4.1) | ||
| bcrypt-ruby | ||
| capybara | ||
| factory_girl | ||
| faker | ||
| pg | ||
| rack-test | ||
| rake | ||
| rerun | ||
| rspec | ||
| shotgun | ||
| shoulda-matchers | ||
| sinatra | ||
| sinatra-contrib |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,35 @@ | ||
| This repo should be used to hold your phase 2, week 1 passion project. | ||
|
|
||
| see more about [portfolio challenges and passion projects here](../../../phase-2-guide/blob/sf/portfolio_challenges.md) | ||
|
|
||
|
|
||
| > **Note**: This branch (master) contains a skeleton without any app code, perfect for creating a _new_ application or challenge. If you're looking for an example app built with this skeleton, take a look at the [example](/../..//tree/example) branch which includes basic CRUD and RSpec tests. | ||
|
|
||
| ### Purpose | ||
| The Sinatra Skeleton: | ||
|
|
||
| 1. Provides a foundation for building challenges or creating a new Sinatra application. | ||
| 2. Demonstrates a reasonable set of practices around building Sinatra applications. | ||
| 3. Eases the transition to Rails for Dev Bootcamp students | ||
|
|
||
| ### Quickstart | ||
|
|
||
| 1. `bundle install` | ||
| 2. `shotgun config.ru` | ||
|
|
||
| As needed, create models & migrations with the `rake` tasks: | ||
|
|
||
| ``` | ||
| rake generate:migration # Create an empty migration in db/migrate, e.g., rake generate:migration NAME=create_tasks | ||
| rake generate:model # Create an empty model in app/models, e.g., rake generate:model NAME=User | ||
| ``` | ||
|
|
||
| ### Contributing | ||
|
|
||
| We would love for you to help make the skeleton more awesome, There are three ways to contribute: | ||
|
|
||
| 1. Ask for a bug fix or enhancement! | ||
| 2. Submit a pull request for a bug fix or enhancement! | ||
| 3. Code review an open pull request! | ||
|
|
||
| Be prepared to give and receive specific, actionable, and kind feedback! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,141 @@ | ||
| require 'rake' | ||
|
|
||
| require ::File.expand_path('../config/environment', __FILE__) | ||
|
|
||
| # Include all of ActiveSupport's core class extensions, e.g., String#camelize | ||
| require 'active_support/core_ext' | ||
|
|
||
| namespace :generate do | ||
| desc "Create an empty model in app/models, e.g., rake generate:model NAME=User" | ||
| task :model do | ||
| unless ENV.has_key?('NAME') | ||
| raise "Must specificy model name, e.g., rake generate:model NAME=User" | ||
| end | ||
|
|
||
| model_name = ENV['NAME'].camelize | ||
| model_filename = ENV['NAME'].underscore + '.rb' | ||
| model_path = APP_ROOT.join('app', 'models', model_filename) | ||
|
|
||
| if File.exist?(model_path) | ||
| raise "ERROR: Model file '#{model_path}' already exists" | ||
| end | ||
|
|
||
| puts "Creating #{model_path}" | ||
| File.open(model_path, 'w+') do |f| | ||
| f.write(<<-EOF.strip_heredoc) | ||
| class #{model_name} < ActiveRecord::Base | ||
| # Remember to create a migration! | ||
| end | ||
| EOF | ||
| end | ||
| end | ||
|
|
||
| desc "Create an empty migration in db/migrate, e.g., rake generate:migration NAME=create_tasks" | ||
| task :migration do | ||
| unless ENV.has_key?('NAME') | ||
| raise "Must specificy migration name, e.g., rake generate:migration NAME=create_tasks" | ||
| end | ||
|
|
||
| name = ENV['NAME'].camelize | ||
| filename = "%s_%s.rb" % [Time.now.strftime('%Y%m%d%H%M%S'), ENV['NAME'].underscore] | ||
| path = APP_ROOT.join('db', 'migrate', filename) | ||
|
|
||
| if File.exist?(path) | ||
| raise "ERROR: File '#{path}' already exists" | ||
| end | ||
|
|
||
| puts "Creating #{path}" | ||
| File.open(path, 'w+') do |f| | ||
| f.write(<<-EOF.strip_heredoc) | ||
| class #{name} < ActiveRecord::Migration | ||
| def change | ||
| end | ||
| end | ||
| EOF | ||
| end | ||
| end | ||
|
|
||
| desc "Create an empty model spec in spec, e.g., rake generate:spec NAME=user" | ||
| task :spec do | ||
| unless ENV.has_key?('NAME') | ||
| raise "Must specificy migration name, e.g., rake generate:spec NAME=user" | ||
| end | ||
|
|
||
| name = ENV['NAME'].camelize | ||
| filename = "%s_spec.rb" % ENV['NAME'].underscore | ||
| path = APP_ROOT.join('spec', filename) | ||
|
|
||
| if File.exist?(path) | ||
| raise "ERROR: File '#{path}' already exists" | ||
| end | ||
|
|
||
| puts "Creating #{path}" | ||
| File.open(path, 'w+') do |f| | ||
| f.write(<<-EOF.strip_heredoc) | ||
| require 'spec_helper' | ||
|
|
||
| describe #{name} do | ||
| pending "add some examples to (or delete) #{__FILE__}" | ||
| end | ||
| EOF | ||
| end | ||
| end | ||
|
|
||
| end | ||
|
|
||
| namespace :db do | ||
| desc "Drop, create, and migrate the database" | ||
| task :reset => [:drop, :create, :migrate] | ||
|
|
||
| desc "Create the databases at #{DB_NAME}" | ||
| task :create do | ||
| puts "Creating development and test databases if they don't exist..." | ||
| system("createdb #{APP_NAME}_development && createdb #{APP_NAME}_test") | ||
| end | ||
|
|
||
| desc "Drop the database at #{DB_NAME}" | ||
| task :drop do | ||
| puts "Dropping development and test databases..." | ||
| system("dropdb #{APP_NAME}_development && dropdb #{APP_NAME}_test") | ||
| end | ||
|
|
||
| desc "Migrate the database (options: VERSION=x, VERBOSE=false, SCOPE=blog)." | ||
| task :migrate do | ||
| ActiveRecord::Migrator.migrations_paths << File.dirname(__FILE__) + 'db/migrate' | ||
| ActiveRecord::Migration.verbose = ENV["VERBOSE"] ? ENV["VERBOSE"] == "true" : true | ||
| ActiveRecord::Migrator.migrate(ActiveRecord::Migrator.migrations_paths, ENV["VERSION"] ? ENV["VERSION"].to_i : nil) do |migration| | ||
| ENV["SCOPE"].blank? || (ENV["SCOPE"] == migration.scope) | ||
| end | ||
| end | ||
|
|
||
| desc "rollback your migration--use STEP=number to step back multiple times" | ||
| task :rollback do | ||
| step = (ENV['STEP'] || 1).to_i | ||
| ActiveRecord::Migrator.rollback('db/migrate', step) | ||
| Rake::Task['db:version'].invoke if Rake::Task['db:version'] | ||
| end | ||
|
|
||
| desc "Populate the database with dummy data by running db/seeds.rb" | ||
| task :seed do | ||
| require APP_ROOT.join('db', 'seeds.rb') | ||
| end | ||
|
|
||
| desc "Returns the current schema version number" | ||
| task :version do | ||
| puts "Current version: #{ActiveRecord::Migrator.current_version}" | ||
| end | ||
|
|
||
| namespace :test do | ||
| desc "Migrate test database" | ||
| task :prepare do | ||
| system "rake db:migrate RACK_ENV=test" | ||
| end | ||
| end | ||
| end | ||
|
|
||
| desc 'Start IRB with application environment loaded' | ||
| task "console" do | ||
| exec "irb -r./config/environment" | ||
| end | ||
|
|
||
| task :default => :spec |
Empty file.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| get '/signup' do | ||
| erb :signup | ||
| end | ||
|
|
||
| post '/signup' do | ||
| @user = User.new(params[:user]) | ||
| if @user.save | ||
| session[:user_id] = @user.id | ||
| redirect '/main' | ||
| else | ||
| erb :signup | ||
| end | ||
| end | ||
|
|
||
| get '/logout' do | ||
| session[:user_id] = nil | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| redirect '/' | ||
| end | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is an idea pattern for this route except
session[:user_id] = @user.idshould be alogin_as_user(user)helper method.