madride 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.
- data/.gitignore +17 -0
- data/.rspec +1 -0
- data/Gemfile +4 -0
- data/LICENSE +22 -0
- data/README.md +4 -0
- data/Rakefile +9 -0
- data/bin/madride +45 -0
- data/lib/madride.rb +10 -0
- data/lib/madride/environment.rb +13 -0
- data/lib/madride/server.rb +18 -0
- data/lib/madride/templates/slim.rb +11 -0
- data/lib/madride/version.rb +3 -0
- data/madride.gemspec +25 -0
- data/spec/.gitkeep +0 -0
- data/spec/fixtures/bar.js +1 -0
- data/spec/fixtures/foo.js +2 -0
- data/spec/fixtures/hello.html.slim +5 -0
- data/spec/server_spec.rb +29 -0
- data/spec/spec_helper.rb +32 -0
- metadata +157 -0
data/.gitignore
ADDED
data/.rspec
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--require './spec/spec_helper' --color --format documentation
|
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2012 Aleksey V Zapparov
|
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
data/Rakefile
ADDED
data/bin/madride
ADDED
@@ -0,0 +1,45 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
|
4
|
+
require 'optparse'
|
5
|
+
require 'madride'
|
6
|
+
|
7
|
+
|
8
|
+
environment = Madride::Environment.new Dir.pwd
|
9
|
+
options = {:Port => 3000}
|
10
|
+
|
11
|
+
|
12
|
+
OptionParser.new("", 24, ' ') do |opts|
|
13
|
+
opts.banner = "Usage: madride [options] [PATH ...]"
|
14
|
+
|
15
|
+
opts.separator ""
|
16
|
+
opts.separator "Options:"
|
17
|
+
|
18
|
+
opts.on("-h", "--host HOST", "listen on HOST (default: 0.0.0.0)") do |host|
|
19
|
+
options[:Host] = host
|
20
|
+
end
|
21
|
+
|
22
|
+
opts.on("-p", "--port PORT", "use PORT (default: 3000)") do |port|
|
23
|
+
options[:Port] = port
|
24
|
+
end
|
25
|
+
|
26
|
+
|
27
|
+
if ARGV.empty?
|
28
|
+
puts opts.help
|
29
|
+
exit
|
30
|
+
end
|
31
|
+
|
32
|
+
|
33
|
+
begin
|
34
|
+
opts.order(ARGV) do |path|
|
35
|
+
environment.append_path path
|
36
|
+
end
|
37
|
+
rescue OptionParser::ParseError => e
|
38
|
+
opts.warn e.message
|
39
|
+
puts opts.help
|
40
|
+
exit
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
|
45
|
+
Madride::Server.new(environment, options).start
|
data/lib/madride.rb
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
require "rack"
|
2
|
+
|
3
|
+
|
4
|
+
module Madride
|
5
|
+
class Server < Rack::Server
|
6
|
+
def initialize(environment, options = {})
|
7
|
+
@app = self.class.app environment
|
8
|
+
super options
|
9
|
+
end
|
10
|
+
|
11
|
+
|
12
|
+
def self.app environment
|
13
|
+
Rack::Builder.new do
|
14
|
+
run environment
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
data/madride.gemspec
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
require File.expand_path('../lib/madride/version', __FILE__)
|
3
|
+
|
4
|
+
Gem::Specification.new do |gem|
|
5
|
+
gem.name = "madride"
|
6
|
+
gem.version = Madride::VERSION
|
7
|
+
gem.homepage = ""
|
8
|
+
gem.authors = ["Aleksey V Zapparov"]
|
9
|
+
gem.email = ["ixti@member.fsf.org"]
|
10
|
+
gem.summary = "madride-#{Madride::VERSION}"
|
11
|
+
gem.description = %q{Zero-configuration command-line HTTP server.}
|
12
|
+
|
13
|
+
gem.add_dependency "sprockets", "~> 2.4"
|
14
|
+
gem.add_dependency "rack", "~> 1.0"
|
15
|
+
gem.add_dependency "slim", "~> 1.2"
|
16
|
+
|
17
|
+
gem.add_development_dependency "rspec", "~> 2.11"
|
18
|
+
gem.add_development_dependency "rack-test", "~> 0.6"
|
19
|
+
|
20
|
+
gem.files = `git ls-files`.split($\)
|
21
|
+
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
22
|
+
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
23
|
+
|
24
|
+
gem.require_paths = ["lib"]
|
25
|
+
end
|
data/spec/.gitkeep
ADDED
File without changes
|
@@ -0,0 +1 @@
|
|
1
|
+
var bar = 'bar';
|
data/spec/server_spec.rb
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
module Madride
|
2
|
+
describe Server do
|
3
|
+
include Rack::Test::Methods
|
4
|
+
|
5
|
+
|
6
|
+
def app
|
7
|
+
env = Environment.new fixtures_root.to_s
|
8
|
+
env.append_path '.'
|
9
|
+
Server.new(env).app
|
10
|
+
end
|
11
|
+
|
12
|
+
|
13
|
+
it "should serve html" do
|
14
|
+
get "/hello.html"
|
15
|
+
last_response.should be_ok
|
16
|
+
end
|
17
|
+
|
18
|
+
it "should serve js" do
|
19
|
+
get "/foo.js"
|
20
|
+
last_response.should be_ok
|
21
|
+
end
|
22
|
+
|
23
|
+
|
24
|
+
it "should respond with 404 if not found" do
|
25
|
+
get "/moo.html"
|
26
|
+
last_response.should_not be_ok
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
# stdlib
|
2
|
+
require 'pathname'
|
3
|
+
|
4
|
+
# 3rd-party
|
5
|
+
require 'rack/test'
|
6
|
+
|
7
|
+
# internal
|
8
|
+
require_relative '../lib/madride'
|
9
|
+
|
10
|
+
|
11
|
+
module Madride
|
12
|
+
module RSpec
|
13
|
+
module Helpers
|
14
|
+
extend self
|
15
|
+
|
16
|
+
|
17
|
+
def fixtures_root
|
18
|
+
@fixtures_root ||= Pathname.new(__FILE__).parent.join('fixtures')
|
19
|
+
end
|
20
|
+
|
21
|
+
|
22
|
+
def fixtures_path path
|
23
|
+
fixtures_root.join(path.to_s)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
|
30
|
+
RSpec.configure do |config|
|
31
|
+
config.include Madride::RSpec::Helpers
|
32
|
+
end
|
metadata
ADDED
@@ -0,0 +1,157 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: madride
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Aleksey V Zapparov
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2012-07-25 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: sprockets
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ~>
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '2.4'
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ~>
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '2.4'
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: rack
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ~>
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '1.0'
|
38
|
+
type: :runtime
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ~>
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '1.0'
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: slim
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ~>
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '1.2'
|
54
|
+
type: :runtime
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ~>
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '1.2'
|
62
|
+
- !ruby/object:Gem::Dependency
|
63
|
+
name: rspec
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
66
|
+
requirements:
|
67
|
+
- - ~>
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '2.11'
|
70
|
+
type: :development
|
71
|
+
prerelease: false
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ~>
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '2.11'
|
78
|
+
- !ruby/object:Gem::Dependency
|
79
|
+
name: rack-test
|
80
|
+
requirement: !ruby/object:Gem::Requirement
|
81
|
+
none: false
|
82
|
+
requirements:
|
83
|
+
- - ~>
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: '0.6'
|
86
|
+
type: :development
|
87
|
+
prerelease: false
|
88
|
+
version_requirements: !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
90
|
+
requirements:
|
91
|
+
- - ~>
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: '0.6'
|
94
|
+
description: Zero-configuration command-line HTTP server.
|
95
|
+
email:
|
96
|
+
- ixti@member.fsf.org
|
97
|
+
executables:
|
98
|
+
- madride
|
99
|
+
extensions: []
|
100
|
+
extra_rdoc_files: []
|
101
|
+
files:
|
102
|
+
- .gitignore
|
103
|
+
- .rspec
|
104
|
+
- Gemfile
|
105
|
+
- LICENSE
|
106
|
+
- README.md
|
107
|
+
- Rakefile
|
108
|
+
- bin/madride
|
109
|
+
- lib/madride.rb
|
110
|
+
- lib/madride/environment.rb
|
111
|
+
- lib/madride/server.rb
|
112
|
+
- lib/madride/templates/slim.rb
|
113
|
+
- lib/madride/version.rb
|
114
|
+
- madride.gemspec
|
115
|
+
- spec/.gitkeep
|
116
|
+
- spec/fixtures/bar.js
|
117
|
+
- spec/fixtures/foo.js
|
118
|
+
- spec/fixtures/hello.html.slim
|
119
|
+
- spec/server_spec.rb
|
120
|
+
- spec/spec_helper.rb
|
121
|
+
homepage: ''
|
122
|
+
licenses: []
|
123
|
+
post_install_message:
|
124
|
+
rdoc_options: []
|
125
|
+
require_paths:
|
126
|
+
- lib
|
127
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
128
|
+
none: false
|
129
|
+
requirements:
|
130
|
+
- - ! '>='
|
131
|
+
- !ruby/object:Gem::Version
|
132
|
+
version: '0'
|
133
|
+
segments:
|
134
|
+
- 0
|
135
|
+
hash: -126278893
|
136
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
137
|
+
none: false
|
138
|
+
requirements:
|
139
|
+
- - ! '>='
|
140
|
+
- !ruby/object:Gem::Version
|
141
|
+
version: '0'
|
142
|
+
segments:
|
143
|
+
- 0
|
144
|
+
hash: -126278893
|
145
|
+
requirements: []
|
146
|
+
rubyforge_project:
|
147
|
+
rubygems_version: 1.8.23
|
148
|
+
signing_key:
|
149
|
+
specification_version: 3
|
150
|
+
summary: madride-0.0.1
|
151
|
+
test_files:
|
152
|
+
- spec/.gitkeep
|
153
|
+
- spec/fixtures/bar.js
|
154
|
+
- spec/fixtures/foo.js
|
155
|
+
- spec/fixtures/hello.html.slim
|
156
|
+
- spec/server_spec.rb
|
157
|
+
- spec/spec_helper.rb
|