rake db:创建失败的错误消息角色"用户名"不存在

时间:2018-02-04 15:39:00

标签: ruby postgresql rubygems

我正在尝试在本地部署updog.co代码。 https://github.com/jshawl/updog。我安装了ruby,nodejs,npm,postgresql,sqlite3等。我克隆了repo,做了一个bundle install。现在 我正试图在终端中发出命令,如rake db:create。我收到以下错误

FATAL:  role "justinechacko" does not exist
/var/lib/gems/2.3.0/gems/activerecord-4.2.1/lib/active_record/connection_adapters/postgresql_adapter.rb:661:in `rescue in connect'
/var/lib/gems/2.3.0/gems/activerecord-4.2.1/lib/active_record/connection_adapters/postgresql_adapter.rb:651:in `connect'
/var/lib/gems/2.3.0/gems/activerecord-4.2.1/lib/active_record/connection_adapters/postgresql_adapter.rb:242:in `initialize'
/var/lib/gems/2.3.0/gems/activerecord-4.2.1/lib/active_record/connection_adapters/postgresql_adapter.rb:44:in `new'
/var/lib/gems/2.3.0/gems/activerecord-4.2.1/lib/active_record/connection_adapters/postgresql_adapter.rb:44:in `postgresql_connection'
/var/lib/gems/2.3.0/gems/activerecord-4.2.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:438:in `new_connection'
/var/lib/gems/2.3.0/gems/activerecord-4.2.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:448:in `checkout_new_connection'
/var/lib/gems/2.3.0/gems/activerecord-4.2.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:422:in `acquire_connection'
/var/lib/gems/2.3.0/gems/activerecord-4.2.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:349:in `block in checkout'
/usr/lib/ruby/2.3.0/monitor.rb:214:in `mon_synchronize'
/var/lib/gems/2.3.0/gems/activerecord-4.2.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:348:in `checkout'
/var/lib/gems/2.3.0/gems/activerecord-4.2.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:263:in `block in connection'
/usr/lib/ruby/2.3.0/monitor.rb:214:in `mon_synchronize'
/var/lib/gems/2.3.0/gems/activerecord-4.2.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:262:in `connection'
/var/lib/gems/2.3.0/gems/activerecord-4.2.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:567:in `retrieve_connection'
/var/lib/gems/2.3.0/gems/activerecord-4.2.1/lib/active_record/connection_handling.rb:113:in `retrieve_connection'
/var/lib/gems/2.3.0/gems/activerecord-4.2.1/lib/active_record/connection_handling.rb:87:in `connection'
/var/lib/gems/2.3.0/gems/activerecord-4.2.1/lib/active_record/tasks/postgresql_database_tasks.rb:8:in `connection'
/var/lib/gems/2.3.0/gems/activerecord-4.2.1/lib/active_record/tasks/postgresql_database_tasks.rb:17:in `create'
/var/lib/gems/2.3.0/gems/activerecord-4.2.1/lib/active_record/tasks/database_tasks.rb:93:in `create'
/var/lib/gems/2.3.0/gems/activerecord-4.2.1/lib/active_record/tasks/database_tasks.rb:107:in `block in create_current'
/var/lib/gems/2.3.0/gems/activerecord-4.2.1/lib/active_record/tasks/database_tasks.rb:275:in `block in each_current_configuration'
/var/lib/gems/2.3.0/gems/activerecord-4.2.1/lib/active_record/tasks/database_tasks.rb:274:in `each'
/var/lib/gems/2.3.0/gems/activerecord-4.2.1/lib/active_record/tasks/database_tasks.rb:274:in `each_current_configuration'
/var/lib/gems/2.3.0/gems/activerecord-4.2.1/lib/active_record/tasks/database_tasks.rb:106:in `create_current'
/var/lib/gems/2.3.0/gems/activerecord-4.2.1/lib/active_record/railties/databases.rake:17:in `block (2 levels) in <top (required)>'
/var/lib/gems/2.3.0/gems/rake-11.1.2/lib/rake/task.rb:248:in `block in execute'
/var/lib/gems/2.3.0/gems/rake-11.1.2/lib/rake/task.rb:243:in `each'
/var/lib/gems/2.3.0/gems/rake-11.1.2/lib/rake/task.rb:243:in `execute'
/var/lib/gems/2.3.0/gems/rake-11.1.2/lib/rake/task.rb:187:in `block in invoke_with_call_chain'
/usr/lib/ruby/2.3.0/monitor.rb:214:in `mon_synchronize'
/var/lib/gems/2.3.0/gems/rake-11.1.2/lib/rake/task.rb:180:in `invoke_with_call_chain'
/var/lib/gems/2.3.0/gems/rake-11.1.2/lib/rake/task.rb:173:in `invoke'
/var/lib/gems/2.3.0/gems/rake-11.1.2/lib/rake/application.rb:150:in `invoke_task'
/var/lib/gems/2.3.0/gems/rake-11.1.2/lib/rake/application.rb:106:in `block (2 levels) in top_level'
/var/lib/gems/2.3.0/gems/rake-11.1.2/lib/rake/application.rb:106:in `each'
/var/lib/gems/2.3.0/gems/rake-11.1.2/lib/rake/application.rb:106:in `block in top_level'
/var/lib/gems/2.3.0/gems/rake-11.1.2/lib/rake/application.rb:115:in `run_with_threads'
/var/lib/gems/2.3.0/gems/rake-11.1.2/lib/rake/application.rb:100:in `top_level'
/var/lib/gems/2.3.0/gems/rake-11.1.2/lib/rake/application.rb:78:in `block in run'
/var/lib/gems/2.3.0/gems/rake-11.1.2/lib/rake/application.rb:176:in `standard_exception_handling'
/var/lib/gems/2.3.0/gems/rake-11.1.2/lib/rake/application.rb:75:in `run'
/var/lib/gems/2.3.0/gems/rake-11.1.2/bin/rake:33:in `<top (required)>'
/usr/local/bin/rake:23:in `load'
/usr/local/bin/rake:23:in `<main>'
Couldn't create database for {"adapter"=>"postgresql", "pool"=>5, "timeout"=>5000, "database"=>"updog_development"}
FATAL:  role "justinechacko" does not exist
/var/lib/gems/2.3.0/gems/activerecord-4.2.1/lib/active_record/connection_adapters/postgresql_adapter.rb:661:in `rescue in connect'
/var/lib/gems/2.3.0/gems/activerecord-4.2.1/lib/active_record/connection_adapters/postgresql_adapter.rb:651:in `connect'
/var/lib/gems/2.3.0/gems/activerecord-4.2.1/lib/active_record/connection_adapters/postgresql_adapter.rb:242:in `initialize'
/var/lib/gems/2.3.0/gems/activerecord-4.2.1/lib/active_record/connection_adapters/postgresql_adapter.rb:44:in `new'
/var/lib/gems/2.3.0/gems/activerecord-4.2.1/lib/active_record/connection_adapters/postgresql_adapter.rb:44:in `postgresql_connection'
/var/lib/gems/2.3.0/gems/activerecord-4.2.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:438:in `new_connection'
/var/lib/gems/2.3.0/gems/activerecord-4.2.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:448:in `checkout_new_connection'
/var/lib/gems/2.3.0/gems/activerecord-4.2.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:422:in `acquire_connection'
/var/lib/gems/2.3.0/gems/activerecord-4.2.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:349:in `block in checkout'
/usr/lib/ruby/2.3.0/monitor.rb:214:in `mon_synchronize'
/var/lib/gems/2.3.0/gems/activerecord-4.2.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:348:in `checkout'
/var/lib/gems/2.3.0/gems/activerecord-4.2.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:263:in `block in connection'
/usr/lib/ruby/2.3.0/monitor.rb:214:in `mon_synchronize'
/var/lib/gems/2.3.0/gems/activerecord-4.2.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:262:in `connection'
/var/lib/gems/2.3.0/gems/activerecord-4.2.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:567:in `retrieve_connection'
/var/lib/gems/2.3.0/gems/activerecord-4.2.1/lib/active_record/connection_handling.rb:113:in `retrieve_connection'
/var/lib/gems/2.3.0/gems/activerecord-4.2.1/lib/active_record/connection_handling.rb:87:in `connection'
/var/lib/gems/2.3.0/gems/activerecord-4.2.1/lib/active_record/tasks/postgresql_database_tasks.rb:8:in `connection'
/var/lib/gems/2.3.0/gems/activerecord-4.2.1/lib/active_record/tasks/postgresql_database_tasks.rb:17:in `create'
/var/lib/gems/2.3.0/gems/activerecord-4.2.1/lib/active_record/tasks/database_tasks.rb:93:in `create'
/var/lib/gems/2.3.0/gems/activerecord-4.2.1/lib/active_record/tasks/database_tasks.rb:107:in `block in create_current'
/var/lib/gems/2.3.0/gems/activerecord-4.2.1/lib/active_record/tasks/database_tasks.rb:275:in `block in each_current_configuration'
/var/lib/gems/2.3.0/gems/activerecord-4.2.1/lib/active_record/tasks/database_tasks.rb:274:in `each'
/var/lib/gems/2.3.0/gems/activerecord-4.2.1/lib/active_record/tasks/database_tasks.rb:274:in `each_current_configuration'
/var/lib/gems/2.3.0/gems/activerecord-4.2.1/lib/active_record/tasks/database_tasks.rb:106:in `create_current'
/var/lib/gems/2.3.0/gems/activerecord-4.2.1/lib/active_record/railties/databases.rake:17:in `block (2 levels) in <top (required)>'
/var/lib/gems/2.3.0/gems/rake-11.1.2/lib/rake/task.rb:248:in `block in execute'
/var/lib/gems/2.3.0/gems/rake-11.1.2/lib/rake/task.rb:243:in `each'
/var/lib/gems/2.3.0/gems/rake-11.1.2/lib/rake/task.rb:243:in `execute'
/var/lib/gems/2.3.0/gems/rake-11.1.2/lib/rake/task.rb:187:in `block in invoke_with_call_chain'
/usr/lib/ruby/2.3.0/monitor.rb:214:in `mon_synchronize'
/var/lib/gems/2.3.0/gems/rake-11.1.2/lib/rake/task.rb:180:in `invoke_with_call_chain'
/var/lib/gems/2.3.0/gems/rake-11.1.2/lib/rake/task.rb:173:in `invoke'
/var/lib/gems/2.3.0/gems/rake-11.1.2/lib/rake/application.rb:150:in `invoke_task'
/var/lib/gems/2.3.0/gems/rake-11.1.2/lib/rake/application.rb:106:in `block (2 levels) in top_level'
/var/lib/gems/2.3.0/gems/rake-11.1.2/lib/rake/application.rb:106:in `each'
/var/lib/gems/2.3.0/gems/rake-11.1.2/lib/rake/application.rb:106:in `block in top_level'
/var/lib/gems/2.3.0/gems/rake-11.1.2/lib/rake/application.rb:115:in `run_with_threads'
/var/lib/gems/2.3.0/gems/rake-11.1.2/lib/rake/application.rb:100:in `top_level'
/var/lib/gems/2.3.0/gems/rake-11.1.2/lib/rake/application.rb:78:in `block in run'
/var/lib/gems/2.3.0/gems/rake-11.1.2/lib/rake/application.rb:176:in `standard_exception_handling'
/var/lib/gems/2.3.0/gems/rake-11.1.2/lib/rake/application.rb:75:in `run'
/var/lib/gems/2.3.0/gems/rake-11.1.2/bin/rake:33:in `<top (required)>'
/usr/local/bin/rake:23:in `load'
/usr/local/bin/rake:23:in `<main>'
Couldn't create database for {"adapter"=>"postgresql", "pool"=>5, "timeout"=>5000, "database"=>"updog_test"}

这是我的database.yml。我在ubuntu中做了sudo捆绑安装。我的电脑名称是justinechacko。我是否需要更改数据库用户名?

# SQLite version 3.x
#   gem install sqlite3
#
#   Ensure the SQLite 3 gem is defined in your Gemfile
#   gem 'sqlite3'
#
default: &default
  adapter: postgresql
  pool: 5
  timeout: 5000

development:
  <<: *default
  database: updog_development

# Warning: The database defined as "test" will be erased and
# re-generated from your development database when you run "rake".
# Do not set this db to the same as development or production.
test:
  <<: *default
  database: updog_test

production:
  <<: *default
  username: jesse
  database: updog_production

修改:sudo -u postgres -i解决此问题。但现在当发出以下命令时,我会收到新的错误。 rake db:migrate

Rails Error: Unable to access log file. Please ensure that /home/justinechacko/www/updog/log/development.log exists and is writable (ie, make it writable for user and group: chmod 0664 /home/justinechacko/www/updog/log/development.log). The log level has been raised to WARN and the output directed to STDERR until the problem is fixed.
   (83.5ms)  CREATE TABLE "schema_migrations" ("version" character varying NOT NULL) 
   (106.4ms)  CREATE UNIQUE INDEX  "unique_schema_migrations" ON "schema_migrations"  ("version")
  ActiveRecord::SchemaMigration Load (1.1ms)  SELECT "schema_migrations".* FROM "schema_migrations"
