lib/zapata.rb in zapata-0.1.4 vs lib/zapata.rb in zapata-0.1.5
- old
+ new
@@ -21,13 +21,14 @@
module Zapata
class Revolutionist
class << self
attr_accessor :analysis, :analysis_as_array
- def generate_with_friendly_output(file, opts)
+ def generate_with_friendly_output(args, opts)
+ file = args.shift
spec_filename = Zapata::Revolutionist.generate(file,
- single: opts.single?)
+ single: single?(opts, args))
puts "Its done, comrades. File #{spec_filename} was generated."
end
def generate(filename, single: false)
dirs = single ? [] : %w(app/models)
@@ -39,9 +40,15 @@
@analysis_as_array = analysis.values.flatten
end
def spec_filename(filename)
filename.gsub('app/', 'spec/').gsub('.rb', '_spec.rb')
+ end
+
+ private
+
+ def single?(opts, args)
+ opts.single? || args.include?('-s') || args.include?('--single')
end
end
def initialize(file_list)
Core::Loader.load_spec_helper