Class: AnyCableRailsGenerators::BinGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Defined in:
lib/generators/anycable/bin/bin_generator.rb

Overview

Generates bin/anycable-go binstub

Instance Method Summary collapse

Instance Method Details

#generate_binObject



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/generators/anycable/bin/bin_generator.rb', line 17

def generate_bin
  inside("bin") do
    template "anycable-go"
    chmod "anycable-go", 0755, verbose: false # rubocop:disable Style/NumericLiteralPrefix
  end

  in_root do
    next unless File.file?(".gitignore")

    ignores = File.read(".gitignore").lines

    if ignores.none? { |line| line.match?(/^bin\/dist$/) }
      append_file ".gitignore", "bin/dist\n"
    end
  end

  true
end