Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added --force option to skip moments of user-interaction

  • Loading branch information...
commit a79fe8dfa1821d15023b93aebe72dc42e7692650 1 parent 1373721
rubyphunk authored
View
7 doc/History.rdoc
@@ -0,0 +1,7 @@
+=== current HEAD
+ * enhancements
+ * Added --force option to skip moments of user-interaction
+ * Replaced FileUtils#methods with its native brothers to gain more speed (and to preserve your cpu)
+
+ * fixed
+ * Fixed no-working repository-pull
View
8 lib/reflection/command/apply.rb
@@ -14,8 +14,10 @@ def run!
stash_directory = Directory::Stash.new(Reflection::Repository.new(config.repository), 'apply')
target_directory = Directory::Base.new(config.directory)
- get_user_approval_for_cleaning_target(target_directory)
- get_user_approval_for_apply_database_dump if config.rails_root
+ unless config.force
+ get_user_approval_for_cleaning_target(target_directory)
+ get_user_approval_for_apply_database_dump if config.rails_root
+ end
verify_that_target_is_not_a_repository(target_directory)
@@ -43,7 +45,7 @@ def run!
private
- def get_user_approval_for_cleaning_target(target_directory)
+ def get_user_approval_for_cleaning_target(target_directory)
puts "\nIn order to get a fresh copy of your files, "
puts "Reflection will have to remove all files under '#{target_directory.path}'."
puts "If you are sure, hit <enter> to proceed.."
View
11 lib/reflection/config.rb
@@ -15,6 +15,7 @@ class Config
attr_accessor :rails_environment
attr_accessor :store_configuration_path
attr_accessor :verbose
+ attr_accessor :force
def self.parse(args = [])
config = Config.new
@@ -33,11 +34,12 @@ def self.parse(args = [])
def to_hash
{
:command => self.command,
- :repository => self.repository,
:directory => self.directory,
+ :repository => self.repository,
:rails_root => self.rails_root,
:rails_environment => self.rails_environment,
- :verbose => self.verbose
+ :verbose => self.verbose,
+ :force => self.force
}
end
@@ -48,6 +50,7 @@ def from_hash(hash)
self.rails_root = hash[:rails_root]
self.rails_environment = hash[:rails_environment]
self.verbose = Reflection.verbose = hash[:verbose]
+ self.force = hash[:force]
end
def write(path)
@@ -119,6 +122,10 @@ def parse_command_line_options(args)
self.verbose = true
Reflection.verbose = true
end
+
+ opts.on("--force", "Hide tedious warnings") do
+ self.force = true
+ end
end
opt_parser.parse!(args)
View
5 spec/reflection/config_spec.rb
@@ -8,7 +8,8 @@
:directory => 'dir',
:rails_root => "rails_root",
:rails_environment => 'development',
- :verbose => true
+ :verbose => true,
+ :force => false
}
end
@@ -51,6 +52,7 @@
@config.rails_root = 'rails_root'
@config.rails_environment = 'development'
@config.verbose = true
+ @config.force = false
@config.to_hash.should == @valid_options
end
end
@@ -65,6 +67,7 @@
@config.rails_root.should eql('rails_root')
@config.rails_environment.should eql('development')
@config.verbose.should be_true
+ @config.force.should be_false
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.