tech_radar 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/helpers/tech_radar/application_helper.rb +4 -0
- data/app/models/tech_radar/rendering/Markdown.rb +28 -0
- data/app/models/tech_radar/rendering/Plaintext.rb +9 -0
- data/app/models/tech_radar/rendering.rb +9 -0
- data/app/views/tech_radar/technologies/show.html.erb +2 -2
- data/lib/tech_radar/version.rb +1 -1
- data/lib/tech_radar.rb +4 -0
- data/test/controllers/tech_radar/technologies_controller_test.rb +2 -1
- data/test/dummy/config/tech-radar.yml +1 -2
- data/test/models/tech_radar/radar_test.rb +1 -1
- data/test/models/tech_radar/rendering_test.rb +21 -0
- data/test/test_helper.rb +0 -1
- metadata +7 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 017f7f9db5644c8fef87cc38ec4b447b60277a8f
|
4
|
+
data.tar.gz: 15926f574b2fdddb449f128db0fe1be0cccf1557
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cec199461227239004563f3c70bd7c3ada6a29f1c63640b2846d1806349ebf41362cc48a2308db38ccf49372895fd4d4cc3f7c7cd72ed802cf6fd24c3f0a8152
|
7
|
+
data.tar.gz: 8e87e6566033cc82957d4eb42e776ba486874340450e9a5398731286f8de085ac206dbe3fee4d165f298e4e4a6365bfe84a1c03dfd7447c3fb54fdad787842cb
|
@@ -0,0 +1,28 @@
|
|
1
|
+
module TechRadar
|
2
|
+
module Rendering
|
3
|
+
class Markdown
|
4
|
+
def initialize
|
5
|
+
require 'redcarpet'
|
6
|
+
renderer = Redcarpet::Render::HTML.new(
|
7
|
+
filter_html: true,
|
8
|
+
no_styles: true,
|
9
|
+
safe_links_only: true
|
10
|
+
)
|
11
|
+
@markdown = Redcarpet::Markdown.new(renderer,
|
12
|
+
no_intra_emphasis: true,
|
13
|
+
tables: true,
|
14
|
+
fenced_code_blocks: true,
|
15
|
+
autolink: true,
|
16
|
+
disable_indented_code_blocks: true,
|
17
|
+
strikethrough: true,
|
18
|
+
superscript: true)
|
19
|
+
rescue LoadError => ex
|
20
|
+
raise "Since you speecified markdown rendering, you must include the redcarpet gem in your app: #{ex.message}"
|
21
|
+
end
|
22
|
+
|
23
|
+
def render_text(text)
|
24
|
+
@markdown.render(text).html_safe
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -14,7 +14,7 @@
|
|
14
14
|
</p>
|
15
15
|
<% else %>
|
16
16
|
<% if @technology.more_details_summary.present? %>
|
17
|
-
<p><%= @technology.more_details_summary %></p>
|
17
|
+
<p class="text-muted"><%= render_summary(@technology.more_details_summary) %></p>
|
18
18
|
<% end %>
|
19
19
|
<p>
|
20
20
|
<%= link_to t("tech_radar.radar.technologies.more_details_url.link"), @technology.more_details_url, class: "btn btn-default" %>
|
@@ -26,7 +26,7 @@
|
|
26
26
|
<% if @technology.why_summary.present? %>
|
27
27
|
<p>
|
28
28
|
<span class="text-muted">
|
29
|
-
<%= @technology.why_summary %>
|
29
|
+
<%= render_summary(@technology.why_summary) %>
|
30
30
|
</span>
|
31
31
|
<% if @technology.why_url.present? %>
|
32
32
|
<%= link_to t("tech_radar.radar.technologies.why_summary.link"), @technology.why_url %>
|
data/lib/tech_radar/version.rb
CHANGED
data/lib/tech_radar.rb
CHANGED
@@ -4,6 +4,7 @@ module TechRadar
|
|
4
4
|
class TechnologiesControllerTest < ActionController::TestCase
|
5
5
|
setup do
|
6
6
|
@routes = Engine.routes
|
7
|
+
TechRadar.summary_format = :markdown
|
7
8
|
end
|
8
9
|
|
9
10
|
test "index" do
|
@@ -46,7 +47,7 @@ module TechRadar
|
|
46
47
|
assert_response :success
|
47
48
|
assert response.body.include?("Ruby"),"Expected #{response.body} to include 'Ruby'"
|
48
49
|
refute response.body.include?("Google"),"Expected #{response.body} NOT to include a link to a Google search"
|
49
|
-
assert response.body.include?("object-oriented"),"Expected #{response.body} to include Ruby's summary"
|
50
|
+
assert response.body.include?("<em>object-oriented</em>"),"Expected #{response.body} to include Ruby's summary, parsed as markdown"
|
50
51
|
end
|
51
52
|
|
52
53
|
test "show with more_details_url" do
|
@@ -8,7 +8,6 @@
|
|
8
8
|
"Trial":
|
9
9
|
ElasticSearch:
|
10
10
|
purpose: "Indexed Search"
|
11
|
-
more_details_url:
|
12
11
|
why_summary: "Erch and CXE using"
|
13
12
|
HumbleKit:
|
14
13
|
purpose: "CSS Framework"
|
@@ -77,7 +76,7 @@
|
|
77
76
|
Ruby:
|
78
77
|
purpose: Middleware Programming
|
79
78
|
more_details_url: https://www.ruby-lang.org/en/
|
80
|
-
more_details_summary: "Ruby is a dynamic,
|
79
|
+
more_details_summary: "Ruby is a dynamic, _object-oriented_ programming language that combines ideas from Smalltalk, Perl, and others"
|
81
80
|
"Trial":
|
82
81
|
CoffeeScript:
|
83
82
|
purpose: Browser Programming
|
@@ -45,7 +45,7 @@ module TechRadar
|
|
45
45
|
technology = @radar.technology("Ruby")
|
46
46
|
assert_equal "Ruby" , technology.name
|
47
47
|
assert_equal "https://www.ruby-lang.org/en/" , technology.more_details_url
|
48
|
-
assert_equal "Ruby is a dynamic,
|
48
|
+
assert_equal "Ruby is a dynamic, _object-oriented_ programming language that combines ideas from Smalltalk, Perl, and others",
|
49
49
|
technology.more_details_summary
|
50
50
|
assert_equal nil , technology.why_url
|
51
51
|
assert_equal nil , technology.why_summary
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
module TechRadar
|
4
|
+
class RenderingTest < ActiveSupport::TestCase
|
5
|
+
|
6
|
+
test "plaintext" do
|
7
|
+
TechRadar.summary_format = :plaintext
|
8
|
+
renderer = Rendering.renderer
|
9
|
+
|
10
|
+
assert_equal TechRadar::Rendering::Plaintext,renderer.class
|
11
|
+
end
|
12
|
+
|
13
|
+
test "markdown" do
|
14
|
+
TechRadar.summary_format = :markdown
|
15
|
+
renderer = Rendering.renderer
|
16
|
+
|
17
|
+
assert_equal TechRadar::Rendering::Markdown,renderer.class
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
21
|
+
end
|
data/test/test_helper.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tech_radar
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stitch Fix Engineering
|
@@ -54,7 +54,7 @@ dependencies:
|
|
54
54
|
- !ruby/object:Gem::Version
|
55
55
|
version: '0'
|
56
56
|
- !ruby/object:Gem::Dependency
|
57
|
-
name:
|
57
|
+
name: redcarpet
|
58
58
|
requirement: !ruby/object:Gem::Requirement
|
59
59
|
requirements:
|
60
60
|
- - ">="
|
@@ -87,6 +87,9 @@ files:
|
|
87
87
|
- app/helpers/tech_radar/application_helper.rb
|
88
88
|
- app/models/tech_radar/quadrant.rb
|
89
89
|
- app/models/tech_radar/radar.rb
|
90
|
+
- app/models/tech_radar/rendering.rb
|
91
|
+
- app/models/tech_radar/rendering/Markdown.rb
|
92
|
+
- app/models/tech_radar/rendering/Plaintext.rb
|
90
93
|
- app/models/tech_radar/ring.rb
|
91
94
|
- app/models/tech_radar/technology.rb
|
92
95
|
- app/views/layouts/tech_radar/application.html.erb
|
@@ -177,6 +180,7 @@ files:
|
|
177
180
|
- test/dummy/tmp/cache/assets/test/sprockets/v3.0/wjc4fxI0T-E_AMREBsqAzcOoJVLQ2XmN8ybSXr2sA1c.cache
|
178
181
|
- test/integration/navigation_test.rb
|
179
182
|
- test/models/tech_radar/radar_test.rb
|
183
|
+
- test/models/tech_radar/rendering_test.rb
|
180
184
|
- test/test_helper.rb
|
181
185
|
homepage: https://github.com/stitchfix/tech_radar
|
182
186
|
licenses:
|
@@ -278,4 +282,5 @@ test_files:
|
|
278
282
|
- test/dummy/tmp/cache/assets/test/sprockets/v3.0/ZWMSse5xwAn4lVdnOdzP7aamfJLIIJ3tgM_K6QgcID8.cache
|
279
283
|
- test/integration/navigation_test.rb
|
280
284
|
- test/models/tech_radar/radar_test.rb
|
285
|
+
- test/models/tech_radar/rendering_test.rb
|
281
286
|
- test/test_helper.rb
|