ataru 0.0.1 → 0.1.0

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: 4767c7dd8ce82e36fab9f319d916c557766bb8c5
4
- data.tar.gz: 884519a1d41e2430e2b2aa31a4e5a20292b66ddb
3
+ metadata.gz: fcbdef8608fe4c9f4b1980f83af3aef1fd23bcd6
4
+ data.tar.gz: 1a6d8144749525a5a9b7b5b6eaa2b8415c7d7aca
5
5
  SHA512:
6
- metadata.gz: 86e70958e3ee6b22d4a32d7d08e424d28b01ef5a48889fb85a45389d2c3090f84b9f05c59bdcd64c58b2f249e4e0e3948f628a71af36a13aba2d44f76733033a
7
- data.tar.gz: 41ab05b0f605926bb066a618791e2bcecee8366bc39f8aa4af52e7ef82df97c3a60be165f78c3a96e04534039a9d1f873d5d10f19a12a1b87f8bea06db27aa2e
6
+ metadata.gz: 21e1251423908020c79a09eec665fb495c7f5549f315bcd0ad4978475fd135c586b80ebaa71a1d66533de918cd991ce22c2b4b92c531ec547d826a30719ceef9
7
+ data.tar.gz: 922a4de8be0b190c4095dd3ad1eeec4407f4d6bd33a73b90af6f8f8795cfd9be066b646a06f7a332fd710412fb47ded005393a27660aa0d492457d37f2dbb2af
data/.gitignore CHANGED
@@ -15,3 +15,6 @@ spec/reports
15
15
  test/tmp
16
16
  test/version_tmp
17
17
  tmp
