Sha256: 19c52ecbb700b01af722e3a9fe05550a9a9dc3e249e0496a15dbbd0b177c2dc1

Contents?: true

Size: 990 Bytes

Versions: 107

Compression:

Stored size: 990 Bytes

Contents

# desc 'Explaining what the task does'
# task :avo do
#   # Task goes here
# end

desc "Installs Avo assets and bundles them for when you want to use the GitHub repo in your app"
task "avo:build-assets" do
  spec = get_gem_spec "avo"
  # Uncomment to enable only when the source is github.com
  # enabled = spec.source.to_s.include?('https://github.com/avo-hq/avo')
  enabled = true

  if enabled
    puts "Starting avo:build-assets"
    path = spec.full_gem_path

    Dir.chdir(path) do
      system "yarn"
      system "yarn prod:build"
    end

    puts "Done"
  else
    puts "Not starting avo:build-assets"
  end
end

# From
# https://stackoverflow.com/questions/9322078/programmatically-determine-gems-path-using-bundler
def get_gem_spec(name)
  spec = Bundler.load.specs.find { |s| s.name == name }
  raise GemNotFound, "Could not find gem '#{name}' in the current bundle." unless spec
  if spec.name == "bundler"
    return File.expand_path("../../../", __FILE__)
  end

  spec
end

Version data entries

107 entries across 107 versions & 1 rubygems

Version Path
avo-2.53.0 lib/tasks/avo_tasks.rake
avo-2.52.0 lib/tasks/avo_tasks.rake
avo-2.49.0 lib/tasks/avo_tasks.rake
avo-2.48.0 lib/tasks/avo_tasks.rake
avo-2.47.0 lib/tasks/avo_tasks.rake
avo-2.46.0 lib/tasks/avo_tasks.rake
avo-2.45.0 lib/tasks/avo_tasks.rake
avo-2.44.0 lib/tasks/avo_tasks.rake
avo-2.43.0 lib/tasks/avo_tasks.rake
avo-2.42.2 lib/tasks/avo_tasks.rake
avo-2.42.1 lib/tasks/avo_tasks.rake
avo-2.42.0 lib/tasks/avo_tasks.rake
avo-2.41.0 lib/tasks/avo_tasks.rake
avo-2.40.0 lib/tasks/avo_tasks.rake
avo-2.39.0 lib/tasks/avo_tasks.rake
avo-2.38.0 lib/tasks/avo_tasks.rake
avo-2.37.2 lib/tasks/avo_tasks.rake
avo-2.37.1 lib/tasks/avo_tasks.rake
avo-2.37.0 lib/tasks/avo_tasks.rake
avo-2.36.3 lib/tasks/avo_tasks.rake