Top Level Namespace

Defined Under Namespace

Modules: RailsInteractive

Instance Method Summary collapse

Instance Method Details

#bundle_installObject



3
4
5
# File 'lib/cli/templates/setup_haml.rb', line 3

def bundle_install
  Bundler.with_unbundled_env { run "bundle install" }
end

#file_contains?(filename, string) ⇒ Boolean

Returns:

  • (Boolean)


3
4
5
# File 'lib/cli/templates/setup_sidekiq.rb', line 3

def file_contains?(filename, string)
  File.foreach(filename).detect { |line| line.include?(string) }
end

#package?(package) ⇒ Boolean

Returns:

  • (Boolean)


3
4
5
6
7
8
9
10
11
# File 'lib/cli/templates/setup_tailwind.rb', line 3

def package?(package)
  require "json"

  file = File.open("package.json") if File.file?("package.json")

  packages = JSON.parse(file.read) if file

  packages["dependencies"].include?(package) if packages
end