astroboa-cli 0.4.0 → 0.4.1
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/astroboa-cli +1 -1
- data/lib/astroboa-cli/command/base.rb +1 -1
- data/lib/astroboa-cli/command/model.rb +1 -1
- data/lib/astroboa-cli/command/repository.rb +1 -14
- data/lib/astroboa-cli/command/server.rb +2 -2
- data/lib/astroboa-cli/command/service.rb +1 -1
- data/lib/astroboa-cli/util.rb +28 -3
- data/lib/astroboa-cli/version.rb +1 -1
- data/lib/astroboa-cli.rb +1 -1
- metadata +2 -2
data/bin/astroboa-cli
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# encoding:
|
1
|
+
# encoding: utf-8
|
2
2
|
|
3
3
|
require 'astroboa-cli/command/base'
|
4
4
|
require 'fileutils'
|
@@ -46,19 +46,6 @@ class AstroboaCLI::Command::Repository < AstroboaCLI::Command::Base
|
|
46
46
|
|
47
47
|
server_configuration = get_server_configuration
|
48
48
|
|
49
|
-
# try to load the 'pg' library if repository is backed by postgres
|
50
|
-
unless server_configuration['database'] == 'derby'
|
51
|
-
error <<-MSG unless gem_available?('pg')
|
52
|
-
You should manually install the 'pg' gem if you want to create repositories backed by postgres
|
53
|
-
astroboa-cli gem does not automatically install 'pg' gem since in some environments (e.g. MAC OS X) this might require
|
54
|
-
to have a local postgres already installed, which in turn is too much if you do not care about postgres.
|
55
|
-
In *Ubuntu Linux* run first 'sudo apt-get install libpq-dev' and then run 'gem install pg'.
|
56
|
-
For MAC OS x read http://deveiate.org/code/pg/README-OS_X_rdoc.html to learn how to install the 'pg' gem.
|
57
|
-
MSG
|
58
|
-
|
59
|
-
require 'pg'
|
60
|
-
end
|
61
|
-
|
62
49
|
check_repo_existense(server_configuration, repository_name)
|
63
50
|
|
64
51
|
database_name = options[:db_name] ||= repository_name
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# encoding:
|
1
|
+
# encoding: utf-8
|
2
2
|
|
3
3
|
require 'astroboa-cli/command/base'
|
4
4
|
require 'astroboa-cli/command/repository'
|
@@ -336,7 +336,7 @@ private
|
|
336
336
|
download_package(@astroboa_setup_templates_download_url, @install_dir) unless File.size?(File.join(@install_dir, @astroboa_setup_templates_package)) == 11030750
|
337
337
|
|
338
338
|
# download astroboa schemas
|
339
|
-
download_package(@schemas_download_url, @install_dir) unless File.size?(File.join(@install_dir, @
|
339
|
+
download_package(@schemas_download_url, @install_dir) unless File.size?(File.join(@install_dir, @schemas_package)) == 28426
|
340
340
|
end
|
341
341
|
|
342
342
|
|
data/lib/astroboa-cli/util.rb
CHANGED
@@ -463,8 +463,26 @@ module AstroboaCLI
|
|
463
463
|
end
|
464
464
|
|
465
465
|
|
466
|
+
def load_pg_library(server_configuration)
|
467
|
+
# try to load the 'pg' library if repository is backed by postgres
|
468
|
+
unless server_configuration['database'] == 'derby'
|
469
|
+
error <<-MSG unless gem_available?('pg')
|
470
|
+
You should manually install the 'pg' gem if you want to create repositories backed by postgres
|
471
|
+
astroboa-cli gem does not automatically install 'pg' gem since in some environments (e.g. MAC OS X) this might require
|
472
|
+
to have a local postgres already installed, which in turn is too much if you do not care about postgres.
|
473
|
+
In *Ubuntu Linux* run first 'sudo apt-get install libpq-dev' and then run 'gem install pg'.
|
474
|
+
For MAC OS x read http://deveiate.org/code/pg/README-OS_X_rdoc.html to learn how to install the 'pg' gem.
|
475
|
+
MSG
|
476
|
+
|
477
|
+
require 'pg'
|
478
|
+
end
|
479
|
+
end
|
480
|
+
|
466
481
|
def create_postgresql_db(server_configuration, database_name)
|
482
|
+
load_pg_library(server_configuration)
|
483
|
+
|
467
484
|
database_admin, database_admin_password, database_server = get_postgresql_config(server_configuration)
|
485
|
+
|
468
486
|
begin
|
469
487
|
conn = PG.connect(
|
470
488
|
host: database_server,
|
@@ -479,7 +497,9 @@ module AstroboaCLI
|
|
479
497
|
display "Database #{database_name} exists. You may run the command with --db_name repo_db_name to specify a different database name"
|
480
498
|
raise
|
481
499
|
end
|
482
|
-
|
500
|
+
|
501
|
+
display "Check that database #{database_name} does not exist: OK"
|
502
|
+
|
483
503
|
res = conn.exec("CREATE DATABASE #{database_name} ENCODING 'UNICODE'")
|
484
504
|
if res.result_status == PG::Result::PGRES_COMMAND_OK
|
485
505
|
display %(Create Postges database "#{database_name}" : OK)
|
@@ -492,9 +512,10 @@ module AstroboaCLI
|
|
492
512
|
display "The error is: #{res.error_message}"
|
493
513
|
display %(The error trace is \n #{e.backtrace.join("\n")})
|
494
514
|
raise
|
495
|
-
|
515
|
+
rescue
|
496
516
|
display %(An error has occured during the creation of postgres database "#{database_name}")
|
497
517
|
display %(The error trace is \n #{e.backtrace.join("\n")})
|
518
|
+
raise
|
498
519
|
ensure
|
499
520
|
conn.finish if conn && !conn.finished?
|
500
521
|
end
|
@@ -502,7 +523,10 @@ module AstroboaCLI
|
|
502
523
|
|
503
524
|
|
504
525
|
def drop_postgresql_db(server_configuration, database_name)
|
526
|
+
load_pg_library(server_configuration)
|
527
|
+
|
505
528
|
database_admin, database_admin_password, database_server = get_postgresql_config(server_configuration)
|
529
|
+
|
506
530
|
begin
|
507
531
|
conn = PG.connect(
|
508
532
|
:host => database_server,
|
@@ -531,9 +555,10 @@ module AstroboaCLI
|
|
531
555
|
display "The error is: #{res.error_message}"
|
532
556
|
display %(The error trace is \n #{e.backtrace.join("\n")})
|
533
557
|
raise
|
534
|
-
|
558
|
+
rescue
|
535
559
|
display %(An error has occured during the deletion of postgres database "#{database_name}")
|
536
560
|
display %(The error trace is \n #{e.backtrace.join("\n")})
|
561
|
+
raise
|
537
562
|
ensure
|
538
563
|
conn.finish if conn && !conn.finished?
|
539
564
|
end
|
data/lib/astroboa-cli/version.rb
CHANGED
data/lib/astroboa-cli.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: astroboa-cli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2012-11-
|
13
|
+
date: 2012-11-06 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: progressbar
|