Sha256: f880be3ca9433c45fab77dab1562ac8829b03d7346f9c36e3d801e07e960eebb

Contents?: true

Size: 1.6 KB

Versions: 21

Compression:

Stored size: 1.6 KB

Contents

# desc "Explaining what the task does"
# task :skip_embedded do
#   # Task goes here
# end
namespace :skip_embedded do
  require 'skip_embedded'

  desc "fetch clippy and jquery"
  task :thirdparty => %w[thirdparty:clippy thirdparty:jquery]

  namespace :thirdparty do
    require 'open-uri'

    desc "fetch clppy.swf from 'http://github.com/mojombo/clippy/raw/master/build/clippy.swf'"
    task :clippy do
      source = "http://github.com/mojombo/clippy/raw/master/build/clippy.swf"
      dest   = File.expand_path("public/flash", Rails.root)

      fetch(source, dest)
    end

    desc "fetch #{SkipEmbedded::Dependencies[:jquery]} from 'http://jqueryjs.googlecode.com/files/#{SkipEmbedded::Dependencies[:jquery]}'"
    task :jquery do
      source =  "http://jqueryjs.googlecode.com/files/#{SkipEmbedded::Dependencies[:jquery]}"
      dest   = File.expand_path("public/javascripts", Rails.root)

      fetch(source, dest)
    end
=begin
    desc "fetch jquery-ui-1.7.1.custom.zip from 'http://jqueryui.com/download/jquery-ui-1.7.1.custom.zip'"
    task :jqueryui do
      source =  'http://jqueryui.com/download/jquery-ui-1.7.1.custom.zip'
      dest   = File.expand_path("tmp/", Rails.root)

      fetch(source, dest)
    end
=end
    private
    def fetch(source, dest, filename_from_url = true)
      if File.directory?(dest) || filename_from_url
        dir, out = dest, File.basename(source)
      else
        dir, out = File.dirname(dest), File.basename(dest)
      end
      FileUtils.mkdir_p(dir) unless File.directory?(dir)
      Dir.chdir(dir){ File.open(out, "wb"){|f| f.write open(source).read } }
    end
  end
end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
openskip-skip_embedded-0.0.19 generators/skip_embedded/templates/lib/tasks/skip_embedded.rake
openskip-skip_embedded-0.9.0 generators/skip_embedded/templates/lib/tasks/skip_embedded.rake
openskip-skip_embedded-0.9.1 generators/skip_embedded/templates/lib/tasks/skip_embedded.rake
openskip-skip_embedded-0.9.10 generators/skip_embedded_init/templates/lib/tasks/skip_embedded.rake
openskip-skip_embedded-0.9.11 generators/skip_embedded_init/templates/lib/tasks/skip_embedded.rake
openskip-skip_embedded-0.9.12 generators/skip_embedded_init/templates/lib/tasks/skip_embedded.rake
openskip-skip_embedded-0.9.13 generators/skip_embedded_init/templates/lib/tasks/skip_embedded.rake
openskip-skip_embedded-0.9.14 generators/skip_embedded_init/templates/lib/tasks/skip_embedded.rake
openskip-skip_embedded-0.9.15 generators/skip_embedded_init/templates/lib/tasks/skip_embedded.rake
openskip-skip_embedded-0.9.16 generators/skip_embedded_init/templates/lib/tasks/skip_embedded.rake
openskip-skip_embedded-0.9.17 generators/skip_embedded_init/templates/lib/tasks/skip_embedded.rake
openskip-skip_embedded-0.9.18 generators/skip_embedded_init/templates/lib/tasks/skip_embedded.rake
openskip-skip_embedded-0.9.19 generators/skip_embedded_init/templates/lib/tasks/skip_embedded.rake
openskip-skip_embedded-0.9.2 generators/skip_embedded/templates/lib/tasks/skip_embedded.rake
openskip-skip_embedded-0.9.3 generators/skip_embedded/templates/lib/tasks/skip_embedded.rake
openskip-skip_embedded-0.9.4 generators/skip_embedded/templates/lib/tasks/skip_embedded.rake
openskip-skip_embedded-0.9.5 generators/skip_embedded/templates/lib/tasks/skip_embedded.rake
openskip-skip_embedded-0.9.6 generators/skip_embedded/templates/lib/tasks/skip_embedded.rake
openskip-skip_embedded-0.9.7 generators/skip_embedded/templates/lib/tasks/skip_embedded.rake
openskip-skip_embedded-0.9.8 generators/skip_embedded_init/templates/lib/tasks/skip_embedded.rake