Migrating to CreateUsers (20150217224226)
   (1.4ms)  BEGIN
== 20150217224226 CreateUsers: migrating ======================================
-- create_table(:users)
DEPRECATION WARNING: `#timestamp` was called without specifying an option for `null`. In Rails 5, this behavior will change to `null: false`. You should manually specify `null: true` to prevent the behavior of your existing migrations from changing. (called from block in change at /home/justinechacko/www/updog/db/migrate/20150217224226_create_users.rb:8)
   (113.1ms)  CREATE TABLE "users" ("id" serial primary key, "provider" character varying, "uid" character varying, "name" character varying, "email" character varying, "created_at" timestamp, "updated_at" timestamp) 
   -> 0.1161s
== 20150217224226 CreateUsers: migrated (0.1163s) =============================

  SQL (1.0ms)  INSERT INTO "schema_migrations" ("version") VALUES ($1)  [["version", "20150217224226"]]
   (81.2ms)  COMMIT
Migrating to CreateSites (20150217225851)
   (0.6ms)  BEGIN
== 20150217225851 CreateSites: migrating ======================================
-- create_table(:sites)
DEPRECATION WARNING: `#timestamp` was called without specifying an option for `null`. In Rails 5, this behavior will change to `null: false`. You should manually specify `null: true` to prevent the behavior of your existing migrations from changing. (called from block in change at /home/justinechacko/www/updog/db/migrate/20150217225851_create_sites.rb:6)
   (212.9ms)  CREATE TABLE "sites" ("id" serial primary key, "user_id" integer, "name" character varying, "created_at" timestamp, "updated_at" timestamp) 
   -> 0.2147s
