mirror of
https://github.com/danog/sass-site.git
synced 2025-01-21 21:31:34 +01:00
Download version information for all implementations
This commit is contained in:
parent
e367b287a7
commit
845001cf65
4
.gitignore
vendored
4
.gitignore
vendored
@ -9,7 +9,9 @@ bundle
|
|||||||
/Icon
|
/Icon
|
||||||
"Icon\r"
|
"Icon\r"
|
||||||
.ruby-version
|
.ruby-version
|
||||||
/.sass
|
/.dart-sass
|
||||||
|
/.libsass
|
||||||
|
/.ruby-sass
|
||||||
/.sass-cache
|
/.sass-cache
|
||||||
*.scssc
|
*.scssc
|
||||||
/source/assets/css/vendor
|
/source/assets/css/vendor
|
||||||
|
1
Gemfile
1
Gemfile
@ -17,6 +17,7 @@ gem 'rack-contrib'
|
|||||||
gem 'rack-rewrite'
|
gem 'rack-rewrite'
|
||||||
gem 'rake'
|
gem 'rake'
|
||||||
gem 'redcarpet', '~> 3.3.3'
|
gem 'redcarpet', '~> 3.3.3'
|
||||||
|
gem 'semantic', '~> 1.6'
|
||||||
gem 'susy', '~> 2.2.9'
|
gem 'susy', '~> 2.2.9'
|
||||||
gem 'therubyracer', '~> 0.12.3'
|
gem 'therubyracer', '~> 0.12.3'
|
||||||
gem 'typogruby', '~> 1.0.18'
|
gem 'typogruby', '~> 1.0.18'
|
||||||
|
@ -136,6 +136,7 @@ GEM
|
|||||||
sass (3.4.25)
|
sass (3.4.25)
|
||||||
sassy-maps (0.4.0)
|
sassy-maps (0.4.0)
|
||||||
sass (~> 3.3)
|
sass (~> 3.3)
|
||||||
|
semantic (1.6.1)
|
||||||
sprockets (2.12.4)
|
sprockets (2.12.4)
|
||||||
hike (~> 1.2)
|
hike (~> 1.2)
|
||||||
multi_json (~> 1.0)
|
multi_json (~> 1.0)
|
||||||
@ -187,6 +188,7 @@ DEPENDENCIES
|
|||||||
rack-rewrite
|
rack-rewrite
|
||||||
rake
|
rake
|
||||||
redcarpet (~> 3.3.3)
|
redcarpet (~> 3.3.3)
|
||||||
|
semantic (~> 1.6)
|
||||||
susy (~> 2.2.9)
|
susy (~> 2.2.9)
|
||||||
therubyracer (~> 0.12.3)
|
therubyracer (~> 0.12.3)
|
||||||
typogruby (~> 1.0.18)
|
typogruby (~> 1.0.18)
|
||||||
@ -198,4 +200,4 @@ RUBY VERSION
|
|||||||
ruby 2.4.1p111
|
ruby 2.4.1p111
|
||||||
|
|
||||||
BUNDLED WITH
|
BUNDLED WITH
|
||||||
1.15.2
|
1.16.1
|
||||||
|
221
Rakefile
221
Rakefile
@ -1,93 +1,160 @@
|
|||||||
|
require 'semantic'
|
||||||
|
require 'yaml'
|
||||||
require 'yard'
|
require 'yard'
|
||||||
|
|
||||||
namespace :sass do
|
namespace :sass do
|
||||||
# Check out the latest stable version of Ruby Sass into the .sass directory.
|
# Adds an implementation's version number to data/version.yml.
|
||||||
task :checkout do
|
def add_version(impl, version)
|
||||||
unless Dir.exists?(".sass")
|
path = 'data/version.yml'
|
||||||
sh %{git clone git://github.com/sass/sass .sass}
|
yaml = File.exist?(path) ? YAML.load(File.read(path)) : {}
|
||||||
|
yaml[impl] = version
|
||||||
|
File.open(path, 'w') {|f| f.write(YAML.dump(yaml))}
|
||||||
|
end
|
||||||
|
|
||||||
|
# Returns the latest tag in the current Git repository that's a valid semantic
|
||||||
|
# version and is not a pre-release version *unless* only pre-release versions
|
||||||
|
# are available.
|
||||||
|
def latest_stable_tag
|
||||||
|
tags = `git tag`.strip.split("\n").map do |v|
|
||||||
|
begin
|
||||||
|
Semantic::Version.new(v)
|
||||||
|
rescue ArgumentError
|
||||||
|
nil
|
||||||
|
end
|
||||||
|
end.compact.sort.reverse
|
||||||
|
(tags.find {|t| !t.pre} || tags.first).to_s
|
||||||
|
end
|
||||||
|
|
||||||
|
namespace :dart do
|
||||||
|
# Check out the latest commit of Dart Sass into the .dart-sass directory.
|
||||||
|
task :checkout do
|
||||||
|
unless Dir.exists?(".dart-sass")
|
||||||
|
sh %{git clone git://github.com/sass/dart-sass .dart-sass}
|
||||||
|
end
|
||||||
|
|
||||||
|
Dir.chdir(".dart-sass") do
|
||||||
|
sh %{git fetch}
|
||||||
|
if ENV["DART_SASS_REVISION"]
|
||||||
|
sh %{git checkout #{ENV["DART_SASS_REVISION"]}}
|
||||||
|
else
|
||||||
|
sh %{git checkout origin/master}
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
Dir.chdir(".sass") do
|
task :version => :checkout do
|
||||||
sh %{git fetch}
|
add_version 'dart', Dir.chdir(".dart-sass") {latest_stable_tag}
|
||||||
if ENV["SASS_REVISION"]
|
|
||||||
sh %{git checkout #{ENV["SASS_REVISION"]}}
|
|
||||||
else
|
|
||||||
sh %{git checkout origin/stable}
|
|
||||||
# Check out the most recent released stable version
|
|
||||||
sh %{git checkout #{File.read("VERSION").strip}}
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
task :version => :checkout do
|
namespace :libsass do
|
||||||
require 'yaml'
|
# Check out the latest commit of Dart Sass into the .libsass directory.
|
||||||
version = File.read(".sass/VERSION").strip
|
task :checkout do
|
||||||
name = File.read(".sass/VERSION_NAME").strip
|
unless Dir.exists?(".libsass")
|
||||||
File.open('data/version.yml', 'w') {|f| f.write(YAML.dump({'number' => version, 'name' => name}))}
|
sh %{git clone git://github.com/sass/libsass .libsass}
|
||||||
end
|
end
|
||||||
|
|
||||||
YARD::Rake::YardocTask.new(:doc) do |t|
|
Dir.chdir(".libsass") do
|
||||||
t.before = lambda do
|
sh %{git fetch}
|
||||||
t.files = FileList.new('.sass/lib/**/*.rb') do |list|
|
if ENV["LIBSASS_REVISION"]
|
||||||
list.exclude('.sass/lib/sass/plugin/merb.rb')
|
sh %{git checkout #{ENV["LIBSASS_REVISION"]}}
|
||||||
list.exclude('.sass/lib/sass/plugin/rails.rb')
|
else
|
||||||
end.to_a
|
sh %{git checkout origin/master}
|
||||||
t.options += FileList.new('.sass/yard/*.rb').to_a.map {|f| ['-e', f]}.flatten
|
end
|
||||||
files = FileList.new('.sass/doc-src/*').to_a.sort_by {|s| s.size} + %w[.sass/MIT-LICENSE .sass/VERSION]
|
end
|
||||||
t.options << '--files' << files.join(',')
|
|
||||||
t.options << '--main' << '.sass/README.md'
|
|
||||||
t.options << '--template-path' << 'yard'
|
|
||||||
end
|
end
|
||||||
|
|
||||||
t.after = lambda do
|
task :version => :checkout do
|
||||||
sh %{rm -rf source/documentation}
|
add_version 'libsass', Dir.chdir(".libsass") {latest_stable_tag}
|
||||||
sh %{mv doc source/documentation}
|
|
||||||
Dir['source/documentation/**/*.html'].each do |path|
|
|
||||||
contents = File.read(path)
|
|
||||||
File.open(path, 'w') {|file| file.write(contents.gsub(%r{css/common\.css}, '../assets/css/docs.css'))}
|
|
||||||
end
|
|
||||||
|
|
||||||
require 'nokogiri'
|
|
||||||
doc = Nokogiri::HTML(File.read('source/documentation/file.SASS_REFERENCE.html'))
|
|
||||||
|
|
||||||
doc.css("#filecontents").css("h1, h2, h3, h4, h5, h6").each do |h|
|
|
||||||
next if h.inner_text.empty?
|
|
||||||
h['id'] =
|
|
||||||
case h.inner_text
|
|
||||||
when "Referencing Parent Selectors: &"; "parent-selector"
|
|
||||||
when /^Comments:/; "comments"
|
|
||||||
when "Strings"; "sass-script-strings"
|
|
||||||
when "Division and /"; "division-and-slash"
|
|
||||||
when /^Subtraction,/; "subtraction"
|
|
||||||
when "& in SassScript"; "parent-script"
|
|
||||||
when "@-Rules and Directives"; "directives"
|
|
||||||
when "@extend-Only Selectors"; "placeholders"
|
|
||||||
when "@extend-Only Selectors"; "placeholders"
|
|
||||||
when "@each"; "each-directive"
|
|
||||||
when "Multiple Assignment"; "each-multi-assign"
|
|
||||||
when "Mixin Directives"; "mixins"
|
|
||||||
when /^Defining a Mixin:/; "defining_a_mixin"
|
|
||||||
when /^Including a Mixin:/; "including_a_mixin"
|
|
||||||
when "Arguments"; "mixin-arguments"
|
|
||||||
when "Passing Content Blocks to a Mixin"; "mixin-content"
|
|
||||||
else
|
|
||||||
h.inner_text.downcase.gsub(/[^a-z _-]/, '').gsub(' ', '_')
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
# Give each option an anchor.
|
|
||||||
doc.css("#filecontents li p strong code").each do |c|
|
|
||||||
c['id'] = c.inner_text.gsub(/:/, '') + '-option'
|
|
||||||
end
|
|
||||||
|
|
||||||
File.write('source/documentation/file.SASS_REFERENCE.html', doc.to_html)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
Rake::Task['sass:doc'].prerequisites.insert(0, 'sass:checkout')
|
|
||||||
Rake::Task['sass:doc'].instance_variable_set('@comment', nil)
|
|
||||||
|
|
||||||
desc "Import information from Sass."
|
namespace :ruby do
|
||||||
task :import => [:doc, :version]
|
# Check out the latest stable version of Ruby Sass into the .ruby-sass directory.
|
||||||
|
task :checkout do
|
||||||
|
unless Dir.exists?(".ruby-sass")
|
||||||
|
sh %{git clone git://github.com/sass/sass .ruby-sass}
|
||||||
|
end
|
||||||
|
|
||||||
|
Dir.chdir(".ruby-sass") do
|
||||||
|
sh %{git fetch}
|
||||||
|
if ENV["RUBY_SASS_REVISION"]
|
||||||
|
sh %{git checkout #{ENV["RUBY_SASS_REVISION"]}}
|
||||||
|
else
|
||||||
|
sh %{git checkout origin/stable}
|
||||||
|
# Check out the most recent released stable version
|
||||||
|
sh %{git checkout #{File.read("VERSION").strip}}
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
task :version => :checkout do
|
||||||
|
add_version 'ruby', File.read(".ruby-sass/VERSION").strip
|
||||||
|
end
|
||||||
|
|
||||||
|
YARD::Rake::YardocTask.new(:doc) do |t|
|
||||||
|
t.before = lambda do
|
||||||
|
t.files = FileList.new('.ruby-sass/lib/**/*.rb') do |list|
|
||||||
|
list.exclude('.ruby-sass/lib/sass/plugin/merb.rb')
|
||||||
|
list.exclude('.ruby-sass/lib/sass/plugin/rails.rb')
|
||||||
|
end.to_a
|
||||||
|
t.options += FileList.new('.ruby-sass/yard/*.rb').to_a.map {|f| ['-e', f]}.flatten
|
||||||
|
files = FileList.new('.ruby-sass/doc-src/*').to_a.sort_by {|s| s.size} + %w[.ruby-sass/MIT-LICENSE .ruby-sass/VERSION]
|
||||||
|
t.options << '--files' << files.join(',')
|
||||||
|
t.options << '--main' << '.ruby-sass/README.md'
|
||||||
|
t.options << '--template-path' << 'yard'
|
||||||
|
end
|
||||||
|
|
||||||
|
t.after = lambda do
|
||||||
|
sh %{rm -rf source/documentation}
|
||||||
|
sh %{mv doc source/documentation}
|
||||||
|
Dir['source/documentation/**/*.html'].each do |path|
|
||||||
|
contents = File.read(path)
|
||||||
|
File.open(path, 'w') {|file| file.write(contents.gsub(%r{css/common\.css}, '../assets/css/docs.css'))}
|
||||||
|
end
|
||||||
|
|
||||||
|
require 'nokogiri'
|
||||||
|
doc = Nokogiri::HTML(File.read('source/documentation/file.SASS_REFERENCE.html'))
|
||||||
|
|
||||||
|
doc.css("#filecontents").css("h1, h2, h3, h4, h5, h6").each do |h|
|
||||||
|
next if h.inner_text.empty?
|
||||||
|
h['id'] =
|
||||||
|
case h.inner_text
|
||||||
|
when "Referencing Parent Selectors: &"; "parent-selector"
|
||||||
|
when /^Comments:/; "comments"
|
||||||
|
when "Strings"; "sass-script-strings"
|
||||||
|
when "Division and /"; "division-and-slash"
|
||||||
|
when /^Subtraction,/; "subtraction"
|
||||||
|
when "& in SassScript"; "parent-script"
|
||||||
|
when "@-Rules and Directives"; "directives"
|
||||||
|
when "@extend-Only Selectors"; "placeholders"
|
||||||
|
when "@extend-Only Selectors"; "placeholders"
|
||||||
|
when "@each"; "each-directive"
|
||||||
|
when "Multiple Assignment"; "each-multi-assign"
|
||||||
|
when "Mixin Directives"; "mixins"
|
||||||
|
when /^Defining a Mixin:/; "defining_a_mixin"
|
||||||
|
when /^Including a Mixin:/; "including_a_mixin"
|
||||||
|
when "Arguments"; "mixin-arguments"
|
||||||
|
when "Passing Content Blocks to a Mixin"; "mixin-content"
|
||||||
|
else
|
||||||
|
h.inner_text.downcase.gsub(/[^a-z _-]/, '').gsub(' ', '_')
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
# Give each option an anchor.
|
||||||
|
doc.css("#filecontents li p strong code").each do |c|
|
||||||
|
c['id'] = c.inner_text.gsub(/:/, '') + '-option'
|
||||||
|
end
|
||||||
|
|
||||||
|
File.write('source/documentation/file.SASS_REFERENCE.html', doc.to_html)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
Rake::Task['sass:ruby:doc'].prerequisites.insert(0, 'sass:ruby:checkout')
|
||||||
|
Rake::Task['sass:ruby:doc'].instance_variable_set('@comment', nil)
|
||||||
|
end
|
||||||
|
|
||||||
|
desc "Import information from Sass implementations."
|
||||||
|
task :import => ["dart:version", "libsass:version", "ruby:version", "ruby:doc"]
|
||||||
end
|
end
|
||||||
|
|
||||||
desc "Build the middleman-controlled portion of the site."
|
desc "Build the middleman-controlled portion of the site."
|
||||||
@ -101,6 +168,6 @@ task "build" => ["sass:import", :middleman]
|
|||||||
# Build the site on Heroku, then clean up unnecessary intermediate files.
|
# Build the site on Heroku, then clean up unnecessary intermediate files.
|
||||||
task "assets:precompile" => :build do
|
task "assets:precompile" => :build do
|
||||||
# Clean up unneccessary files to reduce slug size.
|
# Clean up unneccessary files to reduce slug size.
|
||||||
sh %{rm -rf .sass .yardoc}
|
sh %{rm -rf .dart-sass .libsass .ruby-sass .yardoc}
|
||||||
sh %{bundle install --without=development}
|
sh %{bundle install --without=development}
|
||||||
end
|
end
|
||||||
|
@ -48,7 +48,7 @@ module SassHelpers
|
|||||||
# Returns the version for the given implementation (`:dart`, `:ruby`, or
|
# Returns the version for the given implementation (`:dart`, `:ruby`, or
|
||||||
# `:libsass`), or `nil` if it hasn't been made available yet.
|
# `:libsass`), or `nil` if it hasn't been made available yet.
|
||||||
def impl_version(impl)
|
def impl_version(impl)
|
||||||
nil
|
data.version && data.version[impl]
|
||||||
end
|
end
|
||||||
|
|
||||||
# Returns the URL tag for the latest release of the given implementation.
|
# Returns the URL tag for the latest release of the given implementation.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user