summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
Diffstat (limited to 'bin')
-rwxr-xr-xbin/background_jobs2
-rwxr-xr-xbin/feature-flag18
-rwxr-xr-xbin/mail_room5
-rwxr-xr-xbin/spring10
-rwxr-xr-xbin/web_unicorn5
5 files changed, 29 insertions, 11 deletions
diff --git a/bin/background_jobs b/bin/background_jobs
index 866f5c39cd6..cbc501094c4 100755
--- a/bin/background_jobs
+++ b/bin/background_jobs
@@ -1,6 +1,6 @@
#!/usr/bin/env bash
-cd $(dirname $0)/..
+cd $(dirname $0)/.. || exit 1
if [ -n "$SIDEKIQ_WORKERS" ] ; then
exec bin/background_jobs_sk_cluster "$@"
diff --git a/bin/feature-flag b/bin/feature-flag
index b5e7889be1d..613ddc1d8cb 100755
--- a/bin/feature-flag
+++ b/bin/feature-flag
@@ -35,6 +35,7 @@ class FeatureFlagOptionParser
:name,
:type,
:group,
+ :milestone,
:ee,
:amend,
:dry_run,
@@ -64,6 +65,10 @@ class FeatureFlagOptionParser
options.introduced_by_url = value
end
+ opts.on('-M', '--milestone [string]', String, 'Milestone in which the Feature Flag was introduced') do |value|
+ options.milestone = value
+ end
+
opts.on('-i', '--rollout-issue-url [string]', String, 'URL of Issue rolling out the Feature Flag') do |value|
options.rollout_issue_url = value
end
@@ -99,7 +104,7 @@ class FeatureFlagOptionParser
end
# Name is a first name
- options.name = argv.first
+ options.name = argv.first.downcase.gsub(/-/, '_')
options
end
@@ -126,6 +131,8 @@ class FeatureFlagOptionParser
$stdout.puts ">> Specify the feature flag type:"
$stdout.puts
TYPES.each do |type, data|
+ next if data[:deprecated]
+
$stdout.puts "#{type.to_s.rjust(15)}#{' '*6}#{data[:description]}"
end
@@ -133,7 +140,7 @@ class FeatureFlagOptionParser
$stdout.print "?> "
type = $stdin.gets.strip.to_sym
- return type if TYPES[type]
+ return type if TYPES[type] && !TYPES[type][:deprecated]
$stderr.puts "Invalid type specified '#{type}'"
end
@@ -186,6 +193,11 @@ class FeatureFlagOptionParser
end
end
+ def read_milestone
+ milestone = File.read('VERSION')
+ milestone.gsub(/^(\d+\.\d+).*$/, '\1').chomp
+ end
+
def read_default_enabled(options)
TYPES.dig(options.type, :default_enabled)
end
@@ -212,6 +224,7 @@ class FeatureFlagCreator
options.group ||= FeatureFlagOptionParser.read_group
options.introduced_by_url ||= FeatureFlagOptionParser.read_introduced_by_url
options.rollout_issue_url ||= FeatureFlagOptionParser.read_rollout_issue_url(options)
+ options.milestone ||= FeatureFlagOptionParser.read_milestone
$stdout.puts "\e[32mcreate\e[0m #{file_path}"
$stdout.puts contents
@@ -241,6 +254,7 @@ class FeatureFlagCreator
'name' => options.name,
'introduced_by_url' => options.introduced_by_url,
'rollout_issue_url' => options.rollout_issue_url,
+ 'milestone' => options.milestone,
'group' => options.group,
'type' => options.type.to_s,
'default_enabled' => FeatureFlagOptionParser.read_default_enabled(options)
diff --git a/bin/mail_room b/bin/mail_room
index 2539e3d388e..cf9d422909e 100755
--- a/bin/mail_room
+++ b/bin/mail_room
@@ -1,6 +1,6 @@
#!/bin/sh
-cd $(dirname $0)/..
+cd $(dirname $0)/.. || exit 1
app_root=$(pwd)
mail_room_pidfile="$app_root/tmp/pids/mail_room.pid"
@@ -9,7 +9,8 @@ mail_room_config="$app_root/config/mail_room.yml"
get_mail_room_pid()
{
- local pid=$(cat $mail_room_pidfile)
+ local pid
+ pid=$(cat $mail_room_pidfile)
if [ -z "$pid" ] ; then
echo "Could not find a PID in $mail_room_pidfile"
exit 1
diff --git a/bin/spring b/bin/spring
index e0d140fe0c7..497ab099954 100755
--- a/bin/spring
+++ b/bin/spring
@@ -1,15 +1,17 @@
#!/usr/bin/env ruby
-# This file loads spring without using Bundler, in order to be fast.
+# This file loads Spring without using Bundler, in order to be fast.
# It gets overwritten when you run the `spring binstub` command.
unless (defined?(Spring) || ENV['ENABLE_SPRING'] != '1') && File.basename($0) != 'spring'
require 'rubygems'
require 'bundler'
- if (match = Bundler.default_lockfile.read.match(/^GEM$.*?^ (?: )*spring \((.*?)\)$.*?^$/m))
- Gem.paths = { 'GEM_PATH' => [Bundler.bundle_path.to_s, *Gem.path].uniq.join(Gem.path_separator) }
- gem 'spring', match[1]
+ lockfile = Bundler::LockfileParser.new(Bundler.default_lockfile.read)
+ spring = lockfile.specs.detect { |spec| spec.name == 'spring' }
+ if spring
+ Gem.use_paths Gem.dir, Bundler.bundle_path.to_s, *Gem.path
+ gem 'spring', spring.version
require 'spring/binstub'
end
end
diff --git a/bin/web_unicorn b/bin/web_unicorn
index ecd0bbd10b0..5fa15a8324b 100755
--- a/bin/web_unicorn
+++ b/bin/web_unicorn
@@ -1,6 +1,6 @@
#!/bin/sh
-cd $(dirname $0)/..
+cd $(dirname $0)/.. || exit 1
app_root=$(pwd)
unicorn_pidfile="$app_root/tmp/pids/unicorn.pid"
@@ -9,7 +9,8 @@ unicorn_cmd="bundle exec unicorn_rails -c $unicorn_config -E $RAILS_ENV"
get_unicorn_pid()
{
- local pid=$(cat $unicorn_pidfile)
+ local pid
+ pid=$(cat $unicorn_pidfile)
if [ -z "$pid" ] ; then
echo "Could not find a PID in $unicorn_pidfile"
exit 1