2013-04-21 17 views
8

Đang cố gắng để có được save_and_open_page làm việc tại tất cả mang lại cho tôi những lỗi sau:Launchy :: ApplicationNotFoundError:

1) index page my first test 
Failure/Error: save_and_open_page 
Launchy::ApplicationNotFoundError: 
    No application found to handle 'C:/Sites/Sublist_v2/tmp/capybara/capybara-201304211638563116158687.html' 
# ./spec/features/comics_page_spec.rb:6:in `block (2 levels) in <top (required)>' 

Spec:

require 'spec_helper' 

feature 'index page' do 
    scenario "my first test" do 
    visit root_path 
    save_and_open_page 
    # Launchy.open('http://stackoverflow.com') 
    end 
end 

Nếu tôi bỏ ghi chú dòng Launchy nó ​​hoạt động tốt, vì vậy tôi 'm không chắc chắn những gì rắc rối là ... có thể là một vấn đề với đường dẫn c:/?

Gemfile

group :development, :test do 
    gem 'spork-rails' 
    gem 'rspec-rails' 
    gem 'factory_girl_rails' 
end 

group :test do 
    gem 'faker' 
    gem 'capybara' 
    gem 'launchy' 
    gem 'database_cleaner' 
    gem 'shoulda-matchers' 
end 
+0

thú vị là tôi có thể sao chép và dán đường dẫn thông báo lỗi vào trình duyệt và xem trang. – tehfailsafe

+0

Tôi có cùng một vấn đề. Một điều tôi nhận thấy là khi tôi sao chép url và chạy nó trong commandline với 'launchy C:/Sites/...' Tôi nhận được cùng một lỗi, nhưng khi tôi đặt 'file: ///' trước 'C:' , nó hoạt động. – Matt

+0

Có cùng một vấn đề. Nó đã hoạt động trước đó. Không chắc liệu lỗi có liên quan đến việc chạy cập nhật gói hay không. – user938363

Trả lời

7

Điều này là do các ký tự ổ đĩa trong đường dẫn tập tin đang được sai xác định là một phần của một chương trình uri.

Bạn có thể tạm thời khắc phục nó bằng cách thay đổi dòng 12 trong /launchy/lib/launchy/applications/browser.rb từ:

return true if File.exist?(uri.path) and uri.scheme.nil?

để

return true if File.exist?(uri.path) && !schemes.include?(uri.scheme)

+1

Giải pháp đã được xác minh và nó hoạt động. Vui lòng đánh dấu nó là câu trả lời để Brad có thể nhận điểm thưởng. Cảm ơn. – user938363

+0

Bạn được chào đón! –

+0

Cảm ơn bạn! – tehfailsafe

5

Tôi là tác giả của Launchy, và chỉ thông báo về vấn đề này. Tôi thường sửa lỗi thông qua GitHub và đã đặt vấn đề này ở đó. Issue #65

Bất cứ lúc nào bạn gặp một vấn đề với Launchy, xin vui lòng bật Launchy gỡ lỗi và file an issue with the project on github

Bạn có thể có thể bật gỡ lỗi Launchy bằng cách thiết lập các biến môi trường LAUNCHY_DEBUG=true. Bạn có thể làm điều này hoặc từ trình bao, hoặc thông qua mã ruby ​​nếu bạn đang nhúng khởi chạy trong ứng dụng của bạn.

