Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Launchy.open( uri ) #29

Closed
davemake opened this issue Jul 20, 2011 · 8 comments
Closed

Launchy.open( uri ) #29

davemake opened this issue Jul 20, 2011 · 8 comments
Assignees

Comments

@davemake
Copy link

#### So, I got this through autotest,

WARNING: You made a call to a deprecated Launchy API. This call should be changed to 'Launchy.open( uri )'
WARNING: I think I was able to find the location that needs to be fixed. Please go look at:
WARNING:
WARNING: /home/Dave/.rvm/gems/ruby-1.9.2-p180/gems/capybara-1.0.0/lib/capybara/util/save_and_open_page.rb:26:in open_in_browser' WARNING: def open_in_browser(path) # :nodoc WARNING: require "launchy" WARNING: Launchy::Browser.run(path) WARNING: rescue LoadError WARNING: warn "Sorry, you need to install launchy (gem install launchy`) and " <<
WARNING:
WARNING: If this is not the case, please file a bug. Please file a bug at https://github.com/copiousfreetime/launchy/issues/new
Failure in opening /home/Dave/Rails/socapp/tmp/capybara/capybara-201107201002297103564985.html with options {}: No application found to handle scheme ''. Known schemes: file, ftp, http, https

######### Then I did this,

/home/Dave/.rvm/gems/ruby-1.9.2-p180/gems/capybara-1.0.0/lib/capybara/util/save_and_open_page.rb

24 def open_in_browser(path) # :nodoc
25 require "launchy"
26 #Launchy.open( uri )
27 Launchy::Browser.run(path)
28 rescue LoadError
29 warn "Sorry, you need to install launchy (gem install launchy) and " <<
30 "make sure it's available to open pages with save_and_open_page."
31 end

24 def open_in_browser(path) # :nodoc
25 require "launchy"
26 Launchy.open( uri )
27 #Launchy::Browser.run(path)
28 rescue LoadError
29 warn "Sorry, you need to install launchy (gem install launchy) and " <<
30 "make sure it's available to open pages with save_and_open_page."
31 end

