Sha256: 50e6c03e877207fbdb16bc28bde34790a04064384674887fd6cf3f645dff7b40
Contents?: true
Size: 1014 Bytes
Versions: 3
Compression:
Stored size: 1014 Bytes
Contents
require "fileutils" namespace :futurism do desc "Let's look into a brighter future with futurism and CableReady" task install: :environment do system "yarn add cable_ready" app_path_part = Webpacker && Rails ? Webpacker.config.source_path.relative_path_from(Rails.root) : "app/javascript" FileUtils.mkdir_p "./#{app_path_part}/channels" FileUtils.mkdir_p "./#{app_path_part}/elements" FileUtils.cp File.expand_path("../templates/futurism_channel.js", __dir__), "./#{app_path_part}/channels" FileUtils.cp_r File.expand_path("../templates/elements", __dir__), "./#{app_path_part}" filepath = %w[ app/javascript/packs/application.js app/javascript/packs/application.ts ] .select { |path| File.exist?(path) } .map { |path| Rails.root.join(path) } .first puts "Updating #{filepath}" lines = File.open(filepath, "r") { |f| f.readlines } lines << "\nimport 'elements'" File.open(filepath, "w") { |f| f.write lines.join } end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
futurism-0.1.2 | lib/tasks/futurism_tasks.rake |
futurism-0.1.1 | lib/tasks/futurism_tasks.rake |
futurism-0.1.0 | lib/tasks/futurism_tasks.rake |