stopping thin throws an error - rvm

I am running a little Sinatra app inside EventMachine, with an EM.WebSocket too.
I have setup thin to run my app, but when I execute the command to stop thin, an error is thrown. I was wondeering if anyone could assist me on cleaning that up, based on the small trace here...
sudo service thin stop
[stop] /etc/thin/foobaz.yml ...
Stopping server on 0.0.0.0:80 ...
Sending QUIT signal to process 18889 ...
>> Exiting!
/usr/local/rvm/gems/ree-1.8.7-2010.02/gems/thin-1.2.7/lib/thin/server.rb:147:in `start': app required (ArgumentError)
from /usr/local/rvm/gems/ree-1.8.7-2010.02/gems/thin-1.2.7/lib/thin/controllers/controller.rb:80:in `start'
from /usr/local/rvm/gems/ree-1.8.7-2010.02/gems/thin-1.2.7/lib/thin/runner.rb:177:in `send'
from /usr/local/rvm/gems/ree-1.8.7-2010.02/gems/thin-1.2.7/lib/thin/runner.rb:177:in `run_command'
from /usr/local/rvm/gems/ree-1.8.7-2010.02/gems/thin-1.2.7/lib/thin/runner.rb:143:in `run!'
from /usr/local/rvm/gems/ree-1.8.7-2010.02/gems/thin-1.2.7/bin/thin:6
from /usr/local/rvm/gems/ree-1.8.7-2010.02/bin/thin:19:in `load'
from /usr/local/rvm/gems/ree-1.8.7-2010.02/bin/thin:19

I reckon this is related to how you're starting up your Sinatra app. If you see the following in your config.ru:
YourApp.run! :port => 4567
Then you can change it to:
run YourApp
Which seems to avoid the error on shutdown.

Related

Michael Hartl Chapter 3.3.1 Rails Test error message

Ive followed the tutorial word by word, and I'm using the Cloud9 platform to follow along.
I'm supposed to run: $ rails test
I'm supposed to get: 2 tests, 2 assertions, 0 failures, 0 errors, 0 skips
I'm not sure if i'm running the wrong command since i'm using Cloud9, but when I run the program the pages work, meaning I shouldn't be getting any errors at all. It's almost as if the test's never run at all. Any ideas?
enter code he(static-pages) $ rails test
Running via Spring preloader in process 5822
Run options: --seed 31158
Running:
...
Finished in 0.554944s, 5.4060 runs/s, 5.4060 assertions/s.
/usr/local/rvm/gems/ruby-2.3.0/gems/railties-5.0.1/lib/rails/test_unit/minitest_plugin.rb:9:in aggregated_results': wrong number of arguments (given 1, expected 0) (ArgumentError)
from /usr/local/rvm/gems/ruby-2.3.0/gems/minitest-5.10.2/lib/minitest.rb:597:inreport'
from /usr/local/rvm/gems/ruby-2.3.0/gems/minitest-reporters-1.1.9/lib/minitest/minitest_reporter_plugin.rb:26:in each'
from /usr/local/rvm/gems/ruby-2.3.0/gems/minitest-reporters-1.1.9/lib/minitest/minitest_reporter_plugin.rb:26:inreport'
from /usr/local/rvm/gems/ruby-2.3.0/gems/minitest-5.10.2/lib/minitest.rb:687:in each'
from /usr/local/rvm/gems/ruby-2.3.0/gems/minitest-5.10.2/lib/minitest.rb:687:inreport'
from /usr/local/rvm/gems/ruby-2.3.0/gems/minitest-5.10.2/lib/minitest.rb:141:in run'
from /usr/local/rvm/gems/ruby-2.3.0/gems/railties-5.0.1/lib/rails/test_unit/minitest_plugin.rb:73:inrun'
from /usr/local/rvm/gems/ruby-2.3.0/gems/minitest-5.10.2/lib/minitest.rb:63:in block in autorun'
from /usr/local/rvm/gems/ruby-2.3.0/gems/spring-1.7.2/lib/spring/application.rb:161:infork'
from /usr/local/rvm/gems/ruby-2.3.0/gems/spring-1.7.2/lib/spring/application.rb:161:in serve'
from /usr/local/rvm/gems/ruby-2.3.0/gems/spring-1.7.2/lib/spring/application.rb:131:inblock in run'
from /usr/local/rvm/gems/ruby-2.3.0/gems/spring-1.7.2/lib/spring/application.rb:125:in loop'
from /usr/local/rvm/gems/ruby-2.3.0/gems/spring-1.7.2/lib/spring/application.rb:125:inrun'
from /usr/local/rvm/gems/ruby-2.3.0/gems/spring-1.7.2/lib/spring/application/boot.rb:19:in <top (required)>'
from /usr/local/rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:inrequire'
from /usr/local/rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in require'
from -e:1:in're
Ugg just found out this question was already answered elsewhere.
Apparently there is a bug in the Minitest Gem file.
I added the code below to the test/test_helper.rb file to resolve it. However, i'm pretty sure there are other ways to resolve it as well.
Minitest::Reporters.use!

