Sha256: 1c476f47633401de75ffd5ab00891c10fa93b2f708a7fce7c242ca0df95c26b1

Contents?: true

Size: 1.15 KB

Versions: 13

Compression:

Stored size: 1.15 KB

Contents

namespace :yarn do
	desc 'Load the .bowerrc file and setup the environment for other tasks.'
	task :environment do
		@yarn_package_root = SITE_ROOT + "lib/components"
		@yarn_install_root = SITE_ROOT + "public/_components"
	end
	
	desc 'Update the bower packages and link into the public directory.'
	task :update => :environment do
		require 'fileutils'
		require 'utopia/path'
		
		@yarn_package_root.children.select(&:directory?).collect(&:basename).each do |package_directory|
			install_path = @yarn_install_root + package_directory
			package_path = @yarn_package_root + package_directory
			dist_path = package_path + 'dist'
			
			FileUtils::Verbose.rm_rf install_path
			FileUtils::Verbose.mkpath(install_path.dirname)
			
			# If a package has a dist directory, we only symlink that... otherwise we have to do the entire package, and hope that bower's ignore was setup correctly:
			if File.exist? dist_path
				link_path = Utopia::Path.shortest_path(dist_path, install_path)
			else
				link_path = Utopia::Path.shortest_path(package_path, install_path)
			end
			
			FileUtils::Verbose.cp_r File.expand_path(link_path, install_path), install_path
		end
	end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
utopia-2.11.1 setup/site/tasks/yarn.rake
utopia-2.11.0 setup/site/tasks/yarn.rake
utopia-2.10.0 setup/site/tasks/yarn.rake
utopia-2.9.5 setup/site/tasks/yarn.rake
utopia-2.9.3 setup/site/tasks/yarn.rake
utopia-2.9.2 setup/site/tasks/yarn.rake
utopia-2.9.1 setup/site/tasks/yarn.rake
utopia-2.9.0 setup/site/tasks/yarn.rake
utopia-2.8.2 setup/site/tasks/yarn.rake
utopia-2.8.1 setup/site/tasks/yarn.rake
utopia-2.8.0 setup/site/tasks/yarn.rake
utopia-2.7.0 setup/site/tasks/yarn.rake
utopia-2.6.0 setup/site/tasks/yarn.rake