Ruby. Releasy. Making exe file - ruby

I want to share my ruby app with my friends, so I decided to make .exe file, because I don't want them to install Ruby and run my code manually. I try to use releasy with rake file from their example on GitHub. And when I run rake build:windows:wrapper I see this trace:
$ rake build:windows:wrapper --trace
rake aborted!
LoadError: cannot load such file -- releasy
/home/edward/.rvm/rubies/ruby-2.0.0-p645/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:54:in `require'
/home/edward/.rvm/rubies/ruby-2.0.0-p645/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:54:in `require'
/home/edward/RubyProjects/SG/Rakefile:3:in `<top (required)>'
/home/edward/.rvm/gems/ruby-2.0.0-p645#rails_4_0/gems/rake-10.4.2/lib/rake/rake_module.rb:28:in `load'
/home/edward/.rvm/gems/ruby-2.0.0-p645#rails_4_0/gems/rake-10.4.2/lib/rake/rake_module.rb:28:in `load_rakefile'
/home/edward/.rvm/gems/ruby-2.0.0-p645#rails_4_0/gems/rake-10.4.2/lib/rake/application.rb:689:in `raw_load_rakefile'
/home/edward/.rvm/gems/ruby-2.0.0-p645#rails_4_0/gems/rake-10.4.2/lib/rake/application.rb:94:in `block in load_rakefile'
/home/edward/.rvm/gems/ruby-2.0.0-p645#rails_4_0/gems/rake-10.4.2/lib/rake/application.rb:176:in `standard_exception_handling'
/home/edward/.rvm/gems/ruby-2.0.0-p645#rails_4_0/gems/rake-10.4.2/lib/rake/application.rb:93:in `load_rakefile'
/home/edward/.rvm/gems/ruby-2.0.0-p645#rails_4_0/gems/rake-10.4.2/lib/rake/application.rb:77:in `block in run'
/home/edward/.rvm/gems/ruby-2.0.0-p645#rails_4_0/gems/rake-10.4.2/lib/rake/application.rb:176:in `standard_exception_handling'
/home/edward/.rvm/gems/ruby-2.0.0-p645#rails_4_0/gems/rake-10.4.2/lib/rake/application.rb:75:in `run'
/home/edward/.rvm/gems/ruby-2.0.0-p645#rails_4_0/gems/rake-10.4.2/bin/rake:33:in `<top (required)>'
/home/edward/.rvm/gems/ruby-2.0.0-p645#rails_4_0/bin/rake:23:in `load'
/home/edward/.rvm/gems/ruby-2.0.0-p645#rails_4_0/bin/rake:23:in `<main>'
/home/edward/.rvm/gems/ruby-2.0.0-p645#rails_4_0/bin/ruby_executable_hooks:15:in `eval'
/home/edward/.rvm/gems/ruby-2.0.0-p645#rails_4_0/bin/ruby_executable_hooks:15:in `<main>'
What should I do? Maybe I should use another gem for this purpose? Ocra didn't work for me, because of a lot of strange errors. Ubuntu 14.04. Thank you!

Apparently releasy is not installed, or not in your path.
You should read the error message, and do what it suggests, in this case, install releasy or make it available in your path.
Since you are using rvm, you can install the gem by doing gem install releasy without the use of sudo. If you used sudo, then that explains why it is not in your path, as you are not using the system Ruby.

Related

Creating a gem from a Capistrano task

