-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnew-rails-project
More file actions
executable file
·40 lines (32 loc) · 864 Bytes
/
new-rails-project
File metadata and controls
executable file
·40 lines (32 loc) · 864 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/usr/bin/env ruby
# frozen_string_literal: true
# CLI example:
# ./new-rails-project
# ./new-rails-project file-name-with-options
# TESTING=1 ./new-rails-project file-name-with-options
require_relative "src/ask"
require_relative "src/new_project/cli"
begin
cli = NewProject::CLI.new(ARGV)
puts "Press Ctrl+C to stop anytime."
cli.call
cli.ensure_gem_path_is_writable do
unless cli.railties_installed?
puts "Installing railties gem..."
cli.install_railties
end
puts "Generating application..."
cli.generate_app
cli.add_postinstall_steps
end
if cli.any_postinstall_steps?
puts "Run postinstall script..."
cli.run_postinstall_script
end
puts "Done!"
rescue Interrupt
exit(2)
rescue StandardError => e
warn "Current dir: #{Dir.pwd}", e.message, e.backtrace.grep_v(/ruby|bundle|gems/)
exit(1)
end