From cd820125e2998a48b2285bc3373cccb2432ea87b Mon Sep 17 00:00:00 2001 From: Itamar Haber Date: Fri, 12 Feb 2021 16:36:07 +0200 Subject: [PATCH 1/2] Revamps clients/tools/modules * Changes recommended from star to heart * Sorting is based on activity and number of stars * Adds twitter avatar to tool authors --- app.rb | 4 ++-- makefile | 2 +- public/styles.css | 2 ++ views/clients.haml | 53 +++++++++++++++++++++++++++++++++++----------- views/modules.haml | 22 +++++++++++++++---- 5 files changed, 64 insertions(+), 19 deletions(-) diff --git a/app.rb b/app.rb index 2e27c854..7f8d8cdc 100644 --- a/app.rb +++ b/app.rb @@ -247,13 +247,13 @@ def not_found(locals = {path: nil}) @redis_tools = JSON.parse(File.read(documentation_path + "/tools.json")) @clients_by_language = @clients.group_by { |info| info["language"] }.sort_by { |name, _| name.downcase } - + @redis_tools = @redis_tools.sort_by {|t| [ t["active"] ? 0 : 1, t["github"] && t["github"]["stars"] ? -t["github"]["stars"] : 0, t["name"].downcase ]} custom_render("clients") end on get, "modules" do @modules = JSON.parse(File.read(documentation_path + "/modules.json")) - @modules = @modules.sort_by {|m| -m["stars"]} + @modules = @modules.sort_by {|m| [ m["active"] ? 0 : 1, -m["stars"], m["name"].downcase ]} custom_render("modules") end diff --git a/makefile b/makefile index 8e872851..f67e67f2 100644 --- a/makefile +++ b/makefile @@ -5,7 +5,7 @@ test: cutest $(TEST_FILES) deploy: - cd /srv/redis-doc && git pull + cd /srv/redis-doc && git stash && git pull cd /srv/redis-io && git stash && git pull bash --login -c "cd /srv/redis-io && rvm use 2.7.0 && REDIS_DOC=/srv/redis-doc /srv/redis-io/scripts/generate_interactive_commands.rb > /srv/redis-io/lib/interactive/commands.rb" service redis-io-app restart diff --git a/public/styles.css b/public/styles.css index b97a571a..31e5b4e2 100644 --- a/public/styles.css +++ b/public/styles.css @@ -205,10 +205,12 @@ body { background-color: white; color: #333333; padding: 0; margin: 0; } #clients h2 { margin: 2em 0 1em 0; text-align: left; } #clients .icon { color: #333333; font-size: 20px; } #clients .icon-star { color: #ffe00d; } +#clients .icon-heart { color: #d42e15; } #clients table { table-layout: fixed; } #clients table td, #clients table th { padding: 0.8em; border-bottom: 1px solid #efefef; } #clients table td.description { color: #666666; font-size: 0.9em; } #clients table td.authors { text-align: right; } +#clients table td.stars { white-space: nowrap; } #clients col.homepage, #clients col.recommended, #clients col.active, #clients col.repository { width: 1em; } #clients col.authors { width: 120px; } #clients .twitter-avatar { width: 36px; height: 36px; } diff --git a/views/clients.haml b/views/clients.haml index d6b31b11..02c6bc9c 100644 --- a/views/clients.haml +++ b/views/clients.haml @@ -5,10 +5,11 @@ %h1 Clients %p - The recommended client(s) for a language are marked with a . + The recommended client(s) for a language are marked with a . %p - Clients with some activity in the official repository within the latest six months are marked with a . + Clients with some activity in their GitHub repository within the last six months are marked with a . + %p Want %strong your client listed here? @@ -32,25 +33,27 @@ %col(class="recommended") %col(class="homepage") %col(class="repository") + %col(class="stars") %col(class="description") %col(class="authors") - @clients_by_language.each do |language, clients| %tr - %th(colspan="7") + %th(colspan="8") %h2(id="#{anchorize_language(language)}")= language - - clients.sort_by { |c| c["name"].downcase }.each do |client| + - clients.sort_by { |c| [ c["active"] ? 0 : 1, c["github"] && c["github"]["stars"] ? -c["github"]["stars"] : 0, c["name"].downcase ]}.each do |client| %tr %td = client["name"] + %td - if client["active"] %i(class="fa fa-smile-o icon") %td - if client["recommended"] - %i(class="fa fa-star icon icon-star") + %i(class="fa fa-heart icon icon-heart") %td - if client["url"] @@ -62,6 +65,11 @@ %a(href="#{client["repository"]}" class="icon") %i(class="fa fa-code-fork") + %td.stars + - if client["github"] && client["github"]["stars"] + #{client["github"]["stars"]} + %i(class="fa fa-star icon icon-star") + %td.description = client["description"] @@ -74,9 +82,17 @@ %h1(style="margin-top:80px") Higher level libraries and tools %p - This is an additional list of libraries that are not direct layers on top of the Redis API, but higher level libraries such as ORMs, messaging libraries, and other misc tools that are designed for Redis. + This is an additional list of libraries that are not direct layers on top of the Redis API, but rather higher level libraries such as ORMs, messaging libraries, and other misc tools that are designed for Redis. %table + %col(class="name") + %col(class="active") + %col(class="homepage") + %col(class="repository") + %col(class="stars") + %col(class="description") + %col(class="authors") + - @redis_tools.each do |tool| - tool["description"] += " (#{tool['language']})" %tr @@ -84,16 +100,29 @@ = tool["name"] %td - - if tool["repository"] - %a(href="#{tool["repository"]}") Repository + - if tool["active"] + %i(class="fa fa-smile-o icon") + %td - if tool["url"] - %a(href="#{tool["url"]}") Homepage + %a(href="#{tool["url"]}" class="icon") + %i(class="fa fa-home") %td - - tool["authors"].each do |author| - %a(href="http://twitter.com/#{author}")= author + - if tool["repository"] + %a(href="#{tool["repository"]}" class="icon") + %i(class="fa fa-code-fork") - %td + %td.stars + - if tool["github"] && tool["github"]["stars"] + #{tool["github"]["stars"]} + %i(class="fa fa-star icon icon-star") + + %td.description = tool["description"] + %td.authors + - if tool["authors"] + - tool["authors"].each do |author| + %a(href="https://twitter.com/#{author}") + %img(src="//twitter-avatars.herokuapp.com/avatar/#{author}" alt="#{author}" class="twitter-avatar") diff --git a/views/modules.haml b/views/modules.haml index 877a651a..e5ec4101 100644 --- a/views/modules.haml +++ b/views/modules.haml @@ -5,21 +5,35 @@ %h1 Redis Modules %p - This is a list of Redis modules, for Redis v4.0 or greater, ordered by Github stars. This list contains two set of modules: modules under an OSI approved license, and modules that are under some proprietary license. Non OSI modules are clearly flagged as not open source. Also to have the source code hosted at Github is currently mandatory. To add your module here please send a pull request for the modules.json file in the Redis-doc repository. More information about Redis modules can be found here. + This is a list of Redis modules, for Redis v4.0 or greater, ordered by activity and Github stars. + + %p + Modules with some activity in their GitHub repository within the last six months are marked with a . + + %p + This list contains two types of modules: modules under an OSI approved license, and modules that are under some proprietary license. Non-OSI modules are clearly flagged as not open source. Also to have the source code hosted at Github is currently mandatory. + + %p + To add your module here please send a pull request for the modules.json file in the Redis-doc repository. More information about Redis modules can be found here. %table %col(class="name") - %col(class="license") - %col(class="stars") + %col(class="active") %col(class="repository") %col(class="description") %col(class="authors") + %col(class="license") + %col(class="stars") - @modules.each do |mod| %tr %td = mod["name"] + %td + - if mod["active"] + %i(class="fa fa-smile-o icon") + %td - if mod["repository"] %a(href="#{mod["repository"]}" class="icon") @@ -36,6 +50,6 @@ %td = mod["license"] - %td + %td.stars #{mod["stars"]} %i(class="fa fa-star icon-star") From 63f357185d830beafed67a15b4fa7906c673df80 Mon Sep 17 00:00:00 2001 From: Itamar Haber Date: Sat, 13 Feb 2021 16:20:26 +0200 Subject: [PATCH 2/2] Disables recommended if inactive --- views/clients.haml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/views/clients.haml b/views/clients.haml index 02c6bc9c..e92fc579 100644 --- a/views/clients.haml +++ b/views/clients.haml @@ -52,7 +52,7 @@ %i(class="fa fa-smile-o icon") %td - - if client["recommended"] + - if client["recommended"] && client["active"] %i(class="fa fa-heart icon icon-heart") %td