I have a capistrano task I am trying to make into a gem so I can use it in multiple projects. The repository for this gem is located here:
https://github.com/FoamFactory/capistrano-monorepo-assets/tree/jwir3/initial-commit
I essentially used https://github.com/sheharyarn/capistrano-rake as a basis for creating my gem.
I've tested the actual rake script, but I'm actually not importing it into the project right now. Instead, I'm trying to get it to actually import the gem successfully. When I add the gem to my Gemfile as such:
gem 'capistrano-monorepoassets','0.0.6', path: "~/Source/capistrano-monorepo-assets/pkg"
Run bundle install, then attempt to import it using the following in my Capfile:
require 'capistrano/monorepoassets'
I get an error when I run cap --tasks --trace:
cap aborted!
LoadError: cannot load such file -- capistrano/monorepoassets
/home/scottj/Source/foamfactory/designsystem/Capfile:37:in `require'
/home/scottj/Source/foamfactory/designsystem/Capfile:37:in `<top (required)>'
/home/scottj/.rvm/gems/ruby-2.6.1/gems/rake-12.3.3/lib/rake/rake_module.rb:29:in `load'
/home/scottj/.rvm/gems/ruby-2.6.1/gems/rake-12.3.3/lib/rake/rake_module.rb:29:in `load_rakefile'
/home/scottj/.rvm/gems/ruby-2.6.1/gems/rake-12.3.3/lib/rake/application.rb:703:in `raw_load_rakefile'
/home/scottj/.rvm/gems/ruby-2.6.1/gems/rake-12.3.3/lib/rake/application.rb:104:in `block in load_rakefile'
/home/scottj/.rvm/gems/ruby-2.6.1/gems/rake-12.3.3/lib/rake/application.rb:186:in `standard_exception_handling'
/home/scottj/.rvm/gems/ruby-2.6.1/gems/rake-12.3.3/lib/rake/application.rb:103:in `load_rakefile'
/home/scottj/.rvm/gems/ruby-2.6.1/gems/rake-12.3.3/lib/rake/application.rb:82:in `block in run'
/home/scottj/.rvm/gems/ruby-2.6.1/gems/rake-12.3.3/lib/rake/application.rb:186:in `standard_exception_handling'
/home/scottj/.rvm/gems/ruby-2.6.1/gems/rake-12.3.3/lib/rake/application.rb:80:in `run'
/home/scottj/.rvm/gems/ruby-2.6.1/gems/capistrano-3.11.0/lib/capistrano/application.rb:14:in `run'
/home/scottj/.rvm/gems/ruby-2.6.1/gems/capistrano-3.11.0/bin/cap:3:in `<top (required)>'
/home/scottj/.rvm/gems/ruby-2.6.1/bin/cap:23:in `load'
/home/scottj/.rvm/gems/ruby-2.6.1/bin/cap:23:in `<main>'
/home/scottj/.rvm/gems/ruby-2.6.1/bin/ruby_executable_hooks:24:in `eval'
/home/scottj/.rvm/gems/ruby-2.6.1/bin/ruby_executable_hooks:24:in `<main>
I can't seem to get it to load the module using require, which is where I'm stuck. Can someone tell me what I'm doing incorrectly?
So this actually was happening because I didn't understand that bundle install doesn't support installing local gems by specifying the path in the Gemfile. This question actually covers the problem, and, more specifically, the answer here solved it for me.

Terminal error using Test First Ruby

I'm just starting Test First Ruby & I'm having trouble running rakes to start solving problems.
I think it's either my version of RSpec or my version of Ruby that's causing the error.
Here's the error,
AT MacBook-Pro:01_temperature AT$ rake
(in /Users/AT/Desktop/learn_ruby)
/Library/Ruby/Site/2.0.0/rubygems/core_ext/kernel_require.rb:54:in `require': cannot load such file -- temperature (LoadError)
from /Library/Ruby/Site/2.0.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from /Users/AT/Desktop/learn_ruby/01_temperature/temperature_spec.rb:18:in `<top (required)>'
from /Library/Ruby/Gems/2.0.0/gems/rspec-core-3.1.2/lib/rspec/core/configuration.rb:1105:in `load'
from /Library/Ruby/Gems/2.0.0/gems/rspec-core-3.1.2/lib/rspec/core/configuration.rb:1105:in `block in load_spec_files'
from /Library/Ruby/Gems/2.0.0/gems/rspec-core-3.1.2/lib/rspec/core/configuration.rb:1105:in `each'
from /Library/Ruby/Gems/2.0.0/gems/rspec-core-3.1.2/lib/rspec/core/configuration.rb:1105:in `load_spec_files'
from /Library/Ruby/Gems/2.0.0/gems/rspec-core-3.1.2/lib/rspec/core/runner.rb:96:in `setup'
from /Library/Ruby/Gems/2.0.0/gems/rspec-core-3.1.2/lib/rspec/core/runner.rb:84:in `run'
from /Library/Ruby/Gems/2.0.0/gems/rspec-core-3.1.2/lib/rspec/core/runner.rb:69:in `run'
from /Library/Ruby/Gems/2.0.0/gems/rspec-core-3.1.2/lib/rspec/core/runner.rb:37:in `invoke'
from /Library/Ruby/Gems/2.0.0/gems/rspec-core-3.1.2/exe/rspec:4:in `<top (required)>'
from /usr/bin/rspec:23:in `load'
from /usr/bin/rspec:23:in `<main>'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby -S rspec /Users/AT/Desktop/learn_ruby/01_temperature/temperature_spec.rb -I/Users/AT/Desktop/learn_ruby/01_temperature -I/Users/AT/Desktop/learn_ruby/01_temperature/solution -f documentation -r ./rspec_config failed
I had a similar problem a few minutes ago but fixed by uninstalling RSpec v-3, and installing v-2.14.
Any help would be appreciated!
Your file temperature_spec is requiring what I presume is the source for the class under test, temperature - but the RSpec loader is not able to resolve the path for this file.
It would be helpful for you to post both the source of your rspec file and your class under test.

