Skip to content

Commit 1bc3286

Browse files
committed
MVP O P
1 parent 29609cb commit 1bc3286

62 files changed

Lines changed: 1866 additions & 2 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

CHANGELOG.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
### v0.1.0
2+
* Integrate rspec
3+
* Add rake db:reset task
4+
* Upgrade rake to 10.1.0
5+
* Upgrade sinatra to 1.4.3
6+
* Upgrade sinatra-contrib to 1.4.1
7+
8+
### v.0.1.1
9+
* Implement a basic class and spec to exercise it
10+
* Relocate misplaced comma set
11+
* Convert models/README to Markdown
12+
* Correct misusue of e.g.
13+
* Convert helpers/README to Markdown
14+
* Implement a "em" helper for reference; improve README

Gemfile

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
source 'https://rubygems.org'
2+
ruby '2.0.0'
3+
4+
# PostgreSQL driver
5+
gem 'pg'
6+
7+
# Sinatra driver
8+
gem 'sinatra'
9+
gem 'sinatra-contrib'
10+
11+
gem 'sass'
12+
13+
gem 'activesupport', '~>4.1'
14+
gem 'activerecord', '~>4.1'
15+
16+
gem 'rake'
17+
gem 'bcrypt'
18+
19+
gem 'shotgun'
20+
21+
group :test do
22+
gem 'shoulda-matchers'
23+
gem 'rack-test'
24+
gem 'rspec'
25+
gem 'capybara'
26+
end
27+
28+
group :test, :development do
29+
gem 'factory_girl'
30+
gem 'faker'
31+
end

Gemfile.lock

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
GEM
2+
remote: https://rubygems.org/
3+
specs:
4+
activemodel (4.2.0)
5+
activesupport (= 4.2.0)
6+
builder (~> 3.1)
7+
activerecord (4.2.0)
8+
activemodel (= 4.2.0)
9+
activesupport (= 4.2.0)
10+
arel (~> 6.0)
11+
activesupport (4.2.0)
12+
i18n (~> 0.7)
13+
json (~> 1.7, >= 1.7.7)
14+
minitest (~> 5.1)
15+
thread_safe (~> 0.3, >= 0.3.4)
16+
tzinfo (~> 1.1)
17+
arel (6.0.0)
18+
backports (3.6.4)
19+
bcrypt (3.1.10)
20+
builder (3.2.2)
21+
capybara (2.4.4)
22+
mime-types (>= 1.16)
23+
nokogiri (>= 1.3.3)
24+
rack (>= 1.0.0)
25+
rack-test (>= 0.5.4)
26+
xpath (~> 2.0)
27+
diff-lcs (1.2.5)
28+
factory_girl (4.5.0)
29+
activesupport (>= 3.0.0)
30+
faker (1.4.3)
31+
i18n (~> 0.5)
32+
i18n (0.7.0)
33+
json (1.8.2)
34+
mime-types (2.4.3)
35+
mini_portile (0.6.2)
36+
minitest (5.5.1)
37+
multi_json (1.10.1)
38+
nokogiri (1.6.6.2)
39+
mini_portile (~> 0.6.0)
40+
pg (0.18.1)
41+
rack (1.6.0)
42+
rack-protection (1.5.3)
43+
rack
44+
rack-test (0.6.3)
45+
rack (>= 1.0)
46+
rake (10.4.2)
47+
rspec (3.2.0)
48+
rspec-core (~> 3.2.0)
49+
rspec-expectations (~> 3.2.0)
50+
rspec-mocks (~> 3.2.0)
51+
rspec-core (3.2.0)
52+
rspec-support (~> 3.2.0)
53+
rspec-expectations (3.2.0)
54+
diff-lcs (>= 1.2.0, < 2.0)
55+
rspec-support (~> 3.2.0)
56+
rspec-mocks (3.2.0)
57+
diff-lcs (>= 1.2.0, < 2.0)
58+
rspec-support (~> 3.2.0)
59+
rspec-support (3.2.1)
60+
sass (3.4.11)
61+
shotgun (0.9)
62+
rack (>= 1.0)
63+
shoulda-matchers (2.8.0)
64+
activesupport (>= 3.0.0)
65+
sinatra (1.4.5)
66+
rack (~> 1.4)
67+
rack-protection (~> 1.4)
68+
tilt (~> 1.3, >= 1.3.4)
69+
sinatra-contrib (1.4.2)
70+
backports (>= 2.0)
71+
multi_json
72+
rack-protection
73+
rack-test
74+
sinatra (~> 1.4.0)
75+
tilt (~> 1.3)
76+
thread_safe (0.3.4)
77+
tilt (1.4.1)
78+
tzinfo (1.2.2)
79+
thread_safe (~> 0.1)
80+
xpath (2.0.0)
81+
nokogiri (~> 1.3)
82+
83+
PLATFORMS
84+
ruby
85+
86+
DEPENDENCIES
87+
activerecord (~> 4.1)
88+
activesupport (~> 4.1)
89+
bcrypt
90+
capybara
91+
factory_girl
92+
faker
93+
pg
94+
rack-test
95+
rake
96+
rspec
97+
sass
98+
shotgun
99+
shoulda-matchers
100+
sinatra
101+
sinatra-contrib

README.md

Lines changed: 84 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,85 @@
1-
This repo should be used to hold your phase 2, week 1 passion project.
1+
Be prepared to give and receive specific, actionable, and kind feedback!
22

3-
see more about [portfolio challenges and passion projects here](../../../phase-2-guide/blob/sf/portfolio_challenges.md)
3+
4+
Portfolio 1: RESTful Routing
5+
6+
Your task is to implement the seven RESTful routes. Modify the skeleton code to achieve the following functionality:
7+
8+
√A user can Create a new note.
9+
√A user can Read all the notes created.
10+
√A user can Update a note.
11+
√A user can Delete an existing note.
12+
√A user can see a page where she can create a new note.
13+
√A user can see a page where she can edit a note.
14+
√A user see a page that shows a single note.
15+
√Your note table should have a title and content field.
16+
17+
18+
========================
19+
Portfolio 2: People Skills
20+
21+
√A User has many skills and a Skill can be assigned to many users.
22+
√A User has a proficiency rating for each of their skills.
23+
√Multiple skills can not be saved with the same name.
24+
25+
=======================
26+
Portfolio 3: Authentication & Authorization
27+
28+
Release 0: Implement Sign In
29+
30+
Modify the skeleton code to achieve the following functionality:
31+
32+
√A user can sign up for a new account with an email and password.
33+
An existing user can sign in
34+
If a user is not signed in, they only see a welcome message on the home page.
35+
If a user is signed in, they can see all users on the home page.
36+
A user can sign out using the provided delete route which is from a hidden field in the form.
37+
A helper method current_user returns the current signed in user and is used to display appropriate sign in / sign out portions of the view. (This logic is already implemented in the view - you just need to finish the helper method).
38+
39+
Release 1 Encrypt
40+
√bcrypt(controller/index, /views/login, environment, gemfile)
41+
42+
=======================
43+
Portfolio 4: HTML CSS
44+
Release 0: Choose your poison
45+
46+
Find a web page that represents a topic / item you are interested in (like bicycles). The page should be relatively simple but have some images and some text. If you don't want to choose your own site, you may use the sample.png image provided.
47+
48+
Take a screenshot of the website. You will use this screenshot for your recreation (you should NOT look at the html or styles from the original site - base all your work off the screenshot.) Add this screenshot to your source forder
49+
50+
Create an image directory and download a subset of the images from the page to this folder. (Your page does not need to have exact images - if there are a lot of similar images you can use one to represent them all).
51+
52+
Release 1 : The HTML (views)
53+
54+
Create the HTML using HTML 5.
55+
56+
Create the <head> tag with links to a normalize.css and your style sheet styles.css.
57+
Create the <body> with a <header>, <nav> and content.
58+
You can duplicate the text of your site exactly, or if there is a lot of text you can use lorem ipsum text.
59+
Add all the images.
60+
Make sure your page is validated.
61+
Your HTML should contain as little formatting as possible.
62+
63+
Release 2 : Add the CSS (public/css)
64+
65+
Your CSS should recreate the format of your original page. At a minimum your page should contain the following CSS elements and styles:
66+
67+
Basic selectors like id, class and element
68+
Two advanced selectors like sibling, psuedo, child, etc.
69+
Box model styles like margin, border, and padding
70+
Position styles like fixed, absolute, relative and static
71+
Background styles for color or image
72+
Font styles
73+
CSS3 styles like rounded border if required in your image.
74+
Use a color picker to get the correct colors.
75+
Save your HTML and CSS files to the source folder and submit a pull request to turn in this challenge.
76+
77+
===================
78+
Portfolio 5: Validations
79+
√Release 0 : Validations on Model (models)
80+
81+
Use ActiveRecord and Sinatra to allow anyone to create an event, so long as it passes validation rules.
82+
83+
Add validations to the Event model and show appropriate messages to the user when the validations fail.
84+
85+
Prevent Events from being saved when: a. The events date is empty, in the past, or is not valid. b. The events title is already taken or empty. c. The event organizers name is empty. d. The event organizers email address is invalid.

Rakefile

