serve_dir 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +3 -0
- data/Gemfile.lock +22 -0
- data/README.mkd +54 -0
- data/Rakefile +2 -0
- data/bin/serve_dir +33 -0
- data/config.ru +0 -0
- data/lib/serve_dir/version.rb +3 -0
- data/serve_dir.gemspec +20 -0
- metadata +89 -0
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
serve_dir (0.0.1)
|
5
|
+
launchy (~> 2.1.0)
|
6
|
+
rack (~> 1.4.1)
|
7
|
+
slop (~> 2)
|
8
|
+
|
9
|
+
GEM
|
10
|
+
remote: http://rubygems.org/
|
11
|
+
specs:
|
12
|
+
addressable (2.2.7)
|
13
|
+
launchy (2.1.0)
|
14
|
+
addressable (~> 2.2.6)
|
15
|
+
rack (1.4.1)
|
16
|
+
slop (2.4.4)
|
17
|
+
|
18
|
+
PLATFORMS
|
19
|
+
ruby
|
20
|
+
|
21
|
+
DEPENDENCIES
|
22
|
+
serve_dir!
|
data/README.mkd
ADDED
@@ -0,0 +1,54 @@
|
|
1
|
+
serve_dir
|
2
|
+
=========
|
3
|
+
|
4
|
+
Suppose you are practicing JavaScript and Ajax.
|
5
|
+
|
6
|
+
* a.html
|
7
|
+
* b.js
|
8
|
+
* c.txt : loaded by b.js with Ajax
|
9
|
+
|
10
|
+
First you open a.html and notice c.txt can't be loaded:
|
11
|
+
|
12
|
+
XMLHttpRequest cannot load file:///somewhere/c.txt. Origin null is not allowed by Access-Control-Allow-Origin.
|
13
|
+
|
14
|
+
Then you can type
|
15
|
+
|
16
|
+
$ gem i serve_dir
|
17
|
+
$ serve_dir .
|
18
|
+
|
19
|
+
and open http://localhost:8181/a.html .
|
20
|
+
|
21
|
+
Requirements
|
22
|
+
============
|
23
|
+
|
24
|
+
Ruby 1.9 (Don't know if it works with 1.8)
|
25
|
+
|
26
|
+
Install
|
27
|
+
=======
|
28
|
+
|
29
|
+
$ gem i serve_dir
|
30
|
+
|
31
|
+
Usage
|
32
|
+
=====
|
33
|
+
|
34
|
+
serve_dir DIR [OPTIONS]
|
35
|
+
|
36
|
+
OPTIONS:
|
37
|
+
|
38
|
+
* -p, --port=PORT : http port (default: 8181)
|
39
|
+
* -O, --no-open : don't open browser (default: open browser automatically)
|
40
|
+
* -h, --help : show help
|
41
|
+
|
42
|
+
License
|
43
|
+
=======
|
44
|
+
|
45
|
+
MIT
|
46
|
+
|
47
|
+
Contact
|
48
|
+
=======
|
49
|
+
|
50
|
+
https://github.com/yhara/serve_dir
|
51
|
+
|
52
|
+
Yutaka HARA (yhara)
|
53
|
+
|
54
|
+
twitter: @yhara_en
|
data/Rakefile
ADDED
data/bin/serve_dir
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'rack'
|
3
|
+
require 'rack/directory'
|
4
|
+
require 'slop'
|
5
|
+
require 'launchy'
|
6
|
+
|
7
|
+
opts = Slop.parse!(ARGV){
|
8
|
+
banner "usage: serve_dir DIR [OPTIONS]"
|
9
|
+
on "-p", "--port=", 'http port (default: 8181)', as: :int
|
10
|
+
on "-O", "--no-open", "don't open browser"
|
11
|
+
on "-h", "--help" do
|
12
|
+
puts self.help
|
13
|
+
exit
|
14
|
+
end
|
15
|
+
}
|
16
|
+
if ARGV.size == 0
|
17
|
+
puts opts.help
|
18
|
+
exit
|
19
|
+
end
|
20
|
+
|
21
|
+
dir = File.expand_path(ARGV[0] || Dir.pwd)
|
22
|
+
app = Rack::Builder.app{
|
23
|
+
use Rack::CommonLogger
|
24
|
+
use Rack::ShowExceptions
|
25
|
+
run Rack::Directory.new(dir)
|
26
|
+
}
|
27
|
+
|
28
|
+
port = opts[:port] || 8181
|
29
|
+
url = "http://localhost:#{port}/"
|
30
|
+
puts "Open #{url}"
|
31
|
+
Launchy.open(url) unless opts["no-open"]
|
32
|
+
|
33
|
+
Rack::Server.start(:app => app, :Port => port)
|
data/config.ru
ADDED
File without changes
|
data/serve_dir.gemspec
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
require File.expand_path('../lib/serve_dir/version', __FILE__)
|
2
|
+
|
3
|
+
Gem::Specification.new do |gem|
|
4
|
+
gem.authors = ["Yutaka HARA"]
|
5
|
+
gem.email = ["yutaka.hara.gmail.com"]
|
6
|
+
gem.description = %q{myrurema provides a command 'rurema', which helps searching/browsing/writing the Japanese Ruby documents (a.k.a Rurema http://bugs.ruby-lang.org/projects/rurema/wiki .)}
|
7
|
+
gem.summary = %q{Serves current directory at http://localhost:8181/}
|
8
|
+
gem.homepage = 'http://github.com/yhara/serve_dir'
|
9
|
+
|
10
|
+
gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
11
|
+
gem.files = `git ls-files`.split("\n")
|
12
|
+
gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
13
|
+
gem.name = "serve_dir"
|
14
|
+
gem.require_paths = ['lib']
|
15
|
+
gem.version = ServeDir::VERSION
|
16
|
+
|
17
|
+
gem.add_dependency("slop", "~> 2")
|
18
|
+
gem.add_dependency("rack", "~> 1.4.1")
|
19
|
+
gem.add_dependency("launchy", "~> 2.1.0")
|
20
|
+
end
|
metadata
ADDED
@@ -0,0 +1,89 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: serve_dir
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Yutaka HARA
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2012-04-09 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: slop
|
16
|
+
requirement: &2152937080 !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ~>
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '2'
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: *2152937080
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: rack
|
27
|
+
requirement: &2152936580 !ruby/object:Gem::Requirement
|
28
|
+
none: false
|
29
|
+
requirements:
|
30
|
+
- - ~>
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: 1.4.1
|
33
|
+
type: :runtime
|
34
|
+
prerelease: false
|
35
|
+
version_requirements: *2152936580
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: launchy
|
38
|
+
requirement: &2152936100 !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
40
|
+
requirements:
|
41
|
+
- - ~>
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: 2.1.0
|
44
|
+
type: :runtime
|
45
|
+
prerelease: false
|
46
|
+
version_requirements: *2152936100
|
47
|
+
description: myrurema provides a command 'rurema', which helps searching/browsing/writing
|
48
|
+
the Japanese Ruby documents (a.k.a Rurema http://bugs.ruby-lang.org/projects/rurema/wiki
|
49
|
+
.)
|
50
|
+
email:
|
51
|
+
- yutaka.hara.gmail.com
|
52
|
+
executables:
|
53
|
+
- serve_dir
|
54
|
+
extensions: []
|
55
|
+
extra_rdoc_files: []
|
56
|
+
files:
|
57
|
+
- Gemfile
|
58
|
+
- Gemfile.lock
|
59
|
+
- README.mkd
|
60
|
+
- Rakefile
|
61
|
+
- bin/serve_dir
|
62
|
+
- config.ru
|
63
|
+
- lib/serve_dir/version.rb
|
64
|
+
- serve_dir.gemspec
|
65
|
+
homepage: http://github.com/yhara/serve_dir
|
66
|
+
licenses: []
|
67
|
+
post_install_message:
|
68
|
+
rdoc_options: []
|
69
|
+
require_paths:
|
70
|
+
- lib
|
71
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
72
|
+
none: false
|
73
|
+
requirements:
|
74
|
+
- - ! '>='
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: '0'
|
77
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
78
|
+
none: false
|
79
|
+
requirements:
|
80
|
+
- - ! '>='
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
requirements: []
|
84
|
+
rubyforge_project:
|
85
|
+
rubygems_version: 1.8.11
|
86
|
+
signing_key:
|
87
|
+
specification_version: 3
|
88
|
+
summary: Serves current directory at http://localhost:8181/
|
89
|
+
test_files: []
|