zd_hire 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/zd_hire +37 -0
- data/lib/zd_hire/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 904dc6c89277052207e64e23e70d0f1367b81a40
|
4
|
+
data.tar.gz: 2de15e3b05ff7e28ad81462d465bb629576a24bf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2ad5563e7ffdaaa88e4770e3d51820bbf6ceee26e3af10875ca0db0ca363c444d3e882f39cf30a89e385e0961785b5891d1dd5cd52118a017beccdcebdc81291
|
7
|
+
data.tar.gz: 0e88e993f4a938935cc88418b356d175f2406bb6182e30543045d209d15e9522194dae2cef3799feb09fa6c66611429454c98eebbb9bd59ab91e3d49aec4fcde
|
data/bin/zd_hire
CHANGED
@@ -103,6 +103,35 @@ command :clone do |c|
|
|
103
103
|
end
|
104
104
|
end
|
105
105
|
|
106
|
+
command :pr do |c|
|
107
|
+
c.action do |args, options|
|
108
|
+
|
109
|
+
end
|
110
|
+
end
|
111
|
+
|
112
|
+
def create_pr(new_repo)
|
113
|
+
origin_pull_requests.each {|pr| say "[#{pr.number}] #{pr.head.ref}: #{pr.title}" }
|
114
|
+
pr_number = ask('Which Pull Request? ') do |q|
|
115
|
+
q.character = true
|
116
|
+
end
|
117
|
+
selected = origin_pull_requests.detect {|pr| pr.number.to_i == pr_number.to_i }
|
118
|
+
exit unless selected
|
119
|
+
branch = selected.head.ref
|
120
|
+
command = [
|
121
|
+
"cd #{new_repo.name}",
|
122
|
+
"git checkout -b #{branch}",
|
123
|
+
"git pull #{config.local_path} #{branch} --allow-unrelated-histories --no-edit",
|
124
|
+
"git reset $(git merge-base master #{branch})",
|
125
|
+
'git add -A',
|
126
|
+
"git commit -m '#{selected.title}'",
|
127
|
+
"git push origin #{branch}"
|
128
|
+
].join(' && ')
|
129
|
+
|
130
|
+
`#{command}`
|
131
|
+
sleep 1
|
132
|
+
github.create_pull_request(new_repo.full_name, 'master', branch, selected.title, selected.body)
|
133
|
+
end
|
134
|
+
|
106
135
|
def origin_default_issue
|
107
136
|
@df ||= origin_repo_issues.detect{|issue| issue.labels.any?{ |l| l.name == DEFAULT_ISSUE_LABEL} }
|
108
137
|
end
|
@@ -132,6 +161,10 @@ def origin_repo_issues(options = {})
|
|
132
161
|
@rp ||= github.issues(config.origin_repo, options).reject(&:pull_request)
|
133
162
|
end
|
134
163
|
|
164
|
+
def origin_pull_requests
|
165
|
+
@prs ||= github.pull_requests(config.origin_repo)
|
166
|
+
end
|
167
|
+
|
135
168
|
def copy_and_report_issues(target)
|
136
169
|
issues = presentable_issues
|
137
170
|
issues.each { |i| say "#{i.number}: #{i.title}" }
|
@@ -198,6 +231,10 @@ def create_project(target)
|
|
198
231
|
copy_and_report_issues(new_repo.full_name)
|
199
232
|
end
|
200
233
|
|
234
|
+
if agree("Would you like to copy a Pull Request(y/n) ", true)
|
235
|
+
create_pr(new_repo)
|
236
|
+
end
|
237
|
+
|
201
238
|
if agree('Would you like to open the project in your browser?(y/n) ', true)
|
202
239
|
system "open #{new_repo.html_url}"
|
203
240
|
end
|
data/lib/zd_hire/version.rb
CHANGED