Can I transfer pages from my dev machine to a server?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Can I transfer pages from my dev machine to a server?

patmaddox
I'm messing around with pier to build a new site.  One thing I'm doing is making pages locally, to see how they look, and adding my own behavior, without having to do anything on the server just yet.  Is there a way to take individual pages from my local machine and transfer them to the server?

Pat
_______________________________________________
Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki
Reply | Threaded
Open this post in threaded view
|

Re: Can I transfer pages from my dev machine to a server?

Lukas Renggli
The import/export functionality serializes the complete document tree.

There is nothing built-in to just transfer a single page, other than
manually copy and paste the wiki text.

What could probably be relatively easily added would be to add a
command that syncs with another Pier instance.

Lukas

On 1 July 2010 05:22, Pat Maddox <[hidden email]> wrote:
> I'm messing around with pier to build a new site.  One thing I'm doing is making pages locally, to see how they look, and adding my own behavior, without having to do anything on the server just yet.  Is there a way to take individual pages from my local machine and transfer them to the server?
>
> Pat
> _______________________________________________
> Magritte, Pier and Related Tools ...
> https://www.iam.unibe.ch/mailman/listinfo/smallwiki
>



--
Lukas Renggli
www.lukas-renggli.ch

_______________________________________________
Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki
Reply | Threaded
Open this post in threaded view
|

Re: Can I transfer pages from my dev machine to a server?

Nick Brown
In reply to this post by patmaddox
On 01/07/2010 04:22, Pat Maddox wrote:
>  Is there a way to take individual pages from my local machine and transfer them to the server?

I remembered having a few code snipets for doing this from a few months
back, on digging them out it turns out to be a bit more involved than I
remembered, and maybe more than you're looking for, but here it is
anyway. This is for the Pharo-based Pier 1.2 one-click install, and
mostly cribbed from how the Pier site-wide import/export widget works.
With a little work it could no doubt be turned into something rather
more convenient.

First, create these method in PRStructure (the dev machine will at least
need the export methods, the server will need the import method.)
--------------------
prepareForExport

self decorations do: [:decoration |
        (decoration isKindOf: PUSecurity) ifTrue: [
                self removeDecoration: decoration
        ].
        self removeDecoration: PUSecurity ifAbsent: [].
].
----------------------
copyForExport

| copy |
copy := self veryDeepCopy.
copy enumerator with all do: [:each | each prepareForExport].
copy parent: nil.
^copy
--------------------
attachImport

PRExportImportWidget new sanitizeImport: self.

self enumerator with all do: [:each |
        (each isKindOf: PSRScreenNewStructure) ifTrue: [
                each psrModel attachImport
        ]
].
--------------------
Then, on the dev machine, paste the following line into a workspace and
"explore" it:

PRKernel instances anyOne root enumerator with all select: [:each | each
name = 'my page name'].

In the explorer window, select the entry for your page, paste the
following into the code pane underneath, and "do" it.
---------------------
(FileDirectory default fileNamed: 'export.obj') in: [:fs |
        [(ReferenceStream on: fs) in: [:refs |
                refs nextPut: self copyForExport; close
        ]] ensure: [fs close]
].
----------------------

Copy the export.obj (or whatever you've called it) to the server.
On the server, use the same "explore" line as above to select the page
that you want as the PARENT of your imported page, and "do" the
following in the code pane to import your page.
----------------------
(FileDirectory default readOnlyFileNamed: 'export.obj') in: [:fs |
        [(ReferenceStream on: fs) next in: [:newPage |
                newPage root name: (PRAddCommand new uniqueName: newPage name in: self).
                self addChild: newPage.
                newPage attachImport.
        ]] ensure: [fs close]
].
----------------------

HTH
Nick Brown
_______________________________________________
Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki