Skip to content

Commit

Permalink
Merge pull request #162 from amba178/seed_editing_branch
Browse files Browse the repository at this point in the history
  • Loading branch information
joaopapereira committed Jan 29, 2016
2 parents d60a3cc + 68576ed commit 5d4c3ed
Show file tree
Hide file tree
Showing 9 changed files with 65 additions and 30 deletions.
4 changes: 3 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
source 'https://rubygems.org'


ruby '2.1.8'

# ruby '2.2.2'

# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.2.3'
Expand Down Expand Up @@ -87,4 +88,5 @@ group :production do
# Use Postgres as the database for Active Record
gem 'pg'
gem 'rails_12factor'
gem 'puma'
end
6 changes: 6 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,8 @@ GEM
cliver (~> 0.3.1)
multi_json (~> 1.0)
websocket-driver (>= 0.2.0)
puma (2.11.3)
rack (>= 1.1, < 2.0)
rack (1.6.4)
rack-test (0.6.3)
rack (>= 1.0)
Expand Down Expand Up @@ -293,6 +295,7 @@ DEPENDENCIES
launchy
pg
poltergeist
puma
rails (= 4.2.3)
rails_12factor
rspec-rails (~> 3.0)
Expand All @@ -305,3 +308,6 @@ DEPENDENCIES
turbolinks
uglifier (>= 1.3.0)
web-console (~> 2.0)

BUNDLED WITH
1.11.2
1 change: 1 addition & 0 deletions Procfile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
web: bundle exec puma -C config/puma.rb
1 change: 1 addition & 0 deletions app/controllers/job_seekers_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ def update
person_params.delete('password')
person_params.delete('password_confirmation')
end

if @jobseeker.update_attributes(person_params)
sign_in :user, @jobseeker.user, bypass: true
flash[:notice] = "Jobseeker was updated successfully."
Expand Down
2 changes: 1 addition & 1 deletion config/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ class Application < Rails::Application
# Do not swallow errors in after_commit/after_rollback callbacks.
config.active_record.raise_in_transactional_callbacks = true
end
end
end
1 change: 0 additions & 1 deletion config/environments/development.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@
# Checks for improperly declared sprockets dependencies.
# Raises helpful error messages.
config.assets.raise_runtime_errors = true

# Raises error for missing translations
# config.action_view.raise_on_missing_translations = true
config.action_mailer.default_url_options = { :host => 'localhost', :port => '3000'}
Expand Down
4 changes: 2 additions & 2 deletions config/environments/production.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# Settings specified here will take precedence over those in config/application.rb.

# Code is not reloaded between requests.
config.cache_classes = true
Expand Down Expand Up @@ -80,4 +80,4 @@
config.action_mailer.delivery_method = :sendmail
#this will take care of devise setup default url in production
config.action_mailer.default_url_options = { :host => 'metplus.org' }
end
end
15 changes: 15 additions & 0 deletions config/puma.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
workers Integer(ENV['WEB_CONCURRENCY'] || 2)
threads_count = Integer(ENV['MAX_THREADS'] || 5)
threads threads_count, threads_count

preload_app!

rackup DefaultRackup
port ENV['PORT'] || 3000
environment ENV['RACK_ENV'] || 'development'

on_worker_boot do
# Worker specific setup for Rails 4.1+
# See: https://devcenter.heroku.com/articles/deploying-rails-applications-with-the-puma-web-server#on-worker-boot
ActiveRecord::Base.establish_connection
end
61 changes: 36 additions & 25 deletions db/seeds.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,31 +48,58 @@
# user.confirmed_at = DateTime.now
# end


#incase rerun comes in. not necessary
JobSeekerStatus.delete_all
Job.delete_all
Company.delete_all
Address.delete_all
CompanyPerson.delete_all
JobCategory.delete_all

cp1 = Company.create(:ein => '12-2123244', :phone=> '721-234-4646', email: '[email protected]', website: 'http://www.wallmart.com', :name=> 'Walmart')
cp2 = Company.create(:ein => '13-1244445', :phone=> '721-234-1010', email: '[email protected]', website: 'http://www.target.com', :name=> 'Target')
cp3 = Company.create(:ein => '12-1252445', :phone=> '865-234-4646', email: '[email protected]', website: 'http://www.Food4less.com',:name=> 'Food4less')
cp4 = Company.create(:ein => '15-1342447', :phone=> '971-234-4646', email: '[email protected]', website: 'http://www.macy.com', :name=> 'Macy')

