Class: UpgradeTool
- Inherits:
-
Object
- Object
- UpgradeTool
- Defined in:
- lib/adaptrex/upgradetool.rb
Instance Method Summary collapse
-
#initialize(adaptrexConfig, appConfig) ⇒ UpgradeTool
constructor
A new instance of UpgradeTool.
- #promptSDKType ⇒ Object
Constructor Details
#initialize(adaptrexConfig, appConfig) ⇒ UpgradeTool
Returns a new instance of UpgradeTool.
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 |
# File 'lib/adaptrex/upgradetool.rb', line 23 def initialize(adaptrexConfig, appConfig) ext = appConfig.extVersion touch = appConfig.touchVersion puts "Upgrade SDK".blue @sdks = [["Adaptrex", "adaptrex"]] if not ext.nil? then @sdks.push(["ExtJS", "ext"]) end if not touch.nil? then @sdks.push(["Sencha Touch", "touch"]) end i = 0 if @sdks.length == 1 sdkType = @sdks[0][1] else for sdk in @sdks puts " [" + (i + 1).to_s + "] " + @sdks[i][0] i += 1 end sdkType = promptSDKType[1] puts "" end if sdkType == "adaptrex" adaptrexInstaller = AdaptrexInstaller.new(adaptrexConfig) appConfig.adaptrexVersion = adaptrexInstaller.version appConfig.write if not appConfig.extVersion.nil? BootstrapInstaller.new(adaptrexConfig, appConfig, "ext") end if not appConfig.touchVersion.nil? BootstrapInstaller.new(adaptrexConfig, appConfig, "touch") end else sdkInstaller = SDKInstaller.new(adaptrexConfig, appConfig, sdkType) end AdaptrexBuilder.new(adaptrexConfig, appConfig) end |
Instance Method Details
#promptSDKType ⇒ Object
63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 |
# File 'lib/adaptrex/upgradetool.rb', line 63 def promptSDKType print "Which SDK do you want to upgrade? : " selection = STDIN.gets.chomp len = @sdks.length erm = ("Invalid selection. Enter a number from 1 to " + len.to_s).err if not selection.numeric? puts erm return promptSDKType end selection = Integer(selection) if not (1..len).include?selection puts erm return promptSDKType end return @sdks[selection - 1] end |