Sha256: 263763a651974a5a2bbeefb7dc29d4726a4442016527e2d7494a1b6c725ba9e4

Contents?: true

Size: 1.61 KB

Versions: 19

Compression:

Stored size: 1.61 KB

Contents

desc "Build the haml-coffee-source gem"
task :gem do
  sh "grunt dist"

  require "json"
  require "fileutils"
  require "rubygems"
  require "tmpdir"
  require "rubygems/package"

  gemspec = Gem::Specification.new do |s|
    s.name        = "haml-coffee-source"
    s.version     = JSON.parse(File.read("package.json"))["version"].gsub("-", ".")
    s.date        = Time.now.strftime("%Y-%m-%d")

    s.homepage    = "https://github.com/netzpirat/haml-coffee/"
    s.summary     = "Haml Coffee Compiler"
    s.description = "JavaScript source code for the Haml Coffee compiler"

    s.license     = "MIT"

    s.files = [
      "lib/haml_coffee/hamlcoffee.js",
      "lib/haml_coffee/source.rb"
    ]

    s.authors     = ["Michael Kessler"]
    s.email       = "michi@flinkfinger.com"
  end


  root = Dir.getwd

  Dir.mktmpdir do |tmpdir|
    Dir.chdir(tmpdir) do
      FileUtils.mkdir_p "lib/haml_coffee/"

      File.open "lib/haml_coffee/source.rb", "w" do |f|
        f.write <<-RB
module HamlCoffee
  module Source
    VERSION = #{gemspec.version.to_s.inspect}

      def self.bundled_path
        File.expand_path("../hamlcoffee.js", __FILE__)
      end
  end
end
        RB
      end

      FileUtils.copy File.join(root, "dist/compiler/hamlcoffee.min.js"), "lib/haml_coffee/hamlcoffee.js"

      if defined?(Gem::Builder) # Rubygems 1
        Gem::Builder.new(gemspec).build
      else # Rubygems 2
        Gem::Package.build gemspec
      end

      pkg = File.join(root, 'pkg')
      FileUtils.mkdirr(pkg) unless File.exists?(pkg)
      FileUtils.copy gemspec.file_name, pkg

    end
  end
  warn "Built #{gemspec.file_name}"
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
ela-4.1.6 node_modules/haml-coffee/Rakefile
ela-4.1.5 node_modules/haml-coffee/Rakefile
ela-4.1.4 node_modules/haml-coffee/Rakefile
ela-4.1.3 node_modules/haml-coffee/Rakefile
ela-4.1.2 node_modules/haml-coffee/Rakefile
ela-4.1.1 node_modules/haml-coffee/Rakefile
ela-4.1.0 node_modules/haml-coffee/Rakefile
ela-4.0.0 node_modules/haml-coffee/Rakefile
ela-3.4.3 node_modules/haml-coffee/Rakefile
ela-3.4.2 node_modules/haml-coffee/Rakefile
ela-3.4.0 node_modules/haml-coffee/Rakefile
ela-3.3.1 node_modules/haml-coffee/Rakefile
ela-3.3.0 node_modules/haml-coffee/Rakefile
ela-3.2.0 node_modules/haml-coffee/Rakefile
ela-3.1.1 node_modules/haml-coffee/Rakefile
ela-3.1.0 node_modules/haml-coffee/Rakefile
ela-3.0.0 node_modules/haml-coffee/Rakefile
ela-2.0.0 node_modules/haml-coffee/Rakefile
ela-1.1.0 node_modules/haml-coffee/Rakefile