Skip to content
This repository has been archived by the owner on Sep 7, 2023. It is now read-only.

Commit

Permalink
[#45] changes to staff-user sync, added paperclip
Browse files Browse the repository at this point in the history
  • Loading branch information
Patrick Stoica committed Apr 18, 2014
1 parent acbbe53 commit 811e706
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 2 deletions.
3 changes: 2 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ gem 'cancan'
gem 'bootstrap-sass', '~> 3.1.0'
gem 'active_link_to'
gem 'figaro', github: 'laserlemon/figaro'
gem "rolify", github: "EppO/rolify"
gem 'rolify', github: 'EppO/rolify'
gem 'draper', '~> 1.0'
gem 'simple_form', git: 'git://github.com/plataformatec/simple_form.git'
gem 'will_paginate', '~> 3.0'
Expand All @@ -40,6 +40,7 @@ gem 'whenever'
gem 'nokogiri'
gem 'redcarpet'
gem 'validate_url'
gem 'paperclip', '~> 4.1'

# time helpers
gem 'chronic'
Expand Down
10 changes: 10 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,11 @@ GEM
celluloid (0.15.2)
timers (~> 1.1.0)
chronic (0.10.2)
climate_control (0.0.3)
activesupport (>= 3.0)
cliver (0.3.2)
cocaine (0.5.4)
climate_control (>= 0.0.3, < 1.0)
coderay (1.1.0)
database_cleaner (1.2.0)
debug_inspector (0.0.2)
Expand Down Expand Up @@ -204,6 +208,11 @@ GEM
nokogiri (1.6.1)
mini_portile (~> 0.5.0)
orm_adapter (0.5.0)
paperclip (4.1.1)
activemodel (>= 3.0.0)
activesupport (>= 3.0.0)
cocaine (~> 0.5.3)
mime-types
poltergeist (1.5.0)
capybara (~> 2.1)
cliver (~> 0.3.1)
Expand Down Expand Up @@ -371,6 +380,7 @@ DEPENDENCIES
mysql2
net-ldap!
nokogiri
paperclip (~> 4.1)
poltergeist
quiet_assets
rails (~> 4.0.0)
Expand Down
2 changes: 2 additions & 0 deletions config/environments/production.rb
Original file line number Diff line number Diff line change
Expand Up @@ -97,4 +97,6 @@

# Use default logging formatter so that PID and timestamp are not suppressed.
config.log_formatter = ::Logger::Formatter.new

Paperclip.options[:command_path] = "/usr/bin/"
end
4 changes: 3 additions & 1 deletion lib/tasks/sync_from_staff.rake
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
task :sync_from_staff => :environment do |t, args|
Legacy::Staff.find_each do |staff|
puts "Staff #{staff.id}: #{staff.initials}"

user = User.find_or_initialize_by(username: staff.initials)

unless staff.emails.empty?
Expand All @@ -16,6 +17,7 @@ task :sync_from_staff => :environment do |t, args|
user.phone = staff.phone_numbers.first.number
end

user.legacy_id ||= staff.id
user.password ||= Devise.friendly_token[0,20]
user.status = staff.status || "inactive"
user.birthday ||= staff.birthday
Expand All @@ -24,7 +26,7 @@ task :sync_from_staff => :environment do |t, args|
user.last_name ||= staff.lname

unless staff.pfname.blank?
user.display_name ||= staff.pfname + " " + staff.lname
user.display_name ||= "#{staff.pfname} #{staff.lname}"
end

# normalize created_at
Expand Down

0 comments on commit 811e706

Please sign in to comment.