karmi-markout 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (48) hide show
  1. data/VERSION.yml +1 -1
  2. data/bin/markout +8 -2
  3. data/lib/markout/document.rb +6 -3
  4. data/lib/markout/formatters/html/html.rb +21 -0
  5. data/lib/markout/formatters/html/templates/common/application.js +72 -0
  6. data/lib/markout/formatters/html/templates/common/code.css +11 -0
  7. data/lib/markout/formatters/html/templates/common/code_highlighter.js +188 -0
  8. data/lib/markout/formatters/html/templates/common/jquery-1.3.2.min.js +19 -0
  9. data/lib/markout/formatters/html/templates/common/syntax_diff.js +8 -0
  10. data/lib/markout/formatters/html/templates/default/content.rhtml +39 -7
  11. data/lib/markout/formatters/html/templates/default/screen.css +75 -3
  12. data/lib/markout/formatters/pdf/pdf.rb +4 -1
  13. data/lib/markout/history.rb +31 -0
  14. data/lib/markout/output.rb +1 -1
  15. data/lib/markout/revision.rb +20 -0
  16. data/lib/markout.rb +3 -2
  17. data/test/fixtures/empty.txt +0 -0
  18. data/test/fixtures/empty_repository__dot__git/COMMIT_EDITMSG +12 -0
  19. data/test/fixtures/empty_repository__dot__git/HEAD +1 -0
  20. data/test/fixtures/empty_repository__dot__git/config +6 -0
  21. data/test/fixtures/empty_repository__dot__git/description +1 -0
  22. data/test/fixtures/empty_repository__dot__git/hooks/applypatch-msg.sample +15 -0
  23. data/test/fixtures/empty_repository__dot__git/hooks/commit-msg.sample +24 -0
  24. data/test/fixtures/empty_repository__dot__git/hooks/post-commit.sample +8 -0
  25. data/test/fixtures/empty_repository__dot__git/hooks/post-receive.sample +15 -0
  26. data/test/fixtures/empty_repository__dot__git/hooks/post-update.sample +8 -0
  27. data/test/fixtures/empty_repository__dot__git/hooks/pre-applypatch.sample +14 -0
  28. data/test/fixtures/empty_repository__dot__git/hooks/pre-commit.sample +18 -0
  29. data/test/fixtures/empty_repository__dot__git/hooks/pre-rebase.sample +169 -0
  30. data/test/fixtures/empty_repository__dot__git/hooks/prepare-commit-msg.sample +36 -0
  31. data/test/fixtures/empty_repository__dot__git/hooks/update.sample +107 -0
  32. data/test/fixtures/empty_repository__dot__git/index +0 -0
  33. data/test/fixtures/empty_repository__dot__git/info/exclude +6 -0
  34. data/test/fixtures/empty_repository__dot__git/logs/HEAD +1 -0
  35. data/test/fixtures/empty_repository__dot__git/logs/refs/heads/master +1 -0
  36. data/test/fixtures/empty_repository__dot__git/objects/25/877ea00eb8d2de7a31cf7c4c4c16f0390d48fd +0 -0
  37. data/test/fixtures/empty_repository__dot__git/objects/a0/b6af2541dce8f646276ec7340695c34c7578aa +0 -0
  38. data/test/fixtures/empty_repository__dot__git/objects/ec/9e2a7b50ee2dfd5e6f8b5224fb3d7a98a79558 +0 -0
  39. data/test/fixtures/empty_repository__dot__git/refs/heads/master +1 -0
  40. data/test/fixtures/markdown.html +382 -10
  41. data/test/markout_document_test.rb +1 -1
  42. data/test/markout_formatter_test.rb +1 -1
  43. data/test/markout_history_test.rb +20 -0
  44. data/test/markout_html_test.rb +1 -1
  45. data/test/markout_output_test.rb +2 -2
  46. data/test/markout_revision_test.rb +45 -0
  47. data/test/test_helper.rb +4 -0
  48. metadata +79 -4
