geordi 0.17.3 → 0.17.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ OGQ5ZmIyZjI4ZTQwOGI3MjU4NzkxODQ5MTRlNzE3OTE2YjYzNDAzZA==
5
+ data.tar.gz: !binary |-
6
+ ZTYzYWY4NzYwNDE3M2E3OWViNjg3YjhlNmFkNzBkMjBmMjFhNDRmMw==
7
+ SHA512:
8
+ metadata.gz: !binary |-
9
+ NDFmZWE3ZTNkMTNlOTU2ODlkZGExZjNmYzYyMDBkMjc4NTAxMDY4ZTQ0ZDA2
10
+ ZGFlMWY2ZTM5MzFmNjdjMTM3MWVhNTM1MDkyODRjNGJkMTRiZjZiNWM4MWQ0
11
+ YWQ5MDY3Y2E2NzkwZGEyYWFjNWJhNDBlMDJhMjg4YzVjMTIwM2M=
12
+ data.tar.gz: !binary |-
13
+ NGZiOTlkODE1ZGRmN2JiYjc0ZGQ3NjhiYWM4OWY4MTMwZjRkMmEzY2QxNmNm
14
+ YzUzYWE0ZmZiY2FlZTcwNjk2MTAyN2FkNjlkZWRmMmExMmIwODk4ZmQ4YWI5
15
+ Y2I1OWNhMWE5ZWE1YTE5NTk0YTQzMDkxNzIwOWE4ZDNkYzJjMmI=
data/lib/geordi/cuc.rb CHANGED
@@ -234,7 +234,7 @@ module Geordi
234
234
  98 # was already running after all
235
235
  true
236
236
  when 127 # not installed
237
- puts "Could not launch VNC server. Install it by running cuc-setup-vnc."
237
+ puts "Could not launch VNC server. Install it by running cuc-vnc-setup."
238
238
  puts
239
239
  puts
240
240
  false
@@ -15,28 +15,36 @@ class DumpLoader
15
15
  File.join(user_dir, 'dumps')
16
16
  end
17
17
 
18
- def db_console_command
19
- if File.exists?("script/dbconsole")
20
- "script/dbconsole -p"
21
- else
22
- "rails dbconsole -p"
23
- end
24
- end
18
+ def development_database_config
19
+ require 'yaml'
25
20
 
26
- def source_dump(dump)
27
- require 'open3'
28
- output_buffer = StringIO.new
29
- Open3.popen3(db_console_command) do |stdin, stdout, stderr|
30
- stdin.puts("source #{dump};")
31
- stdin.close
32
- output_buffer.write stdout.read
33
- output_buffer.write stderr.read
34
- end
35
- output_and_errors = output_buffer.string.split("\n")
36
- output = output_and_errors.reject{ |line| line =~ /^ERROR / }
37
- errors = output_and_errors.select{ |line| line =~ /^ERROR / }
21
+ @config ||= YAML::load(ERB.new(File.read('config/database.yml')).result)
22
+ @config['development']
23
+ end
24
+ alias_method :config, :development_database_config
25
+
26
+ def mysql_command
27
+ ENV['MYSQL_PWD'] = config['password']
28
+ command = 'mysql --silent'
29
+ command << ' -u' << config['username']
30
+ command << ' --default-character-set=utf8'
31
+ command << ' ' << config['database']
32
+ command << ' < ' << dump_file
33
+ end
34
+ alias_method :mysql2_command, :mysql_command
35
+
36
+ def postgresql_command
37
+ ENV['PGPASSWORD'] = config['password']
38
+ command = 'pg_restore --no-owner --clean'
39
+ command << ' --username=' << config['username']
40
+ command << ' --host=' << config['host']
41
+ command << ' --dbname=' << config['database']
42
+ command << ' ' << dump_file
43
+ end
38
44
 
39
- [output, errors]
45
+ def source_dump!
46
+ source_command = send("#{config['adapter']}_command")
47
+ `#{source_command}`
40
48
  end
41
49
 
42
50
  def choose_dump_file
@@ -48,46 +56,30 @@ class DumpLoader
48
56
  end
49
57
  end
50
58
 
51
- def get_dump_file
52
- if @argv[0] && File.exists?(@argv[0])
59
+ def dump_file
60
+ @dump_file ||= if @argv[0] && File.exists?(@argv[0])
53
61
  @argv[0]
54
62
  else
55
63
  choose_dump_file
56
64
  end
57
65
  end
58
66
 
59
-
60
- def puts_info(msg = "")
61
- puts msg if @verbose
62
- end
63
-
64
67
  def execute
