Sha256: ff5e96c62578cd879ad3d56fb38462668f74d2f2ea0162ef7e5198e8e9302965
Contents?: true
Size: 1.71 KB
Versions: 15
Compression:
Stored size: 1.71 KB
Contents
# desc 'Explaining what the task does' # task :avo do # # Task goes here # end desc "Runs the update command for all Avo gems." task "avo:update" do system "bundle update avo avo-pro avo-advanced avo-dashboards avo_filters avo-menu avo_upgrade" 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 desc "Finds all Avo gems and outputs theyr paths" task "avo:gem_paths" do config = YAML.load_file("../support/gems.yml") existing_gems = config["gems"].keys .map do |gem| path = `bundle show #{gem} 2> /dev/null`.chomp unless path.empty? "#{gem}:#{path}" end end .reject(&:nil?) result = existing_gems.join(",") # Outputs a CSV "hash-like" string in this format # # GEM_NAME:GEM_PATH,SECOND_GEM_NAME:SECOND_GEM_PATH # avo:/Users/adrian/work/avocado/avo-3,avo_filters:/Users/adrian/work/avocado/advanced/avo_filters puts result end
Version data entries
15 entries across 15 versions & 1 rubygems