doh 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/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +39 -0
- data/Rakefile +1 -0
- data/bin/doh +32 -0
- data/doh.gemspec +22 -0
- data/lib/doh.rb +4 -0
- data/lib/doh/version.rb +3 -0
- data/templates/app/config.ru +2 -0
- data/templates/app/doh.rb +13 -0
- metadata +90 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2013 Primedia, Inc.
|
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,39 @@
|
|
1
|
+
# Doh - The Error Application
|
2
|
+
|
3
|
+
Doh creates a simple, customizable Sinatra application that returns the desired status code.
|
4
|
+
|
5
|
+
Want a 418? No problem. Start up Doh and hit `localhost:9999/418`. Boom, teapot.
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
gem 'doh'
|
12
|
+
|
13
|
+
And then execute:
|
14
|
+
|
15
|
+
$ bundle
|
16
|
+
|
17
|
+
Or install it yourself as:
|
18
|
+
|
19
|
+
$ gem install doh
|
20
|
+
|
21
|
+
## Usage
|
22
|
+
|
23
|
+
Create a new Doh app with
|
24
|
+
|
25
|
+
doh new [app_name]
|
26
|
+
|
27
|
+
Open up the new application's directory and edit `doh.rb` as needed. It's a basic Sinatra app, so customization is a breeze. Start the application up like any Rack app or with
|
28
|
+
|
29
|
+
doh start
|
30
|
+
|
31
|
+
The `start` command will pass along flags and arguments to `rackup` so any valid options for `rackup` should work. If no port option `-p PORT_NUMBER` is provided, `9999` will be used as a default.
|
32
|
+
|
33
|
+
## Contributing
|
34
|
+
|
35
|
+
1. Fork it
|
36
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
37
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
38
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
39
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
data/bin/doh
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'thor'
|
4
|
+
|
5
|
+
module Doh
|
6
|
+
|
7
|
+
class CLI < Thor
|
8
|
+
include Thor::Actions
|
9
|
+
|
10
|
+
def self.source_root
|
11
|
+
File.expand_path('../../templates', __FILE__)
|
12
|
+
end
|
13
|
+
|
14
|
+
desc "new APPLICATION_NAME", "Sets up a new doh application to be abused as needed."
|
15
|
+
def new(name)
|
16
|
+
@name = Thor::Util.snake_case(name)
|
17
|
+
directory :app, @name
|
18
|
+
end
|
19
|
+
|
20
|
+
desc "start", "Starts the doh application. Valid rackup args may be used."
|
21
|
+
def start(*args)
|
22
|
+
port_option = args.include?('-p') ? '' : ' -p 9999'
|
23
|
+
args = args.join(" ")
|
24
|
+
command = "bundle exec rackup config.ru #{port_option} #{args}"
|
25
|
+
system(command)
|
26
|
+
end
|
27
|
+
map "s" => :start
|
28
|
+
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
Doh::CLI.start
|
data/doh.gemspec
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'doh/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |gem|
|
7
|
+
gem.name = "doh"
|
8
|
+
gem.version = Doh::VERSION
|
9
|
+
gem.authors = ["Colin Rymer"]
|
10
|
+
gem.email = ["colin.rymer@gmail.com"]
|
11
|
+
gem.description = %q{Generate a customizable sinatra app that generates a response code mapping to the url endpoint.}
|
12
|
+
gem.summary = %q{The error app generator}
|
13
|
+
gem.homepage = "https://github.com/primedia/doh/"
|
14
|
+
|
15
|
+
gem.files = `git ls-files`.split($/)
|
16
|
+
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
17
|
+
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
18
|
+
gem.require_paths = ["lib"]
|
19
|
+
|
20
|
+
gem.add_dependency 'sinatra', '~> 1.4'
|
21
|
+
gem.add_dependency 'thor', '~> 0.17'
|
22
|
+
end
|
data/lib/doh.rb
ADDED
data/lib/doh/version.rb
ADDED
metadata
ADDED
@@ -0,0 +1,90 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: doh
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease:
|
5
|
+
version: 0.0.1
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Colin Rymer
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2013-03-18 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
version_requirements: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ~>
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.4'
|
20
|
+
none: false
|
21
|
+
name: sinatra
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
requirement: !ruby/object:Gem::Requirement
|
25
|
+
requirements:
|
26
|
+
- - ~>
|
27
|
+
- !ruby/object:Gem::Version
|
28
|
+
version: '1.4'
|
29
|
+
none: false
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
version_requirements: !ruby/object:Gem::Requirement
|
32
|
+
requirements:
|
33
|
+
- - ~>
|
34
|
+
- !ruby/object:Gem::Version
|
35
|
+
version: '0.17'
|
36
|
+
none: false
|
37
|
+
name: thor
|
38
|
+
type: :runtime
|
39
|
+
prerelease: false
|
40
|
+
requirement: !ruby/object:Gem::Requirement
|
41
|
+
requirements:
|
42
|
+
- - ~>
|
43
|
+
- !ruby/object:Gem::Version
|
44
|
+
version: '0.17'
|
45
|
+
none: false
|
46
|
+
description: Generate a customizable sinatra app that generates a response code mapping
|
47
|
+
to the url endpoint.
|
48
|
+
email:
|
49
|
+
- colin.rymer@gmail.com
|
50
|
+
executables:
|
51
|
+
- doh
|
52
|
+
extensions: []
|
53
|
+
extra_rdoc_files: []
|
54
|
+
files:
|
55
|
+
- .gitignore
|
56
|
+
- Gemfile
|
57
|
+
- LICENSE.txt
|
58
|
+
- README.md
|
59
|
+
- Rakefile
|
60
|
+
- bin/doh
|
61
|
+
- doh.gemspec
|
62
|
+
- lib/doh.rb
|
63
|
+
- lib/doh/version.rb
|
64
|
+
- templates/app/config.ru
|
65
|
+
- templates/app/doh.rb
|
66
|
+
homepage: https://github.com/primedia/doh/
|
67
|
+
licenses: []
|
68
|
+
post_install_message:
|
69
|
+
rdoc_options: []
|
70
|
+
require_paths:
|
71
|
+
- lib
|
72
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
73
|
+
requirements:
|
74
|
+
- - ! '>='
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: '0'
|
77
|
+
none: false
|
78
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ! '>='
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
none: false
|
84
|
+
requirements: []
|
85
|
+
rubyforge_project:
|
86
|
+
rubygems_version: 1.8.23
|
87
|
+
signing_key:
|
88
|
+
specification_version: 3
|
89
|
+
summary: The error app generator
|
90
|
+
test_files: []
|