From 10a1e4eb843fccae36fd8d877bf9ee7fd94585fb Mon Sep 17 00:00:00 2001 From: Will Bradley Date: Wed, 28 Aug 2013 05:15:50 -0700 Subject: [PATCH] Switching to RVM, View tweaks --- .rvmrc | 35 ++++++++++++++++++++++++++++ Gemfile | 4 +++- Gemfile.lock | 6 +++++ app/models/payment.rb | 1 + app/views/ipns/index.html.erb | 6 +++-- app/views/payments/index.html.erb | 9 +++++-- app/views/payments/show.html.erb | 7 +++++- app/views/paypal_csvs/index.html.erb | 6 ++++- db/schema.rb | 1 - 9 files changed, 67 insertions(+), 8 deletions(-) create mode 100644 .rvmrc diff --git a/.rvmrc b/.rvmrc new file mode 100644 index 0000000..d462736 --- /dev/null +++ b/.rvmrc @@ -0,0 +1,35 @@ +#!/usr/bin/env bash + +# This is an RVM Project .rvmrc file, used to automatically load the ruby +# development environment upon cd'ing into the directory + +# First we specify our desired [@], the @gemset name is optional, +# Only full ruby name is supported here, for short names use: +# echo "rvm use 1.8.7" > .rvmrc +environment_id="ruby-1.9.3-p385@members-hsl" + +# Uncomment the following lines if you want to verify rvm version per project +# rvmrc_rvm_version="1.18.8 (stable)" # 1.10.1 seams as a safe start +# eval "$(echo ${rvm_version}.${rvmrc_rvm_version} | awk -F. '{print "[[ "$1*65536+$2*256+$3" -ge "$4*65536+$5*256+$6" ]]"}' )" || { +# echo "This .rvmrc file requires at least RVM ${rvmrc_rvm_version}, aborting loading." +# return 1 +# } + +# First we attempt to load the desired environment directly from the environment +# file. This is very fast and efficient compared to running through the entire +# CLI and selector. If you want feedback on which environment was used then +# insert the word 'use' after --create as this triggers verbose mode. +if [[ -d "${rvm_path:-$HOME/.rvm}/environments" + && -s "${rvm_path:-$HOME/.rvm}/environments/$environment_id" ]] +then + \. "${rvm_path:-$HOME/.rvm}/environments/$environment_id" + [[ -s "${rvm_path:-$HOME/.rvm}/hooks/after_use" ]] && + \. "${rvm_path:-$HOME/.rvm}/hooks/after_use" || true +else + # If the environment file has not yet been created, use the RVM CLI to select. + rvm --create "$environment_id" || { + echo "Failed to create RVM environment '${environment_id}'." + return 1 + } +fi + diff --git a/Gemfile b/Gemfile index 921e64e..ca2b42f 100644 --- a/Gemfile +++ b/Gemfile @@ -1,6 +1,6 @@ source 'https://rubygems.org' -#ruby '1.9.3' +ruby '1.9.3' gem 'rails', '3.2.3' @@ -46,3 +46,5 @@ gem 'bcrypt-ruby', '~> 3.0.0' #gem "paperclip", "~> 3.0" gem 'gravtastic' + +gem 'passenger' diff --git a/Gemfile.lock b/Gemfile.lock index 94abf55..0f56725 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -39,6 +39,7 @@ GEM coffee-script-source execjs coffee-script-source (1.3.3) + daemon_controller (1.1.5) devise (2.1.1) bcrypt-ruby (~> 3.0) orm_adapter (~> 0.1) @@ -63,6 +64,10 @@ GEM mime-types (1.19) multi_json (1.3.6) orm_adapter (0.1.0) + passenger (4.0.14) + daemon_controller (>= 1.1.0) + rack + rake (>= 0.8.1) polyglot (0.3.3) rack (1.4.1) rack-cache (1.2) @@ -124,6 +129,7 @@ DEPENDENCIES gravtastic jquery-rails json + passenger rails (= 3.2.3) sass-rails (~> 3.2.3) sqlite3 diff --git a/app/models/payment.rb b/app/models/payment.rb index ea70430..4b10b67 100644 --- a/app/models/payment.rb +++ b/app/models/payment.rb @@ -1,6 +1,7 @@ class Payment < ActiveRecord::Base belongs_to :user has_one :ipn + has_one :paypal_csv attr_accessible :date, :user_id, :created_by, :amount validates_presence_of :user_id, :date, :amount # not created_by diff --git a/app/views/ipns/index.html.erb b/app/views/ipns/index.html.erb index 70c7709..1951302 100644 --- a/app/views/ipns/index.html.erb +++ b/app/views/ipns/index.html.erb @@ -1,4 +1,7 @@ - +

PayPal IPN Records

+

+ Automatically loaded from PayPal's servers +

@@ -30,4 +33,3 @@ <% end %>
Date
- diff --git a/app/views/payments/index.html.erb b/app/views/payments/index.html.erb index 58bbd83..a12862a 100644 --- a/app/views/payments/index.html.erb +++ b/app/views/payments/index.html.erb @@ -1,7 +1,12 @@

Listing payments

-<%= link_to 'New Payment', new_payment_path %> -
+

+Create Payments: +<%= link_to 'Manually', new_payment_path %> | +<%= link_to 'Batched CSV', paypal_csvs_path %> | +<%= link_to 'IPN', ipns_path %> +

+ diff --git a/app/views/payments/show.html.erb b/app/views/payments/show.html.erb index 316d2ec..95cc9db 100644 --- a/app/views/payments/show.html.erb +++ b/app/views/payments/show.html.erb @@ -35,7 +35,12 @@ <% if @payment.ipn.present? %>

- <%= link_to "Paid via PayPal", @payment.ipn %> + <%= link_to "Paid via PayPal (IPN)", @payment.ipn %> +

+<% end %> +<% if @payment.paypal_csv.present? %> +

+ <%= link_to "Paid via PayPal (CSV)", @payment.paypal_csv %>

<% end %> diff --git a/app/views/paypal_csvs/index.html.erb b/app/views/paypal_csvs/index.html.erb index 305bf70..2343574 100644 --- a/app/views/paypal_csvs/index.html.erb +++ b/app/views/paypal_csvs/index.html.erb @@ -1,4 +1,8 @@ -<%= link_to "Upload CSV", new_paypal_csv_path %> +

PayPal CSV Records

+

+ <%= link_to "Upload CSV", new_paypal_csv_path %> +

+
User
diff --git a/db/schema.rb b/db/schema.rb index 25dbad2..3cb31fb 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -1,4 +1,3 @@ -# 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.
Date