adaptrex 0.9.22 → 0.9.32

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -116,7 +116,7 @@ class AdaptrexConfig
116
116
  Pathname.new(self.weblibPath).children.select {|path|
117
117
  folderName = path.basename.to_s
118
118
  if folderName =~ /\s/
119
- puts "Weblib folder name cannot contain spaces (" + folderName + ")".success
119
+ puts(("Weblib folder name cannot contain spaces (" + folderName + ")").success)
120
120
  puts "It will not be available to your applications.\n".indent
121
121
  else
122
122
  if folderName.start_with?"adaptrex" then self.adaptrexVersions.push(folderName)
@@ -1,3 +1,19 @@
1
+ #
2
+ # Copyright 2012 Adaptrex, LLC
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ #
16
+
1
17
  class AdaptrexInstaller
2
18
 
3
19
  attr_accessor :success, :version
@@ -19,7 +35,7 @@ class AdaptrexInstaller
19
35
  self.version = promptForAdaptrexVersion
20
36
  end
21
37
 
22
- puts "AdaptrexJS Configured (" + self.version + ")".success
38
+ puts(("AdaptrexJS Configured (" + self.version + ")").success)
23
39
  end
24
40
 
25
41
  def promptForAdaptrexVersion
@@ -35,7 +51,7 @@ class AdaptrexInstaller
35
51
  end
36
52
  selection = Integer(selection)
37
53
 
38
- if not selection === 1..len
54
+ if not (1..len).include?selection
39
55
  puts erm
40
56
  return promptForAdaptrexVersion
41
57
  end
@@ -1,3 +1,19 @@
1
+ #
2
+ # Copyright 2012 Adaptrex, LLC
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ #
16
+
1
17
  require "adaptrex/adaptrexinstaller"
2
18
 
3
19
  class AppConfig
@@ -27,25 +27,13 @@ class BootstrapInstaller
27
27
  adaptrexVersion = appConfig.adaptrexVersion
28
28
  puts "Generating the bootstrap file for " + adaptrexVersion + " and " + sdkVersion + "..."
29
29
 
30
- adaptrexPath = adaptrexConfig.weblibPath + "/" + adaptrexVersion
31
30
  sdkPath = adaptrexConfig.weblibPath + "/" + sdkVersion
32
-
33
- cmdParts = nil
34
- tmpDir = nil
31
+ adaptrexSdkPath = adaptrexConfig.weblibPath + "/" + adaptrexVersion + "/" + sdkType
32
+
35
33
  if isExt
36
- cmdParts = [
37
- "and include -r -f ExtDependencies.js",
38
- "and exclude -t core",
39
- "and include -na Adaptrex.override.ext",
40
- "and exclude -f ExtDependencies.js",
41
- ]
34
+ dependencyFile = "ExtDependencies.js"
42
35
  else
43
- cmdParts = [
44
- "and include -r -f TouchDependencies.js",
45
- "and exclude -t core",
46
- "and include -na Adaptrex.override.touch",
47
- "and exclude -f TouchDependencies.js",
48
- ]
36
+ dependencyFile = "TouchDependencies.js"
49
37
 
50
38
  # Sencha Touch 2.1.0 has a bug that prevents compilation. The file containing
51
39
  # the bug is not required for the bootstrap file so we move it to a temp file
@@ -55,10 +43,18 @@ class BootstrapInstaller
55
43
  end
56
44
 
57
45
  begin
58
- cmd = "sencha -sdk " + sdkPath + " compile -classpath " + adaptrexPath + "/src" +
59
- " exclude -all and " + cmdParts.join(" and ") +
60
- " and concat adaptrex/" + sdkType + "/bootstrap-debug.js" +
61
- " and concat -compress adaptrex/" + sdkType + "/bootstrap.js"
46
+ cmd = [
47
+ "sencha -sdk " + sdkPath + " compile",
48
+ " -classpath ",
49
+ adaptrexSdkPath + "/src/",
50
+ " exclude -all",
51
+ " and include -r -f " + dependencyFile,
52
+ " and exclude -t core",
53
+ " and include -na Adaptrex.override",
54
+ " and exclude -f " + dependencyFile,
55
+ " and concat adaptrex/" + sdkType + "/bootstrap-debug.js",
56
+ " and concat -compress adaptrex/" + sdkType + "/bootstrap.js"
57
+ ].join("")
62
58
  compileOutput = `#{cmd}`
63
59
 
64
60
  if compileOutput.include?"[ERR]"
@@ -21,57 +21,70 @@ require "fileutils"
21
21
  class AdaptrexBuilder
22
22
  def initialize(adaptrexConfig, appConfig)
23
23
  weblib = adaptrexConfig.weblibPath
24
-
24
+
25
25
  if appConfig.pages.length == 0
26
26
  puts "There are no apps (pages) to be compiled".warn
27
27
  return
28
28
  end
29
29
 
30
-
31
30
  # Loop through each app and compile
32
31
  appConfig.pages.each do|key,val|
33
32
  appPath = key
34
33
  parts = val.split(",")
35
34
  appName = parts[0]
36
35
  sdkType = parts[1]
37
-
36
+
38
37
  puts "Compiling " + appName + " (" + appPath + ")"
39
-
40
- if sdkType == "ext"
41
- sdkVersion = appConfig.extVersion
42
- excludes = "ExtDependencies.js"
38
+
39
+ if sdkType == "ext"
40
+ sdkVersion = appConfig.extVersion
43
41
  sdkPath = weblib + "/" + sdkVersion
44
-
45
- else
42
+ includes = "ExtDependencies.js"
43
+ else
46
44
  sdkVersion = appConfig.touchVersion
47
- excludes = "TouchDependencies.js"
48
45
  sdkPath = weblib + "/" + sdkVersion
49
-
46
+ includes = "TouchDependencies.js"
47
+
50
48
  # Sencha Touch 2.1.0 has a bug that prevents compilation. The file containing
51
49
  # the bug is not required for the bootstrap file so we move it to a temp file
52
50
  # during the compilation and restore it
53
51
  tmpDir = Dir.tmpdir
54
- FileUtils.mv(sdkPath + "/src/ux/auth2", tmpDir + "_senchatouch_auth2")
52
+ FileUtils.mv(sdkPath + "/src/ux/auth2", tmpDir + "_senchatouch_auth2")
55
53
  end
54
+
55
+ #
56
+ # Create Ghosts
57
+ #
58
+ if not createGhosts?(sdkPath, appPath) then return end
56
59
 
60
+ if sdkType == "ext" then sdkFile = "ext" else sdkFile = "sencha-touch" end
61
+
57
62
  begin
58
- cmd = "sencha -d -sdk=" + sdkPath + " compile" +
59
- " -classpath=" +
60
- appPath + "/app.js," +
61
- appPath + "/app," +
62
- weblib + "/" + appConfig.adaptrexVersion + "/src" +
63
- " exclude -all" +
64
- " and include -r -f " + appPath + "/app.js" +
65
- " and save appset" +
66
- " and exclude -all" +
67
- " and include -r -f " + excludes +
68
- " and save bootstrapexcludes" +
69
- " and exclude -all" +
70
- " and include -s appset and exclude -s bootstrapexcludes" +
71
- " and concat " + appPath + "/app-all-debug.js" +
72
- " and concat -compress " + appPath + "/app-all.js"
63
+ cmd = [
64
+ "sencha -d -sdk " + sdkPath + " compile",
65
+ " -classpath ",
66
+ "adaptrex/ghosts.js," +
67
+ appPath + "/app.js,",
68
+ appPath + "/app,",
69
+ weblib + "/" + appConfig.adaptrexVersion + "/" + sdkType + "/src,",
70
+ sdkPath + "/src",
71
+ " exclude -all",
72
+ " and include -r -f " + appPath + "/app.js",
73
+ " and exclude -f " + sdkPath + "/src",
74
+ " and concat " + appPath + "/app-all-debug.js",
75
+ " and concat -compress " + appPath + "/app-all.js",
76
+ " and save appset",
77
+ " and exclude -all",
78
+ " and include -r -f " + appPath + "/app.js",
79
+ " and include -na Adaptrex.override",
80
+ " and include -r -f " + includes,
81
+ " and exclude -s appset",
82
+ " and exclude -f " + includes,
83
+ " and concat " + appPath + "/app-" + sdkFile + "-debug.js",
84
+ " and concat -compress " + appPath + "/app-" + sdkFile + ".js"
85
+ ].join("")
73
86
  compileOutput = `#{cmd}`
74
-
87
+
75
88
  if compileOutput.include?"[ERR]"
76
89
  puts((appName + " (" + appPath + ")").err)
77
90
  puts "See the output from Sencha Cmd for more information".indent
@@ -80,14 +93,40 @@ class AdaptrexBuilder
80
93
  print((appName + " (" + appPath + ")").success)
81
94
  puts ""
82
95
  end
83
-
96
+
84
97
  ensure
85
98
  # Move the broken auth2 ux back to the original Sencha Touch source folder
86
- if not sdkType == "ext"
99
+ if not sdkType == "ext"
87
100
  FileUtils.mv(tmpDir + "_senchatouch_auth2", sdkPath + "/src/ux/auth2")
88
101
  end
89
102
  end
90
103
  end
91
104
  end
92
105
 
106
+ #
107
+ # Scan for missing model/store dependencies that should be autogenerated
108
+ #
109
+ $failPattern = "failed to find meta class definition for name"
110
+ def createGhosts?(sdkPath,appPath)
111
+ ghosts = "adaptrex/ghosts.js"
112
+ if not File.exist?(ghosts) then File.open(ghosts, "w") {} end
113
+
114
+ cmd = "sencha -sdk=" + sdkPath + " compile" +
115
+ " -classpath=" + appPath + "/app.js," + appPath + "/app," + ghosts
116
+ " exclude -a"
117
+ compileOutput = `#{cmd}`
118
+
119
+ if compileOutput.include?"[ERR]"
120
+ if compileOutput.include?$failPattern
121
+ failedClass = compileOutput.split($failPattern)[1].split("\n")[0].strip
122
+ if (failedClass.include?".store." or failedClass.include?".model.")
123
+ File.open(ghosts,"a") {|f| f.puts("Ext.define('" + failedClass + "',{})")}
124
+ return createGhosts?(sdkPath,appPath)
125
+ end
126
+ end
127
+ false
128
+ end
129
+
130
+ true
131
+ end
93
132
  end
@@ -1,3 +1,19 @@
1
+ #
2
+ # Copyright 2012 Adaptrex, LLC
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ #
16
+
1
17
  require "fileutils"
2
18
 
3
19
  class DeleteTool
@@ -33,7 +49,7 @@ class DeleteTool
33
49
  puts ""
34
50
 
35
51
  appToDelete = promptForApplication
36
- puts "Are you sure you want to delete " + appToDelete["text"] + ")?".warn
52
+ puts(("Are you sure you want to delete " + appToDelete["text"] + ")?").warn)
37
53
  print "Type 'DELETE' to confirm: ".indent
38
54
  confirm = STDIN.gets.chomp
39
55
 
@@ -58,13 +74,13 @@ class DeleteTool
58
74
  print "Which page do you want to delete? : "
59
75
  selection = STDIN.gets.chomp
60
76
  len = @appPages.length
61
- erm = ("Invalid selection. Enter a number from 1 to " + len.to_s).warn
77
+ erm = ("Invalid selection. Enter a number from 1 to " + len.to_s).err
62
78
  if not selection.numeric?
63
79
  puts erm
64
80
  return promptForApplication
65
81
  end
66
82
  selection = Integer(selection)
67
- if not selection === 1..len
83
+ if not (1..len).include?selection
68
84
  puts erm
69
85
  return promptForApplication
70
86
  end
@@ -93,7 +93,7 @@ class AdaptrexGenerator
93
93
  # Make sure this page doesn't already exist
94
94
  #
95
95
  if File.directory?appPath
96
- puts "App (page) already exists at this path (" + appPath + ")".err
96
+ puts(("App (page) already exists at this path (" + appPath + ")").err)
97
97
  return appWizard
98
98
  end
99
99
 
@@ -168,12 +168,12 @@ class AdaptrexGenerator
168
168
 
169
169
  responseFolder = response + "/"
170
170
  if (responseFolder.start_with?"ext/" or response.start_with?"touch/" or response.start_with?"adaptrex/")
171
- puts "'" + responseFolder.split("/")[0] + "' is a reserved folder name".err
171
+ puts(("'" + responseFolder.split("/")[0] + "' is a reserved folder name").err)
172
172
  return promptForPagePath
173
173
  end
174
174
 
175
175
  if not response.validate?(/\A[a-z][a-z0-9\/\-\_]*\z/)
176
- puts "Must be lowercase letters, numbers, underscore (_) or dash (-)".err
176
+ puts(("Must be lowercase letters, numbers, underscore (_) or dash (-)").err)
177
177
  return promptForPagePath
178
178
  end
179
179
 
@@ -198,7 +198,7 @@ class AdaptrexGenerator
198
198
 
199
199
  print "Which type of page do you want to create? [" + default + "] : "
200
200
  response = STDIN.gets.chomp
201
- if response == "" then return default end
201
+ if response == "" then response = default end
202
202
  if response == "1" then return "ext" end
203
203
  if response == "2" then return "touch" end
204
204
 
@@ -1,3 +1,19 @@
1
+ #
2
+ # Copyright 2012 Adaptrex, LLC
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ #
16
+
1
17
  require "adaptrex/bootstrapinstaller"
2
18
  require "adaptrex/themeinstaller"
3
19
 
@@ -92,7 +108,7 @@ class SDKInstaller
92
108
  end
93
109
 
94
110
  selection = Integer(selection)
95
- if not selection === 1..len
111
+ if not (1..len).include?selection
96
112
  puts erm
97
113
  return promptForSDKVersion
98
114
  end
@@ -1,10 +1,26 @@
1
+ #
2
+ # Copyright 2012 Adaptrex, LLC
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ #
16
+
1
17
  require "fileutils"
2
18
 
3
19
  class ThemeInstaller
4
20
 
5
21
  @@touchThemes = [
6
- #["Adaptrex Touch Theme", "adaptrex", "adaptrex-all.css"],
7
- ["Sencha Touch Default Theme", "default", "ext-all.css"],
22
+ ["All Adaptrex Touch Themes", "adaptrex", "adaptrex"],
23
+ ["All Sencha Touch Default Themes", "default", "default"],
8
24
  #["Custom Theme", "custom", "custom"]
9
25
  ]
10
26
 
@@ -44,17 +60,26 @@ class ThemeInstaller
44
60
  targetFolder = "adaptrex/" + sdkType + "/resources"
45
61
 
46
62
  # Clean out old theme
47
- FileUtils.rm_rf(targetFolder)
63
+ # FileUtils.rm_rf(targetFolder)
48
64
  FileUtils.mkdir_p(targetFolder + "/css")
49
65
 
50
66
  # Add additional touch theme files
51
- if sdkType == "touch"
52
- sdkResourcesFolder = adaptrexConfig.weblibPath + "/" + appConfig.touchVersion + "/resources"
53
- Dir.glob(sdkResourcesFolder + "/css/*") {|f|
54
- if not File.directory?f
55
- FileUtils.cp(File.expand_path(f), targetFolder + "/css/")
56
- end
57
- }
67
+ if sdkType == "touch"
68
+ if imgFolder == "adaptrex"
69
+ sdkResourcesFolder = adaptrexConfig.weblibPath + "/" + appConfig.adaptrexVersion + "/touch/resources"
70
+ Dir.glob(sdkResourcesFolder + "/css/*") {|f|
71
+ if not File.directory?f
72
+ FileUtils.cp(File.expand_path(f), targetFolder + "/css/")
73
+ end
74
+ }
75
+ else
76
+ sdkResourcesFolder = adaptrexConfig.weblibPath + "/" + appConfig.touchVersion + "/resources"
77
+ Dir.glob(sdkResourcesFolder + "/css/*") {|f|
78
+ if not File.directory?f
79
+ FileUtils.cp(File.expand_path(f), targetFolder + "/css/")
80
+ end
81
+ }
82
+ end
58
83
 
59
84
  # Add additional ext theme files
60
85
  else
@@ -63,7 +88,7 @@ class ThemeInstaller
63
88
  # Adaptrex Theme Not Yet Implemented
64
89
  if imgFolder == "adaptrex"
65
90
  sdkResourcesFolder = adaptrexConfig.weblibPath + "/" + appConfig.adaptrexVersion + "/resources"
66
- FileUtils.cp(sdkResourcesFolder + "/css/" + cssFile, targetFolder + "/css/" + cssFile)
91
+ FileUtils.cp(sdkResourcesFolder + "/css/" + cssFile, targetFolder + "/css/theme.css")
67
92
  FileUtils.cp_r(sdkResourcesFolder + "/themes/images/" + imgFolder, targetFolder + "/themes/images/" + imgFolder)
68
93
 
69
94
  # Custom Themes Not Yet Implemented
@@ -73,14 +98,17 @@ class ThemeInstaller
73
98
  # Standard Ext Themes
74
99
  else
75
100
  sdkResourcesFolder = adaptrexConfig.weblibPath + "/" + appConfig.extVersion + "/resources"
76
- FileUtils.cp(sdkResourcesFolder + "/css/" + cssFile, targetFolder + "/css/" + cssFile)
77
- FileUtils.cp_r(sdkResourcesFolder + "/themes/images/" + imgFolder, targetFolder + "/themes/images/" + imgFolder)
78
101
 
79
102
  # Neptune needs some extra files
80
103
  if imgFolder == "neptune"
81
- FileUtils.cp_r(sdkResourcesFolder + "/themes/images/default", targetFolder + "/themes/images/default/")
104
+ FileUtils.cp_r(sdkResourcesFolder + "/themes/images/default", targetFolder + "/themes/images/neptune")
82
105
  FileUtils.cp(adaptrexConfig.weblibPath + "/" + appConfig.extVersion + "/ext-neptune.js", "adaptrex/" + sdkType + "/ext-neptune.js")
106
+ elsif imgFolder == "access"
107
+ FileUtils.cp_r(sdkResourcesFolder + "/themes/images/default", targetFolder + "/themes/images/neptune")
83
108
  end
109
+
110
+ FileUtils.cp(sdkResourcesFolder + "/css/" + cssFile, targetFolder + "/css/" + cssFile)
111
+ FileUtils.cp_r(sdkResourcesFolder + "/themes/images/" + imgFolder, targetFolder + "/themes/images/" + imgFolder)
84
112
  end
85
113
  end
86
114
 
@@ -90,11 +118,6 @@ class ThemeInstaller
90
118
  end
91
119
 
92
120
  def promptForTheme(sdkType)
93
- # Temporary until we add support for other touch themes
94
- if sdkType == "touch"
95
- return @@touchThemes[0]
96
- end
97
-
98
121
  print "Which theme do you want to use? [1]: "
99
122
 
100
123
  if sdkType == "touch" then options = @@touchThemes else options = @@extThemes end
@@ -109,7 +132,7 @@ class ThemeInstaller
109
132
  return promptForTheme(sdkType)
110
133
  end
111
134
  selection = Integer(selection)
112
- if not selection === 1..len
135
+ if not (1..len).include?selection
113
136
  puts erm
114
137
  return promptForTheme(sdkType)
115
138
  end
@@ -1,3 +1,19 @@
1
+ #
2
+ # Copyright 2012 Adaptrex, LLC
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ #
16
+
1
17
  require "adaptrex/themeinstaller"
2
18
 
3
19
  class ThemeTool
@@ -1,5 +1,22 @@
1
+ #
2
+ # Copyright 2012 Adaptrex, LLC
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ #
16
+
1
17
  require "adaptrex/sdkinstaller"
2
18
  require "adaptrex/adaptrexinstaller"
19
+ require "adaptrex/builder"
3
20
 
4
21
  class UpgradeTool
5
22
 
@@ -39,6 +56,8 @@ class UpgradeTool
39
56
  else
40
57
  sdkInstaller = SDKInstaller.new(adaptrexConfig, appConfig, sdkType)
41
58
  end
59
+
60
+ AdaptrexBuilder.new(adaptrexConfig, appConfig)
42
61
  end
43
62
 
44
63
  def promptSDKType
@@ -53,7 +72,7 @@ class UpgradeTool
53
72
  end
54
73
 
55
74
  selection = Integer(selection)
56
- if not selection === 1..len
75
+ if not (1..len).include?selection
57
76
  puts erm
58
77
  return promptSDKType
59
78
  end
data/lib/adaptrex.rb CHANGED
@@ -17,36 +17,14 @@
17
17
  # Add the project to the load paths
18
18
  $:.unshift File.dirname(__FILE__)
19
19
 
20
+ require "globals"
20
21
  require "adaptrex/adaptrexconfig"
21
22
  require "adaptrex/appconfig"
22
- require 'rbconfig'
23
-
24
- def gem_available?(gemname)
25
- if Gem::Specification.methods.include?(:find_all_by_name)
26
- not Gem::Specification.find_all_by_name(gemname).empty?
27
- else
28
- Gem.available?(gemname)
29
- end
30
- end
31
-
32
- $isWindows = (RbConfig::CONFIG['host_os'] =~ /mswin|mingw|cygwin/)
33
- if $isWindows
34
- begin
35
- if not gem_available?('win32console')
36
- puts "Installing win32console..."
37
- `gem install win32console`
38
- Gem.clear_paths
39
- end
40
- require "win32console"
41
- rescue
42
- puts "Couldn't load win32console. ANSI colors will not be available"
43
- end
44
- end
45
23
 
46
24
  # Utility to run the various Adaptrex scripts
47
25
  class Adaptrex
48
26
  def initialize(basePath, args)
49
- puts "--------------------------------------------------------------------------------"
27
+ puts "-------------------------------------------------------------------------------"
50
28
  puts "Adaptrex Tools".bold
51
29
 
52
30
  trap("INT") {
@@ -62,8 +40,12 @@ class Adaptrex
62
40
 
63
41
  # Make sure we're running from a webapp folder
64
42
  if not File.directory?"WEB-INF"
65
- puts "Adaptrex Tools needs to be run from a webapp folder\n\n".err
66
- return
43
+ if File.directory?"src/main/webapp/WEB-INF"
44
+ Dir.chdir("src/main/webapp")
45
+ else
46
+ puts "Adaptrex Tools needs to be run from a webapp folder\n\n".err
47
+ return
48
+ end
67
49
  end
68
50
 
69
51
  # Test for folders with reserved names
@@ -124,7 +106,10 @@ class Adaptrex
124
106
  DeleteTool.new(appConfig)
125
107
  end
126
108
 
127
- puts "\nHappy Coding!\n".green
109
+ if not command == "build" then
110
+ puts "\nHappy Coding!".green
111
+ end
112
+ puts ""
128
113
  end
129
114
 
130
115
  # List our current adaptrex commands
@@ -139,59 +124,3 @@ class Adaptrex
139
124
  puts ""
140
125
  end
141
126
  end
142
-
143
- # Extend String For Our Evil Purposes
144
- class String
145
- def numeric?
146
- Float(self) != nil rescue false
147
- end
148
-
149
- def validate? regex
150
- !self[regex].nil?
151
- end
152
-
153
- {
154
- :reset => 0,
155
- :bold => 1,
156
- :dark => 2,
157
- :underline => 4,
158
- :blink => 5,
159
- :neg => 7,
160
- :black => 30,
161
- :red => 31,
162
- :green => 32,
163
- :yellow => 33,
164
- :blue => 34,
165
- :magenta => 35,
166
- :cyan => 36,
167
- :white => 37
168
- }.each do |key, value|
169
- if (not $isWindows or ($isWindows and gem_available?('win32console')))
170
- define_method key do
171
- "\e[#{value}m" + self + "\e[0m"
172
- end
173
- else
174
- define_method key do
175
- self
176
- end
177
- end
178
- end
179
-
180
- def err
181
- c = " ERROR ".red + self
182
- if $isWindows then c.bold else c end
183
- end
184
-
185
- def warn
186
- " WARNING ".yellow + self
187
- end
188
-
189
- def success
190
- " SUCCESS ".green + self
191
- end
192
-
193
- def indent
194
- " " + self
195
- end
196
-
197
- end
data/lib/globals.rb ADDED
@@ -0,0 +1,96 @@
1
+ #
2
+ # Copyright 2012 Adaptrex, LLC
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ #
16
+ require 'rbconfig'
17
+
18
+ def gem_available?(gemname)
19
+ if Gem::Specification.methods.include?(:find_all_by_name)
20
+ not Gem::Specification.find_all_by_name(gemname).empty?
21
+ else
22
+ Gem.available?(gemname)
23
+ end
24
+ end
25
+
26
+ $isWindows = (RbConfig::CONFIG['host_os'] =~ /mswin|mingw|cygwin/)
27
+ if $isWindows
28
+ begin
29
+ if not gem_available?('win32console')
30
+ puts "Installing win32console..."
31
+ `gem install win32console`
32
+ Gem.clear_paths
33
+ end
34
+ require "win32console"
35
+ rescue
36
+ puts "Couldn't load win32console. ANSI colors will not be available"
37
+ end
38
+ end
39
+
40
+
41
+
42
+ # Extend String For Our Evil Purposes
43
+ class String
44
+ def numeric?
45
+ Float(self) != nil rescue false
46
+ end
47
+
48
+ def validate? regex
49
+ !self[regex].nil?
50
+ end
51
+
52
+ {
53
+ :reset => 0,
54
+ :bold => 1,
55
+ :dark => 2,
56
+ :underline => 4,
57
+ :blink => 5,
58
+ :neg => 7,
59
+ :black => 30,
60
+ :red => 31,
61
+ :green => 32,
62
+ :yellow => 33,
63
+ :blue => 34,
64
+ :magenta => 35,
65
+ :cyan => 36,
66
+ :white => 37
67
+ }.each do |key, value|
68
+ if (not $isWindows or ($isWindows and gem_available?('win32console')))
69
+ define_method key do
70
+ "\e[#{value}m" + self + "\e[0m"
71
+ end
72
+ else
73
+ define_method key do
74
+ self
75
+ end
76
+ end
77
+ end
78
+
79
+ def err
80
+ c = " ERROR ".red + self
81
+ if $isWindows then c.bold else c end
82
+ end
83
+
84
+ def warn
85
+ " WARNING ".yellow + self
86
+ end
87
+
88
+ def success
89
+ " SUCCESS ".green + self
90
+ end
91
+
92
+ def indent
93
+ " " + self
94
+ end
95
+
96
+ end
@@ -1,6 +1,9 @@
1
1
  Ext.application({
2
2
  name : '<%= appName %>',
3
3
  views : ['Main'],
4
+ requires : [
5
+ "Ext.viewport.Viewport"
6
+ ],
4
7
  launch : function() {
5
8
  Ext.Viewport.add(Ext.create('<%= appName %>.view.Main'));
6
9
  }
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: adaptrex
3
3
  version: !ruby/object:Gem::Version
4
- hash: 23
4
+ hash: 123
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 9
9
- - 22
10
- version: 0.9.22
9
+ - 32
10
+ version: 0.9.32
11
11
  platform: ruby
12
12
  authors:
13
13
  - Bob Obringer
@@ -39,6 +39,7 @@ files:
39
39
  - lib/adaptrex/themetool.rb
40
40
  - lib/adaptrex/upgradetool.rb
41
41
  - lib/adaptrex.rb
42
+ - lib/globals.rb
42
43
  - bin/adaptrex
43
44
  - templates/ext/app/controller/Main.js
44
45
  - templates/ext/app/view/Main.js