vault-tools 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -0
- data/Gemfile +4 -0
- data/README.md +14 -16
- data/bin/d +16 -0
- data/bin/nokogiri +16 -0
- data/bin/pprof.rb +16 -0
- data/bin/rackup +16 -0
- data/bin/ri +16 -0
- data/bin/t +16 -0
- data/bin/tilt +16 -0
- data/bin/turn +16 -0
- data/bin/vault-tools +16 -0
- data/lib/vault-tools/log.rb +1 -1
- data/lib/vault-tools/version.rb +1 -1
- data/test/helper.rb +1 -0
- data/test/test_spec.rb +7 -0
- data/vault-tools.gemspec +0 -1
- metadata +18 -6
- data/lib/vault-tools/test.rb +0 -72
data/.gitignore
CHANGED
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -10,6 +10,16 @@ Add this line to your application's Gemfile:
|
|
10
10
|
|
11
11
|
## Usage
|
12
12
|
|
13
|
+
### Logging
|
14
|
+
|
15
|
+
```ruby
|
16
|
+
Log.time(name, t)
|
17
|
+
# => "measure=true at=web-40"
|
18
|
+
|
19
|
+
Log.count('foo')
|
20
|
+
# => "measure=true at=foo"
|
21
|
+
```
|
22
|
+
|
13
23
|
### Sinatra Base Class
|
14
24
|
|
15
25
|
Includes request logging and health endpoints
|
@@ -20,22 +30,6 @@ Includes request logging and health endpoints
|
|
20
30
|
end
|
21
31
|
```
|
22
32
|
|
23
|
-
### Test Base Classes
|
24
|
-
|
25
|
-
Provides a Stock TestCase and Spec classes to customize.
|
26
|
-
|
27
|
-
To extend your test classes uniformly, use the Vault::
|
28
|
-
|
29
|
-
```ruby
|
30
|
-
module MyTestHelperClass
|
31
|
-
def app; Vault::InvoiceBuilder::Web; end
|
32
|
-
end
|
33
|
-
|
34
|
-
Vault::TestHelpers.include_in_all Vault::InvoiceBuilderHelpers
|
35
|
-
```
|
36
|
-
|
37
|
-
Now you have an `#app` method in your `Vault::TestCase` and your `Vault::Spec`
|
38
|
-
|
39
33
|
## Contributing
|
40
34
|
|
41
35
|
1. Fork it
|
@@ -43,3 +37,7 @@ Now you have an `#app` method in your `Vault::TestCase` and your `Vault::Spec`
|
|
43
37
|
3. Commit your changes (`git commit -am 'Add some feature'`)
|
44
38
|
4. Push to the branch (`git push origin my-new-feature`)
|
45
39
|
5. Create new Pull Request
|
40
|
+
|
41
|
+
## Releasing
|
42
|
+
|
43
|
+
> bundle exec rake release
|
data/bin/d
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
#
|
3
|
+
# This file was generated by Bundler.
|
4
|
+
#
|
5
|
+
# The application 'd' is installed as part of a gem, and
|
6
|
+
# this file is here to facilitate running it.
|
7
|
+
#
|
8
|
+
|
9
|
+
require 'pathname'
|
10
|
+
ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
|
11
|
+
Pathname.new(__FILE__).realpath)
|
12
|
+
|
13
|
+
require 'rubygems'
|
14
|
+
require 'bundler/setup'
|
15
|
+
|
16
|
+
load Gem.bin_path('vault-test-tools', 'd')
|
data/bin/nokogiri
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
#
|
3
|
+
# This file was generated by Bundler.
|
4
|
+
#
|
5
|
+
# The application 'nokogiri' is installed as part of a gem, and
|
6
|
+
# this file is here to facilitate running it.
|
7
|
+
#
|
8
|
+
|
9
|
+
require 'pathname'
|
10
|
+
ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
|
11
|
+
Pathname.new(__FILE__).realpath)
|
12
|
+
|
13
|
+
require 'rubygems'
|
14
|
+
require 'bundler/setup'
|
15
|
+
|
16
|
+
load Gem.bin_path('nokogiri', 'nokogiri')
|
data/bin/pprof.rb
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
#
|
3
|
+
# This file was generated by Bundler.
|
4
|
+
#
|
5
|
+
# The application 'pprof.rb' is installed as part of a gem, and
|
6
|
+
# this file is here to facilitate running it.
|
7
|
+
#
|
8
|
+
|
9
|
+
require 'pathname'
|
10
|
+
ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
|
11
|
+
Pathname.new(__FILE__).realpath)
|
12
|
+
|
13
|
+
require 'rubygems'
|
14
|
+
require 'bundler/setup'
|
15
|
+
|
16
|
+
load Gem.bin_path('perftools.rb', 'pprof.rb')
|
data/bin/rackup
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
#
|
3
|
+
# This file was generated by Bundler.
|
4
|
+
#
|
5
|
+
# The application 'rackup' is installed as part of a gem, and
|
6
|
+
# this file is here to facilitate running it.
|
7
|
+
#
|
8
|
+
|
9
|
+
require 'pathname'
|
10
|
+
ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
|
11
|
+
Pathname.new(__FILE__).realpath)
|
12
|
+
|
13
|
+
require 'rubygems'
|
14
|
+
require 'bundler/setup'
|
15
|
+
|
16
|
+
load Gem.bin_path('rack', 'rackup')
|
data/bin/ri
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
#
|
3
|
+
# This file was generated by Bundler.
|
4
|
+
#
|
5
|
+
# The application 'ri' is installed as part of a gem, and
|
6
|
+
# this file is here to facilitate running it.
|
7
|
+
#
|
8
|
+
|
9
|
+
require 'pathname'
|
10
|
+
ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
|
11
|
+
Pathname.new(__FILE__).realpath)
|
12
|
+
|
13
|
+
require 'rubygems'
|
14
|
+
require 'bundler/setup'
|
15
|
+
|
16
|
+
load Gem.bin_path('rdoc', 'ri')
|
data/bin/t
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
#
|
3
|
+
# This file was generated by Bundler.
|
4
|
+
#
|
5
|
+
# The application 't' is installed as part of a gem, and
|
6
|
+
# this file is here to facilitate running it.
|
7
|
+
#
|
8
|
+
|
9
|
+
require 'pathname'
|
10
|
+
ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
|
11
|
+
Pathname.new(__FILE__).realpath)
|
12
|
+
|
13
|
+
require 'rubygems'
|
14
|
+
require 'bundler/setup'
|
15
|
+
|
16
|
+
load Gem.bin_path('vault-test-tools', 't')
|
data/bin/tilt
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
#
|
3
|
+
# This file was generated by Bundler.
|
4
|
+
#
|
5
|
+
# The application 'tilt' is installed as part of a gem, and
|
6
|
+
# this file is here to facilitate running it.
|
7
|
+
#
|
8
|
+
|
9
|
+
require 'pathname'
|
10
|
+
ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
|
11
|
+
Pathname.new(__FILE__).realpath)
|
12
|
+
|
13
|
+
require 'rubygems'
|
14
|
+
require 'bundler/setup'
|
15
|
+
|
16
|
+
load Gem.bin_path('tilt', 'tilt')
|
data/bin/turn
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
#
|
3
|
+
# This file was generated by Bundler.
|
4
|
+
#
|
5
|
+
# The application 'turn' is installed as part of a gem, and
|
6
|
+
# this file is here to facilitate running it.
|
7
|
+
#
|
8
|
+
|
9
|
+
require 'pathname'
|
10
|
+
ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
|
11
|
+
Pathname.new(__FILE__).realpath)
|
12
|
+
|
13
|
+
require 'rubygems'
|
14
|
+
require 'bundler/setup'
|
15
|
+
|
16
|
+
load Gem.bin_path('turn', 'turn')
|
data/bin/vault-tools
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
#
|
3
|
+
# This file was generated by Bundler.
|
4
|
+
#
|
5
|
+
# The application 'vault-tools' is installed as part of a gem, and
|
6
|
+
# this file is here to facilitate running it.
|
7
|
+
#
|
8
|
+
|
9
|
+
require 'pathname'
|
10
|
+
ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
|
11
|
+
Pathname.new(__FILE__).realpath)
|
12
|
+
|
13
|
+
require 'rubygems'
|
14
|
+
require 'bundler/setup'
|
15
|
+
|
16
|
+
load Gem.bin_path('vault-tools', 'vault-tools')
|
data/lib/vault-tools/log.rb
CHANGED
data/lib/vault-tools/version.rb
CHANGED
data/test/helper.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require 'vault-tools/test'
|
data/test/test_spec.rb
ADDED
data/vault-tools.gemspec
CHANGED
@@ -13,7 +13,6 @@ Gem::Specification.new do |gem|
|
|
13
13
|
gem.homepage = ""
|
14
14
|
|
15
15
|
gem.files = `git ls-files`.split($/)
|
16
|
-
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
17
16
|
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
18
17
|
gem.require_paths = ["lib"]
|
19
18
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vault-tools
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2012-12-
|
13
|
+
date: 2012-12-08 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: sinatra
|
@@ -74,12 +74,22 @@ files:
|
|
74
74
|
- LICENSE.txt
|
75
75
|
- README.md
|
76
76
|
- Rakefile
|
77
|
+
- bin/d
|
78
|
+
- bin/nokogiri
|
79
|
+
- bin/pprof.rb
|
80
|
+
- bin/rackup
|
81
|
+
- bin/ri
|
82
|
+
- bin/t
|
83
|
+
- bin/tilt
|
84
|
+
- bin/turn
|
85
|
+
- bin/vault-tools
|
77
86
|
- lib/vault-tools.rb
|
78
87
|
- lib/vault-tools/log.rb
|
79
88
|
- lib/vault-tools/sinatra_helpers/html_serializer.rb
|
80
|
-
- lib/vault-tools/test.rb
|
81
89
|
- lib/vault-tools/version.rb
|
82
90
|
- lib/vault-tools/web.rb
|
91
|
+
- test/helper.rb
|
92
|
+
- test/test_spec.rb
|
83
93
|
- vault-tools.gemspec
|
84
94
|
homepage: ''
|
85
95
|
licenses: []
|
@@ -95,7 +105,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
95
105
|
version: '0'
|
96
106
|
segments:
|
97
107
|
- 0
|
98
|
-
hash:
|
108
|
+
hash: 303794084916661633
|
99
109
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
100
110
|
none: false
|
101
111
|
requirements:
|
@@ -104,11 +114,13 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
104
114
|
version: '0'
|
105
115
|
segments:
|
106
116
|
- 0
|
107
|
-
hash:
|
117
|
+
hash: 303794084916661633
|
108
118
|
requirements: []
|
109
119
|
rubyforge_project:
|
110
120
|
rubygems_version: 1.8.23
|
111
121
|
signing_key:
|
112
122
|
specification_version: 3
|
113
123
|
summary: Test classes, base web classes, and helpers - oh my!
|
114
|
-
test_files:
|
124
|
+
test_files:
|
125
|
+
- test/helper.rb
|
126
|
+
- test/test_spec.rb
|
data/lib/vault-tools/test.rb
DELETED
@@ -1,72 +0,0 @@
|
|
1
|
-
require 'minitest/unit'
|
2
|
-
require 'minitest/spec'
|
3
|
-
require 'rack/test'
|
4
|
-
|
5
|
-
# Base class for Vault test cases.
|
6
|
-
class Vault::TestCase < MiniTest::Unit::TestCase
|
7
|
-
def setup
|
8
|
-
super
|
9
|
-
Scrolls.stream = StringIO.new
|
10
|
-
end
|
11
|
-
|
12
|
-
def teardown
|
13
|
-
super
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
class Vault::Spec < MiniTest::Spec
|
18
|
-
before do
|
19
|
-
Scrolls.stream = StringIO.new
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
# Register our Spec class as the default
|
24
|
-
MiniTest::Spec.register_spec_type //, Vault::Spec
|
25
|
-
|
26
|
-
module Vault::TestHelpers
|
27
|
-
def self.include_in_all(_module)
|
28
|
-
Vault::TestCase.send(:include, _module)
|
29
|
-
Vault::Spec.send(:include, _module)
|
30
|
-
end
|
31
|
-
|
32
|
-
def save_and_open_page(html = nil, name = 'page.html', i = 1)
|
33
|
-
html ||= last_response.body
|
34
|
-
name = "page_#{i=i+1}.html" while File.exist? name
|
35
|
-
File.open(name, 'w') { |f| f << html }
|
36
|
-
system "open #{name}"
|
37
|
-
end
|
38
|
-
|
39
|
-
def set_doc(body)
|
40
|
-
@doc = Nokogiri::HTML(body)
|
41
|
-
end
|
42
|
-
|
43
|
-
def doc
|
44
|
-
@doc || Nokogiri::HTML(last_response.body)
|
45
|
-
end
|
46
|
-
|
47
|
-
def css(string)
|
48
|
-
doc.css(string)
|
49
|
-
end
|
50
|
-
|
51
|
-
def assert_includes_css(css_string)
|
52
|
-
exists = doc.css(css_string).first
|
53
|
-
assert exists, "Last response must include #{css_string}"
|
54
|
-
end
|
55
|
-
|
56
|
-
def assert_css(css_string, content)
|
57
|
-
e = css(css_string).first
|
58
|
-
assert e, "Element not found: #{css_string}"
|
59
|
-
assert_includes e.content, content
|
60
|
-
end
|
61
|
-
|
62
|
-
def with_env(key, value)
|
63
|
-
old_env = ENV[key]
|
64
|
-
ENV[key] = value
|
65
|
-
yield
|
66
|
-
ensure
|
67
|
-
ENV[key] = old_env
|
68
|
-
end
|
69
|
-
end
|
70
|
-
|
71
|
-
Vault::TestHelpers.include_in_all Rack::Test::Methods
|
72
|
-
Vault::TestHelpers.include_in_all Vault::TestHelpers
|