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,177 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Specify
4
+ module Service
5
+ # ViewLoaders will upload _.views.xml_ files to a Specify::Database.
6
+ class ViewLoader < Service
7
+ # The target to which the ViewLoader uploads _.views.xml_ files; an
8
+ # instance of Specify::Model::Discipline, Specify::Model::Collection,
9
+ # Specify::UserType, or Specify::Model::User
10
+ attr_reader :target
11
+
12
+ # Creates a new instance from a branch +name+, if +name+ conforms to the
13
+ # naming convention <em>database_name/collection_name/level</em>, where
14
+ # _level_ is _discipline_, _collection_, _manager_, _fullaccess_,
15
+ # _limitedaccess_, or _guest_), or _user/username_.
16
+ #
17
+ # +path+ is the filepath for the view file to be uploaded.
18
+ #
19
+ # +config+ is the YAML file containing the database configuration.
20
+ def self.from_branch(config:, path: nil, name: nil)
21
+ parser = if name
22
+ BranchParser.new(path, name, config)
23
+ else
24
+ BranchParser.current_branch config
25
+ end
26
+ new parser.to_h.merge(config: config)
27
+ end
28
+
29
+ # Returns a new ViewLoader.
30
+ #
31
+ # +level+ is the level to which the _.views.xml_ file will be uploaded.
32
+ # valid values are _:discipline_, _:collection_,
33
+ # <tt>{ :user_type => String }</tt> (String Symbol must be a valid
34
+ # Specify::UserType#name) or <tt>{ :user => String }</tt> (where String
35
+ # must be an existing Specify::Model::User#user name).
36
+ def initialize(host:,
37
+ database:,
38
+ collection:,
39
+ specify_user: nil,
40
+ level: nil,
41
+ config:)
42
+ super(host: host,
43
+ database: database,
44
+ collection: collection,
45
+ specify_user: specify_user,
46
+ config: config)
47
+ @target = nil
48
+ self.target = level
49
+ end
50
+
51
+ # Returns the Specify::Model::User instance for +hash+ if +hash+ has the
52
+ # key +:user+ and the value for that key is an existing
53
+ # Specify::Model::User#name.
54
+ def self.user_target(hash)
55
+ return unless hash.key? :user
56
+ Model::User.first(Name: hash[:user])
57
+ end
58
+
59
+ # Returns the Specify::UserType for +hash+ if hash has the key
60
+ # +user_type+, and the value for that key is a valid
61
+ # Specify::UserType#name.
62
+ def self.user_type_target(hash)
63
+ return unless hash.key? :user_type
64
+ UserType.new(hash[:user_type])
65
+ end
66
+
67
+ # Creates a string representation of +self+.
68
+ def inspect
69
+ "#{self} database: #{@db.database}, target: #{@target}"
70
+ end
71
+
72
+ # Loads the _views.xml_ +file+ and stores it as a SQL blob in the
73
+ # Specify::Model::ViewSetObject for the #target.
74
+ def import(file)
75
+ view_set = @target.view_set(collection) ||
76
+ create_view_set(file)
77
+ view_set.import(views_file(file))
78
+ end
79
+
80
+ # Returns +true+ if the view is personal, +false+ otherwise.
81
+ def personal?
82
+ @target.is_a?(Model::User) ? true : false
83
+ end
84
+
85
+ # Sets the target for the instance. +level+ must be +:discipline+,
86
+ # +:collection+, or a Hash with the key :user_type and a valid
87
+ # Specify::UserType#name as value or the key +:user+ and an existing
88
+ # Specify::Model::User#name.
89
+ def target=(level)
90
+ return unless level
91
+ @target = case level
92
+ when :collection
93
+ collection
94
+ when :discipline
95
+ discipline
96
+ else
97
+ ViewLoader.user_target(level) ||
98
+ ViewLoader.user_type_target(level)
99
+ end
100
+ end
101
+
102
+ # Returns the Specify::Model::Collection that _views.xml_ files will be
103
+ # uploaded to (all supported upload levels except +:disciplin+ are
104
+ # scoped to a collection. Will be #collection or +nil+.
105
+ def view_collection
106
+ collection unless @target.is_a? Model::Discipline
107
+ end
108
+
109
+ # Returns the Specify::Model::Discipline that _views.xml_ files will be
110
+ # uploaded to.
111
+ def view_discipline
112
+ discipline
113
+ end
114
+
115
+ # Returns +2+ if the view is for a collection, +0+ otherwise.
116
+ def view_level
117
+ @target.is_a?(Model::Collection) ? 2 : 0
118
+ end
119
+
120
+ # Returns the Specify::Model::Discipline#name, which is the
121
+ # Specify::Model::AppResourceDir#discipline_type.
122
+ def view_type
123
+ view_discipline.name
124
+ end
125
+
126
+ # Returns the Specify::Model::User that _views.xml_ files will be
127
+ # uploaded to. Same as #session Specify::Session#user unless the view is
128
+ # for a different user.
129
+ def view_user
130
+ @target.is_a?(Model::User) ? @target : @session.user
131
+ end
132
+
133
+ # Returns a String with a valid Specify::UserType#name for #target.
134
+ def view_user_type
135
+ case @target
136
+ when UserType
137
+ @target.name.to_s
138
+ when Model::User
139
+ @target.UserType.downcase
140
+ end
141
+ end
142
+
143
+ private
144
+
145
+ def create_view_dir
146
+ vals = { created_by: agent,
147
+ DisciplineType: view_type,
148
+ UserType: view_user_type,
149
+ IsPersonal: personal?,
150
+ collection: view_collection,
151
+ discipline: view_discipline,
152
+ user: view_user }
153
+ @target.view_set_dir = @target.add_app_resource_dir(vals)
154
+ end
155
+
156
+ def create_view_set(file)
157
+ vals = { Level: view_level,
158
+ FileName: file,
159
+ Name: file.basename('.xml'),
160
+ app_resource_dir: create_view_dir,
161
+ created_by: agent }
162
+ view_set = Model::ViewSetObject.create vals
163
+ Model::AppResourceData.create viewsetobj: view_set,
164
+ created_by: agent
165
+ @target.save
166
+ view_set.save
167
+ end
168
+
169
+ def views_file(file)
170
+ raise ArgumentError, FileError::NO_FILE unless File.exist?(file)
171
+ path = Pathname.new file
172
+ return File.open path if path.file? && path.fnmatch?('*.views.xml')
173
+ raise ArgumentError, FileError::VIEWS_FILE
174
+ end
175
+ end
176
+ end
177
+ end
@@ -0,0 +1,77 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'observer'
4
+
5
+ module Specify
6
+ # A Session is responsible for logging an existing Specify::Model::User in and
7
+ # out of a Specify::Model::Collection. Session objects are used to set the
8
+ # #created_by and #modified_by attributes for any record created or updated to
9
+ # the session #user.
10
+ class Session
11
+ include Observable
12
+
13
+ # +true+ if the session is open (the #user is logged in), +false+ otherwise.
14
+ attr_reader :active
15
+
16
+ # The Specify::Model::Collection that #user is logged in to during
17
+ # the life span of the session.
18
+ attr_reader :collection
19
+
20
+ # The Specify::Model::Discipline that #user is logged in to during
21
+ # the life span of the session.
22
+ attr_reader :discipline
23
+
24
+ # The Specify::Model::Division that #collection and #discipline belong to.
25
+ attr_reader :division
26
+
27
+ # The Specify::Model::User that is logged in to #collection during the
28
+ # session.
29
+ attr_reader :user
30
+
31
+ # Returns a new Session.
32
+ #
33
+ # +user+ is a String with an existing Specify::Model::User#name.
34
+ #
35
+ # +collection+ is a String with and existing
36
+ # Specify::Model::Collection#name.
37
+ def initialize(user, collection)
38
+ @user = Model::User.first(Name: user)
39
+ @collection = Model::Collection.first(CollectionName: collection)
40
+ @discipline = @collection.discipline
41
+ @division = @discipline.division
42
+ @active = false
43
+ end
44
+
45
+ # Creates a string representation of +self+.
46
+ def inspect
47
+ "#{self} specify user: #{@user}"\
48
+ ", collection: #{@collection}, open: #{@active}"
49
+ end
50
+
51
+ # Closes this session, logs #user out of #collection.
52
+ def close
53
+ @user.log_out
54
+ @active = false
55
+ changed
56
+ notify_observers(self)
57
+ self
58
+ end
59
+
60
+ # Opens this session, logs #user in to #collection.
61
+ def open
62
+ @user.log_in(@collection)
63
+ @active = true
64
+ self
65
+ end
66
+
67
+ # Returns +true+ if this session is currently open.
68
+ def open?
69
+ @active
70
+ end
71
+
72
+ # Returns the Specify::Model::Agent for #user in #division.
73
+ def session_agent
74
+ user.logged_in_agent
75
+ end
76
+ end
77
+ end
@@ -0,0 +1,61 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Specify
4
+ # A UserType represents a lvel to which _.views.xml_ files can be uploaded.
5
+ # This is the only level that is not represented by a proper Model class,
6
+ # the others being Specify::Model::Collection, Specify::Model::Discipline,
7
+ # and Specify::Model::User. Like the model classes, a UserType implements
8
+ # #view_set_dir and #view_set to give access to the correct
9
+ # Specify::Model::AppResourceDir and Specify::Model::ViewSetObject instances.
10
+ class UserType
11
+ # The Specify::Model::AppResourceDir associated with +self+
12
+ attr_writer :view_set_dir
13
+
14
+ # A String, must be either +manager+, +fullaccess+, +limitedaccess+, or
15
+ # +guest+
16
+ attr_reader :name
17
+
18
+ # Returns a new UserType.
19
+ # +name+ must be a valid #name.
20
+ def initialize(name)
21
+ @name = name.downcase
22
+ @view_set_dir = nil
23
+ valid?
24
+ end
25
+
26
+ # Returns a new instance of Specify::Model::AppResourceDir with +values+.
27
+ def add_app_resource_dir(values)
28
+ Model::AppResourceDir.create values
29
+ end
30
+
31
+ # Returns +self+.
32
+ #
33
+ # This is a dummy method to allow use as a Specify::ViewLoader#target
34
+ # alongside Specify::Model::Collection, Specify::Model::Discipline, and
35
+ # Specify::Model::User.
36
+ def save
37
+ self
38
+ end
39
+
40
+ # Returns +true+ if #name is any of +fullaccess+, +guest+, +limitedaccess+,
41
+ # or +manager+; +false+ otherwise.
42
+ def valid?
43
+ %w[fullaccess guest limitedaccess manager].include? @name
44
+ end
45
+
46
+ # Returns the Specify::Model::AppResourceDir for this user type (#name) in
47
+ # +collection+ (a Specify::Model::Collection).
48
+ def view_set_dir(collection)
49
+ Model::AppResourceDir.first(collection: collection,
50
+ discipline: collection.discipline,
51
+ UserType: @name.to_s,
52
+ IsPersonal: false)
53
+ end
54
+
55
+ # Returns the Specify::Model::ViewSetObject for this user type +collection+
56
+ # (a Specify::Model::Collection).
57
+ def view_set(collection)
58
+ view_set_dir(collection)&.view_set_object
59
+ end
60
+ end
61
+ end
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Specify
4
+ # :nodoc:
5
+ VERSION = '0.0.5'
6
+
7
+ # :nodoc:
8
+ SUMMARY = 'A command line interface for Specify'
9
+
10
+ # :nodoc:
11
+ DESCRIPTION = <<~HEREDOC
12
+ specify_cli is a tool that allows certain tasks in a Specify database
13
+ (http://www.sustain.specifysoftware.org) to be carried out from the command
14
+ line.
15
+ Currently supported tasks:
16
+ - upload of views to the database
17
+ - generation of stub records
18
+ HEREDOC
19
+ end
@@ -0,0 +1,60 @@
1
+ .\" generated with Ronn/v0.7.3
2
+ .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
+ .
4
+ .TH "SPECIFY_CLI\-DATABASE" "1" "August 2018" "" ""
5
+ .
6
+ .SH "NAME"
7
+ \fBspecify_cli\-database\fR \- A command line interface for Specify
8
+ .
9
+ .SH "SYNOPSIS"
10
+ \fBspecify_cli\fR [\fIglobal options\fR] \fBdatabase\fR \fIname\fR
11
+ .
12
+ .SH "DESCRIPTION"
13
+ The database configuration file (default: \fI~/\.specify_dbs\.rc\.yaml\fR) has a \fBhosts\fR section which contains settings for Specify databases by grouped by \fIhostname\fR\.
14
+ .
15
+ .P
16
+ Use the \fBdatabase\fR command to add information for a specific database using this command\.
17
+ .
18
+ .P
19
+ Use the specify_cli global option \fB\-\-host\fR to provide the host information and pass the \fIname\fR of the database to configure as an argument\.
20
+ .
21
+ .P
22
+ The command will look up the \fIhost\fR and \fIdatabase\fR in the database configuration file and ask for necessary information to configure either\. The command will not overwrite existing configurations\. If you need to change information, edit the file\.
23
+ .
24
+ .P
25
+ Information required to configure a \fIhost\fR is the port number\.
26
+ .
27
+ .P
28
+ Information required to configure a \fIdatabase\fR is the MySQL/MariaDB user name and password\. The user will be the typically be the Specify \fImaster user\fR (or any user with equivalent permissions on the database) Leave the password blank to be prompted when working with commands that read the file (\fBspecify_cli\-stubs(1)\fR, \fBspecify_cli\-viewset(1)\fR)\. Apart from the MySQL/MariaDB user, \fBspecify_cli\fR the command will also ask for a \fIspecify user\fR name\. 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 \fIspecify user\fR\.
29
+ .
30
+ .SH "OPTIONS"
31
+ None\.
32
+ .
33
+ .SH "EXAMPLES"
34
+ Configure a database \fBSpecify\fR on the host \fBspecify\.example\.org\fR:
35
+ .
36
+ .IP "" 4
37
+ .
38
+ .nf
39
+
40
+ $ specify_cli \-\-host=specify\.example\.org database Specify
41
+ .
42
+ .fi
43
+ .
44
+ .IP "" 0
45
+ .
46
+ .P
47
+ Configure a database \fBSpecifyTest\fR on localhost:
48
+ .
49
+ .IP "" 4
50
+ .
51
+ .nf
52
+
53
+ $ specify_cli database SpecifyTest
54
+ .
55
+ .fi
56
+ .
57
+ .IP "" 0
58
+ .
59
+ .SH "SPECIFY_CLI"
60
+ Part of the specify_cli(1) suite
@@ -0,0 +1,137 @@
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-database(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="#OPTIONS">OPTIONS</a>
60
+ <a href="#EXAMPLES">EXAMPLES</a>
61
+ <a href="#SPECIFY_CLI">SPECIFY_CLI</a>
62
+ </div>
63
+
64
+ <ol class='man-decor man-head man head'>
65
+ <li class='tl'>specify_cli-database(1)</li>
66
+ <li class='tc'></li>
67
+ <li class='tr'>specify_cli-database(1)</li>
68
+ </ol>
69
+
70
+ <h2 id="NAME">NAME</h2>
71
+ <p class="man-name">
72
+ <code>specify_cli-database</code> - <span class="man-whatis">A command line interface for Specify</span>
73
+ </p>
74
+
75
+ <h2 id="SYNOPSIS">SYNOPSIS</h2>
76
+
77
+ <p><code>specify_cli</code> [<var>global options</var>] <code>database</code> <var>name</var></p>
78
+
79
+ <h2 id="DESCRIPTION">DESCRIPTION</h2>
80
+
81
+ <p>The database configuration file (default: <em>~/.specify_dbs.rc.yaml</em>) has a
82
+ <code>hosts</code> section which contains settings for Specify databases by grouped by
83
+ <em>hostname</em>.</p>
84
+
85
+ <p>Use the <code>database</code> command to add information for a specific database using this command.</p>
86
+
87
+ <p>Use the specify_cli global option <code>--host</code> to provide the host information and
88
+ pass the <em>name</em> of the database to configure as an argument.</p>
89
+
90
+ <p>The command will look up the <em>host</em> and <em>database</em> in the database configuration
91
+ file and ask for necessary information to configure either. The command will
92
+ not overwrite existing configurations. If you need to change information, edit
93
+ the file.</p>
94
+
95
+ <p>Information required to configure a <em>host</em> is the port number.</p>
96
+
97
+ <p>Information required to configure a <em>database</em> is the MySQL/MariaDB user name
98
+ and password. The user will be the typically be the Specify <em>master user</em> (or
99
+ any user with equivalent permissions on the database) Leave the password blank
100
+ to be prompted when working with commands that read the file (<strong><span class="man-ref">specify_cli-stubs<span class="s">(1)</span></span></strong>, <strong><span class="man-ref">specify_cli-viewset<span class="s">(1)</span></span></strong>). Apart from the
101
+ MySQL/MariaDB user, <code>specify_cli</code> the command will also ask for a <em>specify user</em>
102
+ name. Every command (except the configuration commands
103
+ <strong><a class="man-ref" href="specify_cli-database.1.html">specify_cli-database<span class="s">(1)</span></a></strong> and <strong><span class="man-ref">specify_cli-repository<span class="s">(1)</span></span></strong>) will start a
104
+ session in Specify where the Specify user will be logged in to the collection.
105
+ Any records created or modified during this session will be marked as created by
106
+ or modified by the <em>specify user</em>.</p>
107
+
108
+ <h2 id="OPTIONS">OPTIONS</h2>
109
+
110
+ <p>None.</p>
111
+
112
+ <h2 id="EXAMPLES">EXAMPLES</h2>
113
+
114
+ <p>Configure a database <code>Specify</code> on the host <code>specify.example.org</code>:</p>
115
+
116
+ <pre><code>$ specify_cli --host=specify.example.org database Specify
117
+ </code></pre>
118
+
119
+ <p>Configure a database <code>SpecifyTest</code> on localhost:</p>
120
+
121
+ <pre><code>$ specify_cli database SpecifyTest
122
+ </code></pre>
123
+
124
+ <h2 id="SPECIFY_CLI">SPECIFY_CLI</h2>
125
+
126
+ <p>Part of the <span class="man-ref">specify_cli<span class="s">(1)</span></span> suite</p>
127
+
128
+
129
+ <ol class='man-decor man-foot man foot'>
130
+ <li class='tl'></li>
131
+ <li class='tc'>August 2018</li>
132
+ <li class='tr'>specify_cli-database(1)</li>
133
+ </ol>
134
+
135
+ </div>
136
+ </body>
137
+ </html>