rack-usermanual 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/.gitignore +1 -0
- data/.travis.yml +5 -0
- data/README.md +32 -4
- data/lib/rack/usermanual/app.rb +7 -1
- data/rack-usermanual.gemspec +1 -2
- data/views/_menu.haml +1 -1
- data/views/page.haml +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
YmFkZDVmY2I0MWNiNWYwNjEzMGI3NzNkYjFmNDQ0MmMwYmJlMGM4ZA==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
MGIyY2E5ODMyYzczNTQ4ZjAxNDZlOTJmMzkyNTI2NDAwYTUxNDNhNA==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
MDZlZGJiNzAzMDc2NDk1YjlhM2Q0MTdmNDY0MGU4YWVhN2FhODc5ZWFkMTRh
|
10
|
+
ODE3NzY0YTkwOTdjM2ViZTZhMWQyMTMyZWY5ZmEzNTRiZmU5YzcxOTc2MzU4
|
11
|
+
ZDgwNTg4MjFjNDM4MjBiNDk5YTdjYTFhYTlhZjgyNDMyZWQyYzI=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
ZmExMjNiZjFlNGY2MTcxNWVkZDk2OTZjZmNhNjQ0M2VmYzU5MTVmZjcwYTg4
|
14
|
+
N2FlYTA0NDA1ODQ2OWM4MDk0YmU1NzBiYzM4ZmJmMWZmNTEzZmNkMTA4OWZl
|
15
|
+
MzNlNzM2YmFjZTVhMWJhZmIxMTk0MGM4NWM4Y2RhNmZmMTAzMmQ=
|
data/.gitignore
CHANGED
data/.travis.yml
ADDED
data/README.md
CHANGED
@@ -1,7 +1,23 @@
|
|
1
|
-
Rack
|
1
|
+
Rack Usermanual
|
2
2
|
================
|
3
3
|
|
4
|
-
|
4
|
+
![Build status](https://travis-ci.org/chrismdp/rack-usermanual.png) ![Code climate](https://codeclimate.com/github/chrismdp/rack-usermanual.png)
|
5
|
+
|
6
|
+
Want to embed your cucumber features directly into your project as a User manual? Here's a gem to do it.
|
7
|
+
|
8
|
+
See an example here: [http://online.soltrader.net/help/game-manual/combat](http://online.soltrader.net/help/game-manual/combat)
|
9
|
+
|
10
|
+
Installation
|
11
|
+
------------
|
12
|
+
|
13
|
+
```
|
14
|
+
gem install rack-usermanual
|
15
|
+
```
|
16
|
+
|
17
|
+
(or add it to your bundle.)
|
18
|
+
|
19
|
+
Usage
|
20
|
+
-----
|
5
21
|
|
6
22
|
To use, add the following to your Rack app:
|
7
23
|
|
@@ -22,11 +38,23 @@ map "/help" do
|
|
22
38
|
end
|
23
39
|
```
|
24
40
|
|
25
|
-
|
41
|
+
Or with Rails, you can do something like this in `config/routes.rb`:
|
42
|
+
|
43
|
+
```
|
44
|
+
match "/help" => Rack::Usermanual.new(self, :sections => ... }
|
45
|
+
```
|
46
|
+
|
47
|
+
(I'm not quite sure about the best way to pass options with rails - clarifications welcome!)
|
48
|
+
|
49
|
+
Then start your app and point your browser to `/help` and your features should be displayed for you.
|
50
|
+
|
51
|
+
Caveats
|
52
|
+
-------
|
26
53
|
|
27
54
|
The app will use the layout that you have in layout.{erb,haml} in whichever folder you specify. The CSS in the views is based on bootstrap: you might need to style your features slightly differently to get them to work in the way that you want. In the future it may be possible to completely override the views with your own.
|
28
55
|
|
29
|
-
|
56
|
+
Contributing
|
57
|
+
------------
|
30
58
|
|
31
59
|
We work on pull requests. If you have an idea for something you'd like to contribute, here's how to do it:
|
32
60
|
|
data/lib/rack/usermanual/app.rb
CHANGED
@@ -29,6 +29,10 @@ module Rack
|
|
29
29
|
Rack::Utils.escape_html(text)
|
30
30
|
end
|
31
31
|
|
32
|
+
def humanize(word)
|
33
|
+
word.capitalize.gsub(/[-_]/, ' ')
|
34
|
+
end
|
35
|
+
|
32
36
|
def replace_start(sentence)
|
33
37
|
{
|
34
38
|
/^given / => 'Assume ',
|
@@ -49,7 +53,9 @@ module Rack
|
|
49
53
|
sio = StringIO.new
|
50
54
|
json_formatter = Gherkin::Formatter::JSONFormatter.new(sio)
|
51
55
|
parser = Gherkin::Parser::Parser.new(json_formatter)
|
52
|
-
|
56
|
+
filepath = "#{path}/#{page}.feature"
|
57
|
+
halt 404 unless ::File.exist?(filepath)
|
58
|
+
raw = ::File.read(filepath)
|
53
59
|
parser.parse(raw, uri, 0)
|
54
60
|
json_formatter.done
|
55
61
|
[raw, JSON.parse(sio.string)]
|
data/rack-usermanual.gemspec
CHANGED
@@ -1,10 +1,9 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
2
|
$:.push File.expand_path("../lib", __FILE__)
|
3
|
-
require "rack/usermanual"
|
4
3
|
|
5
4
|
Gem::Specification.new do |s|
|
6
5
|
s.name = "rack-usermanual"
|
7
|
-
s.version =
|
6
|
+
s.version = "0.1.1"
|
8
7
|
s.authors = ["Chris Parsons"]
|
9
8
|
s.email = ["chris.p@rsons.org"]
|
10
9
|
s.homepage = "http://github.com/chrismdp/rack-usermanual"
|
data/views/_menu.haml
CHANGED
data/views/page.haml
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rack-usermanual
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Parsons
|
@@ -117,6 +117,7 @@ extra_rdoc_files: []
|
|
117
117
|
files:
|
118
118
|
- .gitignore
|
119
119
|
- .rspec
|
120
|
+
- .travis.yml
|
120
121
|
- Gemfile
|
121
122
|
- LICENSE
|
122
123
|
- README.md
|