address1 = Address.create(:street => "1234 East Maripos Avenu", city: "San Diego", zipcode: "92105")
address2 = Address.create(:street => "1234 East Main Street", city: "Los Angeles", zipcode: "92108")
address1.update_attribute(:location, cp1)
address2.update_attribute(:location, cp2)

cperson = CompanyPerson.create(company_id: cp1.id, address_id: address1.id, status: "Active", title: "General Manager",
email: "[email protected]", :password => "secrete", first_name: "salem", :last_name => "Ali", confirmed_at: DateTime.now)
cperson2 = CompanyPerson.create(company_id: cp2.id, address_id: address2.id, status: "Active", title: "Day Manager",
email: "[email protected]", :password => "secrete", first_name: "Kalem", :last_name => "Kli", confirmed_at: DateTime.now)


# Job Categories
jcategory = JobCategory.create(name: 'SW Developer - RoR',
description: 'Ruby on Rails backend developer')
jcategory1 = JobCategory.create(name: 'SW Developer - JS',
description: 'Javascript frontend developer')
jcategory2 = JobCategory.create(name: 'SW Developer - Java',
description: 'Java backend developer')
jcategory3 = JobCategory.create(name: 'SW Project Manager - Agile',
description: 'Manages Agile SW development projects')
Jjcategory4 = JobCategory.create(name: 'SW Project Manager - Waterfall',
description: 'Manages SW development projects using waterfall SDLC')
jcategory5 = JobCategory.create(name: 'Product Manager - SaaS',
description: 'Manages SaaS product development and commecialization')

Job.create(:title => 'Software Developer', :description => 'Looking for a software developer intern.', :company_id => cp1.id,
:company_person_id => '1', :job_category_id => '1' )
:company_person_id => cperson.id, :job_category_id =>jcategory1.id )
Job.create(:title => 'Cashier', :description => 'Looking for well qualified cashier with 5 years experience', :company_id => cp2.id,
:company_person_id => '2', :job_category_id => '2' )
:company_person_id => cperson2.id, :job_category_id => jcategory.id )
Job.create(:title => 'Driver', :description => 'Looking for a truck driver with class A license', :company_id => cp3.id,
:company_person_id => '3', :job_category_id => '3' )
:company_person_id => cperson.id, :job_category_id => jcategory.id )
Job.create(:title => 'Security Personel', :description => 'If you have Security Guard license, and love to work third shift, than call us.', :company_id => cp4.id,
:company_person_id => '4', :job_category_id => '4' )
:company_person_id => cperson.id, :job_category_id => jcategory1.id)


#incase rerun comes in. not necessary
JobSeekerStatus.delete_all

['Unemployedlooking', 'Employedlooking', 'Employednotlooking'].each do |status|
case status
when 'Unemployedlooking'
when 'Unemployedlooking'
@jss1 = JobSeekerStatus.find_or_create_by(:value => status,
description: "A jobseeker Without any work and looking for a job.")
when 'Employedlooking'
Expand Down Expand Up @@ -183,23 +210,6 @@
"1990", confirmed_at: Time.now)



# Job Categories
JobCategory.create(name: 'SW Developer - RoR',
description: 'Ruby on Rails backend developer')
JobCategory.create(name: 'SW Developer - JS',
description: 'Javascript frontend developer')
JobCategory.create(name: 'SW Developer - Java',
description: 'Java backend developer')
JobCategory.create(name: 'SW Project Manager - Agile',
description: 'Manages Agile SW development projects')
JobCategory.create(name: 'SW Project Manager - Waterfall',
description: 'Manages SW development projects using waterfall SDLC')
JobCategory.create(name: 'Product Manager - SaaS',
description: 'Manages SaaS product development and commecialization')



jobseeker = JobSeeker.create(first_name: 'abc',last_name:'def',email:'[email protected]', password:'dfg123',password_confirmation:'dfg123',phone:'345-890-7890',year_of_birth:
"1990", confirmed_at: Time.now)

Expand All @@ -218,3 +228,4 @@



# Think we have enough users(JS, AA, JD, CM, CP). We can login in productin env with created creditials.

0 comments on commit 5d4c3ed

Please sign in to comment.