% export LAUNCHY_DEBUG=true 
% launchy http://stackoverflow.com/questions/16137410/launchyapplicationnotfounderror 
AUNCHY_DEBUG: URI parsing pass 1 : http://stackoverflow.com/questions/16137410/launchyapplicationnotfounderror -> {:scheme=>"http", :user=>nil, :password=>nil, :host=>"stackoverflow.com", :port=>nil, :path=>"https://stackoverflow.com/questions/16137410/launchyapplicationnotfounderror", :query=>nil, :fragment=>nil} 
LAUNCHY_DEBUG: Checking if class Launchy::Application::Browser is the one for handles?(http://stackoverflow.com/questions/16137410/launchyapplicationnotfounderror)} 
LAUNCHY_DEBUG: Checking if class Launchy::Detect::HostOsFamily::Windows is the one for matches?(darwin12.2.0)} 
LAUNCHY_DEBUG: Checking if class Launchy::Detect::HostOsFamily::Darwin is the one for matches?(darwin12.2.0)} 
LAUNCHY_DEBUG: Checking if class Launchy::Detect::RubyEngine::Mri is the one for is_current_engine?(ruby)} 
LAUNCHY_DEBUG: Checking if class Launchy::Detect::HostOsFamily::Windows is the one for matches?(darwin12.2.0)} 
LAUNCHY_DEBUG: Checking if class Launchy::Detect::HostOsFamily::Darwin is the one for matches?(darwin12.2.0)} 
LAUNCHY_DEBUG: Checking if class Launchy::Detect::RubyEngine::Mri is the one for is_current_engine?(ruby)} 
LAUNCHY_DEBUG: Launchy::Application : found executable /usr/bin/open 
LAUNCHY_DEBUG: Launchy::Application::Browser : possibility : /usr/bin/open 
LAUNCHY_DEBUG: Launchy::Application::Browser : Using browser value '/usr/bin/open' 
LAUNCHY_DEBUG: wet_run: before exec in child process 
LAUNCHY_DEBUG: commandline_normalized => /usr/bin/open http://stackoverflow.com/questions/16137410/launchyapplicationnotfounderror 

Hoặc nếu bạn đang nhúng Launchy:

% irb 
>> require 'launchy' 
>> ENV['LAUNCHY_DEBUG']="true" 
>> Launchy.open("http://stackoverflow.com/questions/16137410/launchyapplicationnotfounderror") 
LAUNCHY_DEBUG: URI parsing pass 1 : http://stackoverflow.com/questions/16137410/launchyapplicationnotfounderror -> {:scheme=>"http", :user=>nil, :password=>nil, :host=>"stackoverflow.com", :port=>nil, :path=>"https://stackoverflow.com/questions/16137410/launchyapplicationnotfounderror", :query=>nil, :fragment=>nil} 
LAUNCHY_DEBUG: Checking if class Launchy::Application::Browser is the one for handles?(http://stackoverflow.com/questions/16137410/launchyapplicationnotfounderror)} 
LAUNCHY_DEBUG: Checking if class Launchy::Detect::HostOsFamily::Windows is the one for matches?(darwin12.2.0)} 
LAUNCHY_DEBUG: Checking if class Launchy::Detect::HostOsFamily::Darwin is the one for matches?(darwin12.2.0)} 
LAUNCHY_DEBUG: Checking if class Launchy::Detect::RubyEngine::Mri is the one for is_current_engine?(ruby)} 
LAUNCHY_DEBUG: Checking if class Launchy::Detect::HostOsFamily::Windows is the one for matches?(darwin12.2.0)} 
LAUNCHY_DEBUG: Checking if class Launchy::Detect::HostOsFamily::Darwin is the one for matches?(darwin12.2.0)} 
LAUNCHY_DEBUG: Checking if class Launchy::Detect::RubyEngine::Mri is the one for is_current_engine?(ruby)} 
LAUNCHY_DEBUG: Launchy::Application : found executable /usr/bin/open 
LAUNCHY_DEBUG: Launchy::Application::Browser : possibility : /usr/bin/open 
LAUNCHY_DEBUG: Launchy::Application::Browser : Using browser value '/usr/bin/open' 
LAUNCHY_DEBUG: wet_run: before exec in child process 
>> LAUNCHY_DEBUG: commandline_normalized => /usr/bin/open http://stackoverflow.com/questions/16137410/launchyapplicationnotfounderror 
+0

Cảm ơn bạn đã trả lời. Bên dưới là đầu ra gỡ lỗi: – user938363

+0

Cũng thông báo ngay bây giờ save_and_open_page không tạo ra bất kỳ lỗi nào. Nhưng không có trang nào hiển thị tốt với rspec. – user938363

+0

@copiousfreetime Bạn có thể vui lòng hướng dẫn tôi về vấn đề này, nếu không thể tìm thấy bất kỳ liên kết nào cho phép có lỗi đánh máy thì có phương pháp nào có sẵn cho phép tìm kiếm "từ hoặc liên kết" – Abhinay

1

Tôi chỉ có phải làm:

fileUri = 'file:///' + outputFile.path 

Launchy.open(fileUri) 

lưu ý ba dấu gạch chéo sau "tệp:". Điều này là với github-markdown-0.5.5 trên Windows 8.