Class: ThemeTool

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

Instance Method Summary collapse

Constructor Details

#initialize(adaptrexConfig, appConfig) ⇒ ThemeTool

Returns a new instance of ThemeTool.



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/adaptrex/themetool.rb', line 21

def initialize(adaptrexConfig, appConfig)
	@appConfig = appConfig
	ext = appConfig.extVersion
	touch = appConfig.touchVersion
	
	if not ext.nil? and not touch.nil?
		puts "Theme SDK".blue
		puts "  [1] ExtJS"
		puts "  [2] Sencha Touch"
		sdkType = promptSDKType
	elsif not ext.nil?
		sdkType = "ext"
	elsif not touch.nil?
		typeType = "touch"
	else
		puts "Your webapp does not have any configured SDKs.  When you create a new".warn
		puts "page using 'adaptrex generate', your SDK and theme will be configured.".indent
		return
	end
	puts ""
	
	themeInstaller = ThemeInstaller.new(adaptrexConfig, appConfig, sdkType)
end

Instance Method Details

#promptSDKTypeObject



45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# File 'lib/adaptrex/themetool.rb', line 45

def promptSDKType
	default = "1"
	if not @appConfig.lastSDK.nil?
		if @appConfig.lastSDK == "ext" then default = "1" else default = "2" end
	end
	
	print "Which SDK do you want to update the theme for? [" + default + "] : "
	response = STDIN.gets.chomp
	if response == "" then return default end
	if response == "1" then return "ext" end
	if response == "2" then return "touch" end

	puts "Invalid selection. Enter a number from 1 to 2".err
	return promptSDKType
end