Class: Produce::CommandsGenerator

Inherits:
Object
  • Object
show all
Includes:
Commander::Methods
Defined in:
lib/produce/commands_generator.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.startObject



10
11
12
13
14
15
# File 'lib/produce/commands_generator.rb', line 10

def self.start
  FastlaneCore::UpdateChecker.start_looking_for_update('produce')
  self.new.run
ensure
  FastlaneCore::UpdateChecker.show_update_status('produce', Produce::VERSION)
end

Instance Method Details

#runObject



17
18
19
20
21
22
23
24
25
26
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
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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
# File 'lib/produce/commands_generator.rb', line 17

def run
  program :name, 'produce'
  program :version, Produce::VERSION
  program :description, 'CLI for \'produce\''
  program :help, 'Author', 'Felix Krause <[email protected]>'
  program :help, 'Website', 'https://fastlane.tools'
  program :help, 'GitHub', 'https://github.com/fastlane/produce'
  program :help_formatter, :compact

  global_option('--verbose') { $verbose = true }

  FastlaneCore::CommanderGenerator.new.generate(Produce::Options.available_options)

  command :create do |c|
    c.syntax = 'produce create'
    c.description = 'Creates a new app on iTunes Connect and the Apple Developer Portal'

    c.action do |args, options|
      Produce.config = FastlaneCore::Configuration.create(Produce::Options.available_options, options.__hash__)

      puts Produce::Manager.start_producing
    end
  end

  command :enable_services do |c|
    c.syntax = 'produce enable_services -a APP_IDENTIFIER SERVICE1, SERVICE2, ...'
    c.description = 'Enable specific Application Services for a specific app on the Apple Developer Portal'
    c.example 'Enable HealthKit, HomeKit and Passbook', 'produce enable_services -a com.example.app --healthkit --homekit --passbook'

    c.option '--app-group', 'Enable App Groups'
    c.option '--apple-pay', 'Enable Apple Pay'
    c.option '--associated-domains', 'Enable Associated Domains'
    c.option '--data-protection STRING', String, 'Enable Data Protection, suitable values are "complete", "unlessopen" and "untilfirstauth"'
    c.option '--game-center', 'Enable Game Center'
    c.option '--healthkit', 'Enable HealthKit'
    c.option '--homekit', 'Enable HomeKit'
    c.option '--wireless-conf', 'Enable Wireless Accessory Configuration'
    c.option '--icloud STRING', String, 'Enable iCloud, suitable values are "legacy" and "cloudkit"'
    c.option '--in-app-purchase', 'Enable In-App Purchase'
    c.option '--inter-app-audio', 'Enable Inter-App-Audio'
    c.option '--passbook', 'Enable Passbook'
    c.option '--push-notification', 'Enable Push notification (only enables the service, does not configure certificates)'
    c.option '--sirikit', 'Enable SiriKit'
    c.option '--vpn-conf', 'Enable VPN Configuration'

    c.action do |args, options|
      # Filter the options so that we can still build the configuration
      allowed_keys = Produce::Options.available_options.collect(&:key)
      Produce.config = FastlaneCore::Configuration.create(Produce::Options.available_options, options.__hash__.select { |key, value| allowed_keys.include? key })

      require 'produce/service'
      Produce::Service.enable(options, args)
    end
  end

  command :disable_services do |c|
    c.syntax = 'produce disable_services -a APP_IDENTIFIER SERVICE1, SERVICE2, ...'
    c.description = 'Disable specific Application Services for a specific app on the Apple Developer Portal'
    c.example 'Disable HealthKit', 'produce disable_services -a com.example.app --healthkit'

    c.option '--app-group', 'Disable App Groups'
    c.option '--apple-pay', 'Disable Apple Pay'
    c.option '--associated-domains', 'Disable Associated Domains'
    c.option '--data-protection', 'Disable Data Protection'
    c.option '--game-center', 'Disable Game Center'
    c.option '--healthkit', 'Disable HealthKit'
    c.option '--homekit', 'Disable HomeKit'
    c.option '--wireless-conf', 'Disable Wireless Accessory Configuration'
    c.option '--icloud', 'Disable iCloud'
    c.option '--in-app-purchase', 'Disable In-App Purchase'
    c.option '--inter-app-audio', 'Disable Inter-App-Audio'
    c.option '--passbook', 'Disable Passbook'
    c.option '--push-notification', 'Disable Push notifications'
    c.option '--sirikit', 'Disable SiriKit'
    c.option '--vpn-conf', 'Disable VPN Configuration'

    c.action do |args, options|
      # Filter the options so that we can still build the configuration
      allowed_keys = Produce::Options.available_options.collect(&:key)
      Produce.config = FastlaneCore::Configuration.create(Produce::Options.available_options, options.__hash__.select { |key, value| allowed_keys.include? key })

      require 'produce/service'
      Produce::Service.disable(options, args)
    end
  end

  command :group do |c|
    c.syntax = 'produce group'
    c.description = 'Ensure that a specific App Group exists'
    c.example 'Create group', 'produce group -g group.example.app -n "Example App Group"'

    c.option '-n', '--group_name STRING', String, 'Name for the group that is created (PRODUCE_GROUP_NAME)'
    c.option '-g', '--group_identifier STRING', String, 'Group identifier for the group (PRODUCE_GROUP_IDENTIFIER)'

    c.action do |args, options|
      allowed_keys = Produce::Options.available_options.collect(&:key)
      Produce.config = FastlaneCore::Configuration.create(Produce::Options.available_options, options.__hash__.select { |key, value| allowed_keys.include? key })

      require 'produce/group'
      Produce::Group.new.create(options, args)
    end
  end

  command :associate_group do |c|
    c.syntax = 'produce associate_group -a APP_IDENTIFIER GROUP_IDENTIFIER1, GROUP_IDENTIFIER2, ...'
    c.description = 'Associate with a group, which is create if needed or simply located otherwise'
    c.example 'Associate with group', 'produce associate-group -a com.example.app group.example.com'

    c.action do |args, options|
      Produce.config = FastlaneCore::Configuration.create(Produce::Options.available_options, options.__hash__)

      require 'produce/group'
      Produce::Group.new.associate(options, args)
    end
  end

  default_command :create

  run!
end