specify_cli 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (106) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +4 -0
  3. data/.rspec +1 -0
  4. data/Gemfile +17 -0
  5. data/Gemfile.lock +117 -0
  6. data/LICENSE.txt +21 -0
  7. data/README.rdoc +43 -0
  8. data/Rakefile +15 -0
  9. data/bin/specify_cli +248 -0
  10. data/lib/specify.rb +45 -0
  11. data/lib/specify/branch_parser.rb +85 -0
  12. data/lib/specify/cli.rb +11 -0
  13. data/lib/specify/cli/database_setup.rb +46 -0
  14. data/lib/specify/cli/stubs.rb +63 -0
  15. data/lib/specify/cli/viewset.rb +21 -0
  16. data/lib/specify/configuration.rb +12 -0
  17. data/lib/specify/configuration/config.rb +120 -0
  18. data/lib/specify/configuration/db_config.rb +162 -0
  19. data/lib/specify/configuration/host_config.rb +37 -0
  20. data/lib/specify/database.rb +140 -0
  21. data/lib/specify/models.rb +43 -0
  22. data/lib/specify/models/accession.rb +33 -0
  23. data/lib/specify/models/agent.rb +138 -0
  24. data/lib/specify/models/app_resource_data.rb +32 -0
  25. data/lib/specify/models/app_resource_dir.rb +43 -0
  26. data/lib/specify/models/auto_numbering_scheme.rb +94 -0
  27. data/lib/specify/models/collecting_event.rb +38 -0
  28. data/lib/specify/models/collection.rb +67 -0
  29. data/lib/specify/models/collection_object.rb +127 -0
  30. data/lib/specify/models/createable.rb +21 -0
  31. data/lib/specify/models/determination.rb +63 -0
  32. data/lib/specify/models/discipline.rb +61 -0
  33. data/lib/specify/models/division.rb +26 -0
  34. data/lib/specify/models/geography.rb +5 -0
  35. data/lib/specify/models/geography/administrative_division.rb +32 -0
  36. data/lib/specify/models/geography/geographic_name.rb +66 -0
  37. data/lib/specify/models/geography/geography.rb +23 -0
  38. data/lib/specify/models/institution.rb +13 -0
  39. data/lib/specify/models/locality.rb +50 -0
  40. data/lib/specify/models/preparation.rb +53 -0
  41. data/lib/specify/models/preparation_type.rb +30 -0
  42. data/lib/specify/models/record_set.rb +55 -0
  43. data/lib/specify/models/record_set_item.rb +29 -0
  44. data/lib/specify/models/taxonomy.rb +6 -0
  45. data/lib/specify/models/taxonomy/common_name.rb +14 -0
  46. data/lib/specify/models/taxonomy/rank.rb +31 -0
  47. data/lib/specify/models/taxonomy/taxon.rb +54 -0
  48. data/lib/specify/models/taxonomy/taxonomy.rb +21 -0
  49. data/lib/specify/models/tree_queryable.rb +55 -0
  50. data/lib/specify/models/updateable.rb +20 -0
  51. data/lib/specify/models/user.rb +104 -0
  52. data/lib/specify/models/view_set_object.rb +32 -0
  53. data/lib/specify/number_format.rb +60 -0
  54. data/lib/specify/services.rb +18 -0
  55. data/lib/specify/services/service.rb +51 -0
  56. data/lib/specify/services/stub_generator.rb +291 -0
  57. data/lib/specify/services/view_loader.rb +177 -0
  58. data/lib/specify/session.rb +77 -0
  59. data/lib/specify/user_type.rb +61 -0
  60. data/lib/specify/version.rb +19 -0
  61. data/man/specify_cli-database.1 +60 -0
  62. data/man/specify_cli-database.1.html +137 -0
  63. data/man/specify_cli-database.1.ronn +53 -0
  64. data/man/specify_cli-repository.1 +55 -0
  65. data/man/specify_cli-repository.1.html +128 -0
  66. data/man/specify_cli-repository.1.ronn +42 -0
  67. data/man/specify_cli-stubs.1 +177 -0
  68. data/man/specify_cli-stubs.1.html +239 -0
  69. data/man/specify_cli-stubs.1.ronn +147 -0
  70. data/man/specify_cli-viewset.1 +92 -0
  71. data/man/specify_cli-viewset.1.html +154 -0
  72. data/man/specify_cli-viewset.1.ronn +72 -0
  73. data/man/specify_cli.1 +213 -0
  74. data/man/specify_cli.1.html +252 -0
  75. data/man/specify_cli.1.ronn +157 -0
  76. data/spec/branch_parser_spec.rb +94 -0
  77. data/spec/cli/stubs_spec.rb +44 -0
  78. data/spec/configuration/config_spec.rb +269 -0
  79. data/spec/configuration/db_config_spec.rb +299 -0
  80. data/spec/configuration/host_config_spec.rb +64 -0
  81. data/spec/database_spec.rb +83 -0
  82. data/spec/examples.txt +217 -0
  83. data/spec/helpers.rb +15 -0
  84. data/spec/models/app_resource_data_spec.rb +38 -0
  85. data/spec/models/app_resource_dir_spec.rb +8 -0
  86. data/spec/models/auto_numbering_scheme_spec.rb +78 -0
  87. data/spec/models/collection_object_spec.rb +92 -0
  88. data/spec/models/collection_spec.rb +32 -0
  89. data/spec/models/discipline_spec.rb +31 -0
  90. data/spec/models/record_set_spec.rb +18 -0
  91. data/spec/models/user_spec.rb +182 -0
  92. data/spec/models/view_set_object_spec.rb +70 -0
  93. data/spec/number_format_spec.rb +43 -0
  94. data/spec/services/stub_generator_spec.rb +635 -0
  95. data/spec/services/view_loader_spec.rb +436 -0
  96. data/spec/session_spec.rb +105 -0
  97. data/spec/spec_helper.rb +116 -0
  98. data/spec/support/db.yml +12 -0
  99. data/spec/support/stub.yaml +17 -0
  100. data/spec/support/stub_locality.yaml +19 -0
  101. data/spec/support/viewsets/paleo.views.xml +30 -0
  102. data/spec/support/viewsets/paleo.xml +30 -0
  103. data/spec/user_type_spec.rb +79 -0
  104. data/specify_cli.gemspec +27 -0
  105. data/specify_cli.rdoc +1 -0
  106. metadata +246 -0
@@ -0,0 +1,154 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta http-equiv='content-type' value='text/html;charset=utf8'>
5
+ <meta name='generator' value='Ronn/v0.7.3 (http://github.com/rtomayko/ronn/tree/0.7.3)'>
6
+ <title>specify_cli-stubsy(1) - A command line interface for Specify</title>
7
+ <style type='text/css' media='all'>
8
+ /* style: man */
9
+ body#manpage {margin:0}
10
+ .mp {max-width:100ex;padding:0 9ex 1ex 4ex}
11
+ .mp p,.mp pre,.mp ul,.mp ol,.mp dl {margin:0 0 20px 0}
12
+ .mp h2 {margin:10px 0 0 0}
13
+ .mp > p,.mp > pre,.mp > ul,.mp > ol,.mp > dl {margin-left:8ex}
14
+ .mp h3 {margin:0 0 0 4ex}
15
+ .mp dt {margin:0;clear:left}
16
+ .mp dt.flush {float:left;width:8ex}
17
+ .mp dd {margin:0 0 0 9ex}
18
+ .mp h1,.mp h2,.mp h3,.mp h4 {clear:left}
19
+ .mp pre {margin-bottom:20px}
20
+ .mp pre+h2,.mp pre+h3 {margin-top:22px}
21
+ .mp h2+pre,.mp h3+pre {margin-top:5px}
22
+ .mp img {display:block;margin:auto}
23
+ .mp h1.man-title {display:none}
24
+ .mp,.mp code,.mp pre,.mp tt,.mp kbd,.mp samp,.mp h3,.mp h4 {font-family:monospace;font-size:14px;line-height:1.42857142857143}
25
+ .mp h2 {font-size:16px;line-height:1.25}
26
+ .mp h1 {font-size:20px;line-height:2}
27
+ .mp {text-align:justify;background:#fff}
28
+ .mp,.mp code,.mp pre,.mp pre code,.mp tt,.mp kbd,.mp samp {color:#131211}
29
+ .mp h1,.mp h2,.mp h3,.mp h4 {color:#030201}
30
+ .mp u {text-decoration:underline}
31
+ .mp code,.mp strong,.mp b {font-weight:bold;color:#131211}
32
+ .mp em,.mp var {font-style:italic;color:#232221;text-decoration:none}
33
+ .mp a,.mp a:link,.mp a:hover,.mp a code,.mp a pre,.mp a tt,.mp a kbd,.mp a samp {color:#0000ff}
34
+ .mp b.man-ref {font-weight:normal;color:#434241}
35
+ .mp pre {padding:0 4ex}
36
+ .mp pre code {font-weight:normal;color:#434241}
37
+ .mp h2+pre,h3+pre {padding-left:0}
38
+ ol.man-decor,ol.man-decor li {margin:3px 0 10px 0;padding:0;float:left;width:33%;list-style-type:none;text-transform:uppercase;color:#999;letter-spacing:1px}
39
+ ol.man-decor {width:100%}
40
+ ol.man-decor li.tl {text-align:left}
41
+ ol.man-decor li.tc {text-align:center;letter-spacing:4px}
42
+ ol.man-decor li.tr {text-align:right;float:right}
43
+ </style>
44
+ </head>
45
+ <!--
46
+ The following styles are deprecated and will be removed at some point:
47
+ div#man, div#man ol.man, div#man ol.head, div#man ol.man.
48
+
49
+ The .man-page, .man-decor, .man-head, .man-foot, .man-title, and
50
+ .man-navigation should be used instead.
51
+ -->
52
+ <body id='manpage'>
53
+ <div class='mp' id='man'>
54
+
55
+ <div class='man-navigation' style='display:none'>
56
+ <a href="#NAME">NAME</a>
57
+ <a href="#SYNOPSIS">SYNOPSIS</a>
58
+ <a href="#DESCRIPTION">DESCRIPTION</a>
59
+ <a href="#FILES">FILES</a>
60
+ <a href="#OPTIONS">OPTIONS</a>
61
+ <a href="#EXAMPLES">EXAMPLES</a>
62
+ <a href="#SPECIFY_CLI">SPECIFY_CLI</a>
63
+ </div>
64
+
65
+ <ol class='man-decor man-head man head'>
66
+ <li class='tl'>specify_cli-stubsy(1)</li>
67
+ <li class='tc'></li>
68
+ <li class='tr'>specify_cli-stubsy(1)</li>
69
+ </ol>
70
+
71
+ <h2 id="NAME">NAME</h2>
72
+ <p class="man-name">
73
+ <code>specify_cli-stubsy</code> - <span class="man-whatis">A command line interface for Specify</span>
74
+ </p>
75
+
76
+ <h2 id="SYNOPSIS">SYNOPSIS</h2>
77
+
78
+ <p><code>specify_cli</code> [<var>global options</var>] <code>viewset</code> [<var>options</var>] <var>collection</var> <var>file</var>
79
+ <code>specify_cli</code> <code>viewset</code> <code>--branch=</code><var>name</var> <var>file</var>
80
+ <code>specify_cli</code> <code>viewset</code> <code>-b</code> <var>file</var></p>
81
+
82
+ <h2 id="DESCRIPTION">DESCRIPTION</h2>
83
+
84
+ <p>The viewset command uploads a view definition file (<em>.views.xml</em>) to the
85
+ database. Viewsets can be uploaded to either of the following levels:
86
+ <em>discipline</em>, <em>collection</em>, <em>user type</em>, or <em>user</em>.</p>
87
+
88
+ <p>Use the <code>`-c</code> or <code>-d</code> switches to upload to collection or discipline level respectively.</p>
89
+
90
+ <p>To upload for a specific user type in a collection, use the <code>--user_type</code> option
91
+ and provide the user type name (<em>manager</em>, <em>fullaccess</em>, <em>limitedaccess</em>, or <em>guest</em>).</p>
92
+
93
+ <p>To upload for a specific user level, use the <code>--user</code> option and provide the
94
+ Specify user name.</p>
95
+
96
+ <p>The <var>collection</var> argument is required unless the <code>-b</code> or <code>-B</code> options are
97
+ used (the collection is needed to register a login session).</p>
98
+
99
+ <p>Provide information about the host, database, MySQL/MariaDB user and Specify
100
+ user with the global options.</p>
101
+
102
+ <p>The <code>--branch</code> option allows to provide a Git branch name, from which all
103
+ necessary information about the target (host, database, collection, level) can
104
+ be parsed. This requires that the directory containing the <em>.views.xml</em> file is
105
+ mapped to a host, and that the branch name follows the naming convention <code>repository_name/database_name/collection_name/level</code>.</p>
106
+
107
+ <p>If your present working directory is mapped to a host and contains a Git
108
+ repository and the current branch conforms to the naming convention, use the
109
+ <code>-b</code> switch to use the current branch instead of specifying the branch name with
110
+ <code>--branch</code>.</p>
111
+
112
+ <h2 id="FILES">FILES</h2>
113
+
114
+ <p>The command requires a <em>.views.xml</em> as an argument.</p>
115
+
116
+ <h2 id="OPTIONS">OPTIONS</h2>
117
+
118
+ <dl>
119
+ <dt class="flush"><code>-b</code></dt><dd> Use current branch to resolve target.</dd>
120
+ <dt><code>-B</code>, <code>--branch</code> <var>name</var></dt><dd> Resolve target from branch name.</dd>
121
+ <dt class="flush"><code>-c</code></dt><dd> Upload to collection level.</dd>
122
+ <dt class="flush"><code>-d</code></dt><dd> Upload to discipline level.</dd>
123
+ <dt><code>-t</code>, <code>--user_type</code> <var>name</var></dt><dd> Upload to specific user type [name] in the collection.</dd>
124
+ <dt><code>-u</code>, <code>--user</code> <var>name</var></dt><dd> Upload to specify user <var>name</var> in the collection.</dd>
125
+ </dl>
126
+
127
+
128
+ <h2 id="EXAMPLES">EXAMPLES</h2>
129
+
130
+ <p>Upload <code>invertpaleo.views.xml</code> to discipline level for collection <code>Trilobites</code>
131
+ in the database <code>Specify</code> on localhost:</p>
132
+
133
+ <pre><code>$ specify_cli -D Specify viewset -d Trilobites invertpaleo.views.xml
134
+ </code></pre>
135
+
136
+ <p>Upload <code>invertpaleo.views.xml</code> auto-resolving target from current Git branch:</p>
137
+
138
+ <pre><code>$ specify_cli viewset -b invertpaleo.views.xml
139
+ </code></pre>
140
+
141
+ <h2 id="SPECIFY_CLI">SPECIFY_CLI</h2>
142
+
143
+ <p>Part of the <span class="man-ref">specify_cli<span class="s">(1)</span></span> suite</p>
144
+
145
+
146
+ <ol class='man-decor man-foot man foot'>
147
+ <li class='tl'></li>
148
+ <li class='tc'>August 2018</li>
149
+ <li class='tr'>specify_cli-stubsy(1)</li>
150
+ </ol>
151
+
152
+ </div>
153
+ </body>
154
+ </html>
@@ -0,0 +1,72 @@
1
+ specify_cli-stubsy(1) -- A command line interface for Specify
2
+ ===============================================================================
3
+
4
+ ## SYNOPSIS
5
+
6
+ `specify_cli` [<global options>] `viewset` [<options>] <collection> <file>
7
+ `specify_cli` `viewset` `--branch=`<name> <file>
8
+ `specify_cli` `viewset` `-b` <file>
9
+
10
+ ## DESCRIPTION
11
+
12
+ The viewset command uploads a view definition file (*.views.xml*) to the
13
+ database. Viewsets can be uploaded to either of the following levels:
14
+ *discipline*, *collection*, *user type*, or *user*.
15
+
16
+ Use the ``-c` or `-d` switches to upload to collection or discipline level respectively.
17
+
18
+ To upload for a specific user type in a collection, use the `--user_type` option
19
+ and provide the user type name (*manager*, *fullaccess*, *limitedaccess*, or *guest*).
20
+
21
+ To upload for a specific user level, use the `--user` option and provide the
22
+ Specify user name.
23
+
24
+ The <collection> argument is required unless the `-b` or `-B` options are
25
+ used (the collection is needed to register a login session).
26
+
27
+ Provide information about the host, database, MySQL/MariaDB user and Specify
28
+ user with the global options.
29
+
30
+ The `--branch` option allows to provide a Git branch name, from which all
31
+ necessary information about the target (host, database, collection, level) can
32
+ be parsed. This requires that the directory containing the *.views.xml* file is
33
+ mapped to a host, and that the branch name follows the naming convention `repository_name/database_name/collection_name/level`.
34
+
35
+ If your present working directory is mapped to a host and contains a Git
36
+ repository and the current branch conforms to the naming convention, use the
37
+ `-b` switch to use the current branch instead of specifying the branch name with
38
+ `--branch`.
39
+
40
+ ## FILES
41
+
42
+ The command requires a *.views.xml* as an argument.
43
+
44
+ ## OPTIONS
45
+
46
+ * `-b`:
47
+ Use current branch to resolve target.
48
+ * `-B`, `--branch` <name>:
49
+ Resolve target from branch name.
50
+ * `-c`:
51
+ Upload to collection level.
52
+ * `-d`:
53
+ Upload to discipline level.
54
+ * `-t`, `--user_type` <name>:
55
+ Upload to specific user type [name] in the collection.
56
+ * `-u`, `--user` <name>:
57
+ Upload to specify user <name> in the collection.
58
+
59
+ ## EXAMPLES
60
+
61
+ Upload `invertpaleo.views.xml` to discipline level for collection `Trilobites`
62
+ in the database `Specify` on localhost:
63
+
64
+ $ specify_cli -D Specify viewset -d Trilobites invertpaleo.views.xml
65
+
66
+ Upload `invertpaleo.views.xml` auto-resolving target from current Git branch:
67
+
68
+ $ specify_cli viewset -b invertpaleo.views.xml
69
+
70
+ ## SPECIFY_CLI
71
+
72
+ Part of the specify_cli(1) suite
data/man/specify_cli.1 ADDED
@@ -0,0 +1,213 @@
1
+ .\" generated with Ronn/v0.7.3
2
+ .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
+ .
4
+ .TH "SPECIFY_CLI" "1" "August 2018" "" ""
5
+ .
6
+ .SH "NAME"
7
+ \fBspecify_cli\fR \- A command line interface for Specify
8
+ .
9
+ .SH "SYNOPSIS"
10
+ \fBspecify_cli\fR [\fB\-D\fR|\fB\-\-database\fR \fIname\fR] [\fB\-H\fR|\fB\-\-host\fR \fIname\fR] [\fB\-P\fR|\fB\-\-password\fR \fIpassword\fR] [\fB\-U\fR|\fB\-\-specify_user\fR \fIname\fR] [\fB\-c\fR|\fB\-\-db_config\fR \fIfile\fR] [\fB\-p\fR|\fB\-\-port\fR \fInumber\fR] [\fB\-u\fR|\fB\-\-user\fR \fIname\fR] \fIcommand\fR [\fIoptions\fR] [\fIargs\fR]
11
+ .
12
+ .SH "DESCRIPTION"
13
+ \fBspecify_cli\fR is a tool that allows certain tasks in a Specify database to be carried out from the command line\. Specify is a management system for biological collections developed by the Specify Collections Consortium (http://www\.sustain\.specifysoftware\.org)\.
14
+ .
15
+ .P
16
+ \fBspecify_cli\fR is an independent development that is not supported by the Specify Collections Consortium\. It operates directly on the MySQL/MariaDB backend used by Specify\. \fBUse at your own risk\fR\.
17
+ .
18
+ .P
19
+ Tasks currently supported:
20
+ .
21
+ .IP "\(bu" 4
22
+ upload of user interface form definitions (\fI\.views\.xml\fR files) to the database
23
+ .
24
+ .IP "\(bu" 4
25
+ generation of collection object stub records
26
+ .
27
+ .IP "" 0
28
+ .
29
+ .SH "FILES"
30
+ \fB~/\.specify_dbs\.rc\.yaml\fR is a YAML file that stores information about Specify databases and directories containing \fI\.views\.xml\fR files\. The file has the general structure:
31
+ .
32
+ .IP "" 4
33
+ .
34
+ .nf
35
+
36
+ \-\-\-
37
+ :dir_names:
38
+ <view_file_directory>: <hostname>
39
+ \.\.\.
40
+ :hosts:
41
+ <hostname>:
42
+ :port: <port_number>
43
+ :databases:
44
+ <database_name>:
45
+ :db_user:
46
+ :name: <mysql_username>
47
+ :password: <password>
48
+ :sp_user: <specify_username>
49
+ \.\.\.
50
+ \.\.\.
51
+ .
52
+ .fi
53
+ .
54
+ .IP "" 0
55
+ .
56
+ .P
57
+ The section \fBdir_names\fR contains directory\-host\-mappings\. A directory\-host\- mapping is a key\-value\-pair, where the key is the path of a directory on your hard drive, the value is a host name\. This is used to automatically resolve the correct host for a \fI\.views\.xml\fR file based on the directory it is in\. Add mappings here by editing the file or using the \fBspecify_cli\-repository(1)\fR command\.
58
+ .
59
+ .P
60
+ The section \fBhosts\fR contains settings for Specify databases by grouped by \fB<hostname>\fR\. For each host, the \fBport\fR and any \fBdatabases\fR can be configured in this file by editing it or by using the \fBspecify_cli\-database(1)\fR command\. The \fBdatabases\fR section contains connection settings for the individual databases by \fB<database_name>\fR\. The \fBdb_user\fR is the MySQL/MariaDB user used to connect to the database and will typically be the Specify \fImaster user\fR\. Leave \fBpassword\fR blank to be prompted for the password when you run the command (this will not work when triggered as a bash script from another application, e\.g\. a text editor)\. Apart from the \fBdb_user\fR \fBspecify_cli\fR also needs a Specify user (a user that Specify uses internally), which is provided under \fBsp_user\fR\. Every command (except the configuration commands \fBspecify_cli\-database(1)\fR and \fBspecify_cli\-repository(1)\fR) will start a session in Specify where the Specify user will be logged in to the collection\. Any records created or modified during this session will be marked as created by or modified by the \fBsp_user\fR\.
61
+ .
62
+ .SH "COMMANDS"
63
+ .
64
+ .IP "\(bu" 4
65
+ \fBspecify_cli\-database\fR(1) Add a database configuration\.
66
+ .
67
+ .IP "\(bu" 4
68
+ \fBspecify_cli\-stubs\fR(1) Create stub records
69
+ .
70
+ .IP "\(bu" 4
71
+ \fBspecify_cli\-repository\fR(1) Map a git repository to a host for automatic target resolution\.
72
+ .
73
+ .IP "\(bu" 4
74
+ \fBspecify_cli\-viewset\fR(1) Upload a view to the database\.
75
+ .
76
+ .IP "" 0
77
+ .
78
+ .SH "OPTIONS"
79
+ .
80
+ .TP
81
+ \fB\-D\fR, \fB\-\-database\fR \fIname\fR
82
+ The name of the Specify database to connect to\.
83
+ .
84
+ .TP
85
+ \fB\-H\fR, \fB\-\-host\fR \fIname\fR
86
+ The name or IP address of the host\. Default: \fBlocalhost\fR
87
+ .
88
+ .TP
89
+ \fB\-P\fR, \fB\-\-password\fR \fIpassword\fR
90
+ The password for the MySQL/MariaDB user\. Leave blank to be prompted\.
91
+ .
92
+ .TP
93
+ \fB\-U\fR, \fB\-\-specify_user\fR \fIname\fR
94
+ The name of the Specify user\.
95
+ .
96
+ .TP
97
+ \fB\-c\fR, \fB\-\-db_config\fR \fIfile\fR
98
+ A database configuration file (if other than the default \fB~/\.specify_dbs\.rc\.yaml\fR)
99
+ .
100
+ .TP
101
+ \fB\-p\fR, \fB\-\-port\fR \fInumber\fR
102
+ The port for the MySQL/MariaDB host\.
103
+ .
104
+ .TP
105
+ \fB\-u\fR, \fB\-\-user\fR \fIname\fR
106
+ The MySQL/MariaDB user name\.
107
+ .
108
+ .SH "EXAMPLES"
109
+ Configure a database \fBSpecify\fR on the host \fBspecify\.example\.org\fR:
110
+ .
111
+ .IP "" 4
112
+ .
113
+ .nf
114
+
115
+ $ specify_cli \-\-host=specify\.example\.org database specify
116
+ .
117
+ .fi
118
+ .
119
+ .IP "" 0
120
+ .
121
+ .P
122
+ Map the current directory to the host \fBspecify\.example\.org\fR:
123
+ .
124
+ .IP "" 4
125
+ .
126
+ .nf
127
+
128
+ $ specify_cli \-\-host=specify\.example\.org repository \-c
129
+ .
130
+ .fi
131
+ .
132
+ .IP "" 0
133
+ .
134
+ .P
135
+ Map \fB~/specify_forms/invertpaleo\fR to \fBlocalhost\fR:
136
+ .
137
+ .IP "" 4
138
+ .
139
+ .nf
140
+
141
+ $ specify_cli repository ~/specify_forms/invertpaleo
142
+ .
143
+ .fi
144
+ .
145
+ .IP "" 0
146
+ .
147
+ .P
148
+ Create 10 blank stub records in the collection \fBTriloites\fR in the database \fBSpecify\fR on localhost:
149
+ .
150
+ .IP "" 4
151
+ .
152
+ .nf
153
+
154
+ $ specify_cli \-D Specify stubs Trilobites 10
155
+ .
156
+ .fi
157
+ .
158
+ .IP "" 0
159
+ .
160
+ .P
161
+ Create 10 stub records for herbarium sheets in the collection \fBOrchids\fR in the database \fBSpecify\fR on localhost, determined to taxon \fBOrchidaceae\fR:
162
+ .
163
+ .IP "" 4
164
+ .
165
+ .nf
166
+
167
+ $ specify_cli \-D Specify stubs \-\-taxon=\'Family: Orchidaceae\'\en
168
+ \-\-preptype=Sheet \-\-perpcount=1 Orchids 10
169
+ .
170
+ .fi
171
+ .
172
+ .IP "" 0
173
+ .
174
+ .P
175
+ Upload \fBinvertpaleo\.views\.xml\fR to discipline level for collection \fBTrilobites\fR in the database \fBSpecify\fR on localhost:
176
+ .
177
+ .IP "" 4
178
+ .
179
+ .nf
180
+
181
+ $ specify_cli \-D Specify viewset \-d Trilobites invertpaleo\.views\.xml
182
+ .
183
+ .fi
184
+ .
185
+ .IP "" 0
186
+ .
187
+ .P
188
+ Upload \fBinvertpaleo\.views\.xml\fR auto\-resolving target from current Git branch:
189
+ .
190
+ .IP "" 4
191
+ .
192
+ .nf
193
+
194
+ $ specify_cli viewset \-b invertpaleo\.views\.xml
195
+ .
196
+ .fi
197
+ .
198
+ .IP "" 0
199
+ .
200
+ .SH "LICENSE"
201
+ MIT License
202
+ .
203
+ .P
204
+ Copyright (c) 2018 Martin Stein
205
+ .
206
+ .P
207
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
208
+ .
209
+ .P
210
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software\.
211
+ .
212
+ .P
213
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT\. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE\.
@@ -0,0 +1,252 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta http-equiv='content-type' value='text/html;charset=utf8'>
5
+ <meta name='generator' value='Ronn/v0.7.3 (http://github.com/rtomayko/ronn/tree/0.7.3)'>
6
+ <title>specify_cli(1) - A command line interface for Specify</title>
7
+ <style type='text/css' media='all'>
8
+ /* style: man */
9
+ body#manpage {margin:0}
10
+ .mp {max-width:100ex;padding:0 9ex 1ex 4ex}
11
+ .mp p,.mp pre,.mp ul,.mp ol,.mp dl {margin:0 0 20px 0}
12
+ .mp h2 {margin:10px 0 0 0}
13
+ .mp > p,.mp > pre,.mp > ul,.mp > ol,.mp > dl {margin-left:8ex}
14
+ .mp h3 {margin:0 0 0 4ex}
15
+ .mp dt {margin:0;clear:left}
16
+ .mp dt.flush {float:left;width:8ex}
17
+ .mp dd {margin:0 0 0 9ex}
18
+ .mp h1,.mp h2,.mp h3,.mp h4 {clear:left}
19
+ .mp pre {margin-bottom:20px}
20
+ .mp pre+h2,.mp pre+h3 {margin-top:22px}
21
+ .mp h2+pre,.mp h3+pre {margin-top:5px}
22
+ .mp img {display:block;margin:auto}
23
+ .mp h1.man-title {display:none}
24
+ .mp,.mp code,.mp pre,.mp tt,.mp kbd,.mp samp,.mp h3,.mp h4 {font-family:monospace;font-size:14px;line-height:1.42857142857143}
25
+ .mp h2 {font-size:16px;line-height:1.25}
26
+ .mp h1 {font-size:20px;line-height:2}
27
+ .mp {text-align:justify;background:#fff}
28
+ .mp,.mp code,.mp pre,.mp pre code,.mp tt,.mp kbd,.mp samp {color:#131211}
29
+ .mp h1,.mp h2,.mp h3,.mp h4 {color:#030201}
30
+ .mp u {text-decoration:underline}
31
+ .mp code,.mp strong,.mp b {font-weight:bold;color:#131211}
32
+ .mp em,.mp var {font-style:italic;color:#232221;text-decoration:none}
33
+ .mp a,.mp a:link,.mp a:hover,.mp a code,.mp a pre,.mp a tt,.mp a kbd,.mp a samp {color:#0000ff}
34
+ .mp b.man-ref {font-weight:normal;color:#434241}
35
+ .mp pre {padding:0 4ex}
36
+ .mp pre code {font-weight:normal;color:#434241}
37
+ .mp h2+pre,h3+pre {padding-left:0}
38
+ ol.man-decor,ol.man-decor li {margin:3px 0 10px 0;padding:0;float:left;width:33%;list-style-type:none;text-transform:uppercase;color:#999;letter-spacing:1px}
39
+ ol.man-decor {width:100%}
40
+ ol.man-decor li.tl {text-align:left}
41
+ ol.man-decor li.tc {text-align:center;letter-spacing:4px}
42
+ ol.man-decor li.tr {text-align:right;float:right}
43
+ </style>
44
+ </head>
45
+ <!--
46
+ The following styles are deprecated and will be removed at some point:
47
+ div#man, div#man ol.man, div#man ol.head, div#man ol.man.
48
+
49
+ The .man-page, .man-decor, .man-head, .man-foot, .man-title, and
50
+ .man-navigation should be used instead.
51
+ -->
52
+ <body id='manpage'>
53
+ <div class='mp' id='man'>
54
+
55
+ <div class='man-navigation' style='display:none'>
56
+ <a href="#NAME">NAME</a>
57
+ <a href="#SYNOPSIS">SYNOPSIS</a>
58
+ <a href="#DESCRIPTION">DESCRIPTION</a>
59
+ <a href="#FILES">FILES</a>
60
+ <a href="#COMMANDS">COMMANDS</a>
61
+ <a href="#OPTIONS">OPTIONS</a>
62
+ <a href="#EXAMPLES">EXAMPLES</a>
63
+ <a href="#LICENSE">LICENSE</a>
64
+ </div>
65
+
66
+ <ol class='man-decor man-head man head'>
67
+ <li class='tl'>specify_cli(1)</li>
68
+ <li class='tc'></li>
69
+ <li class='tr'>specify_cli(1)</li>
70
+ </ol>
71
+
72
+ <h2 id="NAME">NAME</h2>
73
+ <p class="man-name">
74
+ <code>specify_cli</code> - <span class="man-whatis">A command line interface for Specify</span>
75
+ </p>
76
+
77
+ <h2 id="SYNOPSIS">SYNOPSIS</h2>
78
+
79
+ <p><code>specify_cli</code> [<strong>-D</strong>|<strong>--database</strong> <var>name</var>]
80
+ [<strong>-H</strong>|<strong>--host</strong> <var>name</var>]
81
+ [<strong>-P</strong>|<strong>--password</strong> <var>password</var>]
82
+ [<strong>-U</strong>|<strong>--specify_user</strong> <var>name</var>]
83
+ [<strong>-c</strong>|<strong>--db_config</strong> <var>file</var>]
84
+ [<strong>-p</strong>|<strong>--port</strong> <var>number</var>]
85
+ [<strong>-u</strong>|<strong>--user</strong> <var>name</var>]
86
+ <var>command</var> [<var>options</var>] [<var>args</var>]</p>
87
+
88
+ <h2 id="DESCRIPTION">DESCRIPTION</h2>
89
+
90
+ <p><strong>specify_cli</strong> is a tool that allows certain tasks in a Specify database to be
91
+ carried out from the command line.
92
+ Specify is a management system for biological collections developed by the
93
+ Specify Collections Consortium (http://www.sustain.specifysoftware.org).</p>
94
+
95
+ <p><strong>specify_cli</strong> is an independent development that is not supported by the
96
+ Specify Collections Consortium. It operates directly on the MySQL/MariaDB
97
+ backend used by Specify. <strong>Use at your own risk</strong>.</p>
98
+
99
+ <p>Tasks currently supported:</p>
100
+
101
+ <ul>
102
+ <li>upload of user interface form definitions (<em>.views.xml</em> files) to the database</li>
103
+ <li>generation of collection object stub records</li>
104
+ </ul>
105
+
106
+
107
+ <h2 id="FILES">FILES</h2>
108
+
109
+ <p><code>~/.specify_dbs.rc.yaml</code> is a YAML file that stores information about
110
+ Specify databases and directories containing <em>.views.xml</em> files.
111
+ The file has the general structure:</p>
112
+
113
+ <pre><code>---
114
+ :dir_names:
115
+ &lt;view_file_directory>: &lt;hostname>
116
+ ...
117
+ :hosts:
118
+ &lt;hostname>:
119
+ :port: &lt;port_number>
120
+ :databases:
121
+ &lt;database_name>:
122
+ :db_user:
123
+ :name: &lt;mysql_username>
124
+ :password: &lt;password>
125
+ :sp_user: &lt;specify_username>
126
+ ...
127
+ ...
128
+ </code></pre>
129
+
130
+ <p>The section <code>dir_names</code> contains directory-host-mappings. A directory-host-
131
+ mapping is a key-value-pair, where the key is the path of a directory on your
132
+ hard drive, the value is a host name. This is used to automatically resolve the
133
+ correct host for a <em>.views.xml</em> file based on the directory it is in. Add
134
+ mappings here by editing the file or using the <strong><span class="man-ref">specify_cli-repository<span class="s">(1)</span></span></strong>
135
+ command.</p>
136
+
137
+ <p>The section <code>hosts</code> contains settings for Specify databases by grouped by
138
+ <code>&lt;hostname></code>. For each host, the <code>port</code> and any <code>databases</code> can be configured in
139
+ this file by editing it or by using the <strong><span class="man-ref">specify_cli-database<span class="s">(1)</span></span></strong> command. The <code>databases</code> section contains connection settings for the individual databases by
140
+ <code>&lt;database_name></code>. The <code>db_user</code> is the MySQL/MariaDB user used to connect to
141
+ the database and will typically be the Specify <em>master user</em>. Leave <code>password</code>
142
+ blank to be prompted for the password when you run the command (this will not
143
+ work when triggered as a bash script from another application, e.g. a text
144
+ editor). Apart from the <code>db_user</code> <code>specify_cli</code> also needs a Specify user (a
145
+ user that Specify uses internally), which is provided under <code>sp_user</code>. Every
146
+ command (except the configuration commands <strong><span class="man-ref">specify_cli-database<span class="s">(1)</span></span></strong> and <strong><span class="man-ref">specify_cli-repository<span class="s">(1)</span></span></strong>) will start a session in Specify where the Specify
147
+ user will be logged in to the collection. Any records created or modified during
148
+ this session will be marked as created by or modified by the <code>sp_user</code>.</p>
149
+
150
+ <h2 id="COMMANDS">COMMANDS</h2>
151
+
152
+ <ul>
153
+ <li><code>specify_cli-database</code>(1)
154
+ Add a database configuration.</li>
155
+ <li><code>specify_cli-stubs</code>(1)
156
+ Create stub records</li>
157
+ <li><code>specify_cli-repository</code>(1)
158
+ Map a git repository to a host for automatic target resolution.</li>
159
+ <li><code>specify_cli-viewset</code>(1)
160
+ Upload a view to the database.</li>
161
+ </ul>
162
+
163
+
164
+ <h2 id="OPTIONS">OPTIONS</h2>
165
+
166
+ <dl>
167
+ <dt><code>-D</code>, <code>--database</code> <var>name</var></dt><dd> The name of the Specify database to connect to.</dd>
168
+ <dt><code>-H</code>, <code>--host</code> <var>name</var></dt><dd> The name or IP address of the host. Default: <code>localhost</code></dd>
169
+ <dt><code>-P</code>, <code>--password</code> <var>password</var></dt><dd> The password for the MySQL/MariaDB user. Leave blank to be prompted.</dd>
170
+ <dt><code>-U</code>, <code>--specify_user</code> <var>name</var></dt><dd> The name of the Specify user.</dd>
171
+ <dt><code>-c</code>, <code>--db_config</code> <var>file</var></dt><dd> A database configuration file (if other than the default
172
+ <code>~/.specify_dbs.rc.yaml</code>)</dd>
173
+ <dt><code>-p</code>, <code>--port</code> <var>number</var></dt><dd> The port for the MySQL/MariaDB host.</dd>
174
+ <dt><code>-u</code>, <code>--user</code> <var>name</var></dt><dd> The MySQL/MariaDB user name.</dd>
175
+ </dl>
176
+
177
+
178
+ <h2 id="EXAMPLES">EXAMPLES</h2>
179
+
180
+ <p>Configure a database <code>Specify</code> on the host <code>specify.example.org</code>:</p>
181
+
182
+ <pre><code>$ specify_cli --host=specify.example.org database specify
183
+ </code></pre>
184
+
185
+ <p>Map the current directory to the host <code>specify.example.org</code>:</p>
186
+
187
+ <pre><code>$ specify_cli --host=specify.example.org repository -c
188
+ </code></pre>
189
+
190
+ <p>Map <code>~/specify_forms/invertpaleo</code> to <code>localhost</code>:</p>
191
+
192
+ <pre><code>$ specify_cli repository ~/specify_forms/invertpaleo
193
+ </code></pre>
194
+
195
+ <p>Create 10 blank stub records in the collection <code>Triloites</code> in the database
196
+ <code>Specify</code> on localhost:</p>
197
+
198
+ <pre><code>$ specify_cli -D Specify stubs Trilobites 10
199
+ </code></pre>
200
+
201
+ <p>Create 10 stub records for herbarium sheets in the collection <code>Orchids</code> in the
202
+ database <code>Specify</code> on localhost, determined to taxon <code>Orchidaceae</code>:</p>
203
+
204
+ <pre><code>$ specify_cli -D Specify stubs --taxon='Family: Orchidaceae'\n
205
+ --preptype=Sheet --perpcount=1 Orchids 10
206
+ </code></pre>
207
+
208
+ <p>Upload <code>invertpaleo.views.xml</code> to discipline level for collection <code>Trilobites</code>
209
+ in the database <code>Specify</code> on localhost:</p>
210
+
211
+ <pre><code>$ specify_cli -D Specify viewset -d Trilobites invertpaleo.views.xml
212
+ </code></pre>
213
+
214
+ <p>Upload <code>invertpaleo.views.xml</code> auto-resolving target from current Git branch:</p>
215
+
216
+ <pre><code>$ specify_cli viewset -b invertpaleo.views.xml
217
+ </code></pre>
218
+
219
+ <h2 id="LICENSE">LICENSE</h2>
220
+
221
+ <p>MIT License</p>
222
+
223
+ <p>Copyright (c) 2018 Martin Stein</p>
224
+
225
+ <p>Permission is hereby granted, free of charge, to any person obtaining a copy
226
+ of this software and associated documentation files (the "Software"), to deal
227
+ in the Software without restriction, including without limitation the rights
228
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
229
+ copies of the Software, and to permit persons to whom the Software is
230
+ furnished to do so, subject to the following conditions:</p>
231
+
232
+ <p>The above copyright notice and this permission notice shall be included in all
233
+ copies or substantial portions of the Software.</p>
234
+
235
+ <p>THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
236
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
237
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
238
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
239
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
240
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
241
+ SOFTWARE.</p>
242
+
243
+
244
+ <ol class='man-decor man-foot man foot'>
245
+ <li class='tl'></li>
246
+ <li class='tc'>August 2018</li>
247
+ <li class='tr'>specify_cli(1)</li>
248
+ </ol>
249
+
250
+ </div>
251
+ </body>
252
+ </html>