Sha256: e12655cee3886a87861968580a9387beca339ecc6244be16f7c04133b53d2972

Contents?: true

Size: 1.05 KB

Versions: 36

Compression:

Stored size: 1.05 KB

Contents

js_dir = 'vendor/assets/javascripts/'

desc 'Tag the default file versions for asset helpers'
task :tag_default do |t|
  Rake::Task["tag"].invoke
end

desc 'Tag the unstable file versions for asset helpers'
task :tag_unstable do |t|
  ENV['UNSTABLE_TAG'] = "-unstable"
  Rake::Task["tag"].invoke
end

task :tag do |t|
  version = ENV['VERSION']
  version ||= 'latest'
  unstable_tag = ENV['UNSTABLE_TAG'] || ''

  puts "Target version: #{version.chomp('/')}"

  Dir.chdir(js_dir) do
    version_directories = Dir.glob("*").select { |fn| File.directory?(fn) }.sort.reverse
    if !(version_directories.include? version)
      puts "WARN: Specified version='#{version}' not found, setting to latest version: '#{version_directories.first}'"
      version = version_directories.first
    end
    new_files = Hash[*Dir.glob("#{version}/*.js").map {|longfn| [longfn.split(version+'/', 2)[1].chomp("-#{version}.js"), longfn]}.flatten]

    new_files.keys.each do |file|
      FileUtils.cp new_files[file], file.chomp('.js')+unstable_tag+'.js', {verbose: true}
    end
  end
end

Version data entries

36 entries across 36 versions & 1 rubygems

Version Path
angular-gem-1.3.8 lib/tasks/tag.rake
angular-gem-1.3.7 lib/tasks/tag.rake
angular-gem-1.3.6 lib/tasks/tag.rake
angular-gem-1.3.5 lib/tasks/tag.rake
angular-gem-1.3.4 lib/tasks/tag.rake
angular-gem-1.3.2 lib/tasks/tag.rake
angular-gem-1.3.1 lib/tasks/tag.rake
angular-gem-1.3.0 lib/tasks/tag.rake
angular-gem-1.2.26 lib/tasks/tag.rake
angular-gem-1.2.25 lib/tasks/tag.rake
angular-gem-1.2.24 lib/tasks/tag.rake
angular-gem-1.2.23 lib/tasks/tag.rake
angular-gem-1.2.22 lib/tasks/tag.rake
angular-gem-1.2.21 lib/tasks/tag.rake
angular-gem-1.2.20 lib/tasks/tag.rake
angular-gem-1.2.19 lib/tasks/tag.rake
angular-gem-1.2.18.1 lib/tasks/tag.rake
angular-gem-1.2.18 lib/tasks/tag.rake
angular-gem-1.2.16 lib/tasks/tag.rake
angular-gem-1.2.15 lib/tasks/tag.rake