Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

first shot to plugins (and GitHub PR as test case) #268

Merged
merged 13 commits into from
Feb 3, 2017
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
a complete revamp to take advantage of github information . Still nee…
…ds some polishing, but it works :)
  • Loading branch information
estebanlm committed Feb 2, 2017
commit d6b192dc2219831e729da813d301b4a5dadeb89b

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
accessing
baseBranchName: anObject
baseBranchName := anObject
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
accessing
baseBranchName
^ baseBranchName
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
accessing
baseRemote: anObject
baseRemote := anObject
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
accessing
baseRemote
^ baseRemote
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
accessing
credentials: anObject
credentials := anObject
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
accessing
credentials
^ credentials

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
accessing
headBranchName: anObject
headBranchName := anObject
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
accessing
headBranchName
^ headBranchName
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
accessing
headRemote: anObject
headRemote := anObject
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
accessing
headRemote
^ headRemote
22 changes: 22 additions & 0 deletions Iceberg-Plugin.package/IceGitHubPullRequest.class/instance/send.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
actions
send
| prData response |

prData := {
'title' -> self title.
'head' -> (self headRemote owner, ':', self headBranchName).
'base' -> self baseBranchName.
'body' -> self body.
} asDictionary.

response := ZnClient new
headerAt: 'Accept' put: 'application/vnd.github.v3+json';
username: self credentials username password: self credentials password;
url: 'https://api.github.com/repos/', self baseRemote owner, '/', self baseRemote projectName, '/pulls';
entity: (ZnEntity text: (STON toJsonString: prData));
contentType: ZnMimeType applicationJson;
post;
response.

response isSuccess
ifFalse: [ IceGitHubError signalFor: response ]

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,12 @@
],
"commentStamp" : "<historical>",
"instvars" : [
"credentials",
"title",
"base",
"head",
"baseRemote",
"headRemote",
"baseBranchName",
"headBranchName",
"body" ],
"name" : "IceGitHubPullRequest",
"pools" : [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,16 @@ defaultSpec
newColumn: [ :c |
c
newRow: [:row | row add: #titleLabel width: 80; add: #titlePanel ] height: 25;
newRow: [:row | row add: #headLabel width: 80; add: #headPanel ] height: 25;
newRow: [:row | row add: #baseLabel width: 80; add: #basePanel ] height: 25;
newRow: [:row |
row
add: #headLabel width: 80;
add: #headForkList width: 200;
add: #headBranchList ] height: 25;
newRow: [:row |
row
add: #baseLabel width: 80;
add: #baseForkList width: 200;
add: #baseBranchList ] height: 25;
newRow: [:row | row add: #bodyLabel width: 80; add: #bodyPanel ];
add: #addButton height: self buttonHeight ];
yourself
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,6 @@ accept
^ self ].

acceptBlock ifNotNil: [
acceptBlock cull: (IceGitHubPullRequest new
title: title;
head: self headPanel selectedItem;
base: self basePanel selectedItem;
body: self bodyPanel text trim;
yourself) ].
acceptBlock cull: self createPullRequest ].

self window delete.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
accessing
availableBranchNames
^ availableBranchNames ifNil: [ availableBranchNames := self obtainAvailableBranchNames ]
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
accessing
availableRemotes
"retrieves available remotes to perform the PR"
^ availableRemotes ifNil: [ availableRemotes := self obtainAvailableRemotes ]
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
accessing ui
baseBranchList: anObject
baseBranchList := anObject
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
accessing ui
baseBranchList
^ baseBranchList
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
private
baseBranchNames
^ self baseBranches collect: [ :each | each at: #name ]
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
private
baseBranches
^ baseBranches ifNil: [
baseBranches := STON fromString: self requestBaseBranches ]
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
accessing
baseDefaultBranchName
^ self gitBase at: #'default_branch'
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
accessing ui
baseForkList: anObject
baseForkList := anObject
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
accessing ui
baseForkList
^ baseForkList

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
accessing
baseRemote
"This is the 'base' remote (the place where the repository is forked). This is used to
suggest fork PR destination (base)"
^ baseRemote ifNil: [ baseRemote := self obtainBaseRemote ]

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
private
createPullRequest
^ IceGitHubPullRequest new
credentials: self credentials;
title: self titlePanel text trim;
headRemote: self headForkList selectedItem;
headBranchName: self headBranchList selectedItem;
baseRemote: self baseForkList selectedItem;
baseBranchName: self baseBranchList selectedItem;
body: self bodyPanel text trim;
yourself
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
accessing
credentials
^ credentials ifNil: [ credentials := self obtainCredentials ]
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
accessing
currentBranch
^ self repository currentBranch
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
accessing
defaultBaseBranchName
self hasParent ifFalse: [ ^ self baseDefaultBranchName ].
^ self baseBranchNames
detect: [ :each | each = self currentBranch basename ]
ifNone: [ self baseDefaultBranchName ]
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
accessing
defaultHeadBranchName
^ self currentBranch basename
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
private
gitBase
| info |
^ (info := self gitRepositoryInfo)
at: #parent
ifAbsent: [ info ]
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
private
gitRepositoryInfo
^ gitRepositoryInfo ifNil: [
gitRepositoryInfo := STON fromString: self requestGitRepositoryInfo ]
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
private
hasParent
^ self gitRepositoryInfo includesKey: #parent
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
accessing ui
headBranchList: anObject
headBranchList := anObject
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
accessing ui
headBranchList
^ headBranchList
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
accessing ui
headForkList: anObject
headForkList := anObject
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
accessing ui
headForkList
^ headForkList

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
api
initialExtent
^ 500@300
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
initialization
initializePresenter
| currentBranch |

super initializePresenter.
currentBranch := self branches detect: [ :each |
each remoteName = repository pushRemote remoteName
and: [ each basename = repository currentBranch basename ] ].
self titlePanel text: currentBranch basename.
self headPanel
items: self branches;
displayBlock: [ :branch | branch name ];
setSelectedItem: currentBranch.
self basePanel
items: self branches;
displayBlock: [ :branch | branch name ];
setSelectedItem: (self branches detect: [ :each | each ~= currentBranch ])
self titlePanel text: self currentBranch basename.
self headForkList
items: self availableRemotes;
displayBlock: [ :each | each owner, '/', each projectName ];
setSelectedItem: self repository pushRemote.
self headBranchList
items: self availableBranchNames;
displayBlock: [ :each | each ];
setSelectedItem: self currentBranch basename.
self baseForkList
items: self availableRemotes;
displayBlock: [ :each | each owner, '/', each projectName ];
setSelectedItem: self baseRemote.
self baseBranchList
items: self availableBranchNames;
displayBlock: [ :each | each ];
setSelectedItem: self defaultBaseBranchName
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@ initializeWidgets
titleLabel := self newLabel.
titlePanel := self newTextInput.
headLabel := self newLabel.
headPanel := self newDropList.
headForkList := self newDropList.
headBranchList := self newDropList.
baseLabel := self newLabel.
basePanel := self newDropList.
baseForkList := self newDropList.
baseBranchList := self newDropList.
bodyLabel := self newLabel.
bodyPanel := self newText.
addButton := self newButton.
Expand All @@ -19,7 +21,9 @@ initializeWidgets

self focusOrder
add: titlePanel;
add: headPanel;
add: basePanel;
add: headForkList;
add: headBranchList;
add: baseForkList;
add: baseBranchList;
add: bodyPanel;
add: addButton
Loading