CarmineContraption 0.1.0 → 0.1.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/.travis.yml +5 -0
- data/Rakefile +5 -7
- data/Readme.md +34 -10
- data/carmine_contraption.gemspec +1 -1
- data/lib/carmine_contraption.rb +34 -0
- data/lib/carmine_contraption/black_hole.rb +12 -0
- data/lib/carmine_contraption/error.rb +5 -0
- data/lib/carmine_contraption/formatter.rb +34 -0
- data/lib/carmine_contraption/index.rb +47 -106
- data/lib/carmine_contraption/media.rb +1 -1
- data/lib/carmine_contraption/post.rb +34 -79
- data/lib/carmine_contraption/runner.rb +86 -86
- data/lib/carmine_contraption/version.rb +1 -1
- data/lib/carmine_contraption/writer.rb +132 -0
- data/test/data/formats/raw.html.erb +8 -0
- data/test/lib/carmine_contraption/test_error.rb +19 -0
- data/test/lib/carmine_contraption/test_formatter.rb +59 -0
- data/test/lib/carmine_contraption/test_index.rb +4 -0
- data/test/{test_media.rb → lib/carmine_contraption/test_media.rb} +1 -3
- data/test/{test_options.rb → lib/carmine_contraption/test_options.rb} +1 -4
- data/test/{test_post.rb → lib/carmine_contraption/test_post.rb} +2 -37
- data/test/lib/carmine_contraption/test_runner.rb +4 -0
- data/test/{test_uploader.rb → lib/carmine_contraption/test_uploader.rb} +1 -5
- data/test/test_helper.rb +5 -0
- metadata +36 -40
- data/lib/carmine_contraption/formatters.rb +0 -64
- data/lib/carmine_contraption/month_transform.rb +0 -95
- data/test/test_index.rb +0 -6
- data/test/test_runner.rb +0 -6
@@ -1,6 +1,4 @@
|
|
1
|
-
|
2
|
-
require 'shoulda'
|
3
|
-
require_relative '../lib/carmine_contraption/post'
|
1
|
+
require_relative '../../test_helper'
|
4
2
|
|
5
3
|
module CarmineContraption
|
6
4
|
class TestPost < Test::Unit::TestCase
|
@@ -45,39 +43,6 @@ module CarmineContraption
|
|
45
43
|
end
|
46
44
|
end
|
47
45
|
|
48
|
-
context "Date Importing" do
|
49
|
-
should "return date" do
|
50
|
-
d = "2010-02-21 18:42:49 -0400"
|
51
|
-
assert_equal d, Post.send(:convert_date, d)
|
52
|
-
end
|
53
|
-
|
54
|
-
should "return formatted date" do
|
55
|
-
assert_equal "2012-11-20 08:56:32 -0500",
|
56
|
-
Post.send(:convert_date, "Tue, 20 Nov 2012 08:56:32 EST")
|
57
|
-
end
|
58
|
-
end
|
59
|
-
|
60
|
-
context "Date Processing" do
|
61
|
-
setup do
|
62
|
-
@the_post = Post.new published: "2010-02-21 18:00:00 -0400"
|
63
|
-
end
|
64
|
-
|
65
|
-
should "return year" do
|
66
|
-
assert_respond_to @the_post, :year
|
67
|
-
assert_equal "2010", @the_post.year
|
68
|
-
end
|
69
|
-
|
70
|
-
should "return month" do
|
71
|
-
assert_respond_to @the_post, :month
|
72
|
-
assert_equal "02", @the_post.month
|
73
|
-
end
|
74
|
-
|
75
|
-
should "return day" do
|
76
|
-
assert_respond_to @the_post, :day
|
77
|
-
assert_equal "21", @the_post.day
|
78
|
-
end
|
79
|
-
end
|
80
|
-
|
81
46
|
context "Separator" do
|
82
47
|
should "ignore separator" do
|
83
48
|
assert_equal nil, Post.send(:ignore_separator, "=")
|
@@ -160,7 +125,7 @@ module CarmineContraption
|
|
160
125
|
context "public instance api" do
|
161
126
|
setup do
|
162
127
|
@methods = Post.instance_methods false
|
163
|
-
@required_methods = [:
|
128
|
+
@required_methods = [:formatted_output, :method_missing, :update, :<=>]
|
164
129
|
end
|
165
130
|
|
166
131
|
should "include required methods" do
|
@@ -1,8 +1,4 @@
|
|
1
|
-
|
2
|
-
require 'shoulda'
|
3
|
-
require_relative '../lib/carmine_contraption/uploader'
|
4
|
-
require_relative '../lib/carmine_contraption/media'
|
5
|
-
require_relative '../lib/carmine_contraption/options'
|
1
|
+
require_relative '../../test_helper'
|
6
2
|
|
7
3
|
module CarmineContraption
|
8
4
|
class TestUploader < Test::Unit::TestCase
|
data/test/test_helper.rb
ADDED
metadata
CHANGED
@@ -1,20 +1,18 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: CarmineContraption
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
5
|
-
prerelease:
|
4
|
+
version: 0.1.1
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Casey Robinson
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date: 2013-
|
11
|
+
date: 2013-03-17 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: shoulda
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
17
|
- - ~>
|
20
18
|
- !ruby/object:Gem::Version
|
@@ -22,7 +20,6 @@ dependencies:
|
|
22
20
|
type: :development
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
24
|
- - ~>
|
28
25
|
- !ruby/object:Gem::Version
|
@@ -30,7 +27,6 @@ dependencies:
|
|
30
27
|
- !ruby/object:Gem::Dependency
|
31
28
|
name: rake
|
32
29
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
30
|
requirements:
|
35
31
|
- - ~>
|
36
32
|
- !ruby/object:Gem::Version
|
@@ -38,7 +34,6 @@ dependencies:
|
|
38
34
|
type: :development
|
39
35
|
prerelease: false
|
40
36
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
37
|
requirements:
|
43
38
|
- - ~>
|
44
39
|
- !ruby/object:Gem::Version
|
@@ -46,7 +41,6 @@ dependencies:
|
|
46
41
|
- !ruby/object:Gem::Dependency
|
47
42
|
name: colorize
|
48
43
|
requirement: !ruby/object:Gem::Requirement
|
49
|
-
none: false
|
50
44
|
requirements:
|
51
45
|
- - ~>
|
52
46
|
- !ruby/object:Gem::Version
|
@@ -54,7 +48,6 @@ dependencies:
|
|
54
48
|
type: :runtime
|
55
49
|
prerelease: false
|
56
50
|
version_requirements: !ruby/object:Gem::Requirement
|
57
|
-
none: false
|
58
51
|
requirements:
|
59
52
|
- - ~>
|
60
53
|
- !ruby/object:Gem::Version
|
@@ -62,7 +55,6 @@ dependencies:
|
|
62
55
|
- !ruby/object:Gem::Dependency
|
63
56
|
name: redcarpet
|
64
57
|
requirement: !ruby/object:Gem::Requirement
|
65
|
-
none: false
|
66
58
|
requirements:
|
67
59
|
- - ~>
|
68
60
|
- !ruby/object:Gem::Version
|
@@ -70,7 +62,6 @@ dependencies:
|
|
70
62
|
type: :runtime
|
71
63
|
prerelease: false
|
72
64
|
version_requirements: !ruby/object:Gem::Requirement
|
73
|
-
none: false
|
74
65
|
requirements:
|
75
66
|
- - ~>
|
76
67
|
- !ruby/object:Gem::Version
|
@@ -78,7 +69,6 @@ dependencies:
|
|
78
69
|
- !ruby/object:Gem::Dependency
|
79
70
|
name: aws-s3
|
80
71
|
requirement: !ruby/object:Gem::Requirement
|
81
|
-
none: false
|
82
72
|
requirements:
|
83
73
|
- - ~>
|
84
74
|
- !ruby/object:Gem::Version
|
@@ -86,7 +76,6 @@ dependencies:
|
|
86
76
|
type: :runtime
|
87
77
|
prerelease: false
|
88
78
|
version_requirements: !ruby/object:Gem::Requirement
|
89
|
-
none: false
|
90
79
|
requirements:
|
91
80
|
- - ~>
|
92
81
|
- !ruby/object:Gem::Version
|
@@ -100,72 +89,79 @@ extensions: []
|
|
100
89
|
extra_rdoc_files: []
|
101
90
|
files:
|
102
91
|
- .gitignore
|
92
|
+
- .travis.yml
|
103
93
|
- Gemfile
|
104
94
|
- LICENSE.txt
|
105
95
|
- Rakefile
|
106
96
|
- Readme.md
|
107
97
|
- bin/carmine_contraption
|
108
98
|
- carmine_contraption.gemspec
|
109
|
-
- lib/carmine_contraption
|
99
|
+
- lib/carmine_contraption.rb
|
100
|
+
- lib/carmine_contraption/black_hole.rb
|
101
|
+
- lib/carmine_contraption/error.rb
|
102
|
+
- lib/carmine_contraption/formatter.rb
|
110
103
|
- lib/carmine_contraption/index.rb
|
111
104
|
- lib/carmine_contraption/media.rb
|
112
|
-
- lib/carmine_contraption/month_transform.rb
|
113
105
|
- lib/carmine_contraption/options.rb
|
114
106
|
- lib/carmine_contraption/post.rb
|
115
107
|
- lib/carmine_contraption/runner.rb
|
116
108
|
- lib/carmine_contraption/uploader.rb
|
117
109
|
- lib/carmine_contraption/version.rb
|
110
|
+
- lib/carmine_contraption/writer.rb
|
118
111
|
- lib/photos.rb
|
119
112
|
- lib/templates/default.html.erb
|
120
113
|
- lib/templates/landing_page.html
|
121
114
|
- lib/templates/photo.html
|
122
115
|
- lib/update_repo.sh
|
116
|
+
- test/data/formats/raw.html.erb
|
123
117
|
- test/data/media/adama.jpg
|
118
|
+
- test/data/posts/20121209-test.html
|
124
119
|
- test/data/posts/20121209-test.md
|
125
120
|
- test/data/posts/20121210-test-with-image.md
|
126
|
-
- test/
|
127
|
-
- test/
|
128
|
-
- test/
|
129
|
-
- test/
|
130
|
-
- test/
|
131
|
-
- test/
|
132
|
-
|
121
|
+
- test/lib/carmine_contraption/test_error.rb
|
122
|
+
- test/lib/carmine_contraption/test_formatter.rb
|
123
|
+
- test/lib/carmine_contraption/test_index.rb
|
124
|
+
- test/lib/carmine_contraption/test_media.rb
|
125
|
+
- test/lib/carmine_contraption/test_options.rb
|
126
|
+
- test/lib/carmine_contraption/test_post.rb
|
127
|
+
- test/lib/carmine_contraption/test_runner.rb
|
128
|
+
- test/lib/carmine_contraption/test_uploader.rb
|
129
|
+
- test/test_helper.rb
|
130
|
+
homepage: https://github.com/rampantmonkey/carmine_contraption
|
133
131
|
licenses: []
|
132
|
+
metadata: {}
|
134
133
|
post_install_message:
|
135
134
|
rdoc_options: []
|
136
135
|
require_paths:
|
137
136
|
- lib
|
138
137
|
required_ruby_version: !ruby/object:Gem::Requirement
|
139
|
-
none: false
|
140
138
|
requirements:
|
141
|
-
- -
|
139
|
+
- - '>='
|
142
140
|
- !ruby/object:Gem::Version
|
143
141
|
version: '0'
|
144
|
-
segments:
|
145
|
-
- 0
|
146
|
-
hash: -3297282876702184801
|
147
142
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
148
|
-
none: false
|
149
143
|
requirements:
|
150
|
-
- -
|
144
|
+
- - '>='
|
151
145
|
- !ruby/object:Gem::Version
|
152
146
|
version: '0'
|
153
|
-
segments:
|
154
|
-
- 0
|
155
|
-
hash: -3297282876702184801
|
156
147
|
requirements: []
|
157
148
|
rubyforge_project: carmine_contraption
|
158
|
-
rubygems_version:
|
149
|
+
rubygems_version: 2.0.2
|
159
150
|
signing_key:
|
160
|
-
specification_version:
|
151
|
+
specification_version: 4
|
161
152
|
summary: Static Website Generator
|
162
153
|
test_files:
|
154
|
+
- test/data/formats/raw.html.erb
|
163
155
|
- test/data/media/adama.jpg
|
156
|
+
- test/data/posts/20121209-test.html
|
164
157
|
- test/data/posts/20121209-test.md
|
165
158
|
- test/data/posts/20121210-test-with-image.md
|
166
|
-
- test/
|
167
|
-
- test/
|
168
|
-
- test/
|
169
|
-
- test/
|
170
|
-
- test/
|
171
|
-
- test/
|
159
|
+
- test/lib/carmine_contraption/test_error.rb
|
160
|
+
- test/lib/carmine_contraption/test_formatter.rb
|
161
|
+
- test/lib/carmine_contraption/test_index.rb
|
162
|
+
- test/lib/carmine_contraption/test_media.rb
|
163
|
+
- test/lib/carmine_contraption/test_options.rb
|
164
|
+
- test/lib/carmine_contraption/test_post.rb
|
165
|
+
- test/lib/carmine_contraption/test_runner.rb
|
166
|
+
- test/lib/carmine_contraption/test_uploader.rb
|
167
|
+
- test/test_helper.rb
|
@@ -1,64 +0,0 @@
|
|
1
|
-
require 'time'
|
2
|
-
|
3
|
-
module CarmineContraption
|
4
|
-
|
5
|
-
class ArticleFormatter
|
6
|
-
def format_post context
|
7
|
-
s = '<article class="group">
|
8
|
-
<div class="grid14 thetitle"><a href="' + context.year + "/" + context.month + "/" + context.guid + '"><h1>' + context.title + '</h1></a></div>
|
9
|
-
<div class="metadata grid2">
|
10
|
-
<span class="date">' + context.day + ' ' + "#{context.month_alpha context.month}" + ' ' + context.year + '</span>
|
11
|
-
'
|
12
|
-
context.tags.each do |t|
|
13
|
-
s += '<span class="tag"><a href="/tags/' + t.to_s.gsub(' ', '_') + '">' + t.to_s + '</a></span>' + "\n"
|
14
|
-
end
|
15
|
-
s += %Q(<span><a class="permalink nohover" href="/#{context.year}/#{context.month}/#{context.guid}">∞</a></span>
|
16
|
-
</div>
|
17
|
-
<div class="grid14">)
|
18
|
-
s += context.content
|
19
|
-
s += '</div></article>'
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
class LinkFormatter
|
24
|
-
def format_post context
|
25
|
-
s = '<article class="group">
|
26
|
-
<div class="grid14 thetitle"><a href="' + context.extra + '"><h1>' + context.title + '<span>→</span></h1></a></div>
|
27
|
-
<div class="metadata grid2">
|
28
|
-
<span class="date">' + context.day + ' ' + "#{context.month_alpha context.month}" + ' ' + context.year + '</span>
|
29
|
-
'
|
30
|
-
context.tags.each do |t|
|
31
|
-
s += '<span class="tag"><a href="/tags/' + t.to_s.gsub(' ', '_') + '">' + t.to_s + '</a></span>' + "\n"
|
32
|
-
end
|
33
|
-
s += %Q(<span><a class="permalink nohover" href="/#{context.year}/#{context.month}/#{context.guid}">∞</a></span>
|
34
|
-
</div>
|
35
|
-
<div class="grid14">)
|
36
|
-
s += context.content
|
37
|
-
s += '</div></article>'
|
38
|
-
end
|
39
|
-
end
|
40
|
-
|
41
|
-
class RawFormatter
|
42
|
-
def format_post context
|
43
|
-
s = context.title
|
44
|
-
s += "="*context.title.length
|
45
|
-
s += "Type: #{context.type}"
|
46
|
-
s += "Published: #{context.published}"
|
47
|
-
s += "Tags: #{context.tags.join(', ')}\n\n"
|
48
|
-
s += context.content
|
49
|
-
end
|
50
|
-
end
|
51
|
-
|
52
|
-
class RssFormatter
|
53
|
-
def format_post context
|
54
|
-
s = "<item><title>#{context.title.chomp}</title>\n"
|
55
|
-
s += "<description>#{context.summary}</description>\n"
|
56
|
-
s += "<pubDate>#{Time.parse(context.published).strftime("%a, %d %b %Y %H:%M:%S %Z")}</pubDate>\n"
|
57
|
-
s += "<link>http://rampantmonkey.com/#{context.year}/#{context.month}/#{context.guid}</link>\n"
|
58
|
-
s += "<author>Casey Robinson (kc\@rampantmonkey.com)</author>\n"
|
59
|
-
s += %Q(<guid isPermaLink="true">http://rampantmonkey.com/#{context.year}/#{context.month}/#{context.guid}</guid>\n)
|
60
|
-
s += "<content:encoded>\n#{context.content}\n</content:encoded>\n"
|
61
|
-
s += "</item>\n"
|
62
|
-
end
|
63
|
-
end
|
64
|
-
end
|
@@ -1,95 +0,0 @@
|
|
1
|
-
module MonthTransform
|
2
|
-
def month_arabic m
|
3
|
-
case m
|
4
|
-
when 'Jan'
|
5
|
-
'01'
|
6
|
-
when 'Feb'
|
7
|
-
'02'
|
8
|
-
when 'Mar'
|
9
|
-
'03'
|
10
|
-
when 'Apr'
|
11
|
-
'04'
|
12
|
-
when 'May'
|
13
|
-
'05'
|
14
|
-
when 'Jun'
|
15
|
-
'06'
|
16
|
-
when 'Jul'
|
17
|
-
'07'
|
18
|
-
when 'Aug'
|
19
|
-
'08'
|
20
|
-
when 'Sep'
|
21
|
-
'09'
|
22
|
-
when 'Oct'
|
23
|
-
'10'
|
24
|
-
when 'Nov'
|
25
|
-
'11'
|
26
|
-
when 'Dec'
|
27
|
-
'12'
|
28
|
-
else
|
29
|
-
''
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
def month_alpha_long m
|
34
|
-
case m
|
35
|
-
when '01'
|
36
|
-
'January'
|
37
|
-
when '02'
|
38
|
-
'February'
|
39
|
-
when '03'
|
40
|
-
'March'
|
41
|
-
when '04'
|
42
|
-
'April'
|
43
|
-
when '05'
|
44
|
-
'May'
|
45
|
-
when '06'
|
46
|
-
'June'
|
47
|
-
when '07'
|
48
|
-
'July'
|
49
|
-
when '08'
|
50
|
-
'August'
|
51
|
-
when '09'
|
52
|
-
'September'
|
53
|
-
when '10'
|
54
|
-
'October'
|
55
|
-
when '11'
|
56
|
-
'November'
|
57
|
-
when '12'
|
58
|
-
'December'
|
59
|
-
else
|
60
|
-
''
|
61
|
-
end
|
62
|
-
end
|
63
|
-
|
64
|
-
def month_alpha m
|
65
|
-
case m
|
66
|
-
when '01'
|
67
|
-
'Jan'
|
68
|
-
when '02'
|
69
|
-
'Feb'
|
70
|
-
when '03'
|
71
|
-
'Mar'
|
72
|
-
when '04'
|
73
|
-
'Apr'
|
74
|
-
when '05'
|
75
|
-
'May'
|
76
|
-
when '06'
|
77
|
-
'Jun'
|
78
|
-
when '07'
|
79
|
-
'Jul'
|
80
|
-
when '08'
|
81
|
-
'Aug'
|
82
|
-
when '09'
|
83
|
-
'Sep'
|
84
|
-
when '10'
|
85
|
-
'Oct'
|
86
|
-
when '11'
|
87
|
-
'Nov'
|
88
|
-
when '12'
|
89
|
-
'Dec'
|
90
|
-
else
|
91
|
-
''
|
92
|
-
end
|
93
|
-
end
|
94
|
-
|
95
|
-
end
|
data/test/test_index.rb
DELETED