Which version of Padrino runs fine in Ruby 1.8.6? - ruby

Padrino 0.10 gem installed activesupprt 3.0.9 which requires ruby >= 1.8.7.
I am Working on Ruby 1.8.6 can any one suggest me which version of Padrino works fine with Ruby 1.8.6 ?
I don't want upgrade Ruby version atleast for 5-6 months. This my current gemfile
source :rubygems
# Server requirements
# gem 'thin' or mongrel
# Project requirements
gem 'rake'
gem 'rack-flash'
# Component requirements
#gem 'haml'
gem 'SystemTimer', :require => "system_timer"
gem 'mongoid'
gem 'bson_ext', :require => "mongo"
gem "state_machine"
# Test requirements
gem 'rspec', :group => "test"
gem 'rack-test', :group => "test", :require => "rack/test"
gem 'mongoid-rspec', :group => "test"
# Padrino
gem 'padrino', '0.10.0'

v. 0.9.8 should work with ruby 1.8.6.

v. 0.9.9 worked fine for ruby 1.8.6
Installing rake (0.9.2)
Installing SystemTimer (1.2.3) with native extensions
Installing activesupport (2.3.5)
Installing bson (1.0.9)
Installing bson_ext (1.3.1) with native extensions
Using bundler (1.0.7)
Installing diff-lcs (1.1.3)
Installing durran-validatable (2.0.1)
Installing fuzzyhash (0.0.11)
Installing i18n (0.6.0)
Installing mongo (1.0.9)
Installing will_paginate (2.3.16)
Installing mongoid (1.9.0)
Installing rack (1.3.1)
Installing tilt (1.3.3)
Installing sinatra (1.2.6)
Installing thor (0.14.6)
Installing usher (0.8.3)
Installing padrino-core (0.9.9)
Installing padrino-gen (0.9.9)
Installing padrino-helpers (0.9.9)
Installing padrino-admin (0.9.9)
Installing tmail (1.2.7.1) with native extensions
Installing padrino-mailer (0.9.9)
Installing padrino (0.9.9)
Installing rack-flash (0.1.2)
Installing rack-test (0.6.0)
Installing rspec-core (2.6.4)
Installing rspec-expectations (2.6.0)
Installing rspec-mocks (2.6.0)
Installing rspec (2.6.0)
Installing state_machine (1.0.2)
Your bundle is complete! It was installed into ./vendor/bundle_gems
I need to set the version of mongoid ~> 1.9.0 and removed mongoid-rspecs as it required active support 3.0, but active support 3.0 required ruby >= 1.8.7

Related

Calling "brew" in Ruby system call and bundler error

