61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
|
# File 'lib/jobshop/cli/canary.rb', line 61
def setup
File.file?("jobshop.gemspec") || abort(<<~ABORT)
Please run this command from the root of the Jobshop source tree.
ABORT
quiet_command(<<~COMMAND, :check, "dependencies") unless options[:fast]
gem install bundler --conservative
bundle check || bundle install
mkdir -p .git/safe
mkdir -p spec/canary
COMMAND
Dir.chdir "spec/canary" do
quiet_command(<<~COMMAND, :prepare, "environment")
if psql -lqt | cut -d \\| -f 1 | grep -qw canary_development; then
bundle exec rails db:environment:set RAILS_ENV=development
fi
COMMAND
end unless options[:fast]
quiet_command(<<~COMMAND, :install, "jobshop development app") unless options[:fast]
jobshop reset
COMMAND
quiet_command(<<~COMMAND, :seed, "pseudorandom development data")
jobshop seed
COMMAND
say_status :config, "environment template", :white
FileUtils.cp(".env", "spec/canary/.env") if File.file?(".env")
say_status :complete, "", :white
say ""
login_link = if options[:password]
login_with_password_link(options[:password])
else
reset_password_link
end
message = <<~MESSAGE
Thank you for installing #{set_color("Jobshop", :white, :bold)}.
You can start the server by running:
jobshop server
Then open your browser and go to:
#{login_link}
MESSAGE
say message
end
|