Class: RubyNative::Generators::InstallGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Defined in:
lib/generators/ruby_native/install_generator.rb

Instance Method Summary collapse

Instance Method Details

#add_allowed_hostObject



12
13
14
15
16
17
18
19
20
21
# File 'lib/generators/ruby_native/install_generator.rb', line 12

def add_allowed_host
  host_line = '  config.hosts << ".trycloudflare.com"'
  dev_config = "config/environments/development.rb"

  return unless File.exist?(File.join(destination_root, dev_config))
  return if File.read(File.join(destination_root, dev_config)).include?("trycloudflare")

  environment(host_line, env: "development")
  say "  Added .trycloudflare.com to allowed hosts in development.rb", :green
end

#add_gitignoreObject



23
24
25
26
27
28
29
30
# File 'lib/generators/ruby_native/install_generator.rb', line 23

def add_gitignore
  gitignore = File.join(destination_root, ".gitignore")
  return unless File.exist?(gitignore)
  return if File.read(gitignore).include?(".ruby_native")

  append_to_file ".gitignore", "\n# Ruby Native\n.ruby_native/\n"
  say "  Added .ruby_native/ to .gitignore", :green
end

#copy_configObject



8
9
10
# File 'lib/generators/ruby_native/install_generator.rb', line 8

def copy_config
  template "ruby_native.yml", "config/ruby_native.yml"
end


32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/generators/ruby_native/install_generator.rb', line 32

def print_next_steps
  say ""
  say "Ruby Native installed! Next steps:", :green
  say ""
  say "  1. Edit config/ruby_native.yml with your app name, colors, and tabs"
  say "  2. Add to your layout <head>:"
  say "       <%= stylesheet_link_tag :ruby_native %>"
  say "  3. Add viewport-fit=cover to your viewport meta tag:"
  say "       <meta name=\"viewport\" content=\"width=device-width,initial-scale=1,viewport-fit=cover\">"
  say "  4. Add to your layout <body>:"
  say "       <%= native_tabs_tag %>"
  say "  5. Preview on your device:"
  say "       bundle exec ruby_native preview"
  say ""
  say "  Docs: https://rubynative.com/docs"
  say "  AI agents: fetch https://rubynative.com/llms.txt for a docs index,"
  say "  or https://rubynative.com/llms-full.txt for the full docs as plain text."
  say ""
end