vigetlabs / sprig

Relational seeding for Rails apps
MIT License
207 stars 27 forks source link

Errno::ENOENT: No such file or directory - https://docs.google.com/spreadsheets... #61

Closed michaeloboyle closed 9 years ago

michaeloboyle commented 9 years ago

I can curl the URL but Sprig can't seem to get to it. Also tested accessing link from other browsers/computers without active google sessions.

rake aborted!
Errno::ENOENT: No such file or directory - https://docs.google.com/spreadsheets/d/19zl2MuPUVK5kzLfT6oCiCtLWnLVRYPHdajN7RVsYuPQ/edit?usp=sharing
/Users/moboyle/Github/location/db/seeds.rb:12:in `initialize'
#seeds.rb

include Sprig::Helpers

fanciness = {
    :class  => LionNodeEdit,
    :source => open('https://docs.google.com/spreadsheets/d/19zl2MuPUVK5kzLfT6oCiCtLWnLVRYPHdajN7RVsYuPQ/edit?usp=sharing'),
    :parser => Sprig::Data::Parser::GoogleSpreadsheetJson
}

sprig [fanciness]

Environment info:

Rails version   4.2.0
Ruby version    2.0.0-p481 (universal.x86_64-darwin14)
RubyGems version    2.4.5
Rack version    1.5

Gemfile:

source 'https://rubygems.org'

# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.2.0'
# Use postgresql as the database for Active Record
gem 'pg'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# 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

group :development, :test do
  # Call 'byebug' anywhere in the code to stop execution and get a debugger console
  gem 'byebug'

  # Access an IRB console on exception pages or by using <%= console %> in views
  gem 'web-console', '~> 2.0'

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

  gem 'haml-rails'

end

group :test do

  gem 'rspec-rails'

  gem 'cucumber-rails'

  gem "launchy"

  gem 'database_cleaner'

end

gem 'activerecord-postgis-adapter', '3.0.0.beta2'

gem 'httparty'

gem 'sprig'
michaeloboyle commented 9 years ago

Reduced the sheet to 100 rows to see if size was causing a timeout.

Same error. Size, in this case at least, does not matter.

ltk commented 9 years ago

Very strange. I'm looking into it.

ltk commented 9 years ago

I don't think this would cause the error we're seeing, but it's worth noting that your URL looks incorrect if you want to get the JSON feed from that spreadsheet (that's just the link the web UI).

JSON feed links from Google spreadsheets look something like https://spreadsheets.google.com/feeds/list/somerandomtoken/1/public/values?alt=json. You can check the Google Apps documentation for full details.

ltk commented 9 years ago

I just reproduced the error by failing to require open-uri. Be sure to include a require "open-uri" in your seeds.rb.

repro

michaeloboyle commented 9 years ago

Thanks Lawson. Adding require "open-uri" helped.

Getting a 404 now but my URL isn't in the .../public/values?alt=json format so that's the likely cause. Looking into how to get my sheet in the format. Will post when I sort it out.

Thanks again.

ltk commented 9 years ago

Cool. I'm gonna close this issue, but feel free to post back to it when you sort things out. Or if you encounter another issue, feel free to open a new issue.

michaeloboyle commented 9 years ago

There were issues with my URL formation. I found the following article helpful in getting the format right https://spreadsheets.google.com/feeds/list/19zl2MuPUVK5kzLfT6oCiCtLWnLVRYPHdajN7RVsYuPQ/o5upex4/public/basic?alt=json so it returned JSON from the appropriate worksheet:

http://sandbox.idre.ucla.edu/?p=906

It takes longer to fail now, indicating that the data is downloaded, if not seeded.

Current error:

LoadError: cannot load such file -- sprig/data/parser

I'll open a different issue if I can't sort this latest bit out.

Thanks again for the assistance.