rack-blogengine 0.2.5 → 0.2.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8a9967ebc1f5812da39b323ccbfab72c1a0ad7d3
4
- data.tar.gz: 3df6682117a5998123b822ad64154ac4f397beb4
3
+ metadata.gz: 1e4be54f147e68a31e5f0edb4f90f29a37d5a27f
4
+ data.tar.gz: e2ed1e9ab1a4f576bf037af8335dcb29f50fbb26
5
5
  SHA512:
6
- metadata.gz: 9b52f8b93f472e3c98589d7be691dd1959ec2fdc7e0902702196cd5d3ec2907a7779c48422c2c9c521acf2d791db153a1401baa91bc517e48067c0e8e6c69192
7
- data.tar.gz: c37ea97848979aefc91bdcc0f029cb9536a3010bb21b762c9faaf5737db462b877b2dd9fcf40c8f83925fcae048e3cb9a391a1efd15d6c1001786e3e17212f96
6
+ metadata.gz: a81b2fcb06a4b239750b65051a98016c175e5266c5cdc3102aebaf83cf11fa6b5c6c269952f540c82dc6b52dfd8d57475df303048e6a9ef6a795c8b696cabdc5
7
+ data.tar.gz: 13c2c028990696e9c480d3553d4ff44d21058a8764d63581e41a2348478fa8665189219716bfb28c3b41a58346015e658fded99b0a2a01cd8265d20bca0d825a
data/.gitignore CHANGED
@@ -15,3 +15,6 @@ spec/reports
15
15
  test/tmp
16
16
  test/version_tmp
17
17
  tmp