Error - Ruby OCI8 - Wrong number of arguments (2 for 0..1)

When running this script:
require 'oci8'
conn = OCI8.new('username', 'password', 'tnsname')
cursor = conn.exec('SELECT 1+1 FROM dual')
while r = cursor.fetch()
puts r.join(',')
end
cursor.close
conn.logoff
The following error message occurs:
C:/tech/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `initi
alize': wrong number of arguments (2 for 0..1) (ArgumentError)
from C:/tech/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb
:36:in `new'
from C:/tech/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb
:36:in `require'
from C:/tech/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb
:36:in `require'
from C:/tech/Ruby193/lib/ruby/gems/1.9.1/gems/ruby-oci8-2.1.5-x86-mingw3
2/lib/oci8.rb:81:in `<top (required)>'
from C:/tech/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb
:60:in `require'
from C:/tech/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb
:60:in `rescue in require'
from C:/tech/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb
:35:in `require'
from u:/Ruby/test_oci_connect.rb:1:in `<main>'
I can use those credentials in SQLPLUS and I have both the gems and devkit installed. Can anyone assist with this issue or provide some clarity regarding the answer below?
The issue is caused by a mismatch in the Oracle DLLs architecture and your Ruby installation, or your System not finding the right DLLs.
Download the Oracle Instant Client. Its important that its the same arch that your Ruby is in, as it contains the necessary DLLs.
Unzip it somewhere on your HDD, such as:
C:/OracleInstantClient Its also convenient to add both
/network/admin/sqlnet.ora
/network/admin/tnsnames.ora to that folder.
Add the Instant Client's location to your System PATH. You should now be able to connect without that error, provided you've added the correct connection information.
I was getting the same error message, using a gem dependent on ruby-oci8 (dm-oracle-adapter for datamapper).
Re-ran the install as per these instructions on a fresh environment :
Installing instant client for ruby-oci8
Double checked the path was set correctly and restarted my ruby console.
And everything worked perfectly.
On the machine it didn't work on (above incorrect arguments error), I have Oracle 64 bit dlls installed for some other services. My theory is that it was conflicting with these dlls (Ruby-oci8 needs 32bit DLLs), even though there was nothing pointing to these in the path.
Also, if you get the warning "ext/oci8 not found" when running 'gem install ruby-oci8', let me save you some time. In my case, this was a red herring and didn't affect the function of the gem at all.
That problem doesn't seem related to OCI8 at all.
You are misleading us a little here by not showing the whole code.
From your error stack trace, I can tell that you have a class that's trying to initialize but you have defined a parameter to that method and you didn't mention it when creating your object.
What this really means is that you mentioned 2 parameters where it was expecting either nothing or just one parameter.
if you create a test.rb fiel and paste the code you show us above all by itself, does it work?

Guard w/ RSpec2, Ruby1.9.3, Rails 3.1.3

I am running Guard successfully with notifications provided by Libnotify.
funkdified#funkdified-laptop:~/railsprojects/sample_app$ guard
Guard uses Libnotify to send notifications.
Guard is now watching at '/home/funkdified/railsprojects/sample_app'
Guard::RSpec is running, with RSpec 2!
Running all specs
...
Finished in 0.06053 seconds
3 examples, 0 failures
If I modify the spec file I am alerted as to the results of the test, both in the terminal and with a popup notification. If I modify a controller file, again tests run normally. However, when I modify routes.rb, the whole things falls on its face and Guard stops working normally and throws up an error. Anyone have any ideas?
Error:
Running: spec/routing
/home/funkdified/.rvm/gems/ruby-1.9.3-p0#rails3tutorial/gems/rspec-core-2.8.0/lib/rspec/core/configuration.rb:698:in `load': cannot load such file -- /home/funkdified/railsprojects/sample_app/spec/routing (LoadError)
from /home/funkdified/.rvm/gems/ruby-1.9.3-p0#rails3tutorial/gems/rspec-core-2.8.0/lib/rspec/core/configuration.rb:698:in `block in load_spec_files'
from /home/funkdified/.rvm/gems/ruby-1.9.3-p0#rails3tutorial/gems/rspec-core-2.8.0/lib/rspec/core/configuration.rb:698:in `map'
from /home/funkdified/.rvm/gems/ruby-1.9.3-p0#rails3tutorial/gems/rspec-core-2.8.0/lib/rspec/core/configuration.rb:698:in `load_spec_files'
from /home/funkdified/.rvm/gems/ruby-1.9.3-p0#rails3tutorial/gems/rspec-core-2.8.0/lib/rspec/core/command_line.rb:22:in `run'
from /home/funkdified/.rvm/gems/ruby-1.9.3-p0#rails3tutorial/gems/rspec-core-2.8.0/lib/rspec/core/runner.rb:80:in `run_in_process'
from /home/funkdified/.rvm/gems/ruby-1.9.3-p0#rails3tutorial/gems/rspec-core-2.8.0/lib/rspec/core/runner.rb:69:in `run'
from /home/funkdified/.rvm/gems/ruby-1.9.3-p0#rails3tutorial/gems/rspec-core-2.8.0/lib/rspec/core/runner.rb:10:in `block in autorun
Forgot to mention, if I kill Guard and restart (after making changes to routes.rb) then Guard again performs normally, suggesting that a test has now failed:
funkdified#funkdified-laptop:~/railsprojects/sample_app$ guard
Guard uses Libnotify to send notifications.
Guard is now watching at '/home/funkdified/railsprojects/sample_app'
Guard::RSpec is running, with RSpec 2!
Running all specs
..F
Failures:
1) PagesController GET 'about' returns http success
Failure/Error: get 'about'
ActionController::RoutingError:
No route matches {:controller=>"pages", :action=>"about"}
# ./spec/controllers/pages_controller_spec.rb:22:in `block (3 levels) in <top (required)>'
Finished in 0.0576 seconds
3 examples, 1 failure
Failed examples:
rspec ./spec/controllers/pages_controller_spec.rb:21 # PagesController GET 'about' returns http success
Check your spec directory. It should have a routing sub-directory for routing specs. If not, just create an empty one. Apparently, RSpec does not create any sub-directories under spec when running rails g rspec:install, but guard expects it to be there.
I think you may have the following line in your Guardfile:
watch('config/routes.rb') { "spec/routing" }
If you don't have specs in spec/routing, then don't folder that you don't need. Change the line to:
watch('config/routes.rb') { "spec" }
Now, all your specs will run when you update your routes.rb file.