== 20150217225851 CreateSites: migrated (0.2149s) =============================

  SQL (0.7ms)  INSERT INTO "schema_migrations" ("version") VALUES ($1)  [["version", "20150217225851"]]
   (22.8ms)  COMMIT
Migrating to AddDomainToSites (20150221113155)
   (0.3ms)  BEGIN
== 20150221113155 AddDomainToSites: migrating =================================
-- add_column(:sites, :domain, :string)
   (23.5ms)  ALTER TABLE "sites" ADD "domain" character varying
   -> 0.0245s
== 20150221113155 AddDomainToSites: migrated (0.0247s) ========================

  SQL (0.6ms)  INSERT INTO "schema_migrations" ("version") VALUES ($1)  [["version", "20150221113155"]]
   (33.5ms)  COMMIT
Migrating to AddAccessTokenToUsers (20150221141552)
   (0.6ms)  BEGIN
== 20150221141552 AddAccessTokenToUsers: migrating ============================
-- add_column(:users, :access_token, :string)
   (1.1ms)  ALTER TABLE "users" ADD "access_token" character varying
   -> 0.0021s
== 20150221141552 AddAccessTokenToUsers: migrated (0.0023s) ===================

  SQL (1.6ms)  INSERT INTO "schema_migrations" ("version") VALUES ($1)  [["version", "20150221141552"]]
   (10.5ms)  COMMIT
Migrating to RenameSitesId (20150223141106)
   (0.7ms)  BEGIN
== 20150223141106 RenameSitesId: migrating ====================================
-- rename_column(:sites, :user_id, :uid)
   (0.6ms)  ALTER TABLE "sites" RENAME COLUMN "user_id" TO "uid"
   -> 0.0048s
== 20150223141106 RenameSitesId: migrated (0.0049s) ===========================

  SQL (0.5ms)  INSERT INTO "schema_migrations" ("version") VALUES ($1)  [["version", "20150223141106"]]
   (10.3ms)  COMMIT
Migrating to ChangeUidToInteger (20150223141316)
   (0.4ms)  BEGIN
== 20150223141316 ChangeUidToInteger: migrating ===============================
   (95.8ms)  
      alter table users
      alter column uid
      type integer using cast(uid as integer)