65
- dump_to_load = get_dump_file
66
-
67
- puts_info
68
- puts_info "sourcing #{dump_to_load} into db ..."
68
+ puts "Sourcing #{dump_file} into #{config['database']} db ..." if @verbose
69
69
 
70
- output, errors = source_dump(dump_to_load)
70
+ source_dump!
71
71
 
72
- puts_info
73
- puts_info output.join("\n")
74
-
75
- if errors.empty?
76
- puts_info "sourcing completed successfully."
77
- true
72
+ if $?.success?
73
+ puts 'Successfully sourced the dump.' if @verbose
78
74
  else
79
- $stderr.puts "some errors occured while loading the dump #{File.basename(dump_to_load)}:"
80
- $stderr.puts errors.join("\n");
81
- false
75
+ $stderr.puts "An error occured while loading the dump #{File.basename(dump_file)}."
82
76
  end
77
+
78
+ $?.success?
83
79
  end
84
80
 
85
81
  def execute!
86
- if execute
87
- exit(0)
88
- else
89
- exit(1)
90
- end
82
+ execute or exit(1)
91
83
  end
92
84
 
93
85
  end
@@ -1,3 +1,3 @@
1
1
  module Geordi
2
- VERSION = '0.17.3'
2
+ VERSION = '0.17.4'
3
3
  end
metadata CHANGED
@@ -1,27 +1,20 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: geordi
3
- version: !ruby/object:Gem::Version
4
- hash: 93
5
- prerelease:
6
- segments:
7
- - 0
8
- - 17
9
- - 3
10
- version: 0.17.3
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.17.4
11
5
  platform: ruby
12
- authors:
6
+ authors:
13
7
  - Henning Koch
14
8
  autorequire:
15
9
  bindir: bin
16
10
  cert_chain: []
17
-
18
- date: 2013-11-21 00:00:00 Z
11
+ date: 2014-05-13 00:00:00.000000000 Z
19
12
  dependencies: []
20
-
21
- description: Collection of command line tools we use in our daily work with Ruby, Rails and Linux at makandra.
22
- email:
13
+ description: Collection of command line tools we use in our daily work with Ruby,
14
+ Rails and Linux at makandra.
15
+ email:
23
16
  - henning.koch@makandra.de
24
- executables:
17
+ executables:
25
18
  - apache-site
26
19
  - b
27
20
  - cap-all
@@ -49,10 +42,8 @@ executables:
49
42
  - shell-for
50
43
  - tests
51
44
  extensions: []
52
-
53
45
  extra_rdoc_files: []
54
-
55
- files:
46
+ files:
56
47
  - .gitignore
57
48
  - Gemfile
58
49
  - LICENSE
@@ -92,37 +83,28 @@ files:
92
83
  - lib/geordi/gitpt.rb
93
84
  - lib/geordi/version.rb
94
85
  homepage: http://makandra.com
95
- licenses:
86
+ licenses:
96
87
  - MIT
88
+ metadata: {}
97
89
  post_install_message:
98
90
  rdoc_options: []
99
-
100
- require_paths:
91
+ require_paths:
101
92
  - lib
102
- required_ruby_version: !ruby/object:Gem::Requirement
103
- none: false
104
- requirements:
105
- - - ">="
106
- - !ruby/object:Gem::Version
107
- hash: 3
108
- segments:
109
- - 0
110
- version: "0"
111
- required_rubygems_version: !ruby/object:Gem::Requirement
112
- none: false
113
- requirements:
114
- - - ">="
115
- - !ruby/object:Gem::Version
116
- hash: 3
117
- segments:
118
- - 0
119
- version: "0"
93
+ required_ruby_version: !ruby/object:Gem::Requirement
94
+ requirements:
95
+ - - ! '>='
96
+ - !ruby/object:Gem::Version
97
+ version: '0'
98
+ required_rubygems_version: !ruby/object:Gem::Requirement
99
+ requirements:
100
+ - - ! '>='
101
+ - !ruby/object:Gem::Version
102
+ version: '0'
120
103
  requirements: []
121
-
122
104
  rubyforge_project: geordi
123
- rubygems_version: 1.8.28
105
+ rubygems_version: 2.2.1
124
106
  signing_key:
125
- specification_version: 3
126
- summary: Collection of command line tools we use in our daily work with Ruby, Rails and Linux at makandra.
107
+ specification_version: 4
108
+ summary: Collection of command line tools we use in our daily work with Ruby, Rails
109
+ and Linux at makandra.
127
110
  test_files: []
128
-