18
+ playground/
19
+ lib/ataru/class.rb
20
+
@@ -0,0 +1,11 @@
1
+ language: ruby
2
+ rvm:
3
+ - "1.9.2"
4
+ - "1.9.3"
5
+ - "2.0.0"
6
+ - "2.1.2"
7
+ - "2.1.3"
8
+ - jruby-19mode # JRuby in 1.9 mode
9
+ - rbx
10
+ # uncomment this line if your project needs to run something other than `rake`:
11
+ # script: bundle exec rspec spec
data/README.md CHANGED
@@ -1,24 +1,113 @@
1
+ | Project | Ataru
2
+ |:----------------|:--------------------------------------------------
3
+ | CI | [![Build Status](https://travis-ci.org/CodePadawans/ataru.svg?branch=master)](https://travis-ci.org/CodePadawans/ataru)
4
+ | Gem Version | [![Gem Version](https://badge.fury.io/rb/ataru.svg)](http://badge.fury.io/rb/ataru)
5
+
1
6
  # Ataru
2
7
 
3
- TODO: Write a gem description
8
+ Ataru is a gem that provides a command line tool for testing code samples in the documentation files.
9
+ You can also integrate ataru in your continuous integration process on Travis CI.
10
+
11
+ Ataru will check if your documentation is still in sync with the application it was written for.
12
+ The output of the results has the MiniTest style.
13
+
14
+ ## What can ataru check
15
+
16
+ - Ataru can read files written in Github Flavoured Markdown, as it uses Kramdown with Github Flavoured Markdown Parser.
17
+
18
+ - Ataru is currently able to test the Ruby code only.
19
+
20
+ ## Requirements
21
+
22
+ - The dependencies of your gem have to be in the range of the latest major versions of:
23
+
24
+ - minitest (~> 5)
25
+ - kramdown (~> 1)
26
+ - thor (~> 0)
27
+
28
+ - You need to create the setup file (for more info read Setup section).
29
+
30
+ ## Usage as command line tool
31
+
32
+ 1. Add ataru to your project Gemfile.
33
+
34
+ 2. From the top level of your project execute:
35
+
36
+ ```sh
37
+ $ bundle install
38
+ ```
39
+
40
+ 3. To create the setup file (for more info read Setup section) execute:
41
+ ```sh
42
+ $ bundle exec ataru setup
43
+ ```
44
+
45
+ 4. Finally, execute:
46
+ - in case you want to check all the markdown files from your project:
47
+
48
+ ```sh
49
+ $ bundle exec ataru check
50
+ ```
51
+ - in case you want to check only specific markdown files from your project:
52
+
53
+ ```sh
54
+ $ bundle exec ataru check PROJECT_ROOT/foo/bar/filename_1.md PROJECT_ROOT/foo/bar/filename_2.md
55
+ ```
56
+ 5. Check the results.
57
+
58
+ ## Workflow with Travis CI
59
+
60
+ 1. Add ataru to your project Gemfile.
61
+
62
+ 2. From the top level of your project execute:
63
+
64
+ ```sh
65
+ $ bundle install
66
+ ```
67
+
68
+ 3. To create the setup file (for more info read Setup section) execute:
69
+
70
+ ```sh
71
+ $ bundle exec ataru setup
72
+ ```
4
73
 
5
- ## Installation
74
+ 4. In your .travis.yml file add:
75
+ - in case you want to check all the markdown files from your project:
76
+
77
+ ```
78
+ script:
79
+ - bundle exec rake build
80
+ - bundle exec rake ataru check
81
+ ```
82
+ - in case you want to check only specific markdown files from your project:
83
+ ```
84
+ script:
85
+ - bundle exec rake build
86
+ - bundle exec ataru check PROJECT_ROOT/foo/bar/filename_1.md PROJECT_ROOT/foo/bar/filename_2.md
87
+ ```
88
+ 5. Now you can commit and push the changes to github.
89
+ 6. Check the results of your build.
6
90
 
7
- Add this line to your application's Gemfile:
8
91
 
9
- gem 'ataru'
92
+ ## Setup
10
93
 
11
- And then execute:
94
+ The setup file has to be created in order to enable ataru to read your project source code and use it for its checks.
95
+ Ataru comes with an easy to use generator for creating that file. When the generator process is finished, the created
96
+ setup file is automatically passed to ataru.
12
97
 
13
- $ bundle
98
+ To create the setup file execute:
14
99
 
15
- Or install it yourself as:
100
+ ```sh
101
+ $ bundle exec ataru setup
102
+ ```
16
103
 
17
- $ gem install ataru
104
+ Open created file in your text editor and write:
18
105
 
19
- ## Usage
106
+ ```
107
+ require "your_project_name"
108
+ ```
20
109
 
21
- TODO: Write usage instructions here
110
+ Save the file.
22
111
 
23
112
  ## Contributing
24
113
 
@@ -26,4 +115,4 @@ TODO: Write usage instructions here
26
115
  2. Create your feature branch (`git checkout -b my-new-feature`)
27
116
  3. Commit your changes (`git commit -am 'Add some feature'`)
28
117
  4. Push to the branch (`git push origin my-new-feature`)
29
- 5. Create new Pull Request
118
+ 5. Create new Pull Request`
data/Rakefile CHANGED
@@ -1 +1,8 @@
1
1
  require "bundler/gem_tasks"
2
+ require "rake/testtask"
3
+
4
+ task :default => :test
5
+
6
+ Rake::TestTask.new do |t|
7
+ t.pattern = "test/*.rb"
8
+ end
@@ -5,12 +5,12 @@ require 'ataru/version'
5
5
 
6
6
  Gem::Specification.new do |spec|
7
7
  spec.name = "ataru"
8
- spec.version = "0.0.1"
8
+ spec.version = "0.1.0"
9
9
  spec.authors = ["Code_Padawans"]
10
10
  spec.email = ["hello@code-padawans.de"]
11
11
  spec.summary = %q{A documentation testing tool}
12
- spec.description = %q{A documentation testing tool}
13
- spec.homepage = ""
12
+ spec.description = %q{A documentation testing tool, for documentation in Markdown files, for Ruby code}
13
+ spec.homepage = "https://github.com/CodePadawans/ataru"
14
14
  spec.license = "MIT"
15
15
 
16
16
  spec.files = `git ls-files -z`.split("\x0")
@@ -19,5 +19,9 @@ Gem::Specification.new do |spec|
19
19
  spec.require_paths = ["lib"]
20
20
 
21
21
  spec.add_development_dependency "bundler", "~> 1.5"
22
- spec.add_development_dependency "rake"
22
+ spec.add_development_dependency "rake", "~> 10.3"
23
+
24
+ spec.add_runtime_dependency "minitest", "~> 5"
25
+ spec.add_runtime_dependency "kramdown", "~> 1"
26
+ spec.add_runtime_dependency "thor", "~> 0"
23
27
  end
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env ruby
2
+ $: << File.expand_path(File.dirname(__FILE__) + "/../lib")
3
+
4
+ require 'ataru'
5
+
6
+ Ataru::CLI::Application.start(ARGV)
@@ -1,5 +1,9 @@
1
- require "ataru/version"
2
-
3
- module Ataru
4
- # Your code goes here...
5
- end
1
+ require 'ataru/version'
2
+ require 'ataru/markdown_loader'
3
+ require 'ataru/traverser'
4
+ require 'ataru/code_sample'
5
+ require 'ataru/argument_checker'
6
+ require 'ataru/test_converter'
7
+ require 'ataru/test_class_builder'
8
+ require 'ataru/application'
9
+ require 'ataru/cli/application'
@@ -0,0 +1,14 @@
1
+ module Ataru
2
+ class Application
3
+ def self.run_test_for_file(file_name)
4
+
5
+ #creating kramdown doc out of md file
6
+ kramdown_doc = MarkdownLoader.load_file(file_name)
7
+ #pulling an array of codespans/code samples from markdown document
8
+ code_samples = Traverser.new(kramdown_doc, file_name).code_samples
9
+ #wrapping code samples in minitest tests
10
+ TestClassBuilder.new(code_samples).build_test_class
11
+ require 'minitest/autorun'
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,39 @@
1
+ module Ataru
2
+ class ArgumentChecker
3
+
4
+ def initialize(file_names)
5
+ exit_if_empty(file_names)
6
+ @file_names = file_names
7
+ end
8
+
9
+ def exit_if_empty(file_names)
10
+ if file_names.empty?
11
+ puts "ataru: command line usage error"
12
+ puts "ataru: please give the file name"
13
+ puts "usage: ataru.rb <filename>"
14
+ exit 64
15
+ end
16
+ end
17
+
18
+ def verify(file_name)
19
+ if file_name !~ /.+\.md/
20
+ puts "ataru: data format error"
21
+ puts "ataru: #{file_name} is not a markdown file"
22
+ puts "ataru: markdown file required"
23
+ exit 65
24
+ elsif File.file?(file_name) == false
25
+ puts "ataru: cannot open input"
26
+ puts "ataru: #{file_name} file not found"
27
+ exit 66
28
+ else
29
+ file_name
30
+ end
31
+ end
32
+
33
+ def each
34
+ @file_names.each do |file_name|
35
+ yield verify(file_name)
36
+ end
37
+ end
38
+ end
39
+ end
@@ -0,0 +1,39 @@
1
+ require 'thor'
2
+ require 'ataru'
3
+
4
+ module Ataru
5
+ module CLI
6
+ class Application < Thor
7
+ include Thor::Actions
8
+
9
+ def self.source_root
10
+ File.dirname(__FILE__)
11
+ end
12
+
13
+ desc "setup", "Create the setup file containing all dependencies for running code snippets"
14
+ def setup
15
+ create_file(Dir.pwd + "/ataru_setup.rb") do
16
+ <<-eos
17
+ # "Please require your project source code, with the correct path"
18
+
19
+ # require "path_to_your_project_source_code"
20
+ eos
21
+ end
22
+ puts "Well done, young Padawan!\nNow, change the created ataru_setup.rb file."
23
+ end
24
+
25
+ desc "check", "Check code snippets in all .md files of the project or, if given, specific .md files"
26
+ def check(*filenames)
27
+ if filenames.length == 0
28
+ filenames = Dir.glob('**/*md')
29
+ end
30
+ path = Dir.pwd + '/ataru_setup.rb'
31
+ require path if File.exist?(path)
32
+ Ataru::ArgumentChecker.new(filenames).each do |checked_file|
33
+ Ataru::Application.run_test_for_file(checked_file)
34
+ end
35
+ end
36
+ end
37
+ end
38
+ end
39
+
@@ -0,0 +1,26 @@
1
+ module Ataru
2
+ class CodeSample
3
+ attr_accessor :code, :file, :line_number, :prepared_code
4
+
5
+ def initialize(code, file, line_number)
6
+ self.code = code
7
+ self.file = file
8
+ self.line_number = line_number
9
+ end
10
+
11
+ def ==(other)
12
+ self.class == other.class &&
13
+ self.file == other.file &&
14
+ self.code == other.code &&
15
+ self.line_number == other.line_number
16
+ end
17
+
18
+ def prepared_code
19
+ @prepared_code ||= TestConverter.convert(self.code)
20
+ end
21
+
22
+ def run(b)
23
+ eval(self.prepared_code, b, self.file, self.line_number)
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,4 @@
1
+ module Ataru
2
+ class AtaruError < StandardError
3
+ end
4
+ end
@@ -0,0 +1,10 @@
1
+ require 'kramdown'
2
+
3
+ module Ataru
4
+ class MarkdownLoader
5
+ def self.load_file(file_name)
6
+ text = File.read(file_name)
7
+ Kramdown::Document.new(text, :input => 'GFM')
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,35 @@
1
+ require 'minitest'
2
+ require 'pathname'
3
+ require_relative 'errors'
4
+ require_relative 'code_sample'
5
+
6
+ module Ataru
7
+ class TestClassBuilder
8
+ attr_accessor :code_samples
9
+
10
+ def initialize(code_samples)
11
+ self.code_samples = code_samples
12
+ end
13
+
14
+ def build_test_class
15
+ samples = code_samples
16
+ klass = Class.new(MiniTest::Test) do
17
+ samples.each_with_index do |sample, index|
18
+ basename = Pathname.new(sample.file).basename(".*").to_s
19
+ define_method("test_#{basename}_#{index}") do
20
+
21
+ b = binding
22
+
23
+ begin
24
+ sample.run(b)
25
+ rescue StandardError => e
26
+ raise AtaruError.new("In the file: #{sample.file}, in line: #{sample.line_number}, the code sample number: #{index} is raising an error:" + e.inspect)
27
+ end
28
+ end
29
+ end
30
+ end
31
+
32
+ klass
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,8 @@
1
+ module Ataru
2
+ class TestConverter
3
+
4
+ def self.convert(code)
5
+ code.gsub(/(^.+) # ?=> (.+$)/, 'assert_equal(\2, \1)')
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,36 @@
1
+ require_relative 'markdown_loader'
2
+ require_relative 'code_sample'
3
+
4
+ module Ataru
5
+ class Traverser
6
+ CODE_ELEMENTS = [:codeblock, :codespan]
7
+
8
+ attr_accessor :document, :language, :file_name
9
+
10
+ def initialize(document, file_name, language = "language-ruby")
11
+ self.document = document
12
+ self.language = language
13
+ self.file_name = file_name
14
+ end
15
+
16
+ def code_samples
17
+ tree = document.root
18
+ self.walk_tree(tree)
19
+ end
20
+
21
+ def walk_tree(element)
22
+ code_samples = []
23
+ element.children.each do |child|
24
+ if CODE_ELEMENTS.include?(child.type)
25
+ if child.attr["class"] == language
26
+ line_number = child.options[:location] + 1
27
+ code_samples << CodeSample.new(child.value.strip, file_name, line_number)
28
+ end
29
+ else
30
+ code_samples += walk_tree(child)
31
+ end
32
+ end
33
+ code_samples
34
+ end
35
+ end
36
+ end
@@ -1,3 +1,3 @@
1
1
  module Ataru
2
- VERSION = "0.0.1"
2
+ VERSION = "0.1.0"
3
3
  end
@@ -0,0 +1,24 @@
1
+ require 'minitest/autorun'
2
+ require_relative '../lib/ataru/code_sample'
3
+
4
+ class CodeSampleTest < MiniTest::Test
5
+ include Ataru
6
+
7
+ class TestException < Exception
8
+ end
9
+
10
+ def test_run_with_file_name_and_line_number
11
+ code = CodeSample.new("1\n raise TestException.new('bad stuff')", "test.md", 1)
12
+ b = binding
13
+ begin
14
+ code.run(b)
15
+ rescue TestException => e
16
+ e.backtrace.first
17
+ file_name = e.backtrace.first.split(":").first
18
+ line_number = e.backtrace.first.split(":")[1].to_i
19
+ end
20
+
21
+ assert_equal "test.md", file_name
22
+ assert_equal 2, line_number
23
+ end
24
+ end
@@ -0,0 +1,9 @@
1
+ # Getting started
2
+
3
+ To get started, use the following code:
4
+
5
+ ```
6
+ def add(a,b)
7
+ a + b
8
+ end
9
+ ```
@@ -0,0 +1,3 @@
1
+ def test
2
+ def
3
+ end
@@ -0,0 +1,9 @@
1
+ # Getting started
2
+
3
+ To get started, use the following code:
4
+
5
+ ```
6
+ def add(a,b)
7
+ a + b
8
+ end
9
+ ```
@@ -0,0 +1,9 @@
1
+ # Getting started
2
+
3
+ To get started, use the following code:
4
+
5
+ ```
6
+ def add(a,b)
7
+ a + b
8
+ end
9
+ ```
@@ -0,0 +1,5 @@
1
+ that should raise ataru error
2
+
3
+ ```ruby
4
+ b = a + 1
5
+ ```
@@ -0,0 +1,3 @@
1
+ this code sample is empty
2
+ ```
3
+ ```
@@ -0,0 +1,8 @@
1
+ # Expect an output
2
+ foo
3
+ bar
4
+ bar
5
+ ```
6
+ a = 1 + 2
7
+ a #=> 4
8
+ ```
@@ -0,0 +1,4 @@
1
+ ```
2
+ a = 1 + 2
3
+ a #=> 3
4
+ ```
@@ -0,0 +1,4 @@
1
+ ```
2
+ a = 1 + 2
3
+ #=> 3
4
+ ```
@@ -0,0 +1,6 @@
1
+ ```
2
+ a = 2 + 3
3
+ b = a + 1
4
+
5
+ a #=> 5
6
+ ```
@@ -0,0 +1,28 @@
1
+ this is written without anythng
2
+
3
+ ```ruby
4
+ def a
5
+ 2 + 2
6
+ end
7
+ ```
8
+
9
+ ### header
10
+
11
+ ```
12
+ bundle exec
13
+ ```
14
+
15
+ ```ruby
16
+ def add2(number)
17
+ number + 2
18
+ end
19
+
20
+ a = 10
21
+ b = add2(a)
22
+ assert_equal 11, b
23
+ b #=> 11
24
+ ```
25
+
26
+ ```ruby
27
+ a + 1
28
+ ```
@@ -0,0 +1,42 @@
1
+ require 'minitest/autorun'
2
+ require 'kramdown'
3
+ require_relative '../lib/ataru/test_class_builder'
4
+ require_relative '../lib/ataru/errors'
5
+ require_relative '../lib/ataru/code_sample'
6
+
7
+ class TestClassBuilderTest < MiniTest::Test
8
+ include Ataru
9
+ @name_of_the_runnable = "the_name_of_the_runnable"
10
+
11
+ def test_empty_list
12
+ code_samples = []
13
+ klass = TestClassBuilder.new(code_samples).build_test_class
14
+
15
+ refute_respond_to klass.new(@name_of_the_runnable), :test_my_test_0
16
+ end
17
+
18
+ def test_one_code_example
19
+ code_samples = [CodeSample.new("puts 'Hello world'", "my_test.md", 5)]
20
+ klass = TestClassBuilder.new(code_samples).build_test_class
21
+
22
+ assert_respond_to klass.new(@name_of_the_runnable), :test_my_test_0
23
+ end
24
+
25
+ def test_two_code_examples
26
+ code_samples = [CodeSample.new("puts 'blah'", "my_test.md", 5), CodeSample.new("puts 2 + 5", "my_test.md", 5)]
27
+ klass = TestClassBuilder.new(code_samples).build_test_class
28
+
29
+ assert_respond_to klass.new(@name_of_the_runnable), :test_my_test_0
30
+ assert_respond_to klass.new(@name_of_the_runnable), :test_my_test_1
31
+ end
32
+
33
+ def test_invalid_code_sample
34
+ code_samples = [CodeSample.new("a + 1", "my_test.md", 5)]
35
+ message = AtaruError.new("In the file: #{code_samples[0].file}, in line: #{code_samples[0].line_number}, is raising an error:")
36
+ klass = TestClassBuilder.new(code_samples).build_test_class
37
+
38
+ assert_raises(AtaruError) { klass.new(@name_of_the_runnable).send(:test_my_test_0) }
39
+ assert_equal "In the file: my_test.md, in line: 5, is raising an error:", message.to_s
40
+ end
41
+
42
+ end
@@ -0,0 +1,48 @@
1
+ require 'minitest/autorun'
2
+ require_relative '../lib/ataru/test_converter'
3
+
4
+ class TestConverterTest < MiniTest::Test
5
+ include Ataru
6
+
7
+ def test_no_hash
8
+ code_sample = CodeSample.new("puts 'blah'", "test.md", 2)
9
+ converted = TestConverter.convert(code_sample.code)
10
+ assert_equal "puts 'blah'", converted
11
+ end
12
+
13
+ def test_hash_without_context_hash_without_space
14
+ code_sample = CodeSample.new("a #=> 5", "test.md", 2)
15
+ converted = TestConverter.convert(code_sample.code)
16
+ assert_equal "assert_equal(5, a)", converted
17
+ end
18
+
19
+ def test_hash_without_context_hash_with_space
20
+ code_sample = CodeSample.new("a # => 5", "test.md", 2)
21
+ converted = TestConverter.convert(code_sample.code)
22
+ assert_equal "assert_equal(5, a)", converted
23
+ end
24
+
25
+ def test_hash_with_context_hash_without_space
26
+ code_sample = CodeSample.new("a = 1 + 2\na #=> 3", "test.md", 2)
27
+ converted = TestConverter.convert(code_sample.code)
28
+ assert_equal "a = 1 + 2\nassert_equal(3, a)", converted
29
+ end
30
+
31
+ def test_hash_with_context_hash_with_space
32
+ code_sample = CodeSample.new("a = 1 + 2\na # => 3", "test.md", 2)
33
+ converted = TestConverter.convert(code_sample.code)
34
+ assert_equal "a = 1 + 2\nassert_equal(3, a)", converted
35
+ end
36
+
37
+ def test_assertion_in_the_middle
38
+ code_sample = CodeSample.new("a = 1 + 2\na # => 3\nb = 2", "test.md", 2)
39
+ converted = TestConverter.convert(code_sample.code)
40
+ assert_equal "a = 1 + 2\nassert_equal(3, a)\nb = 2", converted
41
+ end
42
+
43
+ def test_assertion_at_the_end
44
+ code_sample = CodeSample.new("a = 1 + 2\nb = 2\na # => 3", "test.md", 2)
45
+ converted = TestConverter.convert(code_sample.code)
46
+ assert_equal "a = 1 + 2\nb = 2\nassert_equal(3, a)", converted
47
+ end
48
+ end
@@ -0,0 +1,38 @@
1
+ require 'minitest/autorun'
2
+ require 'kramdown'
3
+ require_relative "../lib/ataru/traverser"
4
+
5
+ class TraverserTest < Minitest::Test
6
+
7
+ include Ataru
8
+
9
+ def test_single_codespan
10
+ doc = Kramdown::Document.new("```ruby\nputs 'Hello'\n```", :input => 'GFM')
11
+ assert_equal CodeSample.new("puts 'Hello'", "test.md", 2), Traverser.new(doc, "test.md").code_samples.first
12
+ end
13
+
14
+ def test_multiple_codespans
15
+ doc = Kramdown::Document.new("```ruby\nputs 'Hello'\n```\n```ruby\nputs 'Goodbye!'\n```", :input => 'GFM')
16
+ assert_equal [CodeSample.new("puts 'Hello'", "test.md", 2), CodeSample.new("puts 'Goodbye!'", "test.md", 5)], Traverser.new(doc, "test.md").code_samples
17
+
18
+ end
19
+
20
+ def test_no_codespans
21
+ doc = Kramdown::Document.new("#Header", :input => 'GFM')
22
+ assert_equal [], Traverser.new(doc, "test.md").code_samples
23
+ end
24
+
25
+ def test_codespan_in_complicated_structure
26
+ doc = Kramdown::Document.new <<-MARKDOWN, :input => 'GFM'
27
+ #Header
28
+
29
+ * list 1
30
+ * list 2
31
+
32
+ ```ruby
33
+ puts 'Hello'
34
+ ```
35
+ MARKDOWN
36
+ assert_equal [CodeSample.new("puts 'Hello'", "test.md", 7)], Traverser.new(doc, "test.md").code_samples
37
+ end
38
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ataru
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Code_Padawans
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-07-28 00:00:00.000000000 Z
11
+ date: 2014-09-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -28,32 +28,103 @@ dependencies:
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - '>='
31
+ - - ~>
32
32
  - !ruby/object:Gem::Version
33
- version: '0'
33
+ version: '10.3'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - '>='
38
+ - - ~>
39
+ - !ruby/object:Gem::Version
40
+ version: '10.3'
41
+ - !ruby/object:Gem::Dependency
42
+ name: minitest
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ~>
46
+ - !ruby/object:Gem::Version
47
+ version: '5'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ~>
53
+ - !ruby/object:Gem::Version
54
+ version: '5'
55
+ - !ruby/object:Gem::Dependency
56
+ name: kramdown
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ~>
60
+ - !ruby/object:Gem::Version
61
+ version: '1'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ~>
67
+ - !ruby/object:Gem::Version
68
+ version: '1'
69
+ - !ruby/object:Gem::Dependency
70
+ name: thor
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ~>
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ~>
39
81
  - !ruby/object:Gem::Version
40
82
  version: '0'
41
- description: A documentation testing tool
83
+ description: A documentation testing tool, for documentation in Markdown files, for
84
+ Ruby code
42
85
  email:
43
86
  - hello@code-padawans.de
44
- executables: []
87
+ executables:
88
+ - ataru
45
89
  extensions: []
46
90
  extra_rdoc_files: []
47
91
  files:
48
92
  - .gitignore
93
+ - .travis.yml
49
94
  - Gemfile
50
95
  - LICENSE.txt
51
96
  - README.md
52
97
  - Rakefile
53
98
  - ataru.gemspec
99
+ - bin/ataru
54
100
  - lib/ataru.rb
101
+ - lib/ataru/application.rb
102
+ - lib/ataru/argument_checker.rb
103
+ - lib/ataru/cli/application.rb
104
+ - lib/ataru/code_sample.rb
105
+ - lib/ataru/errors.rb
106
+ - lib/ataru/markdown_loader.rb
107
+ - lib/ataru/test_class_builder.rb
108
+ - lib/ataru/test_converter.rb
109
+ - lib/ataru/traverser.rb
55
110
  - lib/ataru/version.rb
56
- homepage: ''
111
+ - playground/arrays.rb
112
+ - test/code_sample_test.rb
113
+ - test/resources/test.md
114
+ - test/resources/test.rb
115
+ - test/resources/test1.md
116
+ - test/resources/test2.md
117
+ - test/resources/test_ataru_error.md
118
+ - test/resources/test_empty_string.md
119
+ - test/resources/test_expectation_incorrect.md
120
+ - test/resources/test_expectation_running.md
121
+ - test/resources/test_expectation_warning.md
122
+ - test/resources/test_linebreak.md
123
+ - test/resources/test_markdown.md
124
+ - test/test_class_builder_test.rb
125
+ - test/test_converter_test.rb
126
+ - test/traverser_test.rb
127
+ homepage: https://github.com/CodePadawans/ataru
57
128
  licenses:
58
129
  - MIT
59
130
  metadata: {}
@@ -77,4 +148,19 @@ rubygems_version: 2.0.14
77
148
  signing_key:
78
149
  specification_version: 4
79
150
  summary: A documentation testing tool
80
- test_files: []
151
+ test_files:
152
+ - test/code_sample_test.rb
153
+ - test/resources/test.md
154
+ - test/resources/test.rb
155
+ - test/resources/test1.md
156
+ - test/resources/test2.md
157
+ - test/resources/test_ataru_error.md
158
+ - test/resources/test_empty_string.md
159
+ - test/resources/test_expectation_incorrect.md
160
+ - test/resources/test_expectation_running.md
161
+ - test/resources/test_expectation_warning.md
162
+ - test/resources/test_linebreak.md
163
+ - test/resources/test_markdown.md
164
+ - test/test_class_builder_test.rb
165
+ - test/test_converter_test.rb
166
+ - test/traverser_test.rb