I'm trying to write a rubygem that does some stuff with homebrew. I'm calling on brew to do some stuff using system(). When I include certain gems in using bundler, I get some errors doing things inside system().
As an example, a basic Gemfile with rake:
~/tmp/foo cat Gemfile
source 'https://rubygems.org'
gem 'rake'
Inside irb after running a bundle install:
irb(main):001:0> system("brew", "info", "ack")
Could not find rake-12.0.0 in any of the sources
Run `bundle install` to install missing gems.
=> false
I can do a bundle install inside the call and receive the same results:
rb(main):007:0> system("bundle", "install")
Using rake 12.0.0
Using bundler 1.14.6
Bundle complete! 1 Gemfile dependency, 2 gems now installed.
Bundled gems are installed into /Users/laura/.bundle.
=> true
irb(main):008:0> system("brew", "version")
Could not find rake-12.0.0 in any of the sources
Run `bundle install` to install missing gems.
=> false
Without the rake gem included I do not receive any errors:
~/tmp/foo cat Gemfile
source 'https://rubygems.org'
gem 'git'
~/tmp/foo bundle install
Fetching gem metadata from https://rubygems.org/.
Fetching version metadata from https://rubygems.org/
Resolving dependencies...
Using git 1.3.0
Using bundler 1.14.6
Bundle complete! 1 Gemfile dependency, 2 gems now installed.
Bundled gems are installed into /Users/surminus/.bundle.
~/tmp/foo
~/tmp/foo irb
irb(main):002:0> system("brew", "info", "ack")
ack: stable 2.16, HEAD
Search tool like grep, but optimized for programmers
https://beyondgrep.com/
/usr/local/Cellar/ack/2.14 (4 files, 184.7KB)
Built from source on 2016-12-16 at 16:24:07
/usr/local/Cellar/ack/2.16 (4 files, 190.7KB) *
Built from source on 2017-03-17 at 20:25:45
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/ack.rb
=> true
I know it's probably related to some conflict between homebrew, rake and bundler, but I can't for the life of me figure out what's going on. I only need to rake tasks for some development specific tasks so I can remove it, but I'm interested to find out why this occurs, or if indeed calling brew this way is $bad.
EDIT: I was asked for output of gem list --local in the bundle directory. Seems to be system gems. With bundle exec:
~/tmp/foo bundle exec gem list --local
*** LOCAL GEMS ***
bundler (1.14.6)
rake (12.0.0)
Without bundle exec:
~/tmp/foo gem list --local
*** LOCAL GEMS ***
activemodel (5.0.1)
activesupport (5.0.1)
addressable (2.5.0)
bigdecimal (1.2.8)
bundler (1.14.6, 1.14.5, 1.13.6)
CFPropertyList (2.2.8)
coderay (1.1.1)
commander (4.4.2)
concurrent-ruby (1.0.3)
did_you_mean (1.0.0)
diff-lcs (1.3, 1.2.5)
domain_name (0.5.20161129)
facter (2.4.6 ruby universal-darwin)
fileutils (0.7)
git (1.3.0)
hiera (1.3.4)
highline (1.7.8)
http-cookie (1.0.3)
i18n (0.7.0)
io-console (0.4.5)
json (2.0.2, 1.8.3)
json_pure (2.0.1, 1.8.3)
metaclass (0.0.4)
method_source (0.8.2)
mime-types (3.1)
mime-types-data (3.2016.0521)
minitest (5.10.1, 5.8.3)
mocha (1.2.1, 1.1.0)
myosx (0.2.2, 0.2.0, 0.1.0)
net-telnet (0.1.1)
netrc (0.11.0)
oauth (0.5.1)
power_assert (0.2.6)
pry (0.10.4)
psych (2.0.17)
public_suffix (2.0.4)
puppet (3.8.7)
puppet-lint (1.1.0)
puppet-syntax (2.3.0, 2.1.0)
puppetlabs_spec_helper (1.1.1)
rake (12.0.0, 11.1.2, 10.5.0, 10.4.2)
rdoc (4.2.1)
rest-client (2.0.0)
rmagick (2.16.0)
rspec (3.5.0, 3.4.0)
rspec-core (3.5.4, 3.4.4)
rspec-expectations (3.5.0, 3.4.0)
rspec-mocks (3.5.0, 3.4.1)
rspec-puppet (2.4.0)
rspec-support (3.5.0, 3.4.1)
ruby-trello (1.6.0)
slop (3.6.0)
test-unit (3.1.5)
thread_safe (0.3.5)
tzinfo (1.2.2)
unf (0.1.4)
unf_ext (0.0.7.2)

Gem Install fails with UnsatisfiableDependencyError