== 20150223141316 ChangeUidToInteger: migrated (0.0961s) ======================

  SQL (0.8ms)  INSERT INTO "schema_migrations" ("version") VALUES ($1)  [["version", "20150223141316"]]
   (19.9ms)  COMMIT
Migrating to RenameDomainToSubdomain (20150223214418)
   (0.5ms)  BEGIN
== 20150223214418 RenameDomainToSubdomain: migrating ==========================
-- rename_column(:sites, :domain, :subdomain)
   (0.5ms)  ALTER TABLE "sites" RENAME COLUMN "domain" TO "subdomain"
   -> 0.0047s
== 20150223214418 RenameDomainToSubdomain: migrated (0.0048s) =================

  SQL (0.3ms)  INSERT INTO "schema_migrations" ("version") VALUES ($1)  [["version", "20150223214418"]]
   (10.7ms)  COMMIT
Migrating to AddDomainToSitesModel (20150223214551)
   (0.5ms)  BEGIN
== 20150223214551 AddDomainToSitesModel: migrating ============================
-- add_column(:sites, :domain, :string)
   (0.7ms)  ALTER TABLE "sites" ADD "domain" character varying
   -> 0.0014s
== 20150223214551 AddDomainToSitesModel: migrated (0.0015s) ===================

  SQL (0.5ms)  INSERT INTO "schema_migrations" ("version") VALUES ($1)  [["version", "20150223214551"]]
   (2.4ms)  COMMIT
Migrating to CreateVersions (20150225004003)
   (0.5ms)  BEGIN
== 20150225004003 CreateVersions: migrating ===================================
-- create_table(:versions)
   (82.9ms)  CREATE TABLE "versions" ("id" serial primary key, "item_type" character varying NOT NULL, "item_id" integer NOT NULL, "event" character varying NOT NULL, "whodunnit" character varying, "object" text, "created_at" timestamp) 
   -> 0.0838s
-- add_index(:versions, [:item_type, :item_id])
   (39.2ms)  CREATE  INDEX  "index_versions_on_item_type_and_item_id" ON "versions"  ("item_type", "item_id")
   -> 0.0448s
== 20150225004003 CreateVersions: migrated (0.1289s) ==========================

  SQL (0.7ms)  INSERT INTO "schema_migrations" ("version") VALUES ($1)  [["version", "20150225004003"]]
   (20.8ms)  COMMIT
Migrating to CreateClicks (20160630134655)
   (0.5ms)  BEGIN
== 20160630134655 CreateClicks: migrating =====================================
-- create_table(:clicks)
DEPRECATION WARNING: `#timestamp` was called without specifying an option for `null`. In Rails 5, this behavior will change to `null: false`. You should manually specify `null: true` to prevent the behavior of your existing migrations from changing. (called from block in change at /home/justinechacko/www/updog/db/migrate/20160630134655_create_clicks.rb:6)
   (83.5ms)  CREATE TABLE "clicks" ("id" serial primary key, "data" json, "site_id" integer, "created_at" timestamp, "updated_at" timestamp) 
   -> 0.0848s
== 20160630134655 CreateClicks: migrated (0.0850s) ============================

  SQL (0.6ms)  INSERT INTO "schema_migrations" ("version") VALUES ($1)  [["version", "20160630134655"]]
   (19.4ms)  COMMIT
Migrating to CreateSubscriptions (20161002210857)
   (0.6ms)  BEGIN
== 20161002210857 CreateSubscriptions: migrating ==============================
-- create_table(:subscriptions)
   (84.7ms)  CREATE TABLE "subscriptions" ("id" serial primary key, "stripe_id" character varying, "user_id" integer, "active_until" timestamp) 
   -> 0.0856s
== 20161002210857 CreateSubscriptions: migrated (0.0858s) =====================

  SQL (0.9ms)  INSERT INTO "schema_migrations" ("version") VALUES ($1)  [["version", "20161002210857"]]
   (18.1ms)  COMMIT
