Skip to content

Commit

Permalink
Add dev scripts to bin dir on install
Browse files Browse the repository at this point in the history
  • Loading branch information
ahangarha committed Oct 26, 2022
1 parent b4b39df commit d4cc4f2
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 0 deletions.
9 changes: 9 additions & 0 deletions lib/generators/react_on_rails/bin/dev
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/usr/bin/env bash

if ! command -v foreman &> /dev/null
then
echo "Installing foreman…"
gem install foreman && echo "Foreman Installed."
fi

foreman start -f Procfile.dev
9 changes: 9 additions & 0 deletions lib/generators/react_on_rails/bin/dev-static
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/usr/bin/env bash

if ! command -v foreman &> /dev/null
then
echo "Installing foreman…"
gem install foreman && echo "Foreman Installed."
fi

foreman start -f Procfile.dev-static
6 changes: 6 additions & 0 deletions lib/generators/react_on_rails/install_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ class InstallGenerator < Rails::Generators::Base
def run_generators
if installation_prerequisites_met? || options.ignore_warnings?
invoke_generators
add_bin_scripts
else
error = "react_on_rails generator prerequisites not met!"
GeneratorMessages.add_error(error)
Expand Down Expand Up @@ -75,6 +76,11 @@ def missing_node?
GeneratorMessages.add_error(error)
true
end

def add_bin_scripts
directory "#{__dir__}/bin", "bin"
chmod "bin", 0o755 & ~File.umask, verbose: false
end
end
end
end

0 comments on commit d4cc4f2

Please sign in to comment.