I have a puppet module project that fails when trying to update Gems, although it works in some computers. The Gems are used for the spec tests of the module.
Here's the command I run and the output:
X:\puppet-module-rems>gem install -g Gemfile -f
ERROR: While executing gem ... (Gem::UnsatisfiableDependencyError)
Unable to resolve dependency: user requested 'win32-service (= 0.8.7)'
The gem that it's trying to install/update is already in the system:
X:\puppet-module-rems>gem list -l
*** LOCAL GEMS ***
ast (2.3.0)
bigdecimal (1.2.4)
builder (3.2.2)
bundler (1.13.0.rc.2)
childprocess (0.5.9)
ci_reporter (2.0.0)
ci_reporter_rspec (1.0.0)
deep_merge (1.0.1)
diff-lcs (1.2.5)
facter (2.4.6 x64-mingw32)
ffi (1.9.14 x64-mingw32, 1.9.6 x64-mingw32)
ffi-win32-extensions (1.0.3)
hiera (1.3.4)
hiera-eyaml (2.1.0)
highline (1.6.21)
io-console (0.4.3, 0.4.2)
json (1.8.1)
json_pure (2.0.2)
metaclass (0.0.4)
minitar (0.5.4)
minitest (4.7.5)
mocha (1.1.0)
multi_json (1.12.1)
multi_test (0.1.2)
parser (2.3.1.2)
powerpack (0.1.1)
psych (2.0.5)
ptools (1.3.3 universal-mingw32)
puppet (3.8.1 x64-mingw32)
puppet-lint (2.0.2)
puppet-syntax (2.1.0)
puppetlabs_spec_helper (1.1.1)
rainbow (2.1.0)
rake (10.1.0)
rdoc (4.1.0)
rspec (3.5.0, 3.5.0.beta2)
rspec-core (3.5.2, 3.5.0.beta2)
rspec-expectations (3.5.0, 3.5.0.beta2)
rspec-mocks (3.5.0, 3.5.0.beta2)
rspec-puppet (2.4.0, 2.3.2)
rspec-support (3.5.0, 3.5.0.beta2)
rubocop (0.42.0)
ruby-progressbar (1.8.1)
stomp (1.3.3)
sys-admin (1.6.4)
test-unit (2.5.5, 2.1.7.0, 2.1.6.0, 2.1.5.0)
thread_order (1.1.0)
trollop (2.1.2)
unicode-display_width (1.1.0)
win32-dir (0.4.9)
win32-eventlog (0.6.6, 0.6.2)
win32-file (0.8.1)
win32-file-stat (1.5.5)
win32-process (0.7.5, 0.7.4)
win32-security (0.2.5)
win32-service (0.8.7, 0.8.6)
Here's the version of ruby I have:
X:\puppet-module-rems>ruby --version
ruby 2.1.7p400 (2015-08-18 revision 51632) [x64-mingw32]
EDITED #1
Here's the content of the Gemfile:
source 'https://rubygems.org'
puppetversion = ENV.key?('PUPPET_VERSION') ? "= #{ENV['PUPPET_VERSION']}" : ['3.8.1']
gem 'puppet', puppetversion
gem 'puppetlabs_spec_helper', '= 1.1.1'
gem 'puppet-lint', '>= 0.3.2'
gem 'facter', '>= 1.7.0'
gem 'ci_reporter_rspec'
gem 'win32-service', '= 0.8.7'
gem 'rake', '= 10.1.0'
gem 'rspec-core', '= 3.5.2'
gem 'rspec-expectations', '= 3.5.0'
gem 'rspec-mocks', '= 3.5.0'
gem 'rspec-puppet', '= 2.4.0'
gem 'rspec-support', '= 3.5.0'
So, after further research, I found that the problem was not related to my code, files or configuration but with a problem with Rubygems.
Bottomline, I had to follow this link and manually update the certificate.
It looks like ruby wasn't able to connect to the server to check for dependencies of the gems I was requiring.

Octopress --> Heroku error env: bundle: no such file or directory