################ Then I got this through autotest,
  undefined local variable or method `uri' for Capybara:Module (NameError)

Any thoughts?

@copiousfreetime
Copy link
Owner

You did almost the correct update, that should be

Launchy.open( path )

not

Launchy.open( uri )

The parameter that was passed to Launchy::Browser.run was 'path' not 'uri'

You may still get an error, because capybara is opening up a file and not a uri. And that is a bug that I will be fixing this week.

@copiousfreetime
Copy link
Owner

This will go out with the next release of launchy

jsonn pushed a commit to jsonn/pkgsrc that referenced this issue Aug 12, 2011
== Version 2.0.5 - 2011-07-24

* Fix the case where $BROWSER is set and no *nix desktop was found
  (copiousfreetime/launchy#33)

== Version 2.0.4 - 2011-07-23

* Fix windows 'start' commandline (copiousfreetime/launchy#5)
* Add capability to open local files with no file: scheme present
  (copiousfreetime/launchy#29)
* Added 'rake how_to_contribute' task (copiousfreetime/launchy#30)
* Make better decisions on when to do shell escaping
  (copiousfreetime/launchy#31)
* Switch to Addressable::URI so UTF-8 urls may be
  parsed. (copiousfreetime/launchy#32)

== Version 2.0.3 - 2011-07-17

* Add in Deprecated API wrappers that warn the user

== Version 2.0.2 - 2011-07-17

* Typo fixes from @mtorrent
* Documentation updates explicitly stating the Public API
* Increase test coverage

== Version 2.0.1 - 2011-07-16

* Almost a complete rewrite
* JRuby Support
* Organization is such that it will be easier to add additional applications
* Windows behavior possibly fixed, again

== Version 1.0.0 - 2011-03-17

* Add JRuby support (Stephen Judkins)
* Remove unused Paths module
* Switch to using bones
* Switch to use minitest
* NOTE, this version was never released.
@lgrains
Copy link

lgrains commented Aug 22, 2011

After making the changes described above, I'm getting this error:

[540]berklee@bizops:/web/bizops-dev git:dev$ cucumber features/leads/index.feature:21
Using the default profile...
.........sh: xprop: not found
/home/berklee/.rvm/gems/ruby-1.9.2-p180/gems/activesupport-3.1.0.rc4/lib/active_support/whiny_nil.rb:48:in method_missing': undefined methodshellsplit' for nil:NilClass (NoMethodError)
from /home/berklee/.rvm/gems/ruby-1.9.2-p180/gems/launchy-2.0.5/lib/launchy/detect/runner.rb:41:in shell_commands' from /home/berklee/.rvm/gems/ruby-1.9.2-p180/gems/launchy-2.0.5/lib/launchy/detect/runner.rb:104:inblock in wet_run'
from /home/berklee/.rvm/gems/ruby-1.9.2-p180/gems/launchy-2.0.5/lib/launchy/detect/runner.rb:103:in fork' from /home/berklee/.rvm/gems/ruby-1.9.2-p180/gems/launchy-2.0.5/lib/launchy/detect/runner.rb:103:inwet_run'
from /home/berklee/.rvm/gems/ruby-1.9.2-p180/gems/launchy-2.0.5/lib/launchy/detect/runner.rb:61:in run' from /home/berklee/.rvm/gems/ruby-1.9.2-p180/gems/launchy-2.0.5/lib/launchy/application.rb:58:inrun'
from /home/berklee/.rvm/gems/ruby-1.9.2-p180/gems/launchy-2.0.5/lib/launchy/applications/browser.rb:76:in open' from /home/berklee/.rvm/gems/ruby-1.9.2-p180/gems/launchy-2.0.5/lib/launchy.rb:30:inopen'
from /home/berklee/.rvm/gems/ruby-1.9.2-p180/gems/capybara-1.0.0/lib/capybara/util/save_and_open_page.rb:26:in open_in_browser' from /home/berklee/.rvm/gems/ruby-1.9.2-p180/gems/capybara-1.0.0/lib/capybara/util/save_and_open_page.rb:19:insave_and_open_page'
from /home/berklee/.rvm/gems/ruby-1.9.2-p180/gems/capybara-1.0.0/lib/capybara/session.rb:283:in save_and_open_page' from /home/berklee/.rvm/gems/ruby-1.9.2-p180/gems/capybara-1.0.0/lib/capybara/dsl.rb:139:insave_and_open_page'
from /mnt/hgfs/bizops/features/step_definitions/web_steps.rb:210:in block in <top (required)>' from /home/berklee/.rvm/gems/ruby-1.9.2-p180/gems/cucumber-1.0.0/lib/cucumber/core_ext/instance_exec.rb:48:ininstance_exec'
. . .

It appears I'm still stuck in getting "Then show me the page" to work with Launchy

@copiousfreetime
Copy link
Owner

Can you run the following and paste the output here?

LAUNCHY_DEBUG=true cucumber features/leads/index.feature:21

And also:

ruby -rrbconfig -e "puts ::RbConfig::CONFIG['host_os']"

@copiousfreetime
Copy link
Owner

I haven't heard anything further on this issue. Are you still having a problem? If not I'll close this issue next week.

@mfn
Copy link

mfn commented Jan 26, 2012

While testing out https://github.com/gitlabhq/gitlabhq I came across this issue while playing around with it; this problem has nothing to do with gitlabhq, it's just that with latest launch due their Gemlock I can see this:

gitlab@vserv03:~/gitlabhq$ bundle exec launchy http://slashdot.org/
sh: xprop: not found
/home/gitlab/gitlabhq/vendor/bundle/ruby/1.9.1/gems/launchy-2.0.5/lib/launchy/detect/runner.rb:41:in `shell_commands': undefined method `shellsplit' for nil:NilClass (NoMethodError)
        from /home/gitlab/gitlabhq/vendor/bundle/ruby/1.9.1/gems/launchy-2.0.5/lib/launchy/detect/runner.rb:104:in `block in wet_run'
        from /home/gitlab/gitlabhq/vendor/bundle/ruby/1.9.1/gems/launchy-2.0.5/lib/launchy/detect/runner.rb:103:in `fork'
        from /home/gitlab/gitlabhq/vendor/bundle/ruby/1.9.1/gems/launchy-2.0.5/lib/launchy/detect/runner.rb:103:in `wet_run'
        from /home/gitlab/gitlabhq/vendor/bundle/ruby/1.9.1/gems/launchy-2.0.5/lib/launchy/detect/runner.rb:61:in `run'
        from /home/gitlab/gitlabhq/vendor/bundle/ruby/1.9.1/gems/launchy-2.0.5/lib/launchy/application.rb:58:in `run'
        from /home/gitlab/gitlabhq/vendor/bundle/ruby/1.9.1/gems/launchy-2.0.5/lib/launchy/applications/browser.rb:76:in `open'
        from /home/gitlab/gitlabhq/vendor/bundle/ruby/1.9.1/gems/launchy-2.0.5/lib/launchy.rb:30:in `open'
        from /home/gitlab/gitlabhq/vendor/bundle/ruby/1.9.1/gems/launchy-2.0.5/lib/launchy/cli.rb:72:in `good_run'
        from /home/gitlab/gitlabhq/vendor/bundle/ruby/1.9.1/gems/launchy-2.0.5/lib/launchy/cli.rb:80:in `run'
        from /home/gitlab/gitlabhq/vendor/bundle/ruby/1.9.1/gems/launchy-2.0.5/bin/launchy:4:in `<top (required)>'
        from /home/gitlab/gitlabhq/vendor/bundle/ruby/1.9.1/bin/launchy:19:in `load'
        from /home/gitlab/gitlabhq/vendor/bundle/ruby/1.9.1/bin/launchy:19:in `<main>'

