Class: Jazzy::Config

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfig

Returns a new instance of Config.



17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/jazzy/config.rb', line 17

def initialize
  self.output = Pathname('docs')
  self.xcodebuild_arguments = []
  self.author_name = ''
  self.module_name = ''
  self.github_url = nil
  self.github_file_prefix = nil
  self.author_url = ''
  self.dash_url = nil
  self.sourcekitten_sourcefile = nil
  self.clean = false
end

Instance Attribute Details

#author_nameObject

Returns the value of attribute author_name.



8
9
10
# File 'lib/jazzy/config.rb', line 8

def author_name
  @author_name
end

#author_urlObject

Returns the value of attribute author_url.



12
13
14
# File 'lib/jazzy/config.rb', line 12

def author_url
  @author_url
end

#cleanObject

Returns the value of attribute clean.



15
16
17
# File 'lib/jazzy/config.rb', line 15

def clean
  @clean
end

#dash_urlObject

Returns the value of attribute dash_url.



13
14
15
# File 'lib/jazzy/config.rb', line 13

def dash_url
  @dash_url
end

#github_file_prefixObject

Returns the value of attribute github_file_prefix.



11
12
13
# File 'lib/jazzy/config.rb', line 11

def github_file_prefix
  @github_file_prefix
end

#github_urlObject

Returns the value of attribute github_url.



10
11
12
# File 'lib/jazzy/config.rb', line 10

def github_url
  @github_url
end

#module_nameObject

Returns the value of attribute module_name.



9
10
11
# File 'lib/jazzy/config.rb', line 9

def module_name
  @module_name
end

#outputObject

Returns the value of attribute output.



6
7
8
# File 'lib/jazzy/config.rb', line 6

def output
  @output
end

#sourcekitten_sourcefileObject

Returns the value of attribute sourcekitten_sourcefile.



14
15
16
# File 'lib/jazzy/config.rb', line 14

def sourcekitten_sourcefile
  @sourcekitten_sourcefile
end

#xcodebuild_argumentsObject

Returns the value of attribute xcodebuild_arguments.



7
8
9
# File 'lib/jazzy/config.rb', line 7

def xcodebuild_arguments
  @xcodebuild_arguments
end

Class Method Details

.parse!Object

rubocop:disable Metrics/MethodLength



31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
# File 'lib/jazzy/config.rb', line 31

def self.parse!
  config = new
  OptionParser.new do |opt|
    opt.banner = 'Usage: jazzy'
    opt.separator ''
    opt.separator 'Options'

    opt.on('-o', '--output FOLDER',
           'Folder to output the HTML docs to') do |output|
      config.output = Pathname(output)
    end

    opt.on('-c', '--[no-]clean',
           'Delete contents of output directory before running.',
           'WARNING: If --output is set to ~/Desktop, this will delete the \
            ~/Desktop directory.') do |clean|
      config.clean = clean
    end

    opt.on('-x', '--xcodebuild-arguments arg1,arg2,…argN', Array,
           'Arguments to forward to xcodebuild') do |args|
      config.xcodebuild_arguments = args
    end

    opt.on('-a', '--author AUTHOR_NAME',
           'Name of author to attribute in docs (i.e. Realm)') do |a|
      config.author_name = a
    end

    opt.on('-u', '--author_url URL',
           'Author URL of this project (i.e. http://realm.io)') do |u|
      config.author_url = u
    end

    opt.on('-m', '--module MODULE_NAME',
           'Name of module being documented. (i.e. RealmSwift)') do |m|
      config.module_name = m
    end

    opt.on('-d', '--dash_url URL',
           'URL to install docs in Dash (i.e. dash-feed://...') do |d|
      config.dash_url = d
    end

    opt.on('-g', '--github_url URL',
           'GitHub URL of this project (i.e. \
            https://github.com/realm/realm-cocoa)') do |g|
      config.github_url = g
    end

    opt.on('--github-file-prefix PREFIX',
           'GitHub URL file prefix of this project (i.e. \
            https://github.com/realm/realm-cocoa/tree/v0.87.1)') do |g|
      config.github_file_prefix = g
    end

    opt.on('-s', '--sourcekitten-sourcefile FILEPATH',
           'XML doc file generated from sourcekitten to parse') do |s|
      config.sourcekitten_sourcefile = Pathname(s)
    end

    opt.on('-v', '--version', 'Print version number') do
      puts 'jazzy version: ' + Jazzy::VERSION
      exit
    end

    opt.on('-h', '--help', 'Print this help message') do
      puts opt
      exit
    end
  end.parse!

  config
end