I have an Octopress blog running on Heroku using a buildpack (https://github.com/jgarber/heroku-buildpack-ruby-octopress). It was working fine up until a few days ago, when I started getting the error below on deployment (everything works fine on local). I reverted to a working git and tried to deploy again but no dice.
env: bundle: no such file or directory error.
Here is the deployment log
-----> Deleting 0 files matching .slugignore patterns.
-----> Fetching custom git buildpack... done
-----> Octopress app detected
-----> Using Ruby version: ruby-2.0.0
-----> Installing dependencies using Bundler version 1.3.2
Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin --deployment
Fetching gem metadata from http://rubygems.org/.......
Fetching gem metadata from http://rubygems.org/..
Installing rake (10.1.1)
Installing RedCloth (4.2.9)
Installing chunky_png (1.2.9)
Installing fast-stemmer (1.0.2)
Installing classifier (1.3.4)
Installing fssm (0.2.10)
Installing sass (3.2.13)
Installing compass (0.12.2)
Installing directory_watcher (1.5.1)
Installing haml (3.1.8)
Installing kramdown (0.14.2)
Installing liquid (2.3.0)
Installing maruku (0.7.0)
Installing posix-spawn (0.3.8)
Installing yajl-ruby (1.1.0)
Installing pygments.rb (0.3.7)
Installing jekyll (0.12.1)
Installing rack (1.5.2)
Installing rack-protection (1.5.1)
Installing rdiscount (1.6.8)
Installing rubypants (0.2.0)
Installing sass-globbing (1.0.0)
Installing tilt (1.4.1)
Installing sinatra (1.4.4)
Installing stringex (1.4.0)
Using bundler (1.3.2)
Your bundle is complete! It was installed into ./vendor/bundle
Cleaning up the bundler cache.
Removing bundler (1.3.0.pre.5)
-----> Building Octopress site
env: bundle: No such file or directory
-----> Discovering process types
Procfile declares types -> (none)
Gemfile
source "http://rubygems.org"
gem 'rake'
gem 'jekyll', '~> 0.12'
gem 'rdiscount', '~> 1.6.8'
gem 'pygments.rb', '~> 0.3.4'
gem 'RedCloth', '~> 4.2.9'
gem 'haml', '~> 3.1.7'
gem 'compass', '~> 0.12.2'
gem 'sass-globbing', '~> 1.0.0'
gem 'rubypants', '~> 0.2.0'
gem 'stringex', '~> 1.4.0'
gem 'liquid', '~> 2.3.0'
gem 'sinatra', '~> 1.4.2'
group :development do
gem 'rb-fsevent', '~> 0.9'
end
Gemfile.lock
GEM
remote: http://rubygems.org/
specs:
RedCloth (4.2.9)
chunky_png (1.2.9)
classifier (1.3.3)
fast-stemmer (>= 1.0.0)
compass (0.12.2)
chunky_png (~> 1.2)
fssm (>= 0.2.7)
sass (~> 3.1)
directory_watcher (1.5.1)
fast-stemmer (1.0.2)
fssm (0.2.10)
haml (3.1.8)
jekyll (0.12.1)
classifier (~> 1.3)
directory_watcher (~> 1.1)
kramdown (~> 0.14)
liquid (~> 2.3)
maruku (~> 0.5)
pygments.rb (~> 0.3.2)
kramdown (0.14.2)
liquid (2.3.0)
maruku (0.7.0)
posix-spawn (0.3.8)
pygments.rb (0.3.7)
posix-spawn (~> 0.3.6)
yajl-ruby (~> 1.1.0)
rack (1.5.2)
rack-protection (1.5.1)
rack
rake (10.1.1)
rb-fsevent (0.9.3)
rdiscount (1.6.8)
rubypants (0.2.0)
sass (3.2.13)
sass-globbing (1.0.0)
sass (>= 3.1)
sinatra (1.4.4)
rack (~> 1.4)
rack-protection (~> 1.4)
tilt (~> 1.3, >= 1.3.4)
stringex (1.4.0)
tilt (1.4.1)
yajl-ruby (1.1.0)
PLATFORMS
ruby
DEPENDENCIES
RedCloth (~> 4.2.9)
compass (~> 0.12.2)
haml (~> 3.1.7)
jekyll (~> 0.12)
liquid (~> 2.3.0)
pygments.rb (~> 0.3.4)
rake
rb-fsevent (~> 0.9)
rdiscount (~> 1.6.8)
rubypants (~> 0.2.0)
sass-globbing (~> 1.0.0)
sinatra (~> 1.4.2)
stringex (~> 1.4.0)
I have searched up and down but nothing seems to work for me. Any help would be much appreciated.
I removed and add the BUILDPACK_URL again.
heroku config:remove BUILDPACK_URL
heroku config:set BUILDPACK_URL=https://github.com/nicholasmott/heroku-buildpack-octopress.git
And created a Procfile with content:
web: bundle exec rackup config.ru -p $PORT
I don't know which resolves the problem, but now it works.
I tried
Simply set the url again: Nothing.
Freeze the ruby version: Nothing.
Create a Profile without bundle: Nothing.
Then I removed the Buildpack and I got my site down. I added again the buildpack and I created a Procfile and after that it just runs :)
Try creating another application and Git remote using an updated version of the buildpack. It takes into account the way Heroku wants you to specify Ruby version in the Gemfile, which is new since Jason wrote his original buildpack.
I had a similar thing happen to me on my jekyll site when I updated my gems.
I had to roll back my heroku to the "stock" heroku buildpack. Then everything started to work again.

Gem::LoadError when using a git repo in Gemfile

