Commit 657e5297 authored by Ricardo J. Mendez's avatar Ricardo J. Mendez

Merge branch 'release/1.0.7'

parents 4c34236d ce12172d
The MIT License (MIT)
Copyright (c) 2016 Ricardo J. Méndez Castro, Numergent Limited
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
\ No newline at end of file
# Relevance
Relevance is a smart tab organizer for Chrome, written in ClojureScript.
It’ll create a natural arrangement where the tabs you have spent the longest on, which are expected to be the most relevant, are placed first, and the ones you haven’t read at all are shunted to the end of your list.
[You can read more about it here](https://numergent.com/relevance/).
This is Relevance 1.0.7
# Building
## Development
To get a development build, run
```
lein chromebuild auto
```
You'll find the `target/unpacked/`, which you'll need to install into Chrome using developer mode.
## Release
To get the release version, run
```
lein clean
lein with-profile release chromebuild zip
```
# Testing
Relevance uses `doo` for running ClojureScript tests. I normally use `phantomjs`, but you can use it with the [environment of your choice](https://github.com/bensu/doo#setting-up-environments).
We can't test the entire application externally, since a lot of its API depend on Chrome functions being present (which only happens when you're running as a Chrome extension). You can however test the general functions running:
```
lein with-profile test doo phantom
```
# License
Includes pixeden's [iOS 7 vector icons](http://themes-pixeden.com/font-demos/7-stroke/).
Relevance is (c) 2016 Numergent Limited, and released under the [MIT License](https://tldrlegal.com/license/mit-license).
\ No newline at end of file
(defproject relevance-chrome "1.0.6"
(defproject relevance-chrome "1.0.7"
:license {:name "Eclipse Public License"
:url "http://www.eclipse.org/legal/epl-v10.html"}
:dependencies [[org.clojure/clojure "1.7.0"]
[org.clojure/clojurescript "1.8.34"]
[org.clojure/core.async "0.2.374"]
[com.cognitect/transit-cljs "0.8.237"]
:dependencies [[org.clojure/clojure "1.8.0"]
[org.clojure/clojurescript "1.9.93"]
[org.clojure/core.async "0.2.385"]
[com.cognitect/transit-cljs "0.8.239"]
[cljsjs/react-bootstrap "0.28.1-1" :exclusions [org.webjars.bower/jquery]]
[khroma "0.3.0"]
[prismatic/dommy "1.1.0"]
......@@ -13,9 +13,9 @@
:source-paths ["src/ui" "src/common" "src/background" "src/content"]
:test-paths ["test"]
:plugins [[lein-cljsbuild "1.1.1"]
:plugins [[lein-cljsbuild "1.1.3"]
[lein-chromebuild "0.3.1"]
[lein-doo "0.1.6-SNAPSHOT"]]
[lein-doo "0.1.6"]]
:doo {:build "test"}
......@@ -71,5 +71,3 @@
:main relevance.test.runner
:optimizations :none
:pretty-print :true}}}}}})
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
......@@ -30,10 +30,6 @@
<div class="wrapper">
<div class="sidebar" data-color="purple" data-image="relevance-0.4-background.jpg">
<!-- you can change the color of the sidebar using: data-color="blue | azure | green | orange | red | purple" -->
<div class="sidebar-wrapper">
<div class="logo">
<a href="http://www.numergent.com" class="simple-text">
......@@ -70,7 +66,7 @@
<footer class="footer">
<div class="container-fluid">
<p class="copyright pull-right">
&copy; 2015-2016 <a href="http://numergent.com" target="_blank">Numergent Limited</a>
&copy; 2015-2016 <a href="https://numergent.com" target="_blank">Numergent Limited</a>
</p>
</div>
</footer>
......
@font-face {
font-family: 'Pe-icon-7-stroke';
src:url('Pe-icon-7-stroke.eot?d7yf1v');
src:url('Pe-icon-7-stroke.eot?#iefixd7yf1v') format('embedded-opentype'),
url('Pe-icon-7-stroke.ttf?d7yf1v') format('truetype');
src:url('Pe-icon-7-stroke.ttf?d7yf1v') format('truetype');
font-weight: normal;
font-style: normal;
}
......
{
"name": "Relevance - Smart Tab Organizer",
"short_name": "Relevance",
"version": "1.0.6",
"version": "1.0.7",
"browser_action": {
"default_title": "Organize tabs",
"default_icon": {
......
......@@ -4,7 +4,10 @@
(defn accumulate-site-times
"Accumulates the total time for a site from a hashmap of URL times"
"Accumulates the total time for a site from a hashmap of URL times.
Returns a hashmap with the URL ID as the key, and the :time, :icon and
:host string on its value."
[url-times]
(->>
(group-by #(hostname (:url %)) (vals url-times))
......@@ -13,7 +16,6 @@
(hash-map :host (key %)
:time (apply + (map :time (val %)))
:icon (:icon (first (val %))))))
(into {})))
......
......@@ -98,7 +98,6 @@
(register-handler
:settings-parse
(fn [app-state [_ settings]]
(console/log settings)
(let [ignore-set (utils/to-string-set (:ignore-set settings))]
(dispatch [:settings-set {:ignore-set ignore-set
:sound-to-left? (:sound-to-left? settings)} true])
......@@ -228,9 +227,9 @@
^{:key i}
[:tr {:class "has_on_hover"}
[:td {:class "col-sm-1"}
[:td {:class "col-sm-2"}
(time-display (:time tab))]
[:td {:class "col-sm-9"}
[:td {:class "col-sm-8"}
[:a
{:href url :target "_blank"}
(if favicon
......@@ -334,7 +333,7 @@
[:div {:class "page-header col-sm-10 col-sm-offset-1"}
[:h1 "Welcome!"]]
[:div {:class "col-sm-10 col-sm-offset-1"}
[:h2 "Thanks for installing Relevance 1.0.6"]
[:h2 "Thanks for installing Relevance 1.0.7"]
[:p [:a {:href "http://numergent.com/relevance/" :target "_blank"} "You can read about the latest changes here."]]
[:p "Relevance will help you sort your tabs when you have too many of them open. Here's how to use it:"]
[:ul
......@@ -424,7 +423,6 @@
our-sound (reagent/atom @sound-to-left?)]
(fn []
(console/log @sound-to-left? @our-sound)
[:div {:class "col-sm-12"}
[:div {:class "row"}
[:div {:class "col-sm-12"}
......
......@@ -270,7 +270,7 @@
(doseq [other (dissoc result id)]
(is (= (val other) (get (:site-times test-db) (key other))) "Other items should have remained untouched"))
;; Let's make sure we did not break anything while adding an ignore parameter
;; Let's make sure we did not break anything while adding an ignore-set parameter
(is (= result (data/track-site-time (:site-times test-db) tab 3 ts
:ignore-set #{"localhost" "newtab"}))
"The result should be the same even if we pass an ignore-set")))
......@@ -297,11 +297,11 @@
(doseq [other (dissoc result id)]
(is (= (val other) (get (:site-times test-db) (key other))) "Other items should have remained untouched"))
;; Then, let's make sure we did not break anything while adding an ignore parameter
;; Then, let's make sure we did not break anything while adding an ignore-set parameter
(is (= result
(data/track-site-time (:site-times test-db) tab 9 ts
:ignore-set #{"localhost" "somedomain.com"})))))
:ignore-set #{"localhost" "somedomain.com"}))
"The result should be the same even if we pass an ignore-set")))
(testing "Add zero time should not result on any changes"
......@@ -319,7 +319,7 @@
(is (= result (:site-times test-db)))
(is (nil? item))))
(testing "Add time from an invalid tab does not change the databse"
(testing "Add time for an invalid tab does not change the databse"
(let [tab {}
ts 1445964037920
result (data/track-site-time (:site-times test-db)
......@@ -352,7 +352,6 @@
147 (:time item)))))
(deftest test-clean-up-by-time
(testing "Clean up date and minimum time are respected"
(let [min-date 1446028215913
......@@ -413,7 +412,6 @@
(is (= 4 (count result))))))
(deftest test-accumulate-site-times
(testing "Accumulate site times creates a total but doesn't add favicons"
(is (= (into {} (map #(vector (key %) (assoc (val %) :icon nil))
......@@ -440,18 +438,17 @@
:time 4
:ts 1446051494575
:title "New York spot price Gold..."}}
acc (data/accumulate-site-times data)]
;; There should be no empty hostnames
; There should be no empty hostnames
; We check (get acc 0) because the result is indexed by the host-key,
; which returns 0 on nil or empty.
(is (nil? (get acc 0)))
;; Let' verify we got the right data
;; Let's verify we got the right data
(is (= {971841386 {:time 39, :icon nil, :host "numergent.com"},
-915908674 {:time 4, :icon nil, :host "www.kitco.com"}}
acc)))))
(deftest test-accumulate-after-clean-up
(testing "We get a value accumulation per site time after clean up"
(let [min-date 1446114615912
......
......@@ -112,7 +112,7 @@
(assoc :time (quot (:time in-v2) 1000))
(rename-keys {:icon :icon}))
)))
;; Test recurrent migration
;; Test applying all possible migrations iteratively
(is (= v3 (migrations/migrate-to-latest base-data)) "Migrating all the way to the latest should yield the same v2 data")
(is (= v3 (migrations/migrate-to-latest v1)) "Migrating all the way to the latest should yield the same v2 data")
(is (not= base-data (migrations/migrate-to-latest base-data)) "Migration loop should have returned a different data set")
......
(ns relevance.test.order
(:require [cljs.test :refer-macros [deftest testing is are]]
[relevance.data :as data]
[relevance.order :as order]
[relevance.utils :as utils]))
(deftest empty-test
(is (= 1 1)))
(deftest test-time-score
; A score for an unknown URL with no tab index is zero
......@@ -39,15 +36,15 @@
{(utils/host-key "google.com") {:time 123}
(utils/host-key "apple.com") {:time 987}}
{})))
; A page inherits its site's score even if it's unknown
; A page inherits its site's score even if the page is unknown
(is (= 987 (order/time-score {:url "http://apple.com/mac"}
{(utils/url-key "http://google.com") {:time 291}
(utils/url-key "http://google.com/somepage") {:time 345}}
{(utils/host-key "google.com") {:time 123}
(utils/host-key "apple.com") {:time 987}}
{})))
; A page inherits its site's score even if it's unknown, but substracts the index so
; that they are placed at the end.
; A page inherits its site's score even if the page is unknown, but
; substracts the index so that they are placed at the end.
(is (= 975 (order/time-score {:url "http://apple.com/mac" :index 12}
{(utils/url-key "http://google.com") {:time 291}
(utils/url-key "http://google.com/somepage") {:time 345}}
......@@ -82,6 +79,7 @@
(utils/host-key "apple.com") {:time 987}}
{}))))
(deftest test-score-tabs
(let [url-times {(utils/url-key "http://google.com") {:time 2910}
(utils/url-key "http://google.com/somepage") {:time 345}
......@@ -173,16 +171,5 @@
url-times
site-times
{})))
)
)
(ns relevance.test.utils
(:require [cljs.test :refer-macros [deftest testing is are]]
[relevance.utils :as utils]
))
[relevance.utils :as utils]))
(deftest test-key-from-url
......@@ -16,16 +15,16 @@
"Key should disregard trailing hashtags")
(is (= (utils/url-key "https://LOCALHOST")
(utils/url-key "https://localhost"))
"Key is not case-sensitive")
"Key should not consider the domain case-sensitive")
(is (= (utils/url-key "https://LOCALHOST/someUrl#hash")
(hash-string "localhost/someUrl"))
"Our hash calculations are consistent with hash-string")
"Our hash calculations should be consistent with hash-string")
(is (not= (utils/url-key "https://localhost?q=v")
(utils/url-key "https://localhost?q="))
"Key should respect query strings")
(is (not= (utils/url-key "https://localhost.com/path")
(utils/url-key "https://localhost.com/Path"))
"Path is case-sensitive")
"url-key should consider the path case-sensitive")
;; Let's confirm we actually return a consistent integer for some known values
(are [k url] (= k (utils/url-key url))
-20650657 "https://LOCALHOST/someUrl#hash"
......@@ -41,6 +40,7 @@
-847465478 "file:///Users/ricardo/Sources/user.html"
))
(deftest test-host-key
(are [k url] (= k (utils/host-key url))
-702889725 "www.google.com"
......@@ -49,8 +49,8 @@
-292940973 "www.numergent.com"
0 ""
0 " "
0 nil)
)
0 nil))
(deftest test-time-display
(are [time label] (= (utils/time-display time) label)
......@@ -74,13 +74,13 @@
248996 "2d 21h"
))
(deftest test-host
(deftest test-hostname
(are [url name] (= (utils/hostname url) name)
"https://www.google.com/some?q=v" "www.google.com"
"https://www.Google.com/some?q=v" "www.google.com"
"https://WWW.GOOGLE.COM/some?q=v" "www.google.com"
"http://WWW.GOOGLE.COM/some?q=v" "www.google.com"
"https://GOOGLE.COM:443/some?q=v" "google.com"
"https://GOOGLE.COM:443/some?q=v" "google.com" ; host would have included the port
"https://GOOGLE.COM:3000/some?q=v" "google.com" ; host would have included the port
"http://numergent.com/tag/khroma" "numergent.com"
"about:blank" ""
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment