[fossil-users] Automation

2014-05-09 Thread Scott Robison
My apologies if this is too long for reading, but I hope you'll bear with
me.

I like the idea behind chiselapp, but am paranoid so I want to host
something similar for myself (and just myself) to keep things private. I
downloaded chiselapp and while it *could* work, I decided it was more
than I really needed, plus it is Apache centric and I run lighttpd. I have
ported configuration files from apache to lighttpd in the past, but just
didn't want to bother with it in this case.

To that end, I've started creating a few basic scripts to give me a front
end to fossil from a protected webpage on a secured server. I have a
directory with an index.php which enumerates a directory full of fossils
and gives me simple links to each fossil. I have a two line fossil cgi
script that gives me access to those repos. I've even created a little page
to allow me to change a password for a single user across all repos at one
time.

My next goal is to script the creation of a new repository. I have the
basics down, in that I can easily use a form to get the needed command
line parameters and run a script to create the new repo. I'd like to go a
little further with it and set the project name  description, default
permissions, and so on.

It does not appear there is a command line based way to set certain
configuration options. I've dumped repos with sqlite3 repo.fossil .dump
to see how certain things work. To accomplish my goal:

1. Is there a fossil command line based way to set config options
(particularly project name and description) that I'm unaware of?

2. If there is not, is this something that could be done with the json api
via cli as it exists today?

3. If the json api is not an option at present, what is the significance of
the mtime field in the config table? Must it be set to some particular
valid value or would an initial value of 0 be okay. If that is the case
(or the proper default value is easily obtained / computed) I could easily
just use a little SQL to set the needed config table values.

FWIW, this is very plain looking stuff (I'm not a web guy at all) but I'd
be happy to share the scripts and such when I'm finished. Probably the most
useful part is just the scripts in the directory that give a front end that
enumerates the existing repositories.

-- 
Scott Robison
___
fossil-users mailing list
fossil-users@lists.fossil-scm.org
http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users


Re: [fossil-users] Automation

2014-05-09 Thread Stephan Beal
On Fri, May 9, 2014 at 9:15 AM, Scott Robison sc...@casaderobison.comwrote:

 links to each fossil. I have a two line fossil cgi script that gives me
 access to those repos. I've even created a little page to allow me to
 change a password for a single user across all repos at one time.


Would you mind sharing that one with us?


 My next goal is to script the creation of a new repository. I have the
 basics down, in that I can easily use a form to get the needed command
 line parameters and run a script to create the new repo. I'd like to go a
 little further with it and set the project name  description, default
 permissions, and so on.

 It does not appear there is a command line based way to set certain
 configuration options. I've dumped repos with sqlite3 repo.fossil .dump
 to see how certain things work. To accomplish my goal:

 1. Is there a fossil command line based way to set config options
 (particularly project name and description) that I'm unaware of?


Not currently, resp. not that see nor remember.



 2. If there is not, is this something that could be done with the json api
 via cli as it exists today?


Same there. The JSON API can set some stuff, like user properties, but
doesn't (it seems) have a way to set the project name/description. If you
can suggest a JSON interface for it, i can add it.

3. If the json api is not an option at present, what is the significance of
 the mtime field in the config table? Must it be set to some particular
 valid value or would an initial value of 0 be okay. If that is the case
 (or the proper default value is easily obtained / computed) I could easily
 just use a little SQL to set the needed config table values.


IIRC we don't actually use the mtime in the config file (or not often,
anyway). Feel free to set it to 0 or (as we do internally):
strftime('%s','now'). It's a Unix timestamp (so (date +%s) can be used from
scripts).


-- 
- stephan beal
http://wanderinghorse.net/home/stephan/
http://gplus.to/sgbeal
Freedom is sloppy. But since tyranny's the only guaranteed byproduct of
those who insist on a perfect world, freedom will have to do. -- Bigby Wolf
___
fossil-users mailing list
fossil-users@lists.fossil-scm.org
http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users


Re: [fossil-users] Automation

2014-05-09 Thread Scott Robison
On Fri, May 9, 2014 at 1:21 AM, Stephan Beal sgb...@googlemail.com wrote:

 On Fri, May 9, 2014 at 9:15 AM, Scott Robison sc...@casaderobison.com
wrote:

 links to each fossil. I have a two line fossil cgi script that gives me
access to those repos. I've even created a little page to allow me to
change a password for a single user across all repos at one time.


 Would you mind sharing that one with us?

The fossil cgi script is just based on the one documented elsewhere, so I
assume you mean the password change script. You can see it at
http://tny.cz/2376d7fa (tinypaste, tny.cz). When the page is accessed via
http GET it just displays the page and any optional message that might have
been passed as a url parameter. When the info is filled in and the form is
POSTed, it does basic validation of the username and passwords. If all is
okay, it uses a foreach loop to enumerate all the fossil files in the hard
coded directory, runs the fossil command to change the password for the
given user on each, and redirects back to the main index with a message. If
it detects errors with the username or password, it redirects back to
itself with simple messages to give the user a chance to do it again.

As I said in my original message, I'm not a web guy, so this is definitely
not professional grade. It lives behind a protected directory so I'm the
only one with access to it, so robustness and aesthetically pleasing were
not my primary considerations. Just something to help automate some things
that I continually have to look up whenever I need to do them. If I were
looking for a place to host something open source, I'd just go to chiselapp
(or expose a repository via a specific unprotected url). In my case:

http://www.webducky.com/dev/ - run a front end index script to provide a
menu of all the fossils
.../dev/project - bash script to set the home environment variable and
then...
.../dev/fossil-cgi - fossil cgi script. It could be named project
directly, but the settings don't work unless the home directory is set
first, and this was the easiest way for me to figure out how to do it.
.../dev/password.php - the below script linked to from /dev/
.../dev/blah.php - other scripts to be written / finished to create,
rename, delete repos.

Note there are no copyrights or licenses claimed in the code itself, as I
didn't really intend to share it, though I don't mind sharing it. In any
case, it is simple enough and non-strategic enough that consider I it
public domain, so do with it what you will and realize there is no warranty
(not that you could easily prove I was the one who provided it anyway,
maybe I just found the link and am claiming it as my own creation). ;) Not
nearly as useful or complex as SQLite, but hey, I'm not nearly as bright as
DRH either.

SDR
___
fossil-users mailing list
fossil-users@lists.fossil-scm.org
http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users


Re: [fossil-users] Automation

2014-05-09 Thread Scott Robison
On May 9, 2014 3:11 AM, Stephan Beal sgb...@googlemail.com wrote:

 On Fri, May 9, 2014 at 9:50 AM, Scott Robison sc...@casaderobison.com
wrote:
 It doesn't need to be great - it'll just be for my own use. i've never
gotten around to using the login group support.

I looked briefly into it and it seemed that the shared login group stuff
only allowed read access to subordinant repos, so I just decided to build a
very basic solution that met my modest needs. :)

SDR
___
fossil-users mailing list
fossil-users@lists.fossil-scm.org
http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users


Re: [fossil-users] Automation

2014-05-09 Thread Richard Hipp
On Fri, May 9, 2014 at 3:15 AM, Scott Robison sc...@casaderobison.comwrote:


 1. Is there a fossil command line based way to set config options
 (particularly project name and description) that I'm unaware of?


Not an easy why.  You'd have to run fossil sql with appropriate SQL
arguments that would update the database directly.


-- 
D. Richard Hipp
d...@sqlite.org
___
fossil-users mailing list
fossil-users@lists.fossil-scm.org
http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users