diff --git a/.gitignore b/.gitignore index 26495ca..20f73e2 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,4 @@ assets/vendor/zeroclipboard/test assets/vendor/selectivizr/tests assets/vendor/qtip2/basic /vendor +Gemfile.lock diff --git a/.travis.yml b/.travis.yml index 0dba74e..d15e661 100644 --- a/.travis.yml +++ b/.travis.yml @@ -18,3 +18,6 @@ notifications: env: global: - NOKOGIRI_USE_SYSTEM_LIBRARIES=true + +sudo: false +cache: bundler diff --git a/Gemfile b/Gemfile index d1d35c1..d94f79e 100644 --- a/Gemfile +++ b/Gemfile @@ -6,4 +6,5 @@ gem "github-pages" group :test do gem "html-proofer" gem "rake" + gem "rspec" end diff --git a/Gemfile.lock b/Gemfile.lock deleted file mode 100644 index 5c37f6a..0000000 --- a/Gemfile.lock +++ /dev/null @@ -1,132 +0,0 @@ -GEM - remote: https://rubygems.org/ - specs: - RedCloth (4.2.9) - activesupport (4.1.5) - i18n (~> 0.6, >= 0.6.9) - json (~> 1.7, >= 1.7.7) - minitest (~> 5.1) - thread_safe (~> 0.1) - tzinfo (~> 1.1) - blankslate (2.1.2.4) - celluloid (0.16.0) - timers (~> 4.0.0) - classifier-reborn (2.0.1) - fast-stemmer (~> 1.0) - coffee-script (2.3.0) - coffee-script-source - execjs - coffee-script-source (1.8.0) - colorator (0.1) - colored (1.2) - ethon (0.7.1) - ffi (>= 1.3.0) - execjs (2.2.1) - fast-stemmer (1.0.2) - ffi (1.9.3) - gemoji (2.1.0) - github-pages (24) - RedCloth (= 4.2.9) - jekyll (= 2.3.0) - jekyll-coffeescript (= 1.0.0) - jekyll-mentions (= 0.1.3) - jekyll-redirect-from (= 0.6.0) - jekyll-sass-converter (= 1.2.0) - jekyll-sitemap (= 0.5.1) - jemoji (= 0.3.0) - kramdown (= 1.3.1) - liquid (= 2.6.1) - maruku (= 0.7.0) - pygments.rb (= 0.6.0) - rdiscount (= 2.1.7) - redcarpet (= 3.1.2) - hitimes (1.2.2) - html-pipeline (1.9.0) - activesupport (>= 2) - nokogiri (~> 1.4) - html-proofer (1.3.3) - colored (~> 1.2) - mercenary (~> 0.3.2) - nokogiri (~> 1.5) - typhoeus (~> 0.6.7) - yell (~> 2.0) - i18n (0.6.11) - jekyll (2.3.0) - classifier-reborn (~> 2.0) - colorator (~> 0.1) - jekyll-coffeescript (~> 1.0) - jekyll-gist (~> 1.0) - jekyll-paginate (~> 1.0) - jekyll-sass-converter (~> 1.0) - jekyll-watch (~> 1.1) - kramdown (~> 1.3) - liquid (~> 2.6.1) - mercenary (~> 0.3.3) - pygments.rb (~> 0.6.0) - redcarpet (~> 3.1) - safe_yaml (~> 1.0) - toml (~> 0.1.0) - jekyll-coffeescript (1.0.0) - coffee-script (~> 2.2) - jekyll-gist (1.1.0) - jekyll-mentions (0.1.3) - html-pipeline (~> 1.9.0) - jekyll (~> 2.0) - jekyll-paginate (1.0.0) - jekyll-redirect-from (0.6.0) - jekyll (~> 2.0) - jekyll-sass-converter (1.2.0) - sass (~> 3.2) - jekyll-sitemap (0.5.1) - jekyll-watch (1.1.0) - listen (~> 2.7) - jemoji (0.3.0) - gemoji (~> 2.0) - html-pipeline (~> 1.9) - jekyll (~> 2.0) - json (1.8.1) - kramdown (1.3.1) - liquid (2.6.1) - listen (2.7.9) - celluloid (>= 0.15.2) - rb-fsevent (>= 0.9.3) - rb-inotify (>= 0.9) - maruku (0.7.0) - mercenary (0.3.4) - mini_portile (0.6.0) - minitest (5.4.1) - nokogiri (1.6.3.1) - mini_portile (= 0.6.0) - parslet (1.5.0) - blankslate (~> 2.0) - posix-spawn (0.3.9) - pygments.rb (0.6.0) - posix-spawn (~> 0.3.6) - yajl-ruby (~> 1.1.0) - rake (10.3.2) - rb-fsevent (0.9.4) - rb-inotify (0.9.5) - ffi (>= 0.5.0) - rdiscount (2.1.7) - redcarpet (3.1.2) - safe_yaml (1.0.3) - sass (3.4.3) - thread_safe (0.3.4) - timers (4.0.0) - hitimes - toml (0.1.1) - parslet (~> 1.5.0) - typhoeus (0.6.9) - ethon (>= 0.7.1) - tzinfo (1.2.2) - thread_safe (~> 0.1) - yajl-ruby (1.1.0) - yell (2.0.4) - -PLATFORMS - ruby - -DEPENDENCIES - github-pages - html-proofer - rake diff --git a/Rakefile b/Rakefile index ed29cdb..fea4552 100644 --- a/Rakefile +++ b/Rakefile @@ -1,7 +1,14 @@ require "html/proofer" +require 'rspec/core/rake_task' + +desc "Run specs" +RSpec::Core::RakeTask.new do |t| + t.pattern = 'spec/**/*_spec.rb' + t.rspec_opts = ["--order", "rand", "--color"] +end task :test do sh "bundle exec jekyll build --trace" - # ignore href="#" for the "Copy to clipboard" button - HTML::Proofer.new("./_site").run + HTML::Proofer.new("./_site", :check_html => true).run + Rake::Task["spec"].invoke end diff --git a/_licenses/agpl-3.0.txt b/_licenses/agpl-3.0.txt index ec2bc6a..b22325a 100644 --- a/_licenses/agpl-3.0.txt +++ b/_licenses/agpl-3.0.txt @@ -1,5 +1,5 @@ --- -title: GNU Affero GPL v3.0 +title: GNU Affero General Public License v3.0 category: GPL tab-slug: agpl-v3 hide-from-license-list: true diff --git a/_licenses/apache-2.0.txt b/_licenses/apache-2.0.txt index 752ee33..37d448e 100644 --- a/_licenses/apache-2.0.txt +++ b/_licenses/apache-2.0.txt @@ -18,7 +18,7 @@ source: http://www.apache.org/licenses/LICENSE-2.0.html required: - include-copyright - document-changes - + permitted: - commercial-use - modifications diff --git a/_licenses/bsd-2-clause.txt b/_licenses/bsd-2-clause.txt index 86fcb11..8610078 100644 --- a/_licenses/bsd-2-clause.txt +++ b/_licenses/bsd-2-clause.txt @@ -1,6 +1,6 @@ --- layout: license -title: Simplified BSD +title: BSD 2-clause "Simplified" License category: BSD tab-slug: bsd hide-from-license-list: true diff --git a/_licenses/bsd-3-clause.txt b/_licenses/bsd-3-clause.txt index 80d67e7..4033a72 100644 --- a/_licenses/bsd-3-clause.txt +++ b/_licenses/bsd-3-clause.txt @@ -1,6 +1,6 @@ --- layout: license -title: New BSD +title: BSD 3-clause "New" or "Revised" License category: BSD tab-slug: bsd-3 hide-from-license-list: true diff --git a/_licenses/cc0.txt b/_licenses/cc0-1.0.txt similarity index 98% rename from _licenses/cc0.txt rename to _licenses/cc0-1.0.txt index 751b9fd..d24b663 100644 --- a/_licenses/cc0.txt +++ b/_licenses/cc0-1.0.txt @@ -1,6 +1,6 @@ --- layout: license -title: CC0 1.0 Universal +title: Creative Commons Zero v1.0 Universal category: Public Domain Dedication tab-slug: cc0 permalink: /licenses/cc0/ @@ -25,6 +25,8 @@ permitted: forbidden: - no-liability +required: [] + --- CC0 1.0 Universal @@ -141,4 +143,4 @@ Affirmer's express Statement of Purpose. CC0 or use of the Work. For more information, please see - \ No newline at end of file + diff --git a/_licenses/epl-1.0.txt b/_licenses/epl-1.0.txt index 0aa38b1..62f0ab5 100644 --- a/_licenses/epl-1.0.txt +++ b/_licenses/epl-1.0.txt @@ -1,6 +1,6 @@ --- layout: license -title: Eclipse Public License v1.0 +title: Eclipse Public License 1.0 category: Eclipse redirect_from: /licenses/eclipse/ permalink: /licenses/epl-1.0/ diff --git a/_licenses/gpl-2.0.txt b/_licenses/gpl-2.0.txt index c526f9f..de06b39 100644 --- a/_licenses/gpl-2.0.txt +++ b/_licenses/gpl-2.0.txt @@ -1,5 +1,5 @@ --- -title: GNU GPL v2.0 +title: GNU General Public License v2.0 category: GPL tab-slug: gpl-v2 hide-from-license-list: false diff --git a/_licenses/gpl-3.0.txt b/_licenses/gpl-3.0.txt index 71c5853..ad4235f 100644 --- a/_licenses/gpl-3.0.txt +++ b/_licenses/gpl-3.0.txt @@ -1,5 +1,5 @@ --- -title: GNU GPL v3.0 +title: GNU General Public License v3.0 category: GPL tab-slug: gpl-v3 hide-from-license-list: true diff --git a/_licenses/isc.txt b/_licenses/isc.txt index 7801bae..8dd8e38 100644 --- a/_licenses/isc.txt +++ b/_licenses/isc.txt @@ -1,6 +1,6 @@ --- layout: license -title: ISC license +title: ISC License permalink: /licenses/isc/ source: http://opensource.org/licenses/isc-license category: BSD diff --git a/_licenses/lgpl-2.1.txt b/_licenses/lgpl-2.1.txt index ee43a3e..9eaaec5 100644 --- a/_licenses/lgpl-2.1.txt +++ b/_licenses/lgpl-2.1.txt @@ -1,6 +1,6 @@ --- layout: license -title: GNU LGPL v2.1 +title: GNU Lesser General Public License v2.1 category: LGPL tab-slug: lgpl-v2_1 redirect_from: /licenses/lgpl-v2.1/ diff --git a/_licenses/lgpl-3.0.txt b/_licenses/lgpl-3.0.txt index 3161fc2..6b7766f 100644 --- a/_licenses/lgpl-3.0.txt +++ b/_licenses/lgpl-3.0.txt @@ -1,6 +1,6 @@ --- layout: license -title: GNU LGPL v3.0 +title: GNU Lesser General Public License v3.0 category: LGPL tab-slug: lgpl-v3 hide-from-license-list: true diff --git a/_licenses/unlicense.txt b/_licenses/unlicense.txt index d8d328c..f0ecae3 100644 --- a/_licenses/unlicense.txt +++ b/_licenses/unlicense.txt @@ -1,6 +1,6 @@ --- layout: license -title: Public Domain (Unlicense) +title: The Unlicense category: Public Domain Dedication tab-slug: unlicense permalink: /licenses/unlicense/ @@ -25,6 +25,8 @@ permitted: forbidden: - no-liability +required: [] + --- This is free and unencumbered software released into the public domain. diff --git a/spec/license_spec.rb b/spec/license_spec.rb new file mode 100644 index 0000000..25efd5e --- /dev/null +++ b/spec/license_spec.rb @@ -0,0 +1,51 @@ +require 'spec_helper' + +licenses.each do |license| + describe "The #{license["title"]} license" do + it "should have a title" do + expect(license["title"]).to_not be_nil + end + + it "should have a description" do + expect(license["description"]).to_not be_nil + end + + describe "SPDX compliance" do + # "No license" isn't really a license, so no need to test + unless license["id"] == "no-license" + it "#{license["id"]} should be a valid SPDX ID" do + expect(find_spdx(license["id"])).to_not be_nil + end + + it "should be the proper SPDX name" do + spdx = find_spdx(license["id"]) + expect(spdx[1]["name"].gsub(/ only$/,"")).to eql(license["title"]) + end + + # CC0 and Unlicense are not OSI approved, but that's okay + unless license["id"] == "unlicense" || license["id"] == "cc0-1.0" + it "should be OSI approved" do + spdx = find_spdx(license["id"]) + expect(spdx[1]["osiApproved"]).to eql(true) + end + end + end + end + + ["permitted", "required", "forbidden"].each do |group| + describe "#{group} properties" do + it "should list the properties" do + expect(license[group]).to_not be_nil + end + + license[group].to_a.each do |tag| + describe "#{tag} tag" do + it "should be a valid tag" do + expect(rule?(tag,group)).to be(true) + end + end + end + end + end + end +end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb new file mode 100644 index 0000000..354ff08 --- /dev/null +++ b/spec/spec_helper.rb @@ -0,0 +1,47 @@ +require 'jekyll' +require 'open-uri' +require 'json' + +def config_file + File.expand_path "./_config.yml", source +end + +def source + File.expand_path("../", File.dirname(__FILE__)) +end + +def config + config = Jekyll::Configuration.new.read_config_file config_file + config = Jekyll::Utils.deep_merge_hashes(config, {:source => source}) + Jekyll::Utils.deep_merge_hashes(Jekyll::Configuration::DEFAULTS, config) +end + +def licenses + site.collections["licenses"].docs.map { |l| l.data.merge("id" => l.basename(".txt")) } +end + +def site + $site ||= begin + site = Jekyll::Site.new(config) + site.reset + site.read + site + end +end + +def rules + site.data["rules"] +end + +def rule?(tag, group) + rules[group].any? { |r| r["tag"] == tag } +end + +def spdx_list + url = "https://raw.githubusercontent.com/sindresorhus/spdx-license-list/master/spdx.json" + $spdx ||= JSON.parse(open(url).read) +end + +def find_spdx(license) + spdx_list.find { |name, properties| name.downcase == license } +end