penetration 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.
- checksums.yaml +7 -0
- data/.codeclimate.yml +2 -0
- data/.coveralls.yml +1 -0
- data/.gitignore +8 -0
- data/.travis.yml +23 -0
- data/Gemfile +14 -0
- data/Gemfile.lock +175 -0
- data/MIT-LICENSE +20 -0
- data/Rakefile +21 -0
- data/lib/penetration.rb +90 -0
- data/lib/penetration/version.rb +3 -0
- data/lib/tasks/penetration_tasks.rake +4 -0
- data/penetration.gemspec +31 -0
- data/spec/dummy/README.rdoc +28 -0
- data/spec/dummy/Rakefile +6 -0
- data/spec/dummy/app/assets/images/.keep +0 -0
- data/spec/dummy/app/assets/javascripts/application.js +13 -0
- data/spec/dummy/app/assets/stylesheets/application.css +13 -0
- data/spec/dummy/app/controllers/application_controller.rb +5 -0
- data/spec/dummy/app/controllers/concerns/.keep +0 -0
- data/spec/dummy/app/controllers/penetrations_controller.rb +35 -0
- data/spec/dummy/app/helpers/application_helper.rb +2 -0
- data/spec/dummy/app/mailers/.keep +0 -0
- data/spec/dummy/app/models/.keep +0 -0
- data/spec/dummy/app/models/concerns/.keep +0 -0
- data/spec/dummy/app/views/layouts/application.html.erb +14 -0
- data/spec/dummy/app/views/penetrations/double.html.erb +2 -0
- data/spec/dummy/app/views/penetrations/dynamic.html.erb +2 -0
- data/spec/dummy/app/views/penetrations/index.html.erb +2 -0
- data/spec/dummy/app/views/penetrations/preset.html.erb +2 -0
- data/spec/dummy/app/views/penetrations/with_param.html.erb +2 -0
- data/spec/dummy/bin/bundle +3 -0
- data/spec/dummy/bin/rails +4 -0
- data/spec/dummy/bin/rake +4 -0
- data/spec/dummy/config.ru +4 -0
- data/spec/dummy/config/application.rb +38 -0
- data/spec/dummy/config/boot.rb +5 -0
- data/spec/dummy/config/database.def.yml +25 -0
- data/spec/dummy/config/environment.rb +5 -0
- data/spec/dummy/config/environments/development.rb +29 -0
- data/spec/dummy/config/environments/production.rb +80 -0
- data/spec/dummy/config/environments/test.rb +36 -0
- data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
- data/spec/dummy/config/initializers/inflections.rb +16 -0
- data/spec/dummy/config/initializers/mime_types.rb +5 -0
- data/spec/dummy/config/initializers/secret_token.rb +12 -0
- data/spec/dummy/config/initializers/session_store.rb +3 -0
- data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/spec/dummy/config/locales/en.yml +23 -0
- data/spec/dummy/config/routes.rb +7 -0
- data/spec/dummy/lib/assets/.keep +0 -0
- data/spec/dummy/log/.keep +0 -0
- data/spec/dummy/public/404.html +58 -0
- data/spec/dummy/public/422.html +58 -0
- data/spec/dummy/public/500.html +57 -0
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/dummy/spec/controllers/penetrations_controller_spec.rb +33 -0
- data/spec/rails_helper.rb +62 -0
- data/spec/requests/penetration_request_spec.rb +37 -0
- data/spec/spec_helper.rb +94 -0
- metadata +243 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: a94e448bdcade545f7c2817968beffbf0c05cfc5
|
4
|
+
data.tar.gz: 2bf22698fbfbb49cafa2a58eb1c6ff1669617757
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: e09361b486407cf7e7baf3780558a52c44889c6b7cdf9864eacb330da5dbe255ab6e837bc721e90a3b48585467a9527107945d9f0f6f29fa9fd4688993668db5
|
7
|
+
data.tar.gz: a28c689bdbb7c3c55361662eee2caeb18546c876ada84e0f466288e76419b8df916d7d6fa6463ba62a01980bba4546fb4acff79045092aa9a026585edf6bb2ce
|
data/.codeclimate.yml
ADDED
data/.coveralls.yml
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
service_name: travis-ci
|
data/.gitignore
ADDED
data/.travis.yml
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
language: ruby
|
2
|
+
rvm:
|
3
|
+
- 2.1.5
|
4
|
+
- 2.2.2
|
5
|
+
env:
|
6
|
+
- DB=sqlite
|
7
|
+
before_install:
|
8
|
+
- gem install bundler -v 1.10.3
|
9
|
+
install:
|
10
|
+
- bundle install
|
11
|
+
cache:
|
12
|
+
directories:
|
13
|
+
- vendor/bundle
|
14
|
+
before_script:
|
15
|
+
- cp spec/dummy/config/database.def.yml spec/dummy/config/database.yml
|
16
|
+
script:
|
17
|
+
- cd spec/dummy
|
18
|
+
- bundle install
|
19
|
+
- bundle exec rake db:create RAILS_ENV=test
|
20
|
+
- bundle exec rake db:migrate RAILS_ENV=test
|
21
|
+
- bundle exec rake db:test:prepare
|
22
|
+
- cd ../../
|
23
|
+
- bundle exec rake
|
data/Gemfile
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
source "https://rubygems.org"
|
2
|
+
|
3
|
+
# Declare your gem's dependencies in penetration.gemspec.
|
4
|
+
# Bundler will treat runtime dependencies like base dependencies, and
|
5
|
+
# development dependencies will be added by default to the :development group.
|
6
|
+
gemspec
|
7
|
+
|
8
|
+
# Declare any dependencies that are still in development here instead of in
|
9
|
+
# your gemspec. These might include edge Rails or gems from your path or
|
10
|
+
# Git. Remember to move these dependencies to your gemspec before releasing
|
11
|
+
# your gem to rubygems.org.
|
12
|
+
|
13
|
+
# To use debugger
|
14
|
+
# gem 'debugger'
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,175 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
penetration (0.0.1)
|
5
|
+
rails (~> 4.0)
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: https://rubygems.org/
|
9
|
+
specs:
|
10
|
+
actionmailer (4.2.3)
|
11
|
+
actionpack (= 4.2.3)
|
12
|
+
actionview (= 4.2.3)
|
13
|
+
activejob (= 4.2.3)
|
14
|
+
mail (~> 2.5, >= 2.5.4)
|
15
|
+
rails-dom-testing (~> 1.0, >= 1.0.5)
|
16
|
+
actionpack (4.2.3)
|
17
|
+
actionview (= 4.2.3)
|
18
|
+
activesupport (= 4.2.3)
|
19
|
+
rack (~> 1.6)
|
20
|
+
rack-test (~> 0.6.2)
|
21
|
+
rails-dom-testing (~> 1.0, >= 1.0.5)
|
22
|
+
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
23
|
+
actionview (4.2.3)
|
24
|
+
activesupport (= 4.2.3)
|
25
|
+
builder (~> 3.1)
|
26
|
+
erubis (~> 2.7.0)
|
27
|
+
rails-dom-testing (~> 1.0, >= 1.0.5)
|
28
|
+
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
29
|
+
activejob (4.2.3)
|
30
|
+
activesupport (= 4.2.3)
|
31
|
+
globalid (>= 0.3.0)
|
32
|
+
activemodel (4.2.3)
|
33
|
+
activesupport (= 4.2.3)
|
34
|
+
builder (~> 3.1)
|
35
|
+
activerecord (4.2.3)
|
36
|
+
activemodel (= 4.2.3)
|
37
|
+
activesupport (= 4.2.3)
|
38
|
+
arel (~> 6.0)
|
39
|
+
activesupport (4.2.3)
|
40
|
+
i18n (~> 0.7)
|
41
|
+
json (~> 1.7, >= 1.7.7)
|
42
|
+
minitest (~> 5.1)
|
43
|
+
thread_safe (~> 0.3, >= 0.3.4)
|
44
|
+
tzinfo (~> 1.1)
|
45
|
+
arel (6.0.2)
|
46
|
+
builder (3.2.2)
|
47
|
+
coveralls (0.8.2)
|
48
|
+
json (~> 1.8)
|
49
|
+
rest-client (>= 1.6.8, < 2)
|
50
|
+
simplecov (~> 0.10.0)
|
51
|
+
term-ansicolor (~> 1.3)
|
52
|
+
thor (~> 0.19.1)
|
53
|
+
diff-lcs (1.2.5)
|
54
|
+
docile (1.1.5)
|
55
|
+
domain_name (0.5.24)
|
56
|
+
unf (>= 0.0.5, < 1.0.0)
|
57
|
+
erubis (2.7.0)
|
58
|
+
factory_girl (4.5.0)
|
59
|
+
activesupport (>= 3.0.0)
|
60
|
+
factory_girl_rails (4.5.0)
|
61
|
+
factory_girl (~> 4.5.0)
|
62
|
+
railties (>= 3.0.0)
|
63
|
+
globalid (0.3.5)
|
64
|
+
activesupport (>= 4.1.0)
|
65
|
+
http-cookie (1.0.2)
|
66
|
+
domain_name (~> 0.5)
|
67
|
+
i18n (0.7.0)
|
68
|
+
json (1.8.3)
|
69
|
+
loofah (2.0.2)
|
70
|
+
nokogiri (>= 1.5.9)
|
71
|
+
mail (2.6.3)
|
72
|
+
mime-types (>= 1.16, < 3)
|
73
|
+
mime-types (2.6.1)
|
74
|
+
mini_portile (0.6.2)
|
75
|
+
minitest (5.7.0)
|
76
|
+
netrc (0.10.3)
|
77
|
+
nokogiri (1.6.6.2)
|
78
|
+
mini_portile (~> 0.6.0)
|
79
|
+
rack (1.6.4)
|
80
|
+
rack-test (0.6.3)
|
81
|
+
rack (>= 1.0)
|
82
|
+
rails (4.2.3)
|
83
|
+
actionmailer (= 4.2.3)
|
84
|
+
actionpack (= 4.2.3)
|
85
|
+
actionview (= 4.2.3)
|
86
|
+
activejob (= 4.2.3)
|
87
|
+
activemodel (= 4.2.3)
|
88
|
+
activerecord (= 4.2.3)
|
89
|
+
activesupport (= 4.2.3)
|
90
|
+
bundler (>= 1.3.0, < 2.0)
|
91
|
+
railties (= 4.2.3)
|
92
|
+
sprockets-rails
|
93
|
+
rails-deprecated_sanitizer (1.0.3)
|
94
|
+
activesupport (>= 4.2.0.alpha)
|
95
|
+
rails-dom-testing (1.0.6)
|
96
|
+
activesupport (>= 4.2.0.beta, < 5.0)
|
97
|
+
nokogiri (~> 1.6.0)
|
98
|
+
rails-deprecated_sanitizer (>= 1.0.1)
|
99
|
+
rails-html-sanitizer (1.0.2)
|
100
|
+
loofah (~> 2.0)
|
101
|
+
railties (4.2.3)
|
102
|
+
actionpack (= 4.2.3)
|
103
|
+
activesupport (= 4.2.3)
|
104
|
+
rake (>= 0.8.7)
|
105
|
+
thor (>= 0.18.1, < 2.0)
|
106
|
+
rake (10.4.2)
|
107
|
+
rb-readline (0.5.3)
|
108
|
+
rest-client (1.8.0)
|
109
|
+
http-cookie (>= 1.0.2, < 2.0)
|
110
|
+
mime-types (>= 1.16, < 3.0)
|
111
|
+
netrc (~> 0.7)
|
112
|
+
rspec (3.3.0)
|
113
|
+
rspec-core (~> 3.3.0)
|
114
|
+
rspec-expectations (~> 3.3.0)
|
115
|
+
rspec-mocks (~> 3.3.0)
|
116
|
+
rspec-core (3.3.1)
|
117
|
+
rspec-support (~> 3.3.0)
|
118
|
+
rspec-expectations (3.3.0)
|
119
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
120
|
+
rspec-support (~> 3.3.0)
|
121
|
+
rspec-html-matchers (0.7.0)
|
122
|
+
nokogiri (~> 1)
|
123
|
+
rspec (~> 3)
|
124
|
+
rspec-mocks (3.3.1)
|
125
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
126
|
+
rspec-support (~> 3.3.0)
|
127
|
+
rspec-rails (3.3.2)
|
128
|
+
actionpack (>= 3.0, < 4.3)
|
129
|
+
activesupport (>= 3.0, < 4.3)
|
130
|
+
railties (>= 3.0, < 4.3)
|
131
|
+
rspec-core (~> 3.3.0)
|
132
|
+
rspec-expectations (~> 3.3.0)
|
133
|
+
rspec-mocks (~> 3.3.0)
|
134
|
+
rspec-support (~> 3.3.0)
|
135
|
+
rspec-support (3.3.0)
|
136
|
+
simplecov (0.10.0)
|
137
|
+
docile (~> 1.1.0)
|
138
|
+
json (~> 1.8)
|
139
|
+
simplecov-html (~> 0.10.0)
|
140
|
+
simplecov-html (0.10.0)
|
141
|
+
sprockets (3.2.0)
|
142
|
+
rack (~> 1.0)
|
143
|
+
sprockets-rails (2.3.2)
|
144
|
+
actionpack (>= 3.0)
|
145
|
+
activesupport (>= 3.0)
|
146
|
+
sprockets (>= 2.8, < 4.0)
|
147
|
+
sqlite3 (1.3.10)
|
148
|
+
term-ansicolor (1.3.2)
|
149
|
+
tins (~> 1.0)
|
150
|
+
thor (0.19.1)
|
151
|
+
thread_safe (0.3.5)
|
152
|
+
tins (1.5.4)
|
153
|
+
tzinfo (1.2.2)
|
154
|
+
thread_safe (~> 0.1)
|
155
|
+
unf (0.1.4)
|
156
|
+
unf_ext
|
157
|
+
unf_ext (0.0.7.1)
|
158
|
+
|
159
|
+
PLATFORMS
|
160
|
+
ruby
|
161
|
+
|
162
|
+
DEPENDENCIES
|
163
|
+
bundler (~> 1.10)
|
164
|
+
coveralls
|
165
|
+
factory_girl_rails
|
166
|
+
penetration!
|
167
|
+
rake (~> 10.0)
|
168
|
+
rb-readline
|
169
|
+
rspec
|
170
|
+
rspec-html-matchers
|
171
|
+
rspec-rails
|
172
|
+
sqlite3
|
173
|
+
|
174
|
+
BUNDLED WITH
|
175
|
+
1.10.3
|
data/MIT-LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright 2015 mmmpa
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/Rakefile
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
begin
|
2
|
+
require 'bundler/setup'
|
3
|
+
rescue LoadError
|
4
|
+
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
5
|
+
end
|
6
|
+
|
7
|
+
require 'rdoc/task'
|
8
|
+
|
9
|
+
RDoc::Task.new(:rdoc) do |rdoc|
|
10
|
+
rdoc.rdoc_dir = 'rdoc'
|
11
|
+
rdoc.title = 'Penetration'
|
12
|
+
rdoc.options << '--line-numbers'
|
13
|
+
rdoc.rdoc_files.include('README.rdoc')
|
14
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
15
|
+
end
|
16
|
+
|
17
|
+
|
18
|
+
|
19
|
+
|
20
|
+
Bundler::GemHelper.install_tasks
|
21
|
+
|
data/lib/penetration.rb
ADDED
@@ -0,0 +1,90 @@
|
|
1
|
+
module Penetration
|
2
|
+
def self.configure(&block)
|
3
|
+
Configure.(&block) if block_given?
|
4
|
+
end
|
5
|
+
|
6
|
+
class Caller
|
7
|
+
class << self
|
8
|
+
def penetrate(session, session_name, element)
|
9
|
+
session[session_name] ||= []
|
10
|
+
session[session_name] << element
|
11
|
+
session[session_name].compact
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
class Configure
|
17
|
+
def self.call(&block)
|
18
|
+
instance_eval(&block)
|
19
|
+
end
|
20
|
+
|
21
|
+
def self.preset(name, &block)
|
22
|
+
Preset.(name, &block) if block_given?
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
class Core
|
27
|
+
def initialize(session, text = nil, &block)
|
28
|
+
@session = session
|
29
|
+
Caller.penetrate(@session, :rough_penetration, text) if text
|
30
|
+
instance_eval(&block) if block_given?
|
31
|
+
end
|
32
|
+
|
33
|
+
def method_missing(name, *rest)
|
34
|
+
preset = Preset.find(name)
|
35
|
+
Caller.penetrate(@session, :rough_penetration, preset.is_a?(Proc) ? preset.(*rest) : preset)
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
class Penetrator
|
40
|
+
class << self
|
41
|
+
def call(*args)
|
42
|
+
new(*args)
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
def initialize(session)
|
47
|
+
@session = session
|
48
|
+
end
|
49
|
+
|
50
|
+
def render
|
51
|
+
return '' if (elements = @session.delete(:rough_penetration)).nil?
|
52
|
+
|
53
|
+
elements.flatten.map(&:html_safe).join
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
class Preset
|
58
|
+
class << self
|
59
|
+
def call(name, &block)
|
60
|
+
@preset ||= {}
|
61
|
+
@preset[name] = yield
|
62
|
+
end
|
63
|
+
|
64
|
+
def find(name)
|
65
|
+
@preset[name] || (raise NotFound)
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
class NotFound < StandardError
|
70
|
+
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
|
75
|
+
module ::ActionController
|
76
|
+
module Renderers
|
77
|
+
def _render_template(options)
|
78
|
+
super.tap do |rendered|
|
79
|
+
rendered.try(:<<, Penetration::Penetrator.(session).render) if formats.first == :html
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
class Base
|
85
|
+
def penetrate(text = nil, &block)
|
86
|
+
Penetration::Core.new(session, text, &block)
|
87
|
+
end
|
88
|
+
end
|
89
|
+
end
|
90
|
+
end
|
data/penetration.gemspec
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
$:.push File.expand_path("../lib", __FILE__)
|
2
|
+
|
3
|
+
# Maintain your gem's version:
|
4
|
+
require "penetration/version"
|
5
|
+
|
6
|
+
# Describe your gem and declare its dependencies:
|
7
|
+
Gem::Specification.new do |spec|
|
8
|
+
spec.name = "penetration"
|
9
|
+
spec.version = Penetration::VERSION
|
10
|
+
spec.authors = ["mmmpa"]
|
11
|
+
spec.email = ["mmmpa.mmmpa@gmail.com"]
|
12
|
+
spec.homepage = "http://mmmpa.net"
|
13
|
+
spec.summary = "Insert text tail of view."
|
14
|
+
spec.description = "Insert text tail of view."
|
15
|
+
|
16
|
+
spec.files = `git ls-files`.split("\n")
|
17
|
+
spec.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
18
|
+
spec.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
spec.add_dependency "rails", "~> 4.0"
|
21
|
+
|
22
|
+
spec.add_development_dependency "bundler", "~> 1.10"
|
23
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
24
|
+
spec.add_development_dependency "sqlite3"
|
25
|
+
spec.add_development_dependency "rspec"
|
26
|
+
spec.add_development_dependency "rspec-rails"
|
27
|
+
spec.add_development_dependency "rspec-html-matchers"
|
28
|
+
spec.add_development_dependency "factory_girl_rails"
|
29
|
+
spec.add_development_dependency "coveralls"
|
30
|
+
spec.add_development_dependency "rb-readline"
|
31
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
== README
|
2
|
+
|
3
|
+
This README would normally document whatever steps are necessary to get the
|
4
|
+
application up and running.
|
5
|
+
|
6
|
+
Things you may want to cover:
|
7
|
+
|
8
|
+
* Ruby version
|
9
|
+
|
10
|
+
* System dependencies
|
11
|
+
|
12
|
+
* Configuration
|
13
|
+
|
14
|
+
* Database creation
|
15
|
+
|
16
|
+
* Database initialization
|
17
|
+
|
18
|
+
* How to run the test suite
|
19
|
+
|
20
|
+
* Services (job queues, cache servers, search engines, etc.)
|
21
|
+
|
22
|
+
* Deployment instructions
|
23
|
+
|
24
|
+
* ...
|
25
|
+
|
26
|
+
|
27
|
+
Please feel free to use a different markup language if you do not plan to run
|
28
|
+
<tt>rake doc:app</tt>.
|