rack-blogengine 1.0.7 → 1.0.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (50) hide show
  1. checksums.yaml +4 -4
  2. checksums.yaml.gz.sig +2 -0
  3. data.tar.gz.sig +0 -0
  4. data/MANIFEST +33 -19
  5. data/README.md +5 -4
  6. data/doc/Operator.html +236 -0
  7. data/doc/Rack.html +117 -0
  8. data/doc/Rack/Blogengine.html +419 -0
  9. data/doc/Rack/Blogengine/Application.html +278 -0
  10. data/doc/Rack/Blogengine/ApplicationRouter.html +413 -0
  11. data/doc/Rack/Blogengine/CommandLineInterface.html +991 -0
  12. data/doc/Rack/Blogengine/Document.html +680 -0
  13. data/doc/Rack/Blogengine/DocumentParser.html +1708 -0
  14. data/doc/_index.html +197 -0
  15. data/doc/class_list.html +54 -0
  16. data/doc/css/common.css +1 -0
  17. data/doc/css/full_list.css +57 -0
  18. data/doc/css/style.css +339 -0
  19. data/doc/file.README.html +237 -0
  20. data/doc/file_list.html +56 -0
  21. data/doc/frames.html +26 -0
  22. data/doc/index.html +237 -0
  23. data/doc/js/app.js +219 -0
  24. data/doc/js/full_list.js +178 -0
  25. data/doc/js/jquery.js +4 -0
  26. data/doc/method_list.html +263 -0
  27. data/doc/top-level-namespace.html +114 -0
  28. data/lib/rack/blogengine/command_line_interface.rb +2 -2
  29. data/lib/rack/blogengine/version.rb +1 -1
  30. data/rack-blogengine.gemspec +2 -2
  31. metadata +48 -21
  32. metadata.gz.sig +0 -0
  33. data/.gitignore +0 -20
  34. data/.rubocop.yml +0 -2
  35. data/.travis.yml +0 -22
  36. data/Gemfile +0 -4
  37. data/Rakefile +0 -8
  38. data/checksum/rack-blogengine-1.0.6.gem.sha512 +0 -1
  39. data/task/build.rake +0 -4
  40. data/task/checksum.rake +0 -15
  41. data/task/default.rake +0 -5
  42. data/task/floodtest.rake +0 -33
  43. data/task/manifest.rake +0 -8
  44. data/task/test.rake +0 -19
  45. data/task/travis.rake +0 -5
  46. data/test/rack/blogengine/application_router_test.rb +0 -49
  47. data/test/rack/blogengine/application_test.rb +0 -41
  48. data/test/rack/blogengine/command_line_interface_test.rb +0 -70
  49. data/test/rack/blogengine/document_parser_test.rb +0 -70
  50. data/test/test_helper.rb +0 -68
