diff --git a/.gitignore b/.gitignore index 0b31147..e3b8ba5 100644 --- a/.gitignore +++ b/.gitignore @@ -26,3 +26,6 @@ doc/ # Ignore sampleimages /sampleimage + +# Ignore application configuration +/config/application.yml diff --git a/Gemfile b/Gemfile index 4a774eb..2e9cece 100644 --- a/Gemfile +++ b/Gemfile @@ -1,18 +1,20 @@ source 'https://rubygems.org' -ruby '2.2.3' #previously 2.0.0 +ruby '2.2.3' # Application gems gem 'rails', '4.2.5' #previously 4.0.0 gem 'jquery-rails' gem 'devise' gem 'simple_form', '~> 3.0.0.rc' gem "paperclip", "~> 4.3" #previously 3.0" -#gem "paperclip-dropbox" -gem 'aws-sdk', '~> 1.5.7' +gem "paperclip-dropbox", ">=1.1.7" +gem 'aws-sdk' #'~> 1.5.7' gem "masonry-rails", '~> 0.2.0' gem 'faker', "~> 1.2.0" gem 'will_paginate', '~> 3.0.3' gem 'bootstrap-will_paginate' gem 'acts_as_follower' +gem "binding_of_caller" +gem "figaro" #gem 'pg' group :production do diff --git a/Gemfile.lock b/Gemfile.lock index 09a86ae..b7907b5 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -48,6 +48,8 @@ GEM coderay (>= 1.0.0) erubis (>= 2.6.6) rack (>= 0.9.0) + binding_of_caller (0.7.2) + debug_inspector (>= 0.0.1) bootstrap-sass (3.0.3.0) sass (~> 3.2) bootstrap-will_paginate (0.0.10) @@ -65,6 +67,7 @@ GEM coffee-script-source execjs coffee-script-source (1.10.0) + debug_inspector (0.0.2) devise (3.5.2) bcrypt (~> 3.0) orm_adapter (~> 0.1) @@ -72,10 +75,14 @@ GEM responders thread_safe (~> 0.1) warden (~> 1.2.3) + dropbox-sdk (1.6.5) + json erubis (2.7.0) execjs (2.6.0) faker (1.2.0) i18n (~> 0.5) + figaro (1.1.1) + thor (~> 0.14) globalid (0.3.6) activesupport (>= 4.1.0) hike (1.2.3) @@ -105,7 +112,7 @@ GEM minitest (5.8.3) multi_json (1.11.2) multi_xml (0.5.5) - nokogiri (1.6.7) + nokogiri (1.6.7.1) mini_portile2 (~> 2.0.0.rc2) orm_adapter (0.5.0) paperclip (4.3.2) @@ -114,6 +121,9 @@ GEM cocaine (~> 0.5.5) mime-types mimemagic (= 0.3.0) + paperclip-dropbox (1.3.2) + dropbox-sdk (~> 1.3) + paperclip (>= 3.1, < 5) pg (0.18.4) protected_attributes (1.1.3) activemodel (>= 4.0.1, < 5.0) @@ -195,18 +205,21 @@ PLATFORMS DEPENDENCIES acts_as_follower - aws-sdk (~> 1.5.7) + aws-sdk better_errors + binding_of_caller bootstrap-sass (~> 3.0.3.0) bootstrap-will_paginate coffee-rails (~> 4.0.0) devise faker (~> 1.2.0) + figaro jbuilder (= 1.2) jquery-rails jquery-turbolinks masonry-rails (~> 0.2.0) paperclip (~> 4.3) + paperclip-dropbox (>= 1.1.7) pg protected_attributes rails (= 4.2.5) diff --git a/app/models/pin.rb b/app/models/pin.rb index 255a0d0..632827b 100644 --- a/app/models/pin.rb +++ b/app/models/pin.rb @@ -1,6 +1,13 @@ class Pin < ActiveRecord::Base attr_accessible :description, :image, :image_remote_url - has_attached_file :image + has_attached_file :image, + :storage => :dropbox, + :dropbox_credentials => { app_key: ENV['APP_KEY'], + app_secret: ENV['APP_SECRET'], + access_token: ENV['ACCESS_TOKEN'], + access_token_secret: ENV['ACCESS_TOKEN_SECRET'], + user_id: ENV['USER_ID'], + access_type: 'app_folder'} validates :image, presence: true validates :description, presence: true diff --git a/config/dropbox.yml b/config/dropbox.yml new file mode 100644 index 0000000..b769c72 --- /dev/null +++ b/config/dropbox.yml @@ -0,0 +1,15 @@ +#Dropbox credentials - view them via heroku config on cmd line +#development: +# app_key: <%= ENV["APP_KEY"] %> +# app_secret: <%= ENV["APP_SECRET"] %> +# access_token: <%= ENV["ACCESS_TOKEN"] %> +# access_token_secret: <%= ENV["ACCESS_TOKEN_SECRET"] %> +# user_id: <%= ENV["USER_ID"] %> +# access_type: "app_folder" +development: + app_key: ENV['APP_KEY'] + app_secret: ENV['APP_SECRET'] + access_token: ENV['ACCESS_TOKEN'] + access_token_secret: ENV['ACCESS_TOKEN_SECRET'] + user_id: ENV['USER_ID'] + access_type: 'app_folder' diff --git a/config/environments/development.rb b/config/environments/development.rb index 8cae1e0..2badc5f 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -28,5 +28,21 @@ config.assets.debug = true #In production, :host should be set to the actual host of your application. config.action_mailer.default_url_options = { :host => 'localhost:3000' } + #config.paperclip_defaults = { + #:storage => :dropbox, + #:dropbox_credentials => { + # :app_key => ENV['APP_KEY'], + # :app_secret => ENV['APP_SECRET'], + # :access_token => ENV['ACCESS_TOKEN'], + # :access_token_secret => ENV['ACCESS_TOKEN_SECRET'], + # :user_id => ENV['USER_ID'], + # :access_type => 'app_folder', + # :dropbox_visibility => 'private' } + #} + #config.paperclip_defaults = { + #:storage => :dropbox, + # :dropbox_credentials => Rails.root.join("config/dropbox.yml"), + # :dropbox_options => {...} + #} Paperclip.options[:command_path] = "/usr/local/bin/" end diff --git a/config/environments/production.rb b/config/environments/production.rb index 4ddcbc9..84d7ed2 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -85,9 +85,13 @@ config.paperclip_defaults = { :storage => :s3, :s3_credentials => { - :bucket => ENV['AWS_BUCKET'], + :bucket => ENV['AWS_BUCKET'], :access_key_id => ENV['AWS_ACCESS_KEY_ID'], :secret_access_key => ENV['AWS_SECRET_ACCESS_KEY'] } -} + #config.paperclip_defaults = { + #:storage => :dropbox, + # :dropbox_credentials => Rails.root.join("config/dropbox.yml"), + # #:dropbox_options => {...} + #} end diff --git a/config/initializers/paperclip.rb b/config/initializers/paperclip.rb index 9441342..1cc3058 100644 --- a/config/initializers/paperclip.rb +++ b/config/initializers/paperclip.rb @@ -1,5 +1,6 @@ # config/initializers/paperclip.rb unless Rails.env.development? + #Paperclip::Attachment.default_options[:url] = ':event_sample_images.s3-website-us-east-1.amazonaws.com' Paperclip::Attachment.default_options[:url] = ':event_sample_images.s3-website-us-east-1.amazonaws.com' Paperclip::Attachment.default_options[:path] = '/:class/:attachment/:id_partition/:style/:filename' end diff --git a/db/schema.rb b/db/schema.rb index 3061914..c941475 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -13,12 +13,12 @@ ActiveRecord::Schema.define(version: 20131218231554) do - create_table "follows", force: true do |t| - t.integer "followable_id", null: false - t.string "followable_type", null: false - t.integer "follower_id", null: false - t.string "follower_type", null: false - t.boolean "blocked", default: false, null: false + create_table "follows", force: :cascade do |t| + t.integer "followable_id", null: false + t.string "followable_type", limit: 255, null: false + t.integer "follower_id", null: false + t.string "follower_type", limit: 255, null: false + t.boolean "blocked", default: false, null: false t.datetime "created_at" t.datetime "updated_at" end @@ -26,45 +26,45 @@ add_index "follows", ["followable_id", "followable_type"], name: "fk_followables" add_index "follows", ["follower_id", "follower_type"], name: "fk_follows" - create_table "locations", force: true do |t| - t.string "address" - t.string "city" - t.string "state" - t.string "zip" + create_table "locations", force: :cascade do |t| + t.string "address", limit: 255 + t.string "city", limit: 255 + t.string "state", limit: 255 + t.string "zip", limit: 255 t.float "lat" t.float "lng" t.datetime "created_at" t.datetime "updated_at" end - create_table "pins", force: true do |t| - t.string "description" + create_table "pins", force: :cascade do |t| + t.string "description", limit: 255 t.datetime "created_at" t.datetime "updated_at" t.integer "user_id" - t.string "image_file_name" - t.string "image_content_type" + t.string "image_file_name", limit: 255 + t.string "image_content_type", limit: 255 t.integer "image_file_size" t.datetime "image_updated_at" - t.string "image_remote_url" + t.string "image_remote_url", limit: 255 end add_index "pins", ["user_id"], name: "index_pins_on_user_id" - create_table "users", force: true do |t| - t.string "email", default: "", null: false - t.string "encrypted_password", default: "", null: false - t.string "reset_password_token" + create_table "users", force: :cascade do |t| + t.string "email", limit: 255, default: "", null: false + t.string "encrypted_password", limit: 255, default: "", null: false + t.string "reset_password_token", limit: 255 t.datetime "reset_password_sent_at" t.datetime "remember_created_at" - t.integer "sign_in_count", default: 0, null: false + t.integer "sign_in_count", default: 0, null: false t.datetime "current_sign_in_at" t.datetime "last_sign_in_at" - t.string "current_sign_in_ip" - t.string "last_sign_in_ip" + t.string "current_sign_in_ip", limit: 255 + t.string "last_sign_in_ip", limit: 255 t.datetime "created_at" t.datetime "updated_at" - t.string "name" + t.string "name", limit: 255 end add_index "users", ["email"], name: "index_users_on_email", unique: true diff --git a/lib/tasks/populateimages3.rake b/lib/tasks/populateimages3.rake index 00abe37..dd6cf84 100644 --- a/lib/tasks/populateimages3.rake +++ b/lib/tasks/populateimages3.rake @@ -1,5 +1,6 @@ require 'open-uri' remote_base_url = "https://s3.amazonaws.com/event_sample_images/sample" +#remote_base_url = "https://www.dropbox.com/home/Apps/social-butterfly-images" #remote_files = Dir.entries("sampleimage").select {|x| x =~ /.*(jpg)/ } remote_files = ["IMG_0537.jpg", "IMG_0555.jpg", "IMG_0556.jpg", "IMG_0574.jpg", "IMG_0582.jpg", "IMG_0588.jpg", "IMG_0590.jpg", "IMG_0595.jpg", "IMG_0606.jpg", "IMG_0620.jpg", "IMG_0622.jpg", "IMG_0632.jpg", "IMG_0641.jpg", "IMG_0644.jpg", "IMG_0657.jpg", "IMG_0660.jpg", "IMG_0666.jpg", "IMG_0683.jpg", "IMG_0698.jpg", "IMG_0710.jpg", "IMG_0714.jpg", "IMG_0733.jpg", "IMG_0739.jpg", "IMG_0750.jpg", "IMG_0771.jpg", "IMG_0798.jpg", "IMG_0809.jpg", "IMG_0814.jpg", "IMG_0819.jpg", "IMG_0820.jpg", "IMG_0823.jpg", "IMG_0825.jpg", "IMG_0833.jpg", "IMG_0856.jpg", "IMG_0865.jpg", "IMG_0901.jpg", "IMG_0909.jpg", "IMG_0921.jpg", "IMG_0930.jpg", "IMG_0936.jpg", "IMG_0948.jpg", "IMG_0959.jpg", "IMG_0962.jpg", "IMG_0967.jpg", "IMG_0969.jpg", "IMG_0993.jpg", "IMG_1006.jpg", "IMG_1042.jpg", "IMG_1098.jpg", "IMG_1099.jpg", "IMG_1109.jpg", "IMG_1137.jpg", "IMG_1138.jpg", "IMG_1354.jpg", "IMG_3621.jpg", "IMG_4099.jpg", "IMG_4796.jpg", "IMG_5490.jpg", "IMG_5580.jpg"] @@ -22,4 +23,4 @@ namespace :db do end end end -end \ No newline at end of file +end