Skip to content

Commit

Permalink
Fixes #58 - Registry should produce an anouncement when creating a re…
Browse files Browse the repository at this point in the history
…pository.
Renamed IceCreateRepositoryModel to IceCloneRepositoryModel.
Allow for git SCP urls without a trailing '.git'.
Slightly improving of error messages on wrong repository URLs.
  • Loading branch information
npasserini committed Aug 2, 2016
1 parent 359fae9 commit 8676a9f
Show file tree
Hide file tree
Showing 38 changed files with 76 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,7 @@ createRepository
self window delete.
]
on: IceWrongUrl
do: [ UIManager default abort: 'The entered URL is not a valid scp repository URL.' ]
do: [ :error |
UIManager default
abort: error messageText
title: 'Could not create repository' ]
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ initializeWidgets
remoteUrlLabel := self newLabel label: 'Remote URL'.
remoteUrl := self newTextInput text: '[email protected]:'; autoAccept: true.

localDirectoryLabel := self newLabel label: 'Local repository:'.
localDirectoryLabel := self newLabel label: 'Local directory:'.
localDirectory := self newLabel label: 'default location (iceberg-cache)'.
changeLocationButton := self newButton label: 'Change'.

subdirectoryLabel := self newLabel label: 'Subdirectory'.
subdirectoryLabel := self newLabel label: 'Code subdirectory'.
subdirectory := self newTextInput autoAccept: true.

createButton := self newButton
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"subdirectory",
"changeLocationButton",
"createButton" ],
"name" : "IceCreateRepositoryModel",
"name" : "IceCloneRepositoryModel",
"pools" : [
],
"super" : "ComposableModel",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
examples - repositories
exampleCreateRepository
IceCreateRepositoryModel new openWithSpec.
IceCloneRepositoryModel new openWithSpec.
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
private
parseUrl
| matcher |
matcher := '(git@)?([\w.]+)\:([\w]+)/([\w\-]+)\.git/?.*' asRegex.
matcher := '(git@)?([\w.]+)\:([\w]+)/([\w\-]+)(\.git)?' asRegex.
(matcher matches: url)
ifTrue: [
host := matcher subexpression: 3.
owner := matcher subexpression: 4.
projectName := matcher subexpression: 5.
]
ifFalse: [ IceWrongUrl signal: 'Could not parse scp url: ', url ]
ifFalse: [ IceWrongUrl signal: 'Could not parse URL: ', url ]



Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,13 @@ composeRepositoriesIn: composite
title: 'Repositories';
column: 'Origin' evaluated: [:repo | repo origin url ] width: 320;
column: 'Current branch' evaluated: #branchName;
updateOn: IceChangeSetChanged from: #announcer;
updateOn: IceRepositoryRegistryModified from: [ Iceberg announcer ];
addAction: self createRepositoryAction;
addAction: self createLocalRepositoryAction;
addAction: self synchronizeRepositoryAction;
selectionAct: self switchBranch on: $b entitled: 'Switch branch';
selectionAct: self forgetRepository on: $x entitled: 'Forget repository';
selectionAct: self switchBranch on: $b entitled: 'Switch branch...';
selectionAct: self forgetRepository on: $x entitled: 'Forget repository...';
addSelectionAction: self pushAction;
selectionAct: self refreshRepository on: $r entitled: 'Refresh repository';
onChangeOfPort: #strongSelection act: [ :table | IceGlamourSynchronizer synchronize: table selection ]
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
action creators
createLocalRepositoryAction
^ GLMGenericAction new
action: [ :presentation | self class createLocalRepository ifNotNil: [ presentation pane ]];
icon: GLMUIThemeExtraIcons glamorousAdd;
shortcut: $a;
title: 'Add local repository'; showTitle
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ createRepositoryAction
^ GLMGenericAction new
action: [ :presentation | self class createRepository ifNotNil: [ presentation pane ]];
icon: GLMUIThemeExtraIcons glamorousAdd;
shortcut: $a;
title: 'Add repository'; showTitle
shortcut: $c;
title: 'Clone new repository'; showTitle
3 changes: 2 additions & 1 deletion Iceberg.package/IceRepository.class/class/reset.st
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
registry
reset
Registry := nil
Registry := nil.
Iceberg announcer announce: IceRepositoryForgotten new.
3 changes: 2 additions & 1 deletion Iceberg.package/IceRepository.class/instance/forget.st
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
registry
forget
self class registry remove: self ifAbsent: [ "Ignore" ]
(self class registry remove: self ifAbsent: [ "Ignore" ])
ifNotNil: [ Iceberg announcer announce: IceRepositoryForgotten new ]
1 change: 1 addition & 0 deletions Iceberg.package/IceRepository.class/instance/register.st
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ registry
register
self ensureLocalRepository.
self class registry add: self.
Iceberg announcer announce: IceRepositoryCreated new.
^ self
Empty file.
14 changes: 14 additions & 0 deletions Iceberg.package/IceRepositoryCreated.class/properties.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"category" : "Iceberg-Announcements",
"classinstvars" : [
],
"classvars" : [
],
"commentStamp" : "",
"instvars" : [
],
"name" : "IceRepositoryCreated",
"pools" : [
],
"super" : "IceRepositoryRegistryModified",
"type" : "normal" }
Empty file.
14 changes: 14 additions & 0 deletions Iceberg.package/IceRepositoryForgotten.class/properties.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"category" : "Iceberg-Announcements",
"classinstvars" : [
],
"classvars" : [
],
"commentStamp" : "",
"instvars" : [
],
"name" : "IceRepositoryForgotten",
"pools" : [
],
"super" : "IceRepositoryRegistryModified",
"type" : "normal" }
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"category" : "Iceberg-Announcements",
"classinstvars" : [
],
"classvars" : [
],
"commentStamp" : "",
"instvars" : [
],
"name" : "IceRepositoryRegistryModified",
"pools" : [
],
"super" : "Announcement",
"type" : "normal" }
2 changes: 1 addition & 1 deletion Iceberg.package/IceTool.class/class/createRepository.st
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
utilities
createRepository
IceCreateRepositoryModel new openWithSpec
IceCloneRepositoryModel new openWithSpec
3 changes: 3 additions & 0 deletions Iceberg.package/Iceberg.class/class/announcer.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
accessing
announcer
^ IcebergAnnouncer ifNil: [ IcebergAnnouncer := Announcer new ]
2 changes: 1 addition & 1 deletion Iceberg.package/Iceberg.class/properties.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"category" : "Iceberg-Core",
"classinstvars" : [
],
"IcebergAnnouncer" ],
"classvars" : [
],
"commentStamp" : "NicoPasserini 4/28/2016 14:10",
Expand Down

0 comments on commit 8676a9f

Please sign in to comment.