18
+
19
+ features
20
+ spec
data/.yardopts ADDED
@@ -0,0 +1 @@
1
+ --private
data/README.md CHANGED
@@ -9,6 +9,8 @@ Rack Middleware to serve a simple blog
9
9
  [![Gem Version](https://badge.fury.io/rb/rack-blogengine.png)](http://badge.fury.io/rb/rack-blogengine)
10
10
  [![Dependency Status](https://gemnasium.com/Benny1992/rack-blogengine.png)](https://gemnasium.com/Benny1992/rack-blogengine)
11
11
 
12
+
13
+
12
14
  ## Supported Ruby Versions & Platforms
13
15
 
14
16
  - rbx 2.2.5
@@ -135,3 +137,5 @@ In your layout.html then
135
137
  3. Commit your changes (`git commit -am 'Add some feature'`)
136
138
  4. Push to the branch (`git push origin my-new-feature`)
137
139
  5. Create new Pull Request
140
+
141
+
@@ -7,15 +7,12 @@ module Rack
7
7
  # @author [benny]
8
8
  #
9
9
  class Application
10
- # def initialize(app)
11
- # @app = app
12
- # end
13
10
  # Call Method for run this method as Rack Middleware.
14
- # @param env Environment contains information such as path, headers etc...
15
- # @return [Array] response Array
11
+ # @param [Hash] env [Environment contains information such as path, headers etc...]
12
+ # @return [Rack::Response] Rack Response
16
13
  def call(env)
17
14
  request = Rack::Request.new(env)
18
-
15
+
19
16
  # Router for map docs to routes
20
17
  route = ApplicationRouter.map_route(request, Rack::Blogengine.documents)
21
18
 
@@ -6,11 +6,11 @@ module Rack
6
6
  # @author [benny]
7
7
  #
8
8
  module ApplicationRouter
9
- # Maps documents to routes.
10
- # @param env Env Contains path info etc...
11
- # @param documents Documents which will be looked at
12
- # @return [Hash] route Hash {:path => "/foo", :response => [Array]}
13
9
  class << self
10
+ # Maps documents to routes.
11
+ # @param [Rack::Request] request [Current Request Object]
12
+ # @param [Array] documents [parsed in Documents]
13
+ # @return [Hash] request [route Hash {'path' => [String], 'response' => [Rack::Response]}]
14
14
  def map_route(request, documents)
15
15
  header = { 'Content-Type' => 'text/html; charset=UTF-8' }
16
16
 
@@ -33,15 +33,17 @@ module Rack
33
33
  errorpage(request, documents)
34
34
  end
35
35
 
36
+ # Returns the errorpage
37
+ # @param [Rack::Request] request [current Request]
38
+ # @param [Array] documents [parsed in Documents]
36
39
  def errorpage(request, documents)
37
40
  header = { 'Content-Type' => 'text/html; charset=UTF-8' }
38
41
  response = Rack::Response.new('Page not found', 404, header)
39
42
 
40
43
  { 'path' => request.path, 'response' => response }
41
44
  end
42
-
43
- private :errorpage
44
45
 
46
+ private :errorpage
45
47
  end
46
48
  end
47
49
  end
@@ -9,6 +9,9 @@ module Rack
9
9
  # @author [benny]
10
10
  #
11
11
  class CommandLineInterface
12
+ # Handle unavailable methods
13
+ # @param [String] name [called Methodname]
14
+ # @param [Array] *args [Available args]
12
15
  def method_missing(name, *args)
13
16
  puts "Command #{name} not available"
14
17
  print "Available Commands are: \n\n"
@@ -72,17 +75,17 @@ module Rack
72
75
  end
73
76
 
74
77
  # Display Version
75
- # return [String] VERSION
78
+ # @return [String] VERSION
76
79
  def version
77
80
  puts "\n\tVERSION: #{Rack::Blogengine::VERSION}\n\tRack::Blogengine releases are all pre-relases, first production release will be VERSION 1.0.0\n\n"
78
81
  end
79
82
 
80
83
  #
81
84
  # Build rack app via Rack::Builder
82
- # @param target String The Targetfolder where all relevant files are located
83
- # @param config [type] Config via get_config -> parses in config.yml
85
+ # @param [String] target [The Targetfolder where all relevant files are located]
86
+ # @param [Hash] config [Config via get_config -> parses in config.yml]
84
87
  #
85
- # @return [type] [description]
88
+ # @return [Rack::Builder] Rack Application
86
89
  def build_rack_app(target, config)
87
90
  Rack::Builder.new do
88
91
  map '/assets' do
@@ -106,9 +109,9 @@ module Rack
106
109
  end
107
110
 
108
111
  # Helper method for generate to set up all essential files
109
- # param [String] name
110
- # param [String] path
111
- # param [boolean] essential
112
+ # @param [String] name
113
+ # @param [String] path
114
+ # @param [boolean] essential
112
115
  def setup(name, path, essential)
113
116
  puts "\tSet up #{path}/#{name}\n"
114
117
  system("touch #{path}/#{name}")
@@ -120,6 +123,8 @@ module Rack
120
123
  end
121
124
 
122
125
  # Get YAML Config settings for Server.start && HTTPauth
126
+ # @param [String] target
127
+ # @return [Hash] Config
123
128
  def get_config(target)
124
129
  config_yaml = YAML.load(::File.open("#{target}/config.yml"))
125
130
 
@@ -139,9 +144,8 @@ module Rack
139
144
  'pygments_style' => pygments_style,
140
145
  'pygments_seperator' => pygments_seperator }
141
146
  end
142
-
143
- private :get_config, :setup, :build_rack_app
144
147
 
148
+ private :get_config, :setup, :build_rack_app
145
149
  end
146
150
  end
147
151
  end
@@ -9,6 +9,8 @@ module Rack
9
9
  class Document
10
10
  attr_accessor :path, :html, :title, :date
11
11
 
12
+ # Converts Rack::Blogengine::Docuemnt to Hash
13
+ # @return [Hash] DocumentHashed [Document in Hash Presentation contains :path and :html]
12
14
  def to_hash
13
15
  hash = {}
14
16
  instance_variables.each do |var|
@@ -19,6 +21,11 @@ module Rack
19
21
  hash
20
22
  end
21
23
 
24
+ # Executes Content Operators and returns modified html
25
+ # @param [Array] documents [Array of Documents available in operators]
26
+ # @param [String] target [Target for executing Operator from Targetfolder]
27
+ #
28
+ # @return [String] @html [Sets @html to modified html from operator]
22
29
  def exec_content_operator(documents, target)
23
30
  @html.scan(/\{\%(.*?)\%\}/).each do |contentoperator|
24
31
  contentoperator = contentoperator[0].strip.to_sym
@@ -10,15 +10,15 @@ module Rack
10
10
  #
11
11
  module DocumentParser
12
12
  class << self
13
+ attr_accessor :target
14
+
13
15
  private
16
+
14
17
  attr_accessor :path, :title, :content, :date, :html, :layout
15
-
16
- public
17
- attr_accessor :target
18
18
  end
19
19
 
20
20
  # Parse in .content Documents.
21
- # @param target.
21
+ # @param [String] target
22
22
  # @return [Hash] Documents
23
23
  def self.parse_in_documents(target)
24
24
  @target = target
@@ -88,7 +88,7 @@ module Rack
88
88
 
89
89
  elsif contentblock.include? '[date]:'
90
90
  contentblock['[date]:'] = ''
91
- if /\d/.match( contentblock )
91
+ if /\d/.match(contentblock)
92
92
  datearray = contentblock.split(',')
93
93
  datearray = datearray.map do |date|
94
94
  date.to_i
@@ -102,6 +102,9 @@ module Rack
102
102
  end
103
103
  end
104
104
 
105
+ # Get Content Array
106
+ # @param [String] content [The Content (.content file)]
107
+ # @return [Array] contentArray [Splitted Content File]
105
108
  def self.get_content_array(content)
106
109
  # Replace Closing tags
107
110
  content['/path'] = '/close'
@@ -112,31 +115,40 @@ module Rack
112
115
  content.split('[/close]')
113
116
  end
114
117
 
118
+ # Get Highlight Code from Content
119
+ # @param [String] content [HTML Content]
120
+ # @param [String] seperator [HTML between seperator will be highlighted]
121
+ #
122
+ # @return [Hash] :text - HTML to highlight, :brush - Brush via seperator class
115
123
  def self.get_highlight_code(content, seperator)
116
124
  html = ::Nokogiri::HTML(content)
117
125
  klass = html.css(seperator).attr('class')
118
126
  brush = klass.to_s.split(':')[1]
119
127
 
120
- highlight_code = { text: html.css(seperator).text, brush: brush }
128
+ # return
129
+ { text: html.css(seperator).text, brush: brush }
121
130
  end
122
131
 
132
+ # Highlight Code in specific language
133
+ # @param [String] code [Code to highlight]
134
+ # @param [String] language [Language to highlight]
135
+ #
136
+ # @return [String] Highlighted HTML String
123
137
  def self.highlight(code, language)
124
- # if language
125
- Pygments.highlight(code, :lexer => language.to_sym)
126
- # else
127
- # code
128
- # end
138
+ Pygments.highlight(code, lexer: language.to_sym)
129
139
  end
130
140
 
141
+ # Populates highlight.css with specific highlight css
142
+ # @param [String] target [Targetfolder in which highlight.css lives]
131
143
  def self.generate_highlight_css(target)
132
144
  cli = Rack::Blogengine::CommandLineInterface.new
133
145
  system("rm #{target}/assets/style/highlight.css") if ::File.exist?("#{target}/assets/style/highlight.css")
134
146
 
135
- cli.send(:setup, "highlight.css", "#{target}/assets/style", false)
147
+ cli.send(:setup, 'highlight.css', "#{target}/assets/style", false)
136
148
 
137
149
  path = "#{target}/assets/style"
138
150
 
139
- css = Pygments.css(:style => Rack::Blogengine.config["pygments_style"])
151
+ css = Pygments.css(style: Rack::Blogengine.config['pygments_style'])
140
152
  ::File.open("#{path}/highlight.css", 'w') { |file| file.write(css) }
141
153
  end
142
154
 
@@ -145,7 +157,8 @@ module Rack
145
157
  # @param [String] title
146
158
  # @param [String] content
147
159
  # @param [Date] date
148
- # return [String] html placeholder replaced with content
160
+ #
161
+ # @return [String] html placeholder replaced with content
149
162
  def self.fill_file_contents(layout, title, content, date)
150
163
  html = layout.dup
151
164
 
@@ -154,21 +167,22 @@ module Rack
154
167
  html.gsub! '{date}', date.strftime('%d.%m.%Y')
155
168
 
156
169
  html = Nokogiri::HTML(html)
157
- seperator = Rack::Blogengine.config["pygments_seperator"]
170
+ seperator = Rack::Blogengine.config['pygments_seperator']
158
171
 
159
- html.css(seperator).map do |html|
160
- highlight_code = get_highlight_code(html.to_s, seperator)
172
+ html.css(seperator).map do |replace_html|
173
+ highlight_code = get_highlight_code(replace_html.to_s, seperator)
161
174
  highlighted = highlight(highlight_code[:text], highlight_code[:brush])
162
175
 
163
- html.replace(highlighted)
176
+ replace_html.replace(highlighted)
164
177
  end
165
178
 
166
- return html.to_s
179
+ html.to_s
167
180
  end
168
181
 
169
182
  # Sort documents array by date of each documenthash
170
183
  # @param [Array] documents
171
- # return [Array] documents (sorted)
184
+ # @return [Array] documents (sorted)
185
+ #
172
186
  # Should it be sorted in Core or in the operator??
173
187
  def self.sort(documents)
174
188
  documents.sort! do | a, b |
@@ -6,6 +6,7 @@ module Rack
6
6
  # @author [benny]
7
7
  #
8
8
  module Blogengine
9
- VERSION = '0.2.5'.freeze
9
+ # Current Rack::Blogengine Version
10
+ VERSION = '0.2.6'.freeze
10
11
  end
11
12
  end
@@ -15,10 +15,17 @@ require 'nokogiri'
15
15
  module Rack
16
16
  #
17
17
  # BlogEngine Module used for namespacing
18
- # Used in all /lib files
19
- #
20
18
  # @author [benny]
21
19
  #
22
20
  module Blogengine
21
+ class << self
22
+ attr_accessor :documents, :config
23
+
24
+ # Method to return Gem Root Dir
25
+ # @return [String] Gem Root Folder
26
+ def root
27
+ ::File.dirname(::File.dirname(::File.expand_path('../..', __FILE__)))
28
+ end
29
+ end
23
30
  end
24
31
  end
@@ -16,7 +16,7 @@ Gem::Specification.new do |spec|
16
16
  spec.files = `git ls-files`.split($/)
17
17
  spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
18
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
- spec.require_paths = ["lib", "spec"]
19
+ spec.require_paths = ["lib"]
20
20
 
21
21
  spec.add_development_dependency "bundler", "~> 1.3"
22
22
  spec.add_development_dependency "rake"
data/tasks/default.rake CHANGED
@@ -1,5 +1,5 @@
1
1
  task :default do
2
2
  Rake::Task['test:unit'].invoke
3
3
  # Rake::Task['test:spec'].invoke
4
- Rake::Task['test:feature'].invoke
4
+ # Rake::Task['test:feature'].invoke
5
5
  end
data/tasks/floodtest.rake CHANGED
@@ -1,5 +1,5 @@
1
1
  test_runs = if ENV['TESTS']
2
- Interger(ENV['TESTS'])
2
+ Integer(ENV['TESTS'])
3
3
  else
4
4
  30
5
5
  end
data/tasks/travis.rake ADDED
@@ -0,0 +1,5 @@
1
+ task :travis do
2
+ Rake::Task['floodtest:unit'].invoke
3
+ # Rake::Task['floodtest:feature'].invoke
4
+ # Rake::Task['floodtest:spec'].invoke
5
+ end
@@ -13,7 +13,7 @@ class ApplicationRouterTest < MiniTest::Unit::TestCase
13
13
 
14
14
  env_fail = { 'PATH_INFO' => '/fail' }
15
15
  request_fail = Rack::Request.new(env_fail)
16
-
16
+
17
17
  env_success = { 'PATH_INFO' => '/' }
18
18
  request_success = Rack::Request.new(env_success)
19
19
 
@@ -7,31 +7,35 @@ require 'test_helper.rb'
7
7
  #
8
8
  class ApplicationTest < MiniTest::Unit::TestCase
9
9
  include Rack::Test::Methods
10
-
10
+ #
11
+ # MockClass for Testing
12
+ #
13
+ # @author [benny]
14
+ #
11
15
  class MockApp
12
16
  def call(env = nil)
13
- [200, {}, ["hello"]]
17
+ [200, {}, ['hello']]
14
18
  end
15
19
  end
16
20
 
17
21
  def app
18
- Rack::Blogengine::Application.new
22
+ Rack::Blogengine::Application.new
19
23
  end
20
24
 
21
25
  def setup
22
- @cli = Rack::Blogengine::CommandLineInterface.new
26
+ @cli = Rack::Blogengine::CommandLineInterface.new
23
27
  capture_stdout { @cli.generate(testpath) }
24
28
  Rack::Blogengine.config = @cli.send(:get_config, testpath)
25
29
  Rack::Blogengine.documents = Rack::Blogengine::DocumentParser.parse_in_documents(testpath)
26
30
  end
27
31
 
28
32
  def test_application_is_callable
29
- get '/'
33
+ get '/'
30
34
 
31
- assert(last_response.body.include?('This is the Index Page'))
35
+ assert(last_response.body.include?('This is the Index Page'))
32
36
  end
33
37
 
34
38
  def teardown
35
- system("rm -rf #{testpath}")
39
+ system("rm -rf #{testpath}")
36
40
  end
37
- end
41
+ end
@@ -61,11 +61,10 @@ class CommandLineInterfaceTest < MiniTest::Unit::TestCase
61
61
  config['Usage'] = 'yes'
62
62
  config['Username'] = 'Benny'
63
63
  config['Password'] = 'Bensn'
64
-
64
+
65
65
  app = @cli.send(:build_rack_app, testpath, config)
66
66
 
67
67
  assert_instance_of(Rack::Builder, app, 'Rack app should be instance of Rack::Builder')
68
68
  system("rm -rf #{testpath}")
69
69
  end
70
-
71
70
  end
@@ -24,24 +24,24 @@ class DocumentParserTest < MiniTest::Unit::TestCase
24
24
 
25
25
  def test_invalid_date
26
26
  system("rm #{testpath}/index.content")
27
- capture_stdout { @cli.send(:setup, "date_error.content", "#{testpath}", true) }
28
- assert_raises(RuntimeError) { documents = Rack::Blogengine::DocumentParser.parse_in_documents(testpath) }
27
+ capture_stdout { @cli.send(:setup, 'date_error.content', "#{testpath}", true) }
28
+ assert_raises(RuntimeError) { Rack::Blogengine::DocumentParser.parse_in_documents(testpath) }
29
29
  end
30
30
 
31
31
  def test_invalid_content
32
32
  system("rm #{testpath}/index.content")
33
- capture_stdout { @cli.send(:setup, "content_error.content", "#{testpath}", true) }
34
- assert_raises(RuntimeError) { documents = Rack::Blogengine::DocumentParser.parse_in_documents(testpath) }
33
+ capture_stdout { @cli.send(:setup, 'content_error.content', "#{testpath}", true) }
34
+ assert_raises(RuntimeError) { Rack::Blogengine::DocumentParser.parse_in_documents(testpath) }
35
35
  end
36
36
 
37
37
  def test_invalid_title
38
38
  system("rm #{testpath}/index.content")
39
- capture_stdout { @cli.send(:setup, "title_error.content", "#{testpath}", true) }
40
- assert_raises(RuntimeError) { documents = Rack::Blogengine::DocumentParser.parse_in_documents(testpath) }
39
+ capture_stdout { @cli.send(:setup, 'title_error.content', "#{testpath}", true) }
40
+ assert_raises(RuntimeError) { Rack::Blogengine::DocumentParser.parse_in_documents(testpath) }
41
41
  end
42
42
 
43
43
  def test_documents_with_pygments
44
- capture_stdout { @cli.send(:setup, "pygment.content", "#{testpath}", true) }
44
+ capture_stdout { @cli.send(:setup, 'pygment.content', "#{testpath}", true) }
45
45
  system("rm #{testpath}/index.content")
46
46
  documents = Rack::Blogengine::DocumentParser.parse_in_documents(testpath)
47
47
  documents.each do |document|
@@ -50,7 +50,7 @@ class DocumentParserTest < MiniTest::Unit::TestCase
50
50
  end
51
51
 
52
52
  def test_documents_with_operator
53
- capture_stdout { @cli.send(:setup, "operator.content", "#{testpath}", true) }
53
+ capture_stdout { @cli.send(:setup, 'operator.content', "#{testpath}", true) }
54
54
  system("rm #{testpath}/index.content")
55
55
  documents = Rack::Blogengine::DocumentParser.parse_in_documents(testpath)
56
56
  documents.each do |document|
@@ -59,7 +59,7 @@ class DocumentParserTest < MiniTest::Unit::TestCase
59
59
  end
60
60
 
61
61
  def test_document_sort
62
- capture_stdout { @cli.send(:setup, "date_test.content", "#{testpath}", true) }
62
+ capture_stdout { @cli.send(:setup, 'date_test.content', "#{testpath}", true) }
63
63
  documents = Rack::Blogengine::DocumentParser.parse_in_documents(testpath)
64
64
  assert(documents[0][:html].include?('This is 2012'), 'The Document with lower date should be first')
65
65
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rack-blogengine
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.5
4
+ version: 0.2.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Benny1992
@@ -9,85 +9,85 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2014-03-04 00:00:00 Z
12
+ date: 2014-03-08 00:00:00 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
+ name: bundler
16
+ prerelease: false
15
17
  requirement: &id001 !ruby/object:Gem::Requirement
16
18
  requirements:
17
19
  - - ~>
18
20
  - !ruby/object:Gem::Version
19
21
  version: "1.3"
20
- name: bundler
21
- prerelease: false
22
- version_requirements: *id001
23
22
  type: :development
23
+ version_requirements: *id001
24
24
  - !ruby/object:Gem::Dependency
25
+ name: rake
26
+ prerelease: false
25
27
  requirement: &id002 !ruby/object:Gem::Requirement
26
28
  requirements:
27
29
  - &id003
28
30
  - ">="
29
31
  - !ruby/object:Gem::Version
30
32
  version: "0"
31
- name: rake
32
- prerelease: false
33
- version_requirements: *id002
34
33
  type: :development
34
+ version_requirements: *id002
35
35
  - !ruby/object:Gem::Dependency
36
+ name: cucumber
37
+ prerelease: false
36
38
  requirement: &id004 !ruby/object:Gem::Requirement
37
39
  requirements:
38
40
  - *id003
39
- name: cucumber
40
- prerelease: false
41
- version_requirements: *id004
42
41
  type: :development
42
+ version_requirements: *id004
43
43
  - !ruby/object:Gem::Dependency
44
+ name: capybara
45
+ prerelease: false
44
46
  requirement: &id005 !ruby/object:Gem::Requirement
45
47
  requirements:
46
48
  - *id003
47
- name: capybara
48
- prerelease: false
49
- version_requirements: *id005
50
49
  type: :development
50
+ version_requirements: *id005
51
51
  - !ruby/object:Gem::Dependency
52
+ name: coveralls
53
+ prerelease: false
52
54
  requirement: &id006 !ruby/object:Gem::Requirement
53
55
  requirements:
54
56
  - *id003
55
- name: coveralls
56
- prerelease: false
57
- version_requirements: *id006
58
57
  type: :development
58
+ version_requirements: *id006
59
59
  - !ruby/object:Gem::Dependency
60
+ name: rack-test
61
+ prerelease: false
60
62
  requirement: &id007 !ruby/object:Gem::Requirement
61
63
  requirements:
62
64
  - *id003
63
- name: rack-test
64
- prerelease: false
65
- version_requirements: *id007
66
65
  type: :development
66
+ version_requirements: *id007
67
67
  - !ruby/object:Gem::Dependency
68
+ name: rack
69
+ prerelease: false
68
70
  requirement: &id008 !ruby/object:Gem::Requirement
69
71
  requirements:
70
72
  - *id003
71
- name: rack
72
- prerelease: false
73
- version_requirements: *id008
74
73
  type: :runtime
74
+ version_requirements: *id008
75
75
  - !ruby/object:Gem::Dependency
76
+ name: pygments.rb
77
+ prerelease: false
76
78
  requirement: &id009 !ruby/object:Gem::Requirement
77
79
  requirements:
78
80
  - *id003
79
- name: pygments.rb
80
- prerelease: false
81
- version_requirements: *id009
82
81
  type: :runtime
82
+ version_requirements: *id009
83
83
  - !ruby/object:Gem::Dependency
84
+ name: nokogiri
85
+ prerelease: false
84
86
  requirement: &id010 !ruby/object:Gem::Requirement
85
87
  requirements:
86
88
  - *id003
87
- name: nokogiri
88
- prerelease: false
89
- version_requirements: *id010
90
89
  type: :runtime
90
+ version_requirements: *id010
91
91
  description: Blogengine based on rack applications
92
92
  email:
93
93
  - klotz.benjamin@yahoo.de
@@ -101,6 +101,7 @@ files:
101
101
  - .gitignore
102
102
  - .rubocop.yml
103
103
  - .travis.yml
104
+ - .yardopts
104
105
  - Gemfile
105
106
  - LICENSE.txt
106
107
  - README.md
@@ -116,24 +117,19 @@ files:
116
117
  - assets/pygment.content
117
118
  - assets/title_error.content
118
119
  - bin/rack-blogengine
119
- - features/hello.feature
120
- - features/step_definitions/hello_steps.rb
121
- - features/support/env.rb
122
120
  - lib/rack/blogengine.rb
123
121
  - lib/rack/blogengine/application.rb
124
122
  - lib/rack/blogengine/application_router.rb
125
123
  - lib/rack/blogengine/command_line_interface.rb
126
124
  - lib/rack/blogengine/document.rb
127
125
  - lib/rack/blogengine/document_parser.rb
128
- - lib/rack/blogengine/methods.rb
129
126
  - lib/rack/blogengine/operator.rb
130
127
  - lib/rack/blogengine/version.rb
131
128
  - rack-blogengine.gemspec
132
- - spec/rack/blogengine/document_spec.rb
133
- - spec/spec_helper.rb
134
129
  - tasks/default.rake
135
130
  - tasks/floodtest.rake
136
131
  - tasks/test.rake
132
+ - tasks/travis.rake
137
133
  - test/rack/blogengine/application_router_test.rb
138
134
  - test/rack/blogengine/application_test.rb
139
135
  - test/rack/blogengine/command_line_interface_test.rb
@@ -149,7 +145,6 @@ rdoc_options: []
149
145
 
150
146
  require_paths:
151
147
  - lib
152
- - spec
153
148
  required_ruby_version: !ruby/object:Gem::Requirement
154
149
  requirements:
155
150
  - *id003
@@ -164,13 +159,9 @@ signing_key:
164
159
  specification_version: 4
165
160
  summary: Blogengine based on rack applications
166
161
  test_files:
167
- - features/hello.feature
168
- - features/step_definitions/hello_steps.rb
169
- - features/support/env.rb
170
- - spec/rack/blogengine/document_spec.rb
171
- - spec/spec_helper.rb
172
162
  - test/rack/blogengine/application_router_test.rb
173
163
  - test/rack/blogengine/application_test.rb
174
164
  - test/rack/blogengine/command_line_interface_test.rb
175
165
  - test/rack/blogengine/document_parser_test.rb
176
166
  - test/test_helper.rb
167
+ has_rdoc:
@@ -1,5 +0,0 @@
1
- Feature: The app should Work
2
-
3
- Scenario: View home page
4
- Given I am on the home page
5
- Then I should see "index"
@@ -1,13 +0,0 @@
1
- Given(/^I am on the home page$/) do
2
- puts visit 'http://localhost:3000'
3
- end
4
-
5
- Then(/^I should see "(.*?)"$/) do |text|
6
- page.has_content?(text)
7
- # page.driver.resize(20,30)
8
- # page.save_screenshot("/path/to/test.pdf")
9
- # puts page.within_window
10
- # puts page.driver.network_traffic
11
- # puts page.driver.cookies
12
- # puts page.response_headers.to_a
13
- end
@@ -1,25 +0,0 @@
1
- require 'simplecov'
2
- require 'coveralls'
3
-
4
- SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
5
- SimpleCov::Formatter::HTMLFormatter,
6
- Coveralls::SimpleCov::Formatter
7
- ]
8
-
9
- SimpleCov.start do
10
- project_name 'rack-blogengine'
11
- add_filter '/test/'
12
- add_filter '/pkg/'
13
- add_filter '/spec/'
14
- add_filter '/features/'
15
- add_filter '/doc/'
16
- add_filter '/assets/'
17
- end if ENV['COVERAGE']
18
-
19
- require 'capybara/cucumber'
20
- require 'rack/blogengine'
21
-
22
- Rack::Blogengine.documents = [{ html: '<!DOCTYPE html><body><h2>index</h2></body></html>',
23
- path: '/' }]
24
-
25
- Capybara.app = Rack::Blogengine::Application.new
@@ -1,17 +0,0 @@
1
- module Rack
2
- #
3
- # BlogEngine Module used for namespacing
4
- # Used in all /lib files
5
- #
6
- # @author [benny]
7
- #
8
- module Blogengine
9
- class << self
10
- attr_accessor :documents, :config
11
-
12
- def root
13
- ::File.dirname(::File.dirname(::File.expand_path('../..', __FILE__)))
14
- end
15
- end
16
- end
17
- end
@@ -1,34 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Rack::Blogengine::Document do
4
- before do
5
- @document = Rack::Blogengine::Document.new
6
-
7
- @document.title = 'testtitle'
8
- @document.path = '/test'
9
- @document.date = '20-20-2014'
10
- @document.html = '<html><h1>Test</h1></html>'
11
- end
12
-
13
- describe '#new' do
14
- it 'should be an instance of Document' do
15
- @document.class.must_equal Rack::Blogengine::Document
16
- end
17
-
18
- it 'should have content when parsed in' do
19
- @document.title.must_equal 'testtitle'
20
- @document.path.must_equal '/test'
21
- @document.date.must_equal '20-20-2014'
22
- @document.html.must_equal '<html><h1>Test</h1></html>'
23
- end
24
- end
25
-
26
- describe '#to_hash' do
27
- it 'should return the right hash' do
28
- hashed = @document.to_hash
29
-
30
- hashed.key?(:path).must_equal true
31
- hashed.key?(:html).must_equal true
32
- end
33
- end
34
- end
data/spec/spec_helper.rb DELETED
@@ -1,68 +0,0 @@
1
- # RSPEC spec_helper
2
- # =========================
3
- # require 'rack/blogengine'
4
-
5
- # This file was generated by the `rspec --init` command. Conventionally, all
6
- # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
7
- # Require this file using `require "spec_helper"` to ensure that it is only
8
- # loaded once.
9
- #
10
- # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
11
- # RSpec.configure do |config|
12
- # config.treat_symbols_as_metadata_keys_with_true_values = true
13
- # config.run_all_when_everything_filtered = true
14
- # config.filter_run :focus
15
-
16
- # Run specs in random order to surface order dependencies. If you find an
17
- # order dependency and want to debug it, you can fix the order by providing
18
- # the seed, which is printed after each run.
19
- # --seed 1234
20
- # config.order = 'random'
21
- # end
22
- # =================================
23
-
24
- require 'simplecov'
25
- require 'coveralls'
26
-
27
- SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
28
- SimpleCov::Formatter::HTMLFormatter,
29
- Coveralls::SimpleCov::Formatter
30
- ]
31
-
32
- SimpleCov.start do
33
- project_name 'rack-blogengine'
34
- add_filter '/test/'
35
- add_filter '/pkg/'
36
- add_filter '/spec/'
37
- add_filter '/features/'
38
- add_filter '/doc/'
39
- add_filter '/assets/'
40
- end if ENV['COVERAGE']
41
-
42
- # Minitest
43
- require 'minitest/autorun'
44
-
45
- # Load Rack::Blogengine gem
46
- require 'rack/blogengine'
47
-
48
- #
49
- # Opening Kernel for testpath method
50
- #
51
- # @author [benny]
52
- #
53
- module Kernel
54
- def testpath
55
- "#{Rack::Blogengine.root}/testfolder"
56
- end
57
- end
58
-
59
- def capture_stdout(&block)
60
- original_stdout = $stdout
61
- $stdout = fake = StringIO.new
62
- begin
63
- yield
64
- ensure
65
- $stdout = original_stdout
66
- end
67
- fake.string
68
- end