I forked the sinbook gem and added the git repo to my Gemfile. But the sinatra-authentication gem, which depends on sinbook, throws Gem::LoadError.
Why isn't my version of the gem being used?
Gemfile
source :rubygems
gem 'sinatra'
gem 'sinatra-contrib'
gem 'sequel'
gem 'jruby-openssl'
gem 'rack-flash'
gem 'sinbook', git: 'https://github.com/JamesGecko/sinbook'
gem 'sinatra-authentication'
gem 'json-jruby'
gem 'coffee-script'
gem 'therubyrhino'
error
PS C:\users\james\code\portal> jruby -S bundle
Fetching gem metadata from http://rubygems.org/........
Fetching gem metadata from http://rubygems.org/..
Fetching https://github.com/JamesGecko/sinbook
Installing addressable (2.2.8)
Installing backports (2.5.1)
Installing bouncy-castle-java (1.5.0146.1)
Installing coffee-script-source (1.3.1)
Installing multi_json (1.2.0)
Installing execjs (1.3.0)
Installing coffee-script (2.2.0)
Installing dm-core (1.2.0)
Installing dm-migrations (1.2.0)
Installing dm-timestamps (1.2.0)
Installing dm-validations (1.2.0)
Installing eventmachine (0.12.10)
Installing jruby-openssl (0.7.7)
Installing json (1.5.0)
Installing json-jruby (1.5.0)
Installing rack (1.4.1)
Installing rack-flash (0.1.2)
Installing rack-protection (1.2.0)
Installing rack-test (0.6.1)
Installing rufus-tokyo (1.0.7)
Installing sequel (3.34.1)
Installing tilt (1.3.3)
Installing sinatra (1.3.2)
Using sinbook (0.1.9.jamesgecko) from https://github.com/JamesGecko/sinbook (at master)
Installing sinatra-authentication (0.4.1)
Installing sinatra-contrib (1.3.1)
Installing therubyrhino (1.73.2)
Using bundler (1.1.4)
Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed.
PS C:\users\james\code\portal> jruby .\app.rb
Gem::LoadError: Could not find sinbook (>= 0) amongst [addressable-2.2.8, backports-2.5.1, bouncy-castle-java-1.5.0146.1, bundler-1.1.4, coffee-script-2.2.0, coffee-script-source-1.3.1, dm-core-1.2.0, dm-migrations-1.2.0, dm-timestamps-1.2.0, dm-validations-1.2.0, eventmachine-0.12.10-java, execjs-1.3.0, jruby-openssl-0.7.7, jruby-win32ole-0.8.5, json-1.5.0-java, json-jruby-1.5.0-java, multi_json-1.2.0, rack-1.4.1, rack-flash-0.1.2, rack-protection-1.2.0, rack-test-0.6.1, rake-0.9.2.2, rufus-tokyo-1.0.7, sequel-3.34.1, sinatra-1.3.2, sinatra-authentication-0.4.1, sinatra-contrib-1.3.1, therubyrhino-1.73.2, tilt-1.3.3]
to_specs at c:/dev/jruby-1.7.0.preview1/lib/ruby/shared/rubygems/dependency.rb:247
activate_dependencies at c:/dev/jruby-1.7.0.preview1/lib/ruby/shared/rubygems/specification.rb:777
each at org/jruby/RubyArray.java:1611
activate_dependencies at c:/dev/jruby-1.7.0.preview1/lib/ruby/shared/rubygems/specification.rb:766
activate at c:/dev/jruby-1.7.0.preview1/lib/ruby/shared/rubygems/specification.rb:750
try_activate at c:/dev/jruby-1.7.0.preview1/lib/ruby/shared/rubygems.rb:212
require at c:/dev/jruby-1.7.0.preview1/lib/ruby/shared/rubygems/custom_require.rb:59
require at c:/dev/jruby-1.7.0.preview1/lib/ruby/shared/rubygems/custom_require.rb:55
(root) at .\app.rb:7
app.rb
require 'sinatra'
require 'sinatra/reloader'
require 'json'
require 'digest/sha1'
require 'rack-flash'
require 'sinatra-authentication'
use Rack::Session::Cookie, secret: 'foobar'
use Rack::Flash
# ...
Add require "bundler/setup" to app.rb. It it needed to load the bundled environment. More info may be found in the bundler documentation.
Since you're using Sinatra, you may also want to look into using config.ru.

JRuby "no such file to load"

Using jruby-1.6.7 via rvm and gem version 1.8.24 I created a new project containing a Gemfile:
source 'http://rubygems.org'
gem 'google-api-client'
and a main.rb:
require 'google/api_client'
After
gem install bundler
bundle install
gem list
I get
addressable (2.2.8)
autoparse (0.3.1)
bouncy-castle-java (1.5.0146.1)
bundler (1.1.4)
extlib (0.9.15)
faraday (0.8.1, 0.7.6)
ffi (1.0.11 java)
google-api-client (0.4.3)
jruby-launcher (1.0.14 java)
jruby-openssl (0.7.7)
json (1.7.3 java)
jwt (0.1.4)
launchy (2.1.0 java)
multi_json (1.3.6)
multipart-post (1.1.5)
rack (1.4.1)
rake (0.9.2.2)
rubygems-bundler (1.0.2)
rubygems-update (1.8.24, 1.7.2)
rvm (1.11.3.3)
signet (0.3.4)
spoon (0.0.1)
But when I run ruby main.rb, it results in an error:
LoadError: no such file to load -- google/api_client
require at org/jruby/RubyKernel.java:1033
(root) at main.rb:1
On MRI everything seems to be working fine. The problem does not seem bound to any specific gem.
Can someone help me with this?
Unless you have JRUBY_OPTS=--1.9 in your environment, or you pass the --1.9 flag on the command line, JRuby will default to 1.8 mode, which means that you explicitly have to require 'rubygems' in main.rb before you load your gems.

Resources