Migrating to AddDocumentRootToSites (20161006225750)
rake aborted!
LoadError: cannot load such file -- dropbox_sdk
/var/lib/gems/2.3.0/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:274:in `require'
/var/lib/gems/2.3.0/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:274:in `block in require'
/var/lib/gems/2.3.0/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:240:in `load_dependency'
/var/lib/gems/2.3.0/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:274:in `require'
/home/justinechacko/www/updog/db/migrate/20161006225750_add_document_root_to_sites.rb:1:in `<top (required)>'
/var/lib/gems/2.3.0/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:274:in `require'
/var/lib/gems/2.3.0/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:274:in `block in require'
/var/lib/gems/2.3.0/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:240:in `load_dependency'
/var/lib/gems/2.3.0/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:274:in `require'
/var/lib/gems/2.3.0/gems/activerecord-4.2.1/lib/active_record/migration.rb:774:in `load_migration'
/var/lib/gems/2.3.0/gems/activerecord-4.2.1/lib/active_record/migration.rb:770:in `migration'
/var/lib/gems/2.3.0/gems/activerecord-4.2.1/lib/active_record/migration.rb:765:in `disable_ddl_transaction'
/var/lib/gems/2.3.0/gems/activerecord-4.2.1/lib/active_record/migration.rb:1048:in `use_transaction?'
/var/lib/gems/2.3.0/gems/activerecord-4.2.1/lib/active_record/migration.rb:1040:in `ddl_transaction'
/var/lib/gems/2.3.0/gems/activerecord-4.2.1/lib/active_record/migration.rb:994:in `execute_migration_in_transaction'
/var/lib/gems/2.3.0/gems/activerecord-4.2.1/lib/active_record/migration.rb:956:in `block in migrate'
/var/lib/gems/2.3.0/gems/activerecord-4.2.1/lib/active_record/migration.rb:952:in `each'
/var/lib/gems/2.3.0/gems/activerecord-4.2.1/lib/active_record/migration.rb:952:in `migrate'
/var/lib/gems/2.3.0/gems/activerecord-4.2.1/lib/active_record/migration.rb:820:in `up'
/var/lib/gems/2.3.0/gems/activerecord-4.2.1/lib/active_record/migration.rb:798:in `migrate'
/var/lib/gems/2.3.0/gems/activerecord-4.2.1/lib/active_record/tasks/database_tasks.rb:137:in `migrate'
/var/lib/gems/2.3.0/gems/activerecord-4.2.1/lib/active_record/railties/databases.rake:44:in `block (2 levels) in <top (required)>'
Tasks: TOP => db:migrate
(See full trace by running task with --trace)

我认为我的gem文件中没有列出dropbox_sdk gem ....

source 'https://rubygems.org'

gem 'charlock_holmes'
gem 'figaro'
gem 'paper_trail'
gem 'google_drive'
gem 'httparty'
gem 'pry'
gem 'dalli'
gem 'gibbon'
gem 'rails_12factor'
gem 'kramdown'
gem 'omniauth'
gem 'omniauth-google-oauth2'
gem 'rouge'
gem 'redis-rails'
gem 'sidekiq'
gem 'stripe'
gem 'thin'
gem 'unicorn'
gem 'vuejs-rails'


group :development, :test do
  gem 'capybara'
  gem 'launchy'
  gem 'rack_session_access'
  gem 'rspec-rails', '~> 3.0'
  gem 'simplecov', :require => false
  gem 'webmock'
end

# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.2.1'
gem 'pg'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 4.0.3'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .js.coffee assets and views
gem 'coffee-rails', '~> 4.0.0'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer',  platforms: :ruby

# Use jquery as the JavaScript library
gem 'jquery-rails'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.0'
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', '~> 0.4.0',          group: :doc

# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
gem 'spring',        group: :development

# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'

# Use unicorn as the app server
# gem 'unicorn'

# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development

# Use debugger
# gem 'debugger', group: [:development, :test]

有一个名为updog / db / migrate / 20161006225750_add_document_root_to_sites.rb的文件

require 'dropbox_sdk'
class AddDocumentRootToSites < ActiveRecord::Migration
  def change
    add_column :sites, :document_root, :string
    Site.all.each do |site|
      p "getting #{site.name}"
      begin
        site.content(DropboxClient.new(site.creator.access_token),
          {
            'REQUEST_URI' => '/_config.yml',
            'REMOTE_ADDR' => '127.0.0.1',
            'HTTP_REFERER' => '',
            'PATH_INFO' => '/_config.yml'
          }
        )
        site.update(document_root: '_site/')
      rescue => e
        p e
      end
    end
  end
end

1 个答案:

答案 0 :(得分:0)

我需要在gemfile

中添加gem dropbox-sdk