capybara-remote-viewer 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +17 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +70 -0
- data/Rakefile +1 -0
- data/bin/capy-remote +9 -0
- data/capybara-remote-viewer.gemspec +29 -0
- data/lib/capybara/remote/viewer/cli.rb +27 -0
- data/lib/capybara/remote/viewer/server.rb +56 -0
- data/lib/capybara/remote/viewer/version.rb +7 -0
- data/lib/capybara/remote/viewer.rb +9 -0
- data/spec/capybara/remote/viewer/server_spec.rb +38 -0
- data/spec/dummy/Gemfile +47 -0
- data/spec/dummy/README.rdoc +28 -0
- data/spec/dummy/Rakefile +6 -0
- data/spec/dummy/app/assets/images/.keep +0 -0
- data/spec/dummy/app/assets/javascripts/application.js +16 -0
- data/spec/dummy/app/assets/stylesheets/application.css +13 -0
- data/spec/dummy/app/controllers/application_controller.rb +5 -0
- data/spec/dummy/app/controllers/concerns/.keep +0 -0
- data/spec/dummy/app/helpers/application_helper.rb +2 -0
- data/spec/dummy/app/mailers/.keep +0 -0
- data/spec/dummy/app/models/.keep +0 -0
- data/spec/dummy/app/models/concerns/.keep +0 -0
- data/spec/dummy/app/views/layouts/application.html.erb +14 -0
- data/spec/dummy/bin/bundle +3 -0
- data/spec/dummy/bin/rails +4 -0
- data/spec/dummy/bin/rake +4 -0
- data/spec/dummy/config/application.rb +23 -0
- data/spec/dummy/config/boot.rb +4 -0
- data/spec/dummy/config/cucumber.yml +8 -0
- data/spec/dummy/config/database.yml +28 -0
- data/spec/dummy/config/environment.rb +5 -0
- data/spec/dummy/config/environments/development.rb +29 -0
- data/spec/dummy/config/environments/production.rb +80 -0
- data/spec/dummy/config/environments/test.rb +36 -0
- data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
- data/spec/dummy/config/initializers/inflections.rb +16 -0
- data/spec/dummy/config/initializers/mime_types.rb +5 -0
- data/spec/dummy/config/initializers/secret_token.rb +12 -0
- data/spec/dummy/config/initializers/session_store.rb +3 -0
- data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/spec/dummy/config/locales/en.yml +23 -0
- data/spec/dummy/config/routes.rb +56 -0
- data/spec/dummy/config.ru +4 -0
- data/spec/dummy/db/seeds.rb +7 -0
- data/spec/dummy/features/support/env.rb +58 -0
- data/spec/dummy/lib/assets/.keep +0 -0
- data/spec/dummy/lib/tasks/.keep +0 -0
- data/spec/dummy/lib/tasks/cucumber.rake +65 -0
- data/spec/dummy/log/.keep +0 -0
- data/spec/dummy/log/development.log +0 -0
- data/spec/dummy/public/404.html +58 -0
- data/spec/dummy/public/422.html +58 -0
- data/spec/dummy/public/500.html +57 -0
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/dummy/public/robots.txt +5 -0
- data/spec/dummy/script/cucumber +10 -0
- data/spec/dummy/test/controllers/.keep +0 -0
- data/spec/dummy/test/fixtures/.keep +0 -0
- data/spec/dummy/test/helpers/.keep +0 -0
- data/spec/dummy/test/integration/.keep +0 -0
- data/spec/dummy/test/mailers/.keep +0 -0
- data/spec/dummy/test/models/.keep +0 -0
- data/spec/dummy/test/test_helper.rb +15 -0
- data/spec/dummy/vendor/assets/javascripts/.keep +0 -0
- data/spec/dummy/vendor/assets/stylesheets/.keep +0 -0
- data/spec/spec_helper.rb +6 -0
- data/static/application.js +18 -0
- data/views/index.haml +17 -0
- metadata +274 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: 4366c063b7cea76765fec03f548f0e3e037aec84
|
4
|
+
data.tar.gz: 54726e9078cfa0e27e4d6917872ef51a9277cf2a
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: ba8289e4502a9c6f9faf1b2a9ca0b5cf42540f2dfbf66c4539d9fe58b0ed28204cc124122c289d5951d4d4f2225df3118121791c5234e1b506e12d3f51e181e3
|
7
|
+
data.tar.gz: 1980572a2817a26cf4069f58ef8233b08506c52f33c1ad6a09894848ee246c3ea5165053a66b76f55fd4ffc393d5725f3069107389258df44100d3387479fe29
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2013 Derek Kastner
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,70 @@
|
|
1
|
+
# Capybara::Remote::Viewer
|
2
|
+
|
3
|
+
Capybara remote viewer runs a server that provides a navigable browser interface
|
4
|
+
to the HTML dumps generated by capybara's `save_page` helper. It is especially
|
5
|
+
useful if you're developing an app on a remote machine or working within a shell
|
6
|
+
that can't open a browser window on your desktop.
|
7
|
+
|
8
|
+
## Installation
|
9
|
+
|
10
|
+
Add this line to your application's Gemfile:
|
11
|
+
|
12
|
+
gem 'capybara-remote-viewer'
|
13
|
+
|
14
|
+
And then execute:
|
15
|
+
|
16
|
+
$ bundle
|
17
|
+
|
18
|
+
Or install it yourself as:
|
19
|
+
|
20
|
+
$ gem install capybara-remote-viewer
|
21
|
+
|
22
|
+
## Usage
|
23
|
+
|
24
|
+
### As a stand-alone binary
|
25
|
+
|
26
|
+
Start a server with:
|
27
|
+
$ capy-remote
|
28
|
+
|
29
|
+
It will start on port 3000 by default and look in the current working directory
|
30
|
+
(and all subdirectories) for any .html files to serve.
|
31
|
+
|
32
|
+
You can specify a path to a directory containing .html files with the -t option.
|
33
|
+
|
34
|
+
You can also specify the port with the -p option.
|
35
|
+
|
36
|
+
### With foreman
|
37
|
+
|
38
|
+
Add a binstub
|
39
|
+
|
40
|
+
$ bundle binstub capybara-remote-viewer
|
41
|
+
|
42
|
+
Add a line to your Procfile
|
43
|
+
|
44
|
+
capy: bin/capy-remote -t tmp -p $PORT
|
45
|
+
|
46
|
+
### Interface
|
47
|
+
|
48
|
+
All files dumped by capybara with the `save_page` method will automatically
|
49
|
+
appear in the viewer interface as they are generated. No need to refresh!
|
50
|
+
|
51
|
+
### Optional capybara configuration
|
52
|
+
|
53
|
+
Capybara does not clean up after itself when it dumps html files, so as these
|
54
|
+
files appear, they will fill up remote viewer's interface with old junk. You can
|
55
|
+
tell cucumber to clean these up before each run.
|
56
|
+
|
57
|
+
In features/support/capybara.rb:
|
58
|
+
|
59
|
+
AfterConfiguration do |config|
|
60
|
+
Dir.glob(File.expand_path('../../../tmp/capybara/*', __FILE__)).
|
61
|
+
each { |f| FileUtils.rm_f f }
|
62
|
+
end
|
63
|
+
|
64
|
+
## Contributing
|
65
|
+
|
66
|
+
1. Fork it
|
67
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
68
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
69
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
70
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
data/bin/capy-remote
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'capybara/remote/viewer/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "capybara-remote-viewer"
|
8
|
+
spec.version = Capybara::Remote::Viewer::VERSION
|
9
|
+
spec.authors = ["Derek Kastner"]
|
10
|
+
spec.email = ["dkastner@gmail.com"]
|
11
|
+
spec.description = %q{View capybara page dumps remotely}
|
12
|
+
spec.summary = %q{A web server that looks for capybara's saved output and makes them available to remotely connected developers}
|
13
|
+
spec.homepage = "http://github.com/dkastner/capybara-remote-viewer"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files`.split($/)
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_dependency 'haml'
|
22
|
+
spec.add_dependency 'sinatra'
|
23
|
+
spec.add_dependency 'thor'
|
24
|
+
|
25
|
+
spec.add_development_dependency "bundler", "~> 1.3"
|
26
|
+
spec.add_development_dependency "rake"
|
27
|
+
spec.add_development_dependency "rack-test"
|
28
|
+
spec.add_development_dependency "rspec"
|
29
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require 'thor'
|
2
|
+
|
3
|
+
module Capybara
|
4
|
+
module Remote
|
5
|
+
module Viewer
|
6
|
+
class CLI < Thor
|
7
|
+
|
8
|
+
desc 'serve', 'Run the web server'
|
9
|
+
method_option :path, type: :string, default: nil, aliases: '-t',
|
10
|
+
desc: "Path to your app's tmp directory, or any directory containing html files"
|
11
|
+
method_option :port, type: :numeric, default: 3000, aliases: '-p',
|
12
|
+
desc: "Port for the server to listen on"
|
13
|
+
def serve
|
14
|
+
path = options.path || File.join(Dir.pwd, 'tmp')
|
15
|
+
|
16
|
+
require 'capybara/remote/viewer/server'
|
17
|
+
|
18
|
+
Capybara::Remote::Viewer::Server.path = path
|
19
|
+
Capybara::Remote::Viewer::Server.set :port, options.port
|
20
|
+
Capybara::Remote::Viewer::Server.run!
|
21
|
+
end
|
22
|
+
|
23
|
+
default_task :serve
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,56 @@
|
|
1
|
+
require 'sinatra/base'
|
2
|
+
require 'haml'
|
3
|
+
require 'json'
|
4
|
+
|
5
|
+
module Capybara
|
6
|
+
module Remote
|
7
|
+
module Viewer
|
8
|
+
class Server < Sinatra::Base
|
9
|
+
|
10
|
+
def self.path
|
11
|
+
@path
|
12
|
+
end
|
13
|
+
def self.path=(val)
|
14
|
+
@path = val
|
15
|
+
end
|
16
|
+
|
17
|
+
set :views, File.expand_path('../../../../../views', __FILE__)
|
18
|
+
set :public_folder, File.expand_path('../../../../../static', __FILE__)
|
19
|
+
|
20
|
+
def files
|
21
|
+
Dir.glob File.join(Server.path, '**/*.html')
|
22
|
+
end
|
23
|
+
|
24
|
+
def file(id)
|
25
|
+
files.find { |f| f =~ /#{id}.html$/ }
|
26
|
+
end
|
27
|
+
|
28
|
+
def file_path(str)
|
29
|
+
"/files/#{file_name(str)}"
|
30
|
+
end
|
31
|
+
|
32
|
+
def file_name(str)
|
33
|
+
File.basename(str, '.html')
|
34
|
+
end
|
35
|
+
|
36
|
+
get '/' do
|
37
|
+
haml :index, locals: { dir: Server.path, files: files }
|
38
|
+
end
|
39
|
+
|
40
|
+
get '/files' do
|
41
|
+
headers 'Content-Type' => 'application/json'
|
42
|
+
|
43
|
+
list = files.map do |file|
|
44
|
+
{ name: file_name(file), url: file_path(file) }
|
45
|
+
end
|
46
|
+
|
47
|
+
{ files: list }.to_json
|
48
|
+
end
|
49
|
+
|
50
|
+
get '/files/:id' do
|
51
|
+
File.read file(params['id'])
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'rack/test'
|
3
|
+
require 'capybara/remote/viewer/server'
|
4
|
+
|
5
|
+
describe Capybara::Remote::Viewer::Server do
|
6
|
+
include Rack::Test::Methods
|
7
|
+
|
8
|
+
before(:all) do
|
9
|
+
Capybara::Remote::Viewer::Server.
|
10
|
+
set :path, File.expand_path('../../../../dummy', __FILE__)
|
11
|
+
end
|
12
|
+
|
13
|
+
def app
|
14
|
+
Capybara::Remote::Viewer::Server
|
15
|
+
end
|
16
|
+
|
17
|
+
describe 'GET /' do
|
18
|
+
|
19
|
+
it 'links to existing files' do
|
20
|
+
get '/'
|
21
|
+
|
22
|
+
last_response.body.should =~ %r{<a href='/files/1'>1</a>}
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
26
|
+
|
27
|
+
describe 'GET /files/1' do
|
28
|
+
|
29
|
+
it 'displays the content of a capybara dump' do
|
30
|
+
get '/files/1'
|
31
|
+
|
32
|
+
last_response.body.should =~ %r{First dump}
|
33
|
+
end
|
34
|
+
|
35
|
+
end
|
36
|
+
|
37
|
+
end
|
38
|
+
|
data/spec/dummy/Gemfile
ADDED
@@ -0,0 +1,47 @@
|
|
1
|
+
source 'https://rubygems.org'
|
2
|
+
|
3
|
+
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
|
4
|
+
gem 'rails', '4.0.1'
|
5
|
+
|
6
|
+
# Use sqlite3 as the database for Active Record
|
7
|
+
gem 'sqlite3'
|
8
|
+
|
9
|
+
# Use SCSS for stylesheets
|
10
|
+
gem 'sass-rails', '~> 4.0.0'
|
11
|
+
|
12
|
+
# Use Uglifier as compressor for JavaScript assets
|
13
|
+
gem 'uglifier', '>= 1.3.0'
|
14
|
+
|
15
|
+
# Use CoffeeScript for .js.coffee assets and views
|
16
|
+
gem 'coffee-rails', '~> 4.0.0'
|
17
|
+
|
18
|
+
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
|
19
|
+
# gem 'therubyracer', platforms: :ruby
|
20
|
+
|
21
|
+
# Use jquery as the JavaScript library
|
22
|
+
gem 'jquery-rails'
|
23
|
+
|
24
|
+
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
|
25
|
+
gem 'turbolinks'
|
26
|
+
|
27
|
+
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
|
28
|
+
gem 'jbuilder', '~> 1.2'
|
29
|
+
|
30
|
+
group :doc do
|
31
|
+
# bundle exec rake doc:rails generates the API under doc/api.
|
32
|
+
gem 'sdoc', require: false
|
33
|
+
end
|
34
|
+
|
35
|
+
# Use ActiveModel has_secure_password
|
36
|
+
# gem 'bcrypt-ruby', '~> 3.1.2'
|
37
|
+
|
38
|
+
# Use unicorn as the app server
|
39
|
+
# gem 'unicorn'
|
40
|
+
|
41
|
+
# Use Capistrano for deployment
|
42
|
+
# gem 'capistrano', group: :development
|
43
|
+
|
44
|
+
# Use debugger
|
45
|
+
# gem 'debugger', group: [:development, :test]
|
46
|
+
|
47
|
+
gem 'cucumber-rails'
|
@@ -0,0 +1,28 @@
|
|
1
|
+
== README
|
2
|
+
|
3
|
+
This README would normally document whatever steps are necessary to get the
|
4
|
+
application up and running.
|
5
|
+
|
6
|
+
Things you may want to cover:
|
7
|
+
|
8
|
+
* Ruby version
|
9
|
+
|
10
|
+
* System dependencies
|
11
|
+
|
12
|
+
* Configuration
|
13
|
+
|
14
|
+
* Database creation
|
15
|
+
|
16
|
+
* Database initialization
|
17
|
+
|
18
|
+
* How to run the test suite
|
19
|
+
|
20
|
+
* Services (job queues, cache servers, search engines, etc.)
|
21
|
+
|
22
|
+
* Deployment instructions
|
23
|
+
|
24
|
+
* ...
|
25
|
+
|
26
|
+
|
27
|
+
Please feel free to use a different markup language if you do not plan to run
|
28
|
+
<tt>rake doc:app</tt>.
|
data/spec/dummy/Rakefile
ADDED
File without changes
|
@@ -0,0 +1,16 @@
|
|
1
|
+
// This is a manifest file that'll be compiled into application.js, which will include all the files
|
2
|
+
// listed below.
|
3
|
+
//
|
4
|
+
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
|
5
|
+
// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
|
6
|
+
//
|
7
|
+
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
|
8
|
+
// compiled file.
|
9
|
+
//
|
10
|
+
// Read Sprockets README (https://github.com/sstephenson/sprockets#sprockets-directives) for details
|
11
|
+
// about supported directives.
|
12
|
+
//
|
13
|
+
//= require jquery
|
14
|
+
//= require jquery_ujs
|
15
|
+
//= require turbolinks
|
16
|
+
//= require_tree .
|
@@ -0,0 +1,13 @@
|
|
1
|
+
/*
|
2
|
+
* This is a manifest file that'll be compiled into application.css, which will include all the files
|
3
|
+
* listed below.
|
4
|
+
*
|
5
|
+
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
|
6
|
+
* or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
|
7
|
+
*
|
8
|
+
* You're free to add application-wide styles to this file and they'll appear at the top of the
|
9
|
+
* compiled file, but it's generally better to create a new file per style scope.
|
10
|
+
*
|
11
|
+
*= require_self
|
12
|
+
*= require_tree .
|
13
|
+
*/
|