NameError Rack::Attack installing GitLab 7.2

I've got a NameError installing GitLab 7.2. More precisely when initializing the database:
$ bundle exec rake gitlab:setup RAILS_ENV=production --trace
rake aborted!
NameError: uninitialized constant Rack::Attack
/home/[user]/gitlab/config/application.rb:67:in `<class:Application>'
/home/[user]/gitlab/config/application.rb:9:in `<module:Gitlab>'
/home/[user]/gitlab/config/application.rb:8:in `<top (required)>'
/home/[user]/gitlab/Rakefile:5:in `require'
/home/[user]/gitlab/Rakefile:5:in `<top (required)>'
/home/[user]/gitlab/vendor/bundle/ruby/1.9.1/gems/rake-10.3.2/lib/rake/rake_module.rb:28:in `load'
/home/[user]/gitlab/vendor/bundle/ruby/1.9.1/gems/rake-10.3.2/lib/rake/rake_module.rb:28:in `load_rakefile'
/home/[user]/gitlab/vendor/bundle/ruby/1.9.1/gems/rake-10.3.2/lib/rake/application.rb:687:in `raw_load_rakefile'
/home/[user]/gitlab/vendor/bundle/ruby/1.9.1/gems/rake-10.3.2/lib/rake/application.rb:94:in `block in load_rakefile'
/home/[user]/gitlab/vendor/bundle/ruby/1.9.1/gems/rake-10.3.2/lib/rake/application.rb:176:in `standard_exception_handling'
/home/[user]/gitlab/vendor/bundle/ruby/1.9.1/gems/rake-10.3.2/lib/rake/application.rb:93:in `load_rakefile'
/home/[user]/gitlab/vendor/bundle/ruby/1.9.1/gems/rake-10.3.2/lib/rake/application.rb:77:in `block in run'
/home/[user]/gitlab/vendor/bundle/ruby/1.9.1/gems/rake-10.3.2/lib/rake/application.rb:176:in `standard_exception_handling'
/home/[user]/gitlab/vendor/bundle/ruby/1.9.1/gems/rake-10.3.2/lib/rake/application.rb:75:in `run'
/home/[user]/gitlab/vendor/bundle/ruby/1.9.1/gems/rake-10.3.2/bin/rake:33:in `<top (required)>'
/home/[user]/gitlab/vendor/bundle/ruby/1.9.1/bin/rake:23:in `load'
/home/[user]/gitlab/vendor/bundle/ruby/1.9.1/bin/rake:23:in `<main>'
Yes, I found this answer discussing the error with an older version of GitLab, where the following line in config/application.rb had to be uncommented
config.middleware.use Rack::Attack
In 7.2. this line is uncommented from the start. It's there. It's apparently where rake chokes.
I renamed config/initializers/rack_attack.rb.example to config/initializers/rack_attack.rb as well.
Installing the bundle gems worked like a charm.
bundle install --deployment --without development test postgres aws
rack-attack is in the bundle's gems folder:
/home/[user]/gitlab/vendor/bundle/ruby/1.9.1/gems/rack-attack-2.3.0/lib/rack/attack.rb
Does anyone know what could be causing this problem? Thanks a lot!
Very ugly workaround™
I added the following line to config/application.rb and it's working:
require '/home/[user]/gitlab/vendor/bundle/ruby/1.9.1/gems/rack-attack-2.3.0/lib/rack/attack.rb'
Why is this working? What's wrong? Thanks!
I can't add comment, so I need to post it as an answer: You need to update your ruby & gems: take a look at https://github.com/gitlabhq/gitlabhq/blob/master/doc/install/installation.md#2-ruby.
GitLab requires Ruby (MRI) 2.0 or 2.1 You will have to use the
standard MRI implementation of Ruby. We love JRuby and Rubinius) but
GitLab needs several Gems that have native extensions.

Capistrano - undefined method `map'

