Class: Cuki

Inherits:
Object
  • Object
show all
Defined in:
lib/cuki.rb

Constant Summary collapse

CONFIG_PATH =
'config/cuki.yaml'
DEFAULT_CONTAINER =
/h1\. Acceptance Criteria/
PRIMARY_HEADER =
"h1\."
FEATURE_HEADER =
"h2\."
SCENARIO_HEADER =
"h6\."
FLAGS =
{:skip_autoformat => '--skip-autoformat'}

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(args) ⇒ Cuki

Returns a new instance of Cuki.



27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/cuki.rb', line 27

def initialize(args)
  @args = args
  validate_args
  read_config
  configure_http_client
  @link_builder = LinkBuilder.new(@config['host'])
  action = args.first
  if args.include?(FLAGS[:skip_autoformat])
    args.delete_if { |arg| FLAGS[:skip_autoformat] == arg }
    @skip_autoformat = true
  end
  configure_pull_stubs
  verify_project
  file = args[1]
  if file
    id = mappings.invert[file]
    terminate "could not get id for #{file}" unless id
    pull_feature id, file
  else
    Parallel.map(mappings, :in_processes => 4) do |id, filepath|
      pull_feature id, filepath
    end
  end
  autoformat!
end

Class Method Details

.invoke(args) ⇒ Object



23
24
25
# File 'lib/cuki.rb', line 23

def self.invoke(args)
  new(args)
end