Lines changed: 140 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,140 @@
1+
require 'rake'
2+
3+
require ::File.expand_path('../config/environment', __FILE__)
4+
5+
# Include all of ActiveSupport's core class extensions, e.g., String#camelize
6+
require 'active_support/core_ext'
7+
8+
namespace :generate do
9+
desc "Create an empty model in app/models, e.g., rake generate:model NAME=User"
10+
task :model do
11+
unless ENV.has_key?('NAME')
12+
raise "Must specificy model name, e.g., rake generate:model NAME=User"
13+
end
14+
15+
model_name = ENV['NAME'].camelize
16+
model_filename = ENV['NAME'].underscore + '.rb'
17+
model_path = APP_ROOT.join('app', 'models', model_filename)
18+
19+
if File.exist?(model_path)
20+
raise "ERROR: Model file '#{model_path}' already exists"
21+
end
22+
23+
puts "Creating #{model_path}"
24+
File.open(model_path, 'w+') do |f|
25+
f.write(<<-EOF.strip_heredoc)
26+
class #{model_name} < ActiveRecord::Base
27+
# Remember to create a migration!
28+
end
29+
EOF
30+
end
31+
end
32+
33+
desc "Create an empty migration in db/migrate, e.g., rake generate:migration NAME=create_tasks"
34+
task :migration do
35+
unless ENV.has_key?('NAME')
36+
raise "Must specificy migration name, e.g., rake generate:migration NAME=create_tasks"
37+
end
38+
39+
name = ENV['NAME'].camelize
40+
filename = "%s_%s.rb" % [Time.now.strftime('%Y%m%d%H%M%S'), ENV['NAME'].underscore]
41+
path = APP_ROOT.join('db', 'migrate', filename)
42+
43+
if File.exist?(path)
44+
raise "ERROR: File '#{path}' already exists"
45+
end
46+
47+
puts "Creating #{path}"
48+
File.open(path, 'w+') do |f|
49+
f.write(<<-EOF.strip_heredoc)
50+
class #{name} < ActiveRecord::Migration
51+
def change
52+
end
53+
end
54+
EOF
55+
end
56+
end
57+
58+
desc "Create an empty model spec in spec, e.g., rake generate:spec NAME=user"
59+
task :spec do
60+
unless ENV.has_key?('NAME')
61+
raise "Must specificy migration name, e.g., rake generate:spec NAME=user"
62+
end
63+
64+
name = ENV['NAME'].camelize
65+
filename = "%s_spec.rb" % ENV['NAME'].underscore
66+
path = APP_ROOT.join('spec', filename)
67+
68+
if File.exist?(path)
69+
raise "ERROR: File '#{path}' already exists"
70+
end
71+
72+
puts "Creating #{path}"
73+
File.open(path, 'w+') do |f|
74+
f.write(<<-EOF.strip_heredoc)
75+
require 'spec_helper'
76+
describe #{name} do
77+
pending "add some examples to (or delete) #{__FILE__}"
78+
end
79+
EOF
80+
end
81+
end
82+
83+
end
84+
85+
namespace :db do
86+
desc "Drop, create, and migrate the database"
87+
task :reset => [:drop, :create, :migrate]
88+
89+
desc "Create the databases at #{DB_NAME}"
90+
task :create do
91+
puts "Creating development and test databases if they don't exist..."
92+
system("createdb #{APP_NAME}_development && createdb #{APP_NAME}_test")
93+
end
94+
95+
desc "Drop the database at #{DB_NAME}"
96+
task :drop do
97+
puts "Dropping development and test databases..."
98+
system("dropdb #{APP_NAME}_development && dropdb #{APP_NAME}_test")
99+
end
100+
101+
desc "Migrate the database (options: VERSION=x, VERBOSE=false, SCOPE=blog)."
102+
task :migrate do
103+
ActiveRecord::Migrator.migrations_paths << File.dirname(__FILE__) + 'db/migrate'
104+
ActiveRecord::Migration.verbose = ENV["VERBOSE"] ? ENV["VERBOSE"] == "true" : true
105+
ActiveRecord::Migrator.migrate(ActiveRecord::Migrator.migrations_paths, ENV["VERSION"] ? ENV["VERSION"].to_i : nil) do |migration|
106+
ENV["SCOPE"].blank? || (ENV["SCOPE"] == migration.scope)
107+
end
108+
end
109+
110+
desc "rollback your migration--use STEP=number to step back multiple times"
111+
task :rollback do
112+
step = (ENV['STEP'] || 1).to_i
113+
ActiveRecord::Migrator.rollback('db/migrate', step)
114+
Rake::Task['db:version'].invoke if Rake::Task['db:version']
115+
end
116+
117+
desc "Populate the database with dummy data by running db/seeds.rb"
118+
task :seed do
119+
require APP_ROOT.join('db', 'seeds.rb')
120+
end
121+
122+
desc "Returns the current schema version number"
123+
task :version do
124+
puts "Current version: #{ActiveRecord::Migrator.current_version}"
125+
end
126+
127+
namespace :test do
128+
desc "Migrate test database"
129+
task :prepare do
130+
system "rake db:migrate RACK_ENV=test"
131+
end
132+
end
133+
end
134+
135+
desc 'Start IRB with application environment loaded'
136+
task "console" do
137+
exec "irb -r./config/environment"
138+
end
139+
140+
task :default => :spec

app/controllers/.gitkeep

Whitespace-only changes.

0 commit comments

Comments
 (0)