Module: XcodeInstaller::Helpers
- Defined in:
- lib/xcode-installer/helpers.rb
Instance Method Summary collapse
Instance Method Details
#agent ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/xcode-installer/helpers.rb', line 12 def agent unless @agent @agent = XcodeInstaller::Agent.new @agent.instance_eval do def username @username ||= ask "Username:" end def password @password ||= pw "Password:" end # def team # teams_by_name = {} # page.form_with(:name => 'saveTeamSelection').radiobuttons.each do |radio| # name = page.search("label[for=\"#{radio.dom_id}\"]").first.text.strip # teams_by_name[name] = radio.value # end # name = choose "Select a team:", *teams_by_name.keys # @team ||= teams_by_name[name] # end end end @agent end |
#pluralize(n, singular, plural = nil) ⇒ Object
41 42 43 |
# File 'lib/xcode-installer/helpers.rb', line 41 def pluralize(n, singular, plural = nil) n.to_i == 1 ? "1 #{singular}" : "#{n} #{plural || singular + 's'}" end |
#try ⇒ Object
45 46 47 48 49 50 51 52 53 |
# File 'lib/xcode-installer/helpers.rb', line 45 def try return unless block_given? begin yield rescue UnsuccessfulAuthenticationError say_error "Could not authenticate with Apple Developer Center. Check that your username & password are correct, and that your membership is valid and all pending Terms of Service & agreements are accepted. If this problem continues, try logging into https://developer.apple.com/membercenter/ from a browser to see what's going on." and abort end end |