Sha256: 561617870cc80a6e5ebf04da5786d74f89286f49286d9735ea5a9dc740a87b83
Contents?: true
Size: 1.73 KB
Versions: 13
Compression:
Stored size: 1.73 KB
Contents
say "Compile into app/assets/builds" empty_directory "app/assets/builds" keep_file "app/assets/builds" if (sprockets_manifest_path = Rails.root.join("app/assets/config/manifest.js")).exist? append_to_file sprockets_manifest_path, %(//= link_tree ../builds\n) end if Rails.root.join(".gitignore").exist? append_to_file(".gitignore", %(\n/app/assets/builds/*\n!/app/assets/builds/.keep\n)) append_to_file(".gitignore", %(\n/node_modules\n)) end if (app_layout_path = Rails.root.join("app/views/layouts/application.html.erb")).exist? say "Add JavaScript include tag in application layout" insert_into_file app_layout_path.to_s, %(\n <%= javascript_include_tag "application", "data-turbo-track": "reload", defer: true %>), before: /\s*<\/head>/ else say "Default application.html.erb is missing!", :red say %( Add <%= javascript_include_tag "application", "data-turbo-track": "reload", defer: true %> within the <head> tag in your custom layout.) end unless (app_js_entrypoint_path = Rails.root.join("app/javascript/application.js")).exist? say "Create default entrypoint in app/javascript/application.js" empty_directory app_js_entrypoint_path.parent.to_s copy_file "#{__dir__}/application.js", app_js_entrypoint_path end unless Rails.root.join("package.json").exist? say "Add default package.json" copy_file "#{__dir__}/package.json", "package.json" end if Rails.root.join("Procfile.dev").exist? append_to_file "Procfile.dev", "js: yarn build --watch\n" else say "Add default Procfile.dev" copy_file "#{__dir__}/Procfile.dev", "Procfile.dev" say "Ensure foreman is installed" run "gem install foreman" end say "Add bin/dev to start foreman" copy_file "#{__dir__}/dev", "bin/dev" chmod "bin/dev", 0755, verbose: false
Version data entries
13 entries across 13 versions & 1 rubygems