It does not actually exhibit a real problem, it's just during e.g. loading the initial database there's seems to be something done using launchy which spams the screen full. After some searching I figured out it relates to launchy and did this simply test case.

I don't have cucumber installed, but I can give you the ruby output:

gitlab@vserv03:~/gitlabhq$ bundle exec ruby -rrbconfig -e "puts ::RbConfig::CONFIG['host_os']"
linux-gnu

This is a headless server so naturally there is no window manager installed thus no Xcfe and no xprop:

gitlab@vserv03:~/gitlabhq$ grep -r xprop *
vendor/bundle/ruby/1.9.1/gems/launchy-2.0.5/lib/launchy/detect/nix_desktop_environment.rb:        %x[ xprop -root _DT_SAVE_MODE | grep ' = \"xfce\"$' ].strip.size > 0

hth

@copiousfreetime
Copy link
Owner

the best help would be if you could run:

LAUNCHY_DEBUG=true bundle exec launch http://slashdot.org

It looks to me like on that machine launchy is unable to find a way to launch a browser. The debug will help me figure out what it is.

Also, if you could do a uname -a or similar so I could know what type of machine that is, that would help.

thanks, and we'll figure this out.

@copiousfreetime
Copy link
Owner

@mfn I somehow missed the bottom of your message.

I would expect Launchy to fail on a machine that had no browsers installed and now window manager. Launchy launches a browser, so i'm not sure what the goal of using launchy on a headless system would be.

I've put this in Issue #42 to deal with separately.

jsonn pushed a commit to jsonn/pkgsrc that referenced this issue Oct 11, 2014
== Version 2.0.5 - 2011-07-24

* Fix the case where $BROWSER is set and no *nix desktop was found
  (copiousfreetime/launchy#33)

== Version 2.0.4 - 2011-07-23

* Fix windows 'start' commandline (copiousfreetime/launchy#5)
* Add capability to open local files with no file: scheme present
  (copiousfreetime/launchy#29)
* Added 'rake how_to_contribute' task (copiousfreetime/launchy#30)
* Make better decisions on when to do shell escaping
  (copiousfreetime/launchy#31)
* Switch to Addressable::URI so UTF-8 urls may be
  parsed. (copiousfreetime/launchy#32)

== Version 2.0.3 - 2011-07-17

* Add in Deprecated API wrappers that warn the user

== Version 2.0.2 - 2011-07-17

* Typo fixes from @mtorrent
* Documentation updates explicitly stating the Public API
* Increase test coverage

== Version 2.0.1 - 2011-07-16

* Almost a complete rewrite
* JRuby Support
* Organization is such that it will be easier to add additional applications
* Windows behavior possibly fixed, again

== Version 1.0.0 - 2011-03-17

* Add JRuby support (Stephen Judkins)
* Remove unused Paths module
* Switch to using bones
* Switch to use minitest
* NOTE, this version was never released.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants