Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History
executable file
·
92 lines (77 loc) · 2.64 KB

File metadata and controls

executable file
·
92 lines (77 loc) · 2.64 KB
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
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
#!/usr/bin/env ruby
require_relative '../deployment.rb'
require 'cdo/git_utils'
require 'cdo/only_one'
CONTENT_PATHS = 'dashboard pegasus'.freeze
def ask_for_name
name = ''
until name != ''
print "Who are you? "
name = gets.chomp
end
puts "Hi #{name}!"
name
end
def disallow_case_change
`git add -A #{CONTENT_PATHS}`
`git status --porcelain --untracked-files=all #{CONTENT_PATHS}`.split("\n").each do |line|
next unless (%r{^R ([^ ]+) -> ([^ ]+)}.match(line) || %r{^R ("[^"]+") -> ("[^"]+")}.match(line)) && $1.casecmp($2) == 0
STDERR.puts "\nAborting due to case-only rename:\n\n #{line}\n\n"
STDERR.puts "To fix this, run the following commands:\n\n"
STDERR.puts " git add #{$2}\n\n"
STDERR.puts " git mv #{$2} #{$2}.tmp\n\n"
STDERR.puts " git commit --only #{$1} #{$2}.tmp -m 'temporarily rename #{$1} -> #{$2}.tmp'\n\n"
STDERR.puts " git mv #{$2}.tmp #{$2}\n\n"
STDERR.puts " bin/content-push\n\n"
# unstage all changes so the above instructions can be followed
`git reset HEAD`
exit 1
end
end
def check_changes
if `git status --porcelain --untracked-files=all #{CONTENT_PATHS}`.empty?
puts "There are no unstaged or untracked files to commit."
return false
end
disallow_case_change
system("git status --untracked-files=all #{CONTENT_PATHS}")
print "Should I commit and push all of these unstaged and untracked files in pegasus and dashboard? [Y/n] "
input = gets.chomp
if input == '' || input[0].downcase == 'y'
puts "Cool!"
true
else
puts "Ok, not doing anything."
false
end
end
def commit_changes(name)
branchname = GitUtils.current_branch
exit 1 unless system("git add -A #{CONTENT_PATHS}")
exit 1 unless system("git commit #{CONTENT_PATHS} -m '#{branchname} content changes (-#{name})'")
exit 1 unless system("git pull")
exit 1 unless system("git push")
end
options = {}
OptionParser.new do |opts|
opts.on('-n', '--name NAME', 'Your name, or name of the process doing this commit') do |name|
options['name'] = name
end
opts.on('-s', '--subdirectory SUBDIRECTORY', 'Only push changes in this subdirectory') do |subdir|
options['subdirectory'] = subdir
end
opts.on('-f', '--force', 'Damn the torpedos, just do the commit and push, requires name') do
options['force'] = true
end
opts.on('-h', '--help', 'Print this') do
puts opts
exit
end
end.parse!
raise OptionParser::MissingArgument, 'Name is required if forcing push' if options['force'] && options['name'].nil?
Dir.chdir(deploy_dir) do
name = options['name'] || ask_for_name
if options['force'] || check_changes
commit_changes(name)
end
end
Morty Proxy This is a proxified and sanitized view of the page, visit original site.