@@ -0,0 +1,45 @@
1
+ require File.join(File.dirname(__FILE__), 'test_helper')
2
+ require 'markout/revision'
3
+ require 'ostruct'
4
+
5
+ module Markout
6
+ class RevisionTest < Test::Unit::TestCase
7
+
8
+ def test_should_initialize_with_commit
9
+ assert_nothing_raised do
10
+ @revision = Markout::Revision.new( fake_grit_commit )
11
+ end
12
+ assert_not_nil @revision.sha
13
+ assert_not_nil @revision.date
14
+ assert_not_nil @revision.author
15
+ assert_not_nil @revision.subject
16
+ assert_not_nil @revision.message
17
+ assert_not_nil @revision.diff
18
+ end
19
+
20
+ private
21
+
22
+ def fake_grit_commit
23
+ diff=<<END
24
+ diff --git a/file.txt
25
+ index 0000000..11111111 100644
26
+ --- a/file.txt
27
+ +++ b/file.txt
28
+ @@ -1 +1,5 @@
29
+ # Header
30
+ +## Subheader
31
+ +Lorem ipsum dolor sit amet, consectetur adipisicing elit.+
32
+ +sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
33
+ +
34
+ END
35
+ OpenStruct.new(
36
+ :sha => '0'*40,
37
+ :date => Time.now,
38
+ :author => 'John Git',
39
+ :message => "Subject is on the first line\nAnd everything else is the message",
40
+ :show => [OpenStruct.new(:diff => diff)]
41
+ )
42
+ end
43
+
44
+ end
45
+ end
data/test/test_helper.rb CHANGED
@@ -13,5 +13,9 @@ def fixture_file(name)
13
13
  File.join(File.dirname(__FILE__), 'fixtures', name.to_s)
14
14
  end
15
15
 
16
+ def fixtures_path
17
+ Pathname.new( File.join(File.dirname(__FILE__), 'fixtures') )
18
+ end
19
+
16
20
  class Test::Unit::TestCase
17
21
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: karmi-markout
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Karel Minarik
@@ -9,10 +9,39 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-03-30 00:00:00 -07:00
12
+ date: 2009-04-06 00:00:00 -07:00
13
13
  default_executable: markout
14
- dependencies: []
15
-
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: schacon-grit
17
+ type: :runtime
18
+ version_requirement:
19
+ version_requirements: !ruby/object:Gem::Requirement
20
+ requirements:
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: "0"
24
+ version:
25
+ - !ruby/object:Gem::Dependency
26
+ name: rdiscount
27
+ type: :runtime
28
+ version_requirement:
29
+ version_requirements: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: "0"
34
+ version:
35
+ - !ruby/object:Gem::Dependency
36
+ name: mime-types
37
+ type: :runtime
38
+ version_requirement:
39
+ version_requirements: !ruby/object:Gem::Requirement
40
+ requirements:
41
+ - - ">="
42
+ - !ruby/object:Gem::Version
43
+ version: "0"
44
+ version:
16
45
  description:
17
46
  email: karmi@karmi.cz
18
47
  executables:
@@ -33,6 +62,12 @@ files:
33
62
  - lib/markout/formatters/html
34
63
  - lib/markout/formatters/html/html.rb
35
64
  - lib/markout/formatters/html/templates
65
+ - lib/markout/formatters/html/templates/common
66
+ - lib/markout/formatters/html/templates/common/application.js
67
+ - lib/markout/formatters/html/templates/common/code.css
68
+ - lib/markout/formatters/html/templates/common/code_highlighter.js
69
+ - lib/markout/formatters/html/templates/common/jquery-1.3.2.min.js
70
+ - lib/markout/formatters/html/templates/common/syntax_diff.js
36
71
  - lib/markout/formatters/html/templates/default
37
72
  - lib/markout/formatters/html/templates/default/content.rhtml
