Sha256: 25270ed56f011b497cd3d1b8bd06fc47e8b0e49077c6cfbb25292f78e83a4170

Contents?: true

Size: 1.22 KB

Versions: 18

Compression:

Stored size: 1.22 KB

Contents

require 'bundler'
require 'multi_json'
require 'open-uri'
Bundler::GemHelper.install_tasks

def say(line)
  puts "  \e[32m=>\e[0m #{line}"
end

def execute(banner, command)
  say(banner + "...")
  output = `#{command} 2>&1`
  unless $?.success?
    $stderr.puts("  \e[31mOops, something went wrong!\e[0m\n\n")
    $stderr.puts(output)
    exit(1)
  end
  output
end

desc "Downloads stylus into './vendor' and checks the latest released tag"
task :update do
  raw = open('http://registry.npmjs.org/stylus') { |io| io.binmode.read }
  metadata = MultiJson.decode(raw)
  current_version = File.read('VERSION')
  version = ENV['VERSION'] || metadata['dist-tags']['latest']
  tarball = metadata['versions'][version]['dist']['tarball']

  say "Updating stylus source from #{current_version} to #{version}"

  execute 'cleaning up old files', 'rm -rf vendor'
  execute "download stylus #{version}", "wget #{tarball} -O stylus.tgz"
  execute "upacking stylus #{version}", 'tar -zxvf stylus.tgz'
  execute 'cleaning up', 'rm stylus.tgz package/.npmignore'
  execute 'updating stylus dependencies', 'mv package vendor && cd vendor && npm install .'
  say 'updating VERSION file'
  File.open('VERSION', 'w') { |file| file.write(version) }
  say 'done!'
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
stylus-source-0.23.0 Rakefile
stylus-source-0.22.6 Rakefile
stylus-source-0.22.5 Rakefile
stylus-source-0.22.4 Rakefile
stylus-source-0.22.3 Rakefile
stylus-source-0.22.2 Rakefile
stylus-source-0.22.1 Rakefile
stylus-source-0.22.0 Rakefile
stylus-source-0.21.2 Rakefile
stylus-source-0.21.1 Rakefile
stylus-source-0.21.0 Rakefile
stylus-source-0.20.1 Rakefile
stylus-source-0.20.0 Rakefile
stylus-source-0.19.8 Rakefile
stylus-source-0.19.7 Rakefile
stylus-source-0.19.6 Rakefile
stylus-source-0.19.5 Rakefile
stylus-source-0.19.4 Rakefile