require 'govuk_template/version'
require_relative '../helpers'
require 'tmpdir'
require 'open3'

module Publisher
  class EJSPublisher
    GIT_REPO = "github.com/alphagov/govuk_template_ejs.git"
    GIT_URL = "https://#{ENV['GITHUB_TOKEN']}@#{GIT_REPO}"

    def initialize(version = GovukTemplate::VERSION)
      @version = version
      @repo_root = Pathname.new(File.expand_path('../../..', __FILE__))
      @source_dir = @repo_root.join('pkg', "ejs_govuk_template-#{@version}")
    end

    def publish
      Dir.mktmpdir("govuk_template_ejs") do |dir|
        run("git clone -q #{GIT_URL.shellescape} #{dir.shellescape}",
            "Error running `git clone` on #{GIT_REPO}")
        Dir.chdir(dir) do
          run "ls -1 | grep -v 'README.md' | xargs -I {} rm -rf {}"
          run "cp -r #{@source_dir.to_s.shellescape}/* ."
          run "git add -A ."
          run "git commit -q -m 'Publishing GOV.UK Embedded JavaScript template version #{@version}'"
          run "git tag v#{@version}"
          run "git push --tags origin master"
          run "npm publish ./"
        end
      end
    end
  end
end

require 'govuk_template/version'
require_relative '../helpers'
require 'tmpdir'
require 'open3'

module Publisher
  class EJSPublisher
    include Helpers
    GIT_REPO = "github.com/alphagov/govuk_template_ejs.git"
    GIT_URL = "https://#{ENV['GITHUB_TOKEN']}@#{GIT_REPO}"

    def initialize(version = GovukTemplate::VERSION)
      @version = version
      @repo_root = Pathname.new(File.expand_path('../../..', __FILE__))
      @source_dir = @repo_root.join('pkg', "ejs_govuk_template-#{@version}")
    end

    def publish
      Dir.mktmpdir("govuk_template_ejs") do |dir|
        run("git clone -q #{GIT_URL.shellescape} #{dir.shellescape}",
            "Error running `git clone` on #{GIT_REPO}")
        Dir.chdir(dir) do
          run "ls -1 | grep -v 'README.md' | xargs -I {} rm -rf {}"
          run "cp -r #{@source_dir.to_s.shellescape}/* ."
          run "git add -A ."
          run "git commit -q -m 'Publishing GOV.UK Embedded JavaScript template version #{@version}'"
          run "git tag v#{@version}"
          run "git push --tags origin master"
          run "npm publish ./"
        end
      end
    end
  end
end

Add missing include statement to EJS publisher
Add missing include statement to EJS publisher