@@ -1,41 +0,0 @@
1
- require 'test_helper.rb'
2
-
3
- #
4
- # TestClass for ApplicationRouter
5
- #
6
- # @author [benny]
7
- #
8
- class ApplicationTest < MiniTest::Unit::TestCase
9
- include Rack::Test::Methods
10
- #
11
- # MockClass for Testing
12
- #
13
- # @author [benny]
14
- #
15
- class MockApp
16
- def call(env = nil)
17
- [200, {}, ['hello']]
18
- end
19
- end
20
-
21
- def app
22
- Rack::Blogengine::Application.new
23
- end
24
-
25
- def setup
26
- @cli = Rack::Blogengine::CommandLineInterface
27
- capture_stdout { @cli.generate(testpath) }
28
- Rack::Blogengine.config = @cli.send(:get_config, testpath)
29
- Rack::Blogengine.documents = Rack::Blogengine::DocumentParser.parse_in_documents(testpath)
30
- end
31
-
32
- def test_application_is_callable
33
- get '/'
34
-
35
- assert(last_response.body.include?('This is the Index Page'))
36
- end
37
-
38
- def teardown
39
- system("rm -rf #{testpath}")
40
- end
41
- end
@@ -1,70 +0,0 @@
1
- require 'test_helper.rb'
2
-
3
- #
4
- # TestClass for CommandLineInterface
5
- #
6
- # @author [benny]
7
- #
8
- class CommandLineInterfaceTest < MiniTest::Unit::TestCase
9
- def setup
10
- @cli = Rack::Blogengine::CommandLineInterface
11
- end
12
-
13
- def test_available_methods
14
- assert(@cli.respond_to?(:method_missing), 'CLI should respond to :method_missing method')
15
- assert(@cli.respond_to?(:run), 'CLI should respond to :run method')
16
- assert(@cli.respond_to?(:generate), 'CLI should respond to :generate method')
17
- assert(@cli.respond_to?(:version), 'CLI should respond to :version? method')
18
- end
19
-
20
- def test_methods_missing
21
- result = capture_stdout { @cli.send(:missing_method) }
22
- assert(result.include?('Command missing_method not available'), 'Not Available Method should not raise NoMethodError')
23
- end
24
-
25
- def test_version?
26
- result = capture_stdout { @cli.send(:version) }
27
- assert(result.include?('VERSION'), ':version? should output the current VERSION')
28
- end
29
-
30
- def test_generate
31
- capture_stdout { @cli.send(:generate, testpath) }
32
- assert(Dir.exist?(testpath), 'Test Directory should exist after generate method')
33
- assert(Dir.exist?("#{testpath}/assets"), 'assets Directory should exist after generate method')
34
- assert(Dir.exist?("#{testpath}/assets/layout"), 'assets/layout Directory should exist after generate method')
35
- assert(Dir.exist?("#{testpath}/assets/style"), 'assets/style Directory should exist after generate method')
36
- assert(Dir.exist?("#{testpath}/assets/js"), 'assets/js Directory should exist after generate method')
37
- assert(Dir.exist?("#{testpath}/assets/images"), 'assets/images Directory should exist after generate method')
38
- assert(Dir.exist?("#{testpath}/operator"), 'operator Directory should exist after generate method')
39
- assert(File.exist?("#{testpath}/operator/operator.rb"), 'operator.rb should exist after generate method')
40
- assert(File.exist?("#{testpath}/config.yml"), 'config.yml should exist after generate method')
41
- assert(File.exist?("#{testpath}/index.content"), 'index.content should exist after generate method')
42
- assert(File.exist?("#{testpath}/assets/layout/layout.html"), 'layout.html should exist after generate method')
43
- assert(File.exist?("#{testpath}/assets/style/style.css"), 'style.css should exist after generate method')
44
- assert(File.exist?("#{testpath}/assets/js/script.js"), 'script.js should exist after generate method')
45
- system("rm -rf #{testpath}")
46
- end
47
-
48
- def test_run_empty_string_argument
49
- result = capture_stdout { @cli.send(:run, '') }
50
- assert_equal('Specify a targetfolder!', result, 'run method should output "Specify a targetfolder!" when folderstring is empty')
51
- end
52
-
53
- def test_run_not_folder_string_argument
54
- result = capture_stdout { @cli.send(:run, '/not_a_directory') }
55
- assert_equal('/not_a_directory is not a folder!', result, 'run method should output "Target is not a folder!" when folderstring is not a directory')
56
- end
57
-
58
- def test_build_rack_app
59
- capture_stdout { @cli.generate(testpath) }
60
- config = @cli.send(:get_config, testpath)
61
- config['Usage'] = 'yes'
62
- config['Username'] = 'Benny'
63
- config['Password'] = 'Bensn'
64
-
65
- app = @cli.send(:build_rack_app, testpath, config)
66
-
67
- assert_instance_of(Rack::Builder, app, 'Rack app should be instance of Rack::Builder')
68
- system("rm -rf #{testpath}")
69
- end
70
- end
@@ -1,70 +0,0 @@
1
- require 'test_helper'
2
-
3
- #
4
- # Test Class for DocumentParser
5
- #
6
- # @author [benny]
7
- #
8
- class DocumentParserTest < MiniTest::Unit::TestCase
9
- def setup
10
- @cli = Rack::Blogengine::CommandLineInterface
11
- capture_stdout { @cli.generate(testpath) }
12
- @cli.send(:get_config, testpath)
13
- end
14
-
15
- def test_parse_in_documents
16
- documents = Rack::Blogengine::DocumentParser.parse_in_documents(testpath)
17
-
18
- documents.each do |document|
19
- # Check Hash keys
20
- assert(document.key?(:html), 'Documents should contain content')
21
- assert(document.key?(:path), 'Documents should contain a path')
22
- end
23
- end
24
-
25
- def test_invalid_date
26
- system("rm #{testpath}/index.content")
27
- capture_stdout { @cli.send(:setup, 'date_error.content', "#{testpath}", true) }
28
- assert_raises(RuntimeError) { Rack::Blogengine::DocumentParser.parse_in_documents(testpath) }
29
- end
30
-
31
- def test_invalid_content
32
- system("rm #{testpath}/index.content")
33
- capture_stdout { @cli.send(:setup, 'content_error.content', "#{testpath}", true) }
34
- assert_raises(RuntimeError) { Rack::Blogengine::DocumentParser.parse_in_documents(testpath) }
35
- end
36
-
37
- def test_invalid_title
38
- system("rm #{testpath}/index.content")
39
- capture_stdout { @cli.send(:setup, 'title_error.content', "#{testpath}", true) }
40
- assert_raises(RuntimeError) { Rack::Blogengine::DocumentParser.parse_in_documents(testpath) }
41
- end
42
-
43
- def test_documents_with_pygments
44
- capture_stdout { @cli.send(:setup, 'pygment.content', "#{testpath}", true) }
45
- system("rm #{testpath}/index.content")
46
- documents = Rack::Blogengine::DocumentParser.parse_in_documents(testpath)
47
- documents.each do |document|
48
- assert(document[:html].include?('class="highlight"'), 'Highlighted code should be wrapped in a div.highlight')
49
- end
50
- end
51
-
52
- def test_documents_with_operator
53
- capture_stdout { @cli.send(:setup, 'operator.content', "#{testpath}", true) }
54
- system("rm #{testpath}/index.content")
55
- documents = Rack::Blogengine::DocumentParser.parse_in_documents(testpath)
56
- documents.each do |document|
57
- assert(document[:html].include?('test'), 'Test Operator should return test')
58
- end
59
- end
60
-
61
- def test_document_sort
62
- capture_stdout { @cli.send(:setup, 'date_test.content', "#{testpath}", true) }
63
- documents = Rack::Blogengine::DocumentParser.parse_in_documents(testpath)
64
- assert(documents[0][:html].include?('This is 2012'), 'The Document with lower date should be first')
65
- end
66
-
67
- def teardown
68
- system("rm -rf #{testpath}")
69
- end
70
- end
data/test/test_helper.rb DELETED
@@ -1,68 +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
- # Previous content of test helper now starts here
20
-
21
- # Minitest
22
- require 'minitest/autorun'
23
- require 'minitest/mock'
24
- require 'minitest/pride' # for colored output
25
-
26
- # Rack Test Methods
27
- require 'rack/test'
28
-
29
- # TestUnit -> MiniTest (TestUnit is only compatibility Layer)
30
- # require 'test/unit'
31
-
32
- # Load Rack::Blogengine gem
33
- require 'rack/blogengine'
34
-
35
- # class Hash
36
- # method for usage with assert_boolean
37
- # -> for failing it needs nil instead of false (which #has_key? returns in failing case)
38
- # NOT Needed use assert_true instead...
39
- # def hash_key?(key)
40
- # if self.has_key?(key)
41
- # return true
42
- # else
43
- # return nil
44
- # end
45
- # end
46
- # end
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