38
73
  - lib/markout/formatters/html/templates/default/print.css
@@ -44,13 +79,53 @@ files:
44
79
  - lib/markout/revision.rb
45
80
  - lib/markout.rb
46
81
  - test/fixtures
82
+ - test/fixtures/empty.txt
83
+ - test/fixtures/empty_repository__dot__git
84
+ - test/fixtures/empty_repository__dot__git/COMMIT_EDITMSG
85
+ - test/fixtures/empty_repository__dot__git/config
86
+ - test/fixtures/empty_repository__dot__git/description
87
+ - test/fixtures/empty_repository__dot__git/HEAD
88
+ - test/fixtures/empty_repository__dot__git/hooks
89
+ - test/fixtures/empty_repository__dot__git/hooks/applypatch-msg.sample
90
+ - test/fixtures/empty_repository__dot__git/hooks/commit-msg.sample
91
+ - test/fixtures/empty_repository__dot__git/hooks/post-commit.sample
92
+ - test/fixtures/empty_repository__dot__git/hooks/post-receive.sample
93
+ - test/fixtures/empty_repository__dot__git/hooks/post-update.sample
94
+ - test/fixtures/empty_repository__dot__git/hooks/pre-applypatch.sample
95
+ - test/fixtures/empty_repository__dot__git/hooks/pre-commit.sample
96
+ - test/fixtures/empty_repository__dot__git/hooks/pre-rebase.sample
97
+ - test/fixtures/empty_repository__dot__git/hooks/prepare-commit-msg.sample
98
+ - test/fixtures/empty_repository__dot__git/hooks/update.sample
99
+ - test/fixtures/empty_repository__dot__git/index
100
+ - test/fixtures/empty_repository__dot__git/info
101
+ - test/fixtures/empty_repository__dot__git/info/exclude
102
+ - test/fixtures/empty_repository__dot__git/logs
103
+ - test/fixtures/empty_repository__dot__git/logs/HEAD
104
+ - test/fixtures/empty_repository__dot__git/logs/refs
105
+ - test/fixtures/empty_repository__dot__git/logs/refs/heads
106
+ - test/fixtures/empty_repository__dot__git/logs/refs/heads/master
107
+ - test/fixtures/empty_repository__dot__git/objects
108
+ - test/fixtures/empty_repository__dot__git/objects/25
109
+ - test/fixtures/empty_repository__dot__git/objects/25/877ea00eb8d2de7a31cf7c4c4c16f0390d48fd
110
+ - test/fixtures/empty_repository__dot__git/objects/a0
111
+ - test/fixtures/empty_repository__dot__git/objects/a0/b6af2541dce8f646276ec7340695c34c7578aa
112
+ - test/fixtures/empty_repository__dot__git/objects/ec
113
+ - test/fixtures/empty_repository__dot__git/objects/ec/9e2a7b50ee2dfd5e6f8b5224fb3d7a98a79558
114
+ - test/fixtures/empty_repository__dot__git/objects/info
115
+ - test/fixtures/empty_repository__dot__git/objects/pack
116
+ - test/fixtures/empty_repository__dot__git/refs
117
+ - test/fixtures/empty_repository__dot__git/refs/heads
118
+ - test/fixtures/empty_repository__dot__git/refs/heads/master
119
+ - test/fixtures/empty_repository__dot__git/refs/tags
47
120
  - test/fixtures/markdown.html
48
121
  - test/fixtures/markdown.txt
49
122
  - test/fixtures/mt_textformat_menu.png
50
123
  - test/markout_document_test.rb
51
124
  - test/markout_formatter_test.rb
125
+ - test/markout_history_test.rb
52
126
  - test/markout_html_test.rb
53
127
  - test/markout_output_test.rb
128
+ - test/markout_revision_test.rb
54
129
  - test/markout_test.rb
55
130
  - test/test_helper.rb
56
131
  - LICENSE