reflection 0.4.1 → 0.4.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{reflection}
8
- s.version = "0.4.1"
8
+ s.version = "0.4.3"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Andreas Wolff"]
12
- s.date = %q{2009-11-18}
12
+ s.date = %q{2009-11-19}
13
13
  s.default_executable = %q{reflection}
14
14
  s.description = %q{
15
15
  Reflection is designed to keep your development system in sync with your production system's files and database (by dumping).
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.4.1
1
+ 0.4.3
@@ -14,6 +14,7 @@ module Reflection
14
14
 
15
15
  attr_accessor :home
16
16
  attr_accessor :log
17
+ attr_accessor :verbose
17
18
 
18
19
  def boot!(args)
19
20
  @log = Reflection::Support::Log.new
@@ -14,6 +14,7 @@ module Reflection
14
14
  attr_accessor :rails_root
15
15
  attr_accessor :rails_environment
16
16
  attr_accessor :store_configuration_path
17
+ attr_accessor :verbose
17
18
 
18
19
  def self.parse(args = [])
19
20
  config = Config.new
@@ -35,7 +36,8 @@ module Reflection
35
36
  :repository => self.repository,
36
37
  :directory => self.directory,
37
38
  :rails_root => self.rails_root,
38
- :rails_environment => self.rails_environment
39
+ :rails_environment => self.rails_environment,
40
+ :verbose => self.verbose
39
41
  }
40
42
  end
41
43
 
@@ -45,6 +47,7 @@ module Reflection
45
47
  self.repository = hash[:repository]
46
48
  self.rails_root = hash[:rails_root]
47
49
  self.rails_environment = hash[:rails_environment]
50
+ self.verbose = Reflection.verbose = hash[:verbose]
48
51
  end
49
52
 
50
53
  def write(path)
@@ -111,6 +114,11 @@ module Reflection
111
114
  opts.on("--write [FILE]", "Create a configuration FILE from the current commandline options") do |config_file_path|
112
115
  self.store_configuration_path = config_file_path if config_file_path
113
116
  end
117
+
118
+ opts.on("-v", "--verbose", "Include debug information in output") do
119
+ self.verbose = true
120
+ Reflection.verbose = true
121
+ end
114
122
  end
115
123
 
116
124
  opt_parser.parse!(args)
@@ -19,8 +19,8 @@ module Reflection
19
19
  def database_command_line_options(database_config)
20
20
  options = []
21
21
  options << "-h #{database_config['host']}"
22
- options << "-u #{database_config['username']}"
23
- options << "-p #{database_config['password']}" if database_config['password'] && !database_config['password'].empty?
22
+ options << "-u#{database_config['username']}"
23
+ options << "-p#{database_config['password']}" if database_config['password'] && !database_config['password'].empty?
24
24
  options << "#{database_config['database']}"
25
25
  options.join(' ')
26
26
  end
@@ -5,7 +5,7 @@ module Reflection
5
5
  autoload :Log, 'reflection/support/log'
6
6
 
7
7
  def self.exit_with_error(message)
8
- puts message
8
+ Reflection.log.error message
9
9
  exit(1)
10
10
  end
11
11
  end
@@ -2,8 +2,10 @@ module Reflection
2
2
  module Support
3
3
  class Log
4
4
 
5
+ attr_accessor :verbose
6
+
5
7
  def debug(message)
6
- puts "** #{message}" if message && !message.empty?
8
+ puts "** #{message}" if Reflection.verbose == true && message && !message.empty?
7
9
  end
8
10
 
9
11
  def info(message)
@@ -3,7 +3,12 @@ require File.dirname(__FILE__) + '/../spec_helper'
3
3
  describe Reflection::Config do
4
4
  before(:each) do
5
5
  @valid_options = {
6
- :command => :stash, :repository => 'repo', :directory => 'dir', :rails_root => "rails_root", :rails_environment => 'development'
6
+ :command => :stash,
7
+ :repository => 'repo',
8
+ :directory => 'dir',
9
+ :rails_root => "rails_root",
10
+ :rails_environment => 'development',
11
+ :verbose => true
7
12
  }
8
13
  end
9
14
 
@@ -45,6 +50,7 @@ describe Reflection::Config do
45
50
  @config.directory = 'dir'
46
51
  @config.rails_root = 'rails_root'
47
52
  @config.rails_environment = 'development'
53
+ @config.verbose = true
48
54
  @config.to_hash.should == @valid_options
49
55
  end
50
56
  end
@@ -58,6 +64,7 @@ describe Reflection::Config do
58
64
  @config.directory.should eql('dir')
59
65
  @config.rails_root.should eql('rails_root')
60
66
  @config.rails_environment.should eql('development')
67
+ @config.verbose.should be_true
61
68
  end
62
69
  end
63
70
 
@@ -41,15 +41,15 @@ describe Reflection::Rails do
41
41
  end
42
42
 
43
43
  it 'should create options for the mysql command' do
44
- @rails.database_command_line_options(@db_config).should == "-h localhost -u root -p secret test"
44
+ @rails.database_command_line_options(@db_config).should == "-h localhost -uroot -psecret test"
45
45
  end
46
46
 
47
47
  it 'should ignore the password option if its not available' do
48
48
  @db_config['password'] = ""
49
- @rails.database_command_line_options(@db_config).should == "-h localhost -u root test"
49
+ @rails.database_command_line_options(@db_config).should == "-h localhost -uroot test"
50
50
 
51
51
  @db_config['password'] = nil
52
- @rails.database_command_line_options(@db_config).should == "-h localhost -u root test"
52
+ @rails.database_command_line_options(@db_config).should == "-h localhost -uroot test"
53
53
  end
54
54
  end
55
55
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: reflection
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
4
+ version: 0.4.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andreas Wolff
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-11-18 00:00:00 +01:00
12
+ date: 2009-11-19 00:00:00 +01:00
13
13
  default_executable: reflection
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency