From b94422b71ec88a29379032864c33bf0337168626 Mon Sep 17 00:00:00 2001 From: Blurredbits Date: Sat, 31 Jan 2015 15:28:48 -0700 Subject: [PATCH 1/5] Created spot to hold ENV variables with dotenv. Added ForecastIO gem and initializer as a starting point for issue #54. --- .env | 0 .gitignore | 3 +++ Gemfile | 3 +++ Gemfile.lock | 13 +++++++++++++ config/environments/development.rb | 3 +++ config/environments/test.rb | 3 +++ config/initializers/forecast_io.rb | 3 +++ my-template.env | 7 +++++++ 8 files changed, 35 insertions(+) create mode 100644 .env create mode 100644 config/initializers/forecast_io.rb create mode 100644 my-template.env diff --git a/.env b/.env new file mode 100644 index 000000000..e69de29bb diff --git a/.gitignore b/.gitignore index caa3d7177..030d739c4 100644 --- a/.gitignore +++ b/.gitignore @@ -19,3 +19,6 @@ /log/* !/log/.keep /tmp + +my.env + diff --git a/Gemfile b/Gemfile index f53d742a5..df49df0ff 100644 --- a/Gemfile +++ b/Gemfile @@ -13,6 +13,8 @@ gem 'pg' gem 'rails_12factor' gem 'rails_admin' gem 'validates_formatting_of' +gem 'forecast_io' + platforms :ruby_18 do gem 'fastercsv' @@ -29,6 +31,7 @@ end group :development, :test do gem 'pry' + gem 'dotenv-rails' end group :production do diff --git a/Gemfile.lock b/Gemfile.lock index f78d66046..ae6b95b8f 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -67,17 +67,27 @@ GEM thread_safe (~> 0.1) warden (~> 1.2.3) docile (1.1.5) + dotenv (1.0.2) + dotenv-rails (1.0.2) + dotenv (= 1.0.2) erubis (2.7.0) execjs (2.2.2) + faraday (0.9.1) + multipart-post (>= 1.2, < 3) fastercsv (1.5.5) font-awesome-rails (4.3.0.0) railties (>= 3.2, < 5.0) + forecast_io (2.0.0) + faraday + hashie + multi_json geokit (1.9.0) multi_json (>= 1.3.2) globalid (0.3.0) activesupport (>= 4.1.0) haml (4.0.6) tilt + hashie (3.3.2) hike (1.2.3) http_accept_language (2.0.5) i18n (0.7.0) @@ -100,6 +110,7 @@ GEM mini_portile (0.6.2) minitest (5.5.1) multi_json (1.10.1) + multipart-post (2.0.0) nested_form (0.3.2) netrc (0.10.2) nokogiri (1.6.6.2) @@ -232,7 +243,9 @@ DEPENDENCIES arel coveralls devise + dotenv-rails fastercsv + forecast_io geokit haml http_accept_language diff --git a/config/environments/development.rb b/config/environments/development.rb index e0e0ea829..af5caf566 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -1,3 +1,6 @@ +require 'dotenv' +Dotenv.load '.env','my.env' + Rails.application.configure do # Settings specified here will take precedence over those in config/application.rb. diff --git a/config/environments/test.rb b/config/environments/test.rb index 5c6dadfee..b32d27ff3 100644 --- a/config/environments/test.rb +++ b/config/environments/test.rb @@ -1,3 +1,6 @@ +require 'dotenv' +Dotenv.load '.env','my.env' + Rails.application.configure do # Settings specified here will take precedence over those in config/application.rb. diff --git a/config/initializers/forecast_io.rb b/config/initializers/forecast_io.rb new file mode 100644 index 000000000..cbd2e4cab --- /dev/null +++ b/config/initializers/forecast_io.rb @@ -0,0 +1,3 @@ +ForecastIO.configure do |configuration| + configuration.api_key = ENV['FORECAST_IO_API_KEY'] +end \ No newline at end of file diff --git a/my-template.env b/my-template.env new file mode 100644 index 000000000..41a5f5e03 --- /dev/null +++ b/my-template.env @@ -0,0 +1,7 @@ +# Template for my.env file + +# Rename this file to .env, and set the envirionment variables to your specific values. +# This file will be ignored by Git, once renamed. + + +FORECAST_IO_API_KEY="Get a key from https://developer.forecast.io/" \ No newline at end of file From 707eda930c210c6947d955755b5610ffa0915a55 Mon Sep 17 00:00:00 2001 From: Blurredbits Date: Sat, 31 Jan 2015 15:46:13 -0700 Subject: [PATCH 2/5] Updates based on travis failures --- Gemfile | 1 - config/environments/development.rb | 2 +- config/environments/test.rb | 2 +- 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/Gemfile b/Gemfile index df49df0ff..dc17220c6 100644 --- a/Gemfile +++ b/Gemfile @@ -15,7 +15,6 @@ gem 'rails_admin' gem 'validates_formatting_of' gem 'forecast_io' - platforms :ruby_18 do gem 'fastercsv' end diff --git a/config/environments/development.rb b/config/environments/development.rb index af5caf566..ecd4edd2e 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -1,5 +1,5 @@ require 'dotenv' -Dotenv.load '.env','my.env' +Dotenv.load '.env', 'my.env' Rails.application.configure do # Settings specified here will take precedence over those in config/application.rb. diff --git a/config/environments/test.rb b/config/environments/test.rb index b32d27ff3..039935a5e 100644 --- a/config/environments/test.rb +++ b/config/environments/test.rb @@ -1,5 +1,5 @@ require 'dotenv' -Dotenv.load '.env','my.env' +Dotenv.load '.env', 'my.env' Rails.application.configure do # Settings specified here will take precedence over those in config/application.rb. From 4c9a51c8fc87bf4fb333f4cb610a9ed30ff2678c Mon Sep 17 00:00:00 2001 From: Blurredbits Date: Sat, 31 Jan 2015 15:52:06 -0700 Subject: [PATCH 3/5] Added newline to ForecastIO initializer --- config/initializers/forecast_io.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/initializers/forecast_io.rb b/config/initializers/forecast_io.rb index cbd2e4cab..1c798a709 100644 --- a/config/initializers/forecast_io.rb +++ b/config/initializers/forecast_io.rb @@ -1,3 +1,3 @@ ForecastIO.configure do |configuration| configuration.api_key = ENV['FORECAST_IO_API_KEY'] -end \ No newline at end of file +end From 2eb38fffceb5aae5638c6e75c14ea65956a69498 Mon Sep 17 00:00:00 2001 From: Blurredbits Date: Sat, 31 Jan 2015 16:04:33 -0700 Subject: [PATCH 4/5] Added additional option for pulling in repo --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index adb15319d..9b74eab1c 100644 --- a/README.md +++ b/README.md @@ -23,6 +23,10 @@ You can see a running version of the application at This application requires [Postgres](http://www.postgresql.org/) to be installed git clone git://github.com/codeforamerica/adopt-a-hydrant.git + + _note: if Git appears to hang or outright fails, try:_ + git clone git@github.com:codeforamerica/adopt-a-hydrant.git + cd adopt-a-hydrant bundle install From 1aeacaf6bedeeae5f854e2601a12309816ae5625 Mon Sep 17 00:00:00 2001 From: Blurredbits Date: Sat, 31 Jan 2015 16:10:43 -0700 Subject: [PATCH 5/5] Readme updates --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 9b74eab1c..1c7f8216e 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,8 @@ This application requires [Postgres](http://www.postgresql.org/) to be installed git clone git://github.com/codeforamerica/adopt-a-hydrant.git - _note: if Git appears to hang or outright fails, try:_ +_Note: if Git appears to hang or outright fails, try:_ + git clone git@github.com:codeforamerica/adopt-a-hydrant.git cd adopt-a-hydrant