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 all commits
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
5 changes: 2 additions & 3 deletions BaselineOfIceberg.package/.filetree
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{
"separateMethodMetaAndSource" : false,
"noMethodMetaData" : true,
"useCypressPropertiesFile" : true
}
"separateMethodMetaAndSource" : false,
"useCypressPropertiesFile" : true }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It could be cool if:

  • The exporter could not rewrite metadata without changes
  • The exporter could not change the order of metadata between two export.

I am the only one to be bothered by this?

Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,16 @@ baseline: spec
with: [ spec requires: #('ProcessWrapper') ] ];

package: 'Iceberg';
package: 'Iceberg-Metacello-Integration' with: [ spec requires: #(Iceberg)];
package: 'Iceberg-UI' with: [ spec requires: #(Iceberg) ];
package: 'Iceberg-Tests' with: [ spec requires: #(Iceberg 'Iceberg-GitCommand') ];
package: 'Iceberg-Plugin';
package: 'Iceberg-Metacello-Integration' with: [ spec requires: #('Iceberg')];
package: 'Iceberg-UI' with: [ spec requires: #('Iceberg' 'Iceberg-Plugin') ];
package: 'Iceberg-Tests' with: [ spec requires: #('Iceberg' 'Iceberg-GitCommand') ];
package: 'Iceberg-UI-Tests' with: [ spec requires: #('Iceberg-UI' 'Iceberg-Tests')];
package: 'Iceberg-GitFileTree' with: [ spec requires: #(Iceberg FileTree) ];
package: 'Iceberg-GitFileTree' with: [ spec requires: #('Iceberg' 'FileTree') ];
package: 'Iceberg-GitFileTree-Tests' with: [ spec requires: #('Iceberg-GitFileTree' 'Iceberg-Tests') ];
package: 'Iceberg-Libgit' with: [ spec requires: #(Iceberg LibGit) ];
package: 'Iceberg-Libgit' with: [ spec requires: #('Iceberg' 'LibGit') ];

group: 'minimal' with: #(Iceberg 'Iceberg-Libgit');
group: 'minimal' with: #('Iceberg' 'Iceberg-Libgit');
group: 'default' with: #(minimal 'Iceberg-Metacello-Integration' 'Iceberg-UI');
group: 'allTests' with: #('Iceberg-Tests' 'LibGit-Tests' 'Iceberg-GitFileTree-Tests' 'Iceberg-UI-Tests' );
group: 'development' with: #(default 'Iceberg-GitFileTree' allTests)
Expand Down

This file was deleted.

19 changes: 11 additions & 8 deletions BaselineOfIceberg.package/BaselineOfIceberg.class/properties.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
{
"commentStamp" : "",
"super" : "BaselineOf",
"category" : "BaselineOfIceberg",
"classinstvars" : [ ],
"pools" : [ ],
"classvars" : [ ],
"instvars" : [ ],
"classinstvars" : [
],
"classvars" : [
],
"commentStamp" : "",
"instvars" : [
],
"name" : "BaselineOfIceberg",
"type" : "normal"
}
"pools" : [
],
"super" : "BaselineOf",
"type" : "normal" }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here, the exporter produce a lot of noise for nothing :(

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The files are exported from FileTree right? So If I open an issue it is on FileTree?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yep

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ty, I opened an issue (dalehenrich/filetree#214)

3 changes: 2 additions & 1 deletion BaselineOfIceberg.package/properties.json
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
{ }
{
}
4 changes: 4 additions & 0 deletions Iceberg-Plugin.package/.filetree
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"noMethodMetaData" : true,
"separateMethodMetaAndSource" : false,
"useCypressPropertiesFile" : true }
2 changes: 2 additions & 0 deletions Iceberg-Plugin.package/IceGitHubAPI.class/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
I represent an access point to the GitHub API.
I provide different high level abstractions to interact with GitHub, following the speciphications you can find here: https://developer.github.com/v3/
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
6 changes: 6 additions & 0 deletions Iceberg-Plugin.package/IceGitHubAPI.class/instance/get..st
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
private requesting
get: aString
^ self withResponseValidationDo: [
(self newRequestTo: aString)
get;
response ]
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
private factory
newRequestTo: aString
^ ZnClient new
username: self credentials username password: self credentials password;
headerAt: 'Accept' put: 'application/vnd.github.v3+json';
url: 'https://api.github.com/', aString;
yourself
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
private requesting
post: aString with: aBlock
^ self withResponseValidationDo: [
(self newRequestTo: aString)
in: aBlock;
post;
response ]
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
requesting
postPullRequestTo: owner project: projectName data: aDictionary
^ self
post: 'repos/', owner, '/', projectName, '/pulls'
with: [ :client |
client
entity: (ZnEntity text: (STON toJsonString: aDictionary));
contentType: ZnMimeType applicationJson ]
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
requesting
requestBranchesFrom: owner project: projectName
^ self get: 'repos/', owner,'/', projectName, '/branches'
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
requesting
requestRepositoryFrom: owner project: projectName
^ self get: 'repos/', owner,'/', projectName
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
private requesting
withResponseValidationDo: aBlock
| response |

response := aBlock value.
response isSuccess
ifFalse: [ IceGitHubError signalFor: response ].
^ response contents
14 changes: 14 additions & 0 deletions Iceberg-Plugin.package/IceGitHubAPI.class/properties.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"category" : "Iceberg-Plugin-GitHub",
"classinstvars" : [
],
"classvars" : [
],
"commentStamp" : "<historical>",
"instvars" : [
"credentials" ],
"name" : "IceGitHubAPI",
"pools" : [
],
"super" : "Object",
"type" : "normal" }
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
I'm an error that happens when credentials are bad.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
testing
isAppropriateFor: aResponse
^ aResponse status = 401
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
accessing
messageBody
^ 'Credentials provided are wrong'
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"category" : "Iceberg-Plugin-GitHub",
"classinstvars" : [
],
"classvars" : [
],
"commentStamp" : "<historical>",
"instvars" : [
],
"name" : "IceGitHubBadCredentialsError",
"pools" : [
],
"super" : "IceGitHubError",
"type" : "normal" }
1 change: 1 addition & 0 deletions Iceberg-Plugin.package/IceGitHubError.class/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
I'm an error that happens when something fails when performing a GitHub action.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
private
errorClassFor: aResponse
^ self allSubclasses
detect: [ :each | each isAppropriateFor: aResponse ]
ifNone: [ self ]
5 changes: 5 additions & 0 deletions Iceberg-Plugin.package/IceGitHubError.class/class/for..st
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
instance creation
for: aResponse
^ (self errorClassFor: aResponse) new
response: aResponse;
yourself
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
testing
isAppropriateFor: aResponse
^ false
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
instance creation
signalFor: aResponse
^ (self for: aResponse) signal
3 changes: 3 additions & 0 deletions Iceberg-Plugin.package/IceGitHubError.class/instance/code.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
accessing
code
^ self response status
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
accessing
contents
^ self response contents
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
private
customError: aDictionary
^ aDictionary at: #message

Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
private
errorToString: aDictionary
(aDictionary at: #code) = 'custom' ifTrue: [ ^ self customError: aDictionary ].
(aDictionary at: #code) = 'invalid' ifTrue: [ ^ self invalidError: aDictionary ].

^ self unknownError: aDictionary
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
private
invalidError: aDictionary
^ 'Invalid field: ', (aDictionary at: #field)


Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
accessing
jsonContents
^ jsonContents ifNil: [ jsonContents := STON fromString: self contents ]

Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
accessing
messageBody
| errors |
errors := self jsonContents at: #errors ifAbsent: [ ^ '' ].
^ String streamContents: [ :stream |
errors
do: [ :each | stream << (self errorToString: each) ]
separatedBy: [ stream cr ] ].
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
accessing
messageText
^ self jsonContents at: #message
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
accessing
response: anObject
response := anObject
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
accessing
response
^ response
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
private
unknownError: aDictionary
^ String streamContents: [ :stream |
(aDictionary associations sorted: [ :a :b | a key < b key ])
do: [ :each | stream << each key << ': ' << each value ]
separatedBy: [ stream << ', ' ] ]
15 changes: 15 additions & 0 deletions Iceberg-Plugin.package/IceGitHubError.class/properties.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"category" : "Iceberg-Plugin-GitHub",
"classinstvars" : [
],
"classvars" : [
],
"commentStamp" : "EstebanLorenzano 2/1/2017 17:15",
"instvars" : [
"response",
"jsonContents" ],
"name" : "IceGitHubError",
"pools" : [
],
"super" : "Error",
"type" : "normal" }
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
I'm an error that happens when something went wrong on GitHub API operations.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
testing
isAppropriateFor: aResponse
^ aResponse status = 422
14 changes: 14 additions & 0 deletions Iceberg-Plugin.package/IceGitHubGenericError.class/properties.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"category" : "Iceberg-Plugin-GitHub",
"classinstvars" : [
],
"classvars" : [
],
"commentStamp" : "<historical>",
"instvars" : [
],
"name" : "IceGitHubGenericError",
"pools" : [
],
"super" : "IceGitHubError",
"type" : "normal" }
2 changes: 2 additions & 0 deletions Iceberg-Plugin.package/IceGitHubPullRequest.class/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
I am a pull request.
I can be sent using ==#sendWithCredentials:== protocol.
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
body: anObject
body := anObject
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
accessing
body
^ body
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
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
Loading