I am using capistrano through Magentify. I am using RVM as a regular user on archlinux. I have it using Ruby 2.0.0 and I ran gem install magentify in a gemset I defined for this purpose. It installed Capistrano 3.0.1 and a about 9 other gems. When I set the recipe, I tried
cap -T
and it writes
cap aborted!
undefined method `map' for :except:Symbol
/home/dirtymikeandtheboys/.rvm/gems/ruby-1.9.3-p484/gems/magentify-0.0.6/lib/nonrails.rb:24:in `block in <top (required)>'
I also tried cap deploy with the same result (not sure what I expected.) How do I get started trying to fix this?
Edit: ran --trace with command cap -T:
cap aborted!
undefined method `map' for :except:Symbol
/home/dirtymike/.rvm/gems/ruby-1.9.3-p484/gems/rake-10.1.1/lib/rake/task.rb:304:in `set_arg_names'
/home/dirtymike/.rvm/gems/ruby-1.9.3-p484/gems/rake-10.1.1/lib/rake/task_manager.rb:29:in `define_task'
/home/dirtymike/.rvm/gems/ruby-1.9.3-p484/gems/rake-10.1.1/lib/rake/task.rb:360:in `define_task'
/home/dirtymike/.rvm/gems/ruby-1.9.3-p484/gems/rake-10.1.1/lib/rake/dsl_definition.rb:32:in `task'
/home/dirtymike/.rvm/gems/ruby-1.9.3-p484/gems/magentify-0.0.6/lib/nonrails.rb:24:in `block in <top (required)>'
/home/dirtymike/.rvm/gems/ruby-1.9.3-p484/gems/rake-10.1.1/lib/rake/task_manager.rb:196:in `in_namespace'
/home/dirtymike/.rvm/gems/ruby-1.9.3-p484/gems/rake-10.1.1/lib/rake/dsl_definition.rb:104:in `namespace'
/home/dirtymike/.rvm/gems/ruby-1.9.3-p484/gems/magentify-0.0.6/lib/nonrails.rb:7:in `<top (required)>'
/home/dirtymike/.rvm/gems/ruby-1.9.3-p484/gems/magentify-0.0.6/lib/mage.rb:1:in `load'
/home/dirtymike/.rvm/gems/ruby-1.9.3-p484/gems/magentify-0.0.6/lib/mage.rb:1:in `<top (required)>'
/home/dirtymike/public_html/project/Capfile:3:in `load'
/home/dirtymike/public_html/project/Capfile:3:in `<top (required)>'
/home/dirtymike/.rvm/gems/ruby-1.9.3-p484/gems/rake-10.1.1/lib/rake/rake_module.rb:25:in `load'
/home/dirtymike/.rvm/gems/ruby-1.9.3-p484/gems/rake-10.1.1/lib/rake/rake_module.rb:25:in `load_rakefile'
/home/dirtymike/.rvm/gems/ruby-1.9.3-p484/gems/rake-10.1.1/lib/rake/application.rb:637:in `raw_load_rakefile'
/home/dirtymike/.rvm/gems/ruby-1.9.3-p484/gems/rake-10.1.1/lib/rake/application.rb:94:in `block in load_rakefile'
/home/dirtymike/.rvm/gems/ruby-1.9.3-p484/gems/rake-10.1.1/lib/rake/application.rb:165:in `standard_exception_handling'
/home/dirtymike/.rvm/gems/ruby-1.9.3-p484/gems/rake-10.1.1/lib/rake/application.rb:93:in `load_rakefile'
/home/dirtymike/.rvm/gems/ruby-1.9.3-p484/gems/capistrano-3.0.1/lib/capistrano/application.rb:22:in `load_rakefile'
/home/dirtymike/.rvm/gems/ruby-1.9.3-p484/gems/rake-10.1.1/lib/rake/application.rb:77:in `block in run'
/home/dirtymike/.rvm/gems/ruby-1.9.3-p484/gems/rake-10.1.1/lib/rake/application.rb:165:in `standard_exception_handling'
/home/dirtymike/.rvm/gems/ruby-1.9.3-p484/gems/rake-10.1.1/lib/rake/application.rb:75:in `run'
/home/dirtymike/.rvm/gems/ruby-1.9.3-p484/gems/capistrano-3.0.1/lib/capistrano/application.rb:12:in `run'
/home/dirtymike/.rvm/gems/ruby-1.9.3-p484/gems/capistrano-3.0.1/bin/cap:3:in `<top (required)>'
/home/dirtymike/.rvm/gems/ruby-1.9.3-p484/bin/cap:23:in `load'
/home/dirtymike/.rvm/gems/ruby-1.9.3-p484/bin/cap:23:in `<main>'
/home/dirtymike/.rvm/gems/ruby-1.9.3-p484/bin/ruby_executable_hooks:15:in `eval'
/home/dirtymike/.rvm/gems/ruby-1.9.3-p484/bin/ruby_executable_hooks:15:in `<main>'
EDIT
This is fixed in version 0.0.7 of the Gem. I submitted a patch and it now forces to Capistrano 2.X, which is the only compatible version. The original answer was wrong, the problem was not with Rake.
Original Answer
It seems that the problem is with Rake and not with Capistrano. You may need to, either use an older version of rake (possibly 0.9.6), or update the Magentify gem to work with rake 10. Maybe you can open an issue on that repo.
EDIT
Confirmed: It works with rake 0.9.6.
You can add this Gemfile to your project:
source 'http://rubygems.org'
gem 'rake', '~> 0.9'
gem 'magentify'
and then running it like bundle exec cap -T

How to get Ruby to work (on .gitbook)?

I'm trying to get Ruby to run so that I can draft a contribution to the Git Community Book.
I'm on windows XP. I've downloaded Ruby 1.9.2 and the dev kit. I've downloaded the gitbook and its files .gitbook
I'm now at the situation where it tells me it can't find the script files, and after trying updating the windows Path variable, and moving the .gitbook folder to various locations I still can't make any progress..
The trace option gave the following (sorry it doesn't format properly!). It still looks like some silly path error but help is needed...
D:\Ruby192\bin\gitbook>rake html --trace
(in D:/Ruby192/bin/gitbook)
rake aborted!
no such file to load -- script/merge
<internal:lib/rubygems/custom_require>:29:in `require'
<internal:lib/rubygems/custom_require>:29:in `require'
D:/Ruby192/bin/gitbook/Rakefile:1:in `<top (required)>'
D:/Ruby192/lib/ruby/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:2383:in `load'
D:/Ruby192/lib/ruby/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:2383:in `raw_load_rakefile'
D:/Ruby192/lib/ruby/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:2017:in `block in load_rakefile'
D:/Ruby192/lib/ruby/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'
D:/Ruby192/lib/ruby/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:2016:in `load_rakefile'
D:/Ruby192/lib/ruby/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:2000:in `block in run'
D:/Ruby192/lib/ruby/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'
D:/Ruby192/lib/ruby/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:1998:in `run'
D:/Ruby192/lib/ruby/gems/1.9.1/gems/rake-0.8.7/bin/rake:31:in `<top (required)>'
D:/Ruby192/bin/rake:19:in `load'
D:/Ruby192/bin/rake:19:in `<main>'
Any advice welcome.
Rakefile in github is like,
require 'script/merge'
to make it work in ruby 1.9.x edit as follows
require './script/merge'

Resources