as_paperclip_bridge initialization error in rails3

I'm trying to use both of PaperClip and ActiveScaffold with help of as_paperclip_bridge in a rails3.0.5 project.
However, following initialization error is occurred when I launch the project.
=> Booting WEBrick
=> Rails 3.0.5 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
Exiting
C:/Users/ken/Documents/NetBeansProjects/fcheck/vendor/plugins/as_paperclip_bridge/init.rb:10: undefined method bridge' for ActiveScaffold:Module (NoMethodError)
from C:/Ruby187/lib/ruby/gems/1.8/gems/railties-3.0.5/lib/rails/plugin.rb:81
from C:/Ruby187/lib/ruby/gems/1.8/gems/railties-3.0.5/lib/rails/initializable.rb:25:ininstance_exec'
from C:/Ruby187/lib/ruby/gems/1.8/gems/railties-3.0.5/lib/rails/initializable.rb:25:in run'
from C:/Ruby187/lib/ruby/gems/1.8/gems/railties-3.0.5/lib/rails/initializable.rb:50:inrun_initializers'
from C:/Ruby187/lib/ruby/gems/1.8/gems/railties-3.0.5/lib/rails/initializable.rb:49:in each'
from C:/Ruby187/lib/ruby/gems/1.8/gems/railties-3.0.5/lib/rails/initializable.rb:49:inrun_initializers'
from C:/Ruby187/lib/ruby/gems/1.8/gems/railties-3.0.5/lib/rails/application.rb:134:in initialize!'
from C:/Ruby187/lib/ruby/gems/1.8/gems/railties-3.0.5/lib/rails/application.rb:77:insend'
from C:/Ruby187/lib/ruby/gems/1.8/gems/railties-3.0.5/lib/rails/application.rb:77:in method_missing'
from C:/Users/ken/Documents/NetBeansProjects/fcheck/config/environment.rb:7
from C:/Ruby187/lib/ruby/gems/1.8/gems/activesupport-3.0.5/lib/active_support/dependencies.rb:239:inrequire'
from C:/Ruby187/lib/ruby/gems/1.8/gems/activesupport-3.0.5/lib/active_support/dependencies.rb:239:in require'
from C:/Ruby187/lib/ruby/gems/1.8/gems/activesupport-3.0.5/lib/active_support/dependencies.rb:225:inload_dependency'
from C:/Ruby187/lib/ruby/gems/1.8/gems/activesupport-3.0.5/lib/active_support/dependencies.rb:596:in new_constants_in'
from C:/Ruby187/lib/ruby/gems/1.8/gems/activesupport-3.0.5/lib/active_support/dependencies.rb:225:inload_dependency'
from C:/Ruby187/lib/ruby/gems/1.8/gems/activesupport-3.0.5/lib/active_support/dependencies.rb:239:in require'
from C:/Users/ken/Documents/NetBeansProjects/fcheck/config.ru:3
from C:/Ruby187/lib/ruby/gems/1.8/gems/rack-1.2.3/lib/rack/builder.rb:46:ininstance_eval'
from C:/Ruby187/lib/ruby/gems/1.8/gems/rack-1.2.3/lib/rack/builder.rb:46:in initialize'
from C:/Users/ken/Documents/NetBeansProjects/fcheck/config.ru:1:innew'
from C:/Users/ken/Documents/NetBeansProjects/fcheck/config.ru:1
The code in as_paperclip_bridge\init.rb is attempting to call a module method 'ActiveScaffold.bridge' but it coun't be found.
Even though, same code is working without error in rails2.3.8 project.
We can see a big difference of rails initialization code between version 2 and 3.
On rails 2.3.8, plugins are loaded in 'load_plugins' method which is called after 'load_gems' method in initializer.rb. However, rails3 doesn't have initializer.rb and the loading process seems to be totally different.
I also have tried to remove AS gem and install both of AS plugin with as_paperclip_bridge plugin. But, the error haven't disappeared.
Could someone explain why the error is occurring?!
Anyway, I really hope to get any solution or workaround.
Thanks,
Kenichi
Self reply.
I had realized that as_paperclip_bridge was not required for latest ActiveScaffold implementation. (It's including the bridge)
Please make sure to install ImageMagick and RMagick gem to use PaperClip for image files. Or, you may also think 'as_paperclip_bridge should be there'
Thank you,
Kenichi

Bundle install Jquery-rails taking too long to respond from gemcutter

Hi guys the gem jquery-rails(0.2.7) cant seem to be installed on my machine saying there are too many connections and it times out, I know this is not actualy programming but it is a fundamental for any ROR programmer esp in rails 3, so i'm actually looking for any1 who might have came across this error and resolved it. The error is as follows.
/usr/local/lib/site_ruby/1.8/rubygems/remote_fetcher.rb:365:in request': too many connection resets (http://production.cf.rubygems.org/gems/libxml-ruby-1.1.4.gem) (Gem::RemoteFetcher::FetchError)
from /usr/local/lib/site_ruby/1.8/rubygems/remote_fetcher.rb:289:inopen_uri_or_path'
from /usr/local/lib/site_ruby/1.8/rubygems/remote_fetcher.rb:298:in open_uri_or_path'
from /usr/local/lib/site_ruby/1.8/rubygems/remote_fetcher.rb:172:infetch_path'
from /usr/local/lib/site_ruby/1.8/rubygems/remote_fetcher.rb:110:in download'
from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.0/lib/bundler/source.rb:253:indownload_gem_from_uri'
from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.0/lib/bundler/source.rb:76:in fetch'
from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.0/lib/bundler/installer.rb:45:inrun'
from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.0/lib/bundler/spec_set.rb:12:in each'
from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.0/lib/bundler/spec_set.rb:12:ineach'
from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.0/lib/bundler/installer.rb:44:in run'
from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.0/lib/bundler/installer.rb:8:ininstall'
from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.0/lib/bundler/cli.rb:217:in install'
from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.0/lib/bundler/vendor/thor/task.rb:22:insend'
from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.0/lib/bundler/vendor/thor/task.rb:22:in run'
from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.0/lib/bundler/vendor/thor/invocation.rb:118:ininvoke_task'
from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.0/lib/bundler/vendor/thor.rb:246:in dispatch'
from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.0/lib/bundler/vendor/thor/base.rb:389:instart'
from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.0/bin/bundle:13
from /usr/bin/bundle:19:in `load'
from /usr/bin/bundle:19
Thanks in advance
~D
This is a connection issue. Try running the command again will install the gem.