adaptrex 0.9.22
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.
- data/bin/adaptrex +21 -0
- data/lib/adaptrex/adaptrexconfig.rb +130 -0
- data/lib/adaptrex/adaptrexinstaller.rb +46 -0
- data/lib/adaptrex/appconfig.rb +103 -0
- data/lib/adaptrex/bootstrapinstaller.rb +82 -0
- data/lib/adaptrex/builder.rb +93 -0
- data/lib/adaptrex/deletetool.rb +74 -0
- data/lib/adaptrex/generate.rb +222 -0
- data/lib/adaptrex/sdkinstaller.rb +102 -0
- data/lib/adaptrex/themeinstaller.rb +118 -0
- data/lib/adaptrex/themetool.rb +44 -0
- data/lib/adaptrex/upgradetool.rb +64 -0
- data/lib/adaptrex.rb +197 -0
- data/templates/ext/app/controller/Main.js +3 -0
- data/templates/ext/app/view/Main.js +4 -0
- data/templates/ext/app/view/Viewport.js +20 -0
- data/templates/ext/app.js +6 -0
- data/templates/touch/app/view/Main.js +35 -0
- data/templates/touch/app.js +7 -0
- metadata +83 -0
data/lib/adaptrex.rb
ADDED
@@ -0,0 +1,197 @@
|
|
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
|
+
|
17
|
+
# Add the project to the load paths
|
18
|
+
$:.unshift File.dirname(__FILE__)
|
19
|
+
|
20
|
+
require "adaptrex/adaptrexconfig"
|
21
|
+
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
|
+
|
46
|
+
# Utility to run the various Adaptrex scripts
|
47
|
+
class Adaptrex
|
48
|
+
def initialize(basePath, args)
|
49
|
+
puts "--------------------------------------------------------------------------------"
|
50
|
+
puts "Adaptrex Tools".bold
|
51
|
+
|
52
|
+
trap("INT") {
|
53
|
+
puts "\nQuitting Adaptrex Tools\n\n"
|
54
|
+
return
|
55
|
+
}
|
56
|
+
|
57
|
+
# If we don't have a command specificied, just list them
|
58
|
+
if (args.length < 1)
|
59
|
+
listCommands
|
60
|
+
return
|
61
|
+
end
|
62
|
+
|
63
|
+
# Make sure we're running from a webapp folder
|
64
|
+
if not File.directory?"WEB-INF"
|
65
|
+
puts "Adaptrex Tools needs to be run from a webapp folder\n\n".err
|
66
|
+
return
|
67
|
+
end
|
68
|
+
|
69
|
+
# Test for folders with reserved names
|
70
|
+
illegal = []
|
71
|
+
["ext", "touch"].each do |word|
|
72
|
+
if File.directory?word then illegal.push(word) end
|
73
|
+
end
|
74
|
+
if illegal.length > 0
|
75
|
+
puts "Your project includes reserved folders (" + illegal.join(",") + ")".err
|
76
|
+
puts "Please rename or remove those folders before using Adaptrex Tools\n\n".indent
|
77
|
+
return
|
78
|
+
end
|
79
|
+
|
80
|
+
# Print out command title
|
81
|
+
command = args[0]
|
82
|
+
if command == "generate"
|
83
|
+
puts "ExtJS/Sencha Touch Application (Page) Generator".bold
|
84
|
+
elsif command == "build"
|
85
|
+
puts "Webapp Builder".bold
|
86
|
+
elsif command == "theme"
|
87
|
+
puts "Theme Configurator".bold
|
88
|
+
elsif command == "upgrade"
|
89
|
+
puts "SDK Upgrader".bold
|
90
|
+
elsif command == "delete"
|
91
|
+
puts "Application Remover".bold
|
92
|
+
else
|
93
|
+
puts "Command Not Found (#{args[0]})".err
|
94
|
+
listCommands
|
95
|
+
return
|
96
|
+
end
|
97
|
+
puts ""
|
98
|
+
|
99
|
+
# Get our adaptrex config
|
100
|
+
adaptrexConfig = AdaptrexConfig.new
|
101
|
+
appConfig = AppConfig.new(adaptrexConfig)
|
102
|
+
if not appConfig.valid then return end
|
103
|
+
|
104
|
+
# Launch our specific adaptrex command
|
105
|
+
command = args[0]
|
106
|
+
if command == "generate"
|
107
|
+
require "adaptrex/generate"
|
108
|
+
AdaptrexGenerator.new(adaptrexConfig, appConfig, basePath)
|
109
|
+
|
110
|
+
elsif command == "build"
|
111
|
+
require "adaptrex/builder"
|
112
|
+
AdaptrexBuilder.new(adaptrexConfig, appConfig)
|
113
|
+
|
114
|
+
elsif command == "theme"
|
115
|
+
require "adaptrex/themetool"
|
116
|
+
ThemeTool.new(adaptrexConfig, appConfig)
|
117
|
+
|
118
|
+
elsif command == "upgrade"
|
119
|
+
require "adaptrex/upgradetool"
|
120
|
+
UpgradeTool.new(adaptrexConfig, appConfig)
|
121
|
+
|
122
|
+
elsif command == "delete"
|
123
|
+
require "adaptrex/deletetool"
|
124
|
+
DeleteTool.new(appConfig)
|
125
|
+
end
|
126
|
+
|
127
|
+
puts "\nHappy Coding!\n".green
|
128
|
+
end
|
129
|
+
|
130
|
+
# List our current adaptrex commands
|
131
|
+
def listCommands
|
132
|
+
puts ""
|
133
|
+
puts " " + "Commands".bold
|
134
|
+
puts " generate : Generates a new application (page) in your project"
|
135
|
+
puts " build : Build all javascript for production use"
|
136
|
+
puts " theme : Install or update an ExtJS or Sencha Touch theme"
|
137
|
+
puts " upgrade : Upgrade to a new AdaptrexJS, ExtJS or Sencha Touch version"
|
138
|
+
puts " delete : Delete a page and clean up all configuration settings"
|
139
|
+
puts ""
|
140
|
+
end
|
141
|
+
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
|
@@ -0,0 +1,20 @@
|
|
1
|
+
Ext.define('<%= appName %>.view.Viewport', {
|
2
|
+
renderTo : Ext.getBody(),
|
3
|
+
extend : 'Ext.container.Viewport',
|
4
|
+
requires : ['Ext.tab.Panel', 'Ext.layout.container.Border'],
|
5
|
+
layout : {
|
6
|
+
type : 'border'
|
7
|
+
},
|
8
|
+
items : [{
|
9
|
+
region : 'west',
|
10
|
+
xtype : 'panel',
|
11
|
+
title : 'west',
|
12
|
+
width : 150
|
13
|
+
},{
|
14
|
+
region : 'center',
|
15
|
+
xtype : 'tabpanel',
|
16
|
+
items : [{
|
17
|
+
title : 'Center Tab 1'
|
18
|
+
}]
|
19
|
+
}]
|
20
|
+
});
|
@@ -0,0 +1,35 @@
|
|
1
|
+
Ext.define('<%= appName %>.view.Main', {
|
2
|
+
extend : 'Ext.tab.Panel',
|
3
|
+
xtype : 'main',
|
4
|
+
requires : ['Ext.TitleBar', 'Ext.Video'],
|
5
|
+
config : {
|
6
|
+
tabBarPosition : 'bottom',
|
7
|
+
items : [{
|
8
|
+
title : 'Welcome',
|
9
|
+
iconCls : 'home',
|
10
|
+
styleHtmlContent: true,
|
11
|
+
scrollable : true,
|
12
|
+
items : {
|
13
|
+
docked : 'top',
|
14
|
+
xtype : 'titlebar',
|
15
|
+
title : 'Welcome to Sencha Touch 2'
|
16
|
+
},
|
17
|
+
html : [
|
18
|
+
"You've just generated a new Sencha Touch 2 project. What you're looking at right now is the ",
|
19
|
+
"contents of <a target='_blank' href=\"app/view/Main.js\">app/view/Main.js</a> - edit that file ",
|
20
|
+
"and refresh to change what's rendered here."].join("")
|
21
|
+
}, {
|
22
|
+
title : 'Get Started',
|
23
|
+
iconCls : 'action',
|
24
|
+
items : [{
|
25
|
+
docked : 'top',
|
26
|
+
xtype : 'titlebar',
|
27
|
+
title : 'Getting Started'
|
28
|
+
}, {
|
29
|
+
xtype : 'video',
|
30
|
+
url : 'http://av.vimeo.com/64284/137/87347327.mp4?token=1330978144_f9b698fea38cd408d52a2393240c896c',
|
31
|
+
posterUrl : 'http://b.vimeocdn.com/ts/261/062/261062119_640.jpg'
|
32
|
+
}]
|
33
|
+
}]
|
34
|
+
}
|
35
|
+
});
|
metadata
ADDED
@@ -0,0 +1,83 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: adaptrex
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 23
|
5
|
+
prerelease:
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 9
|
9
|
+
- 22
|
10
|
+
version: 0.9.22
|
11
|
+
platform: ruby
|
12
|
+
authors:
|
13
|
+
- Bob Obringer
|
14
|
+
autorequire:
|
15
|
+
bindir: bin
|
16
|
+
cert_chain: []
|
17
|
+
|
18
|
+
date: 2012-12-22 00:00:00 Z
|
19
|
+
dependencies: []
|
20
|
+
|
21
|
+
description: Command Line Tools For Adaptrex
|
22
|
+
email: code@adaptrex.com
|
23
|
+
executables:
|
24
|
+
- adaptrex
|
25
|
+
extensions: []
|
26
|
+
|
27
|
+
extra_rdoc_files: []
|
28
|
+
|
29
|
+
files:
|
30
|
+
- lib/adaptrex/adaptrexconfig.rb
|
31
|
+
- lib/adaptrex/adaptrexinstaller.rb
|
32
|
+
- lib/adaptrex/appconfig.rb
|
33
|
+
- lib/adaptrex/bootstrapinstaller.rb
|
34
|
+
- lib/adaptrex/builder.rb
|
35
|
+
- lib/adaptrex/deletetool.rb
|
36
|
+
- lib/adaptrex/generate.rb
|
37
|
+
- lib/adaptrex/sdkinstaller.rb
|
38
|
+
- lib/adaptrex/themeinstaller.rb
|
39
|
+
- lib/adaptrex/themetool.rb
|
40
|
+
- lib/adaptrex/upgradetool.rb
|
41
|
+
- lib/adaptrex.rb
|
42
|
+
- bin/adaptrex
|
43
|
+
- templates/ext/app/controller/Main.js
|
44
|
+
- templates/ext/app/view/Main.js
|
45
|
+
- templates/ext/app/view/Viewport.js
|
46
|
+
- templates/ext/app.js
|
47
|
+
- templates/touch/app/view/Main.js
|
48
|
+
- templates/touch/app.js
|
49
|
+
homepage: http://adaptrex.com
|
50
|
+
licenses: []
|
51
|
+
|
52
|
+
post_install_message:
|
53
|
+
rdoc_options: []
|
54
|
+
|
55
|
+
require_paths:
|
56
|
+
- lib
|
57
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
58
|
+
none: false
|
59
|
+
requirements:
|
60
|
+
- - ">="
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
hash: 3
|
63
|
+
segments:
|
64
|
+
- 0
|
65
|
+
version: "0"
|
66
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
67
|
+
none: false
|
68
|
+
requirements:
|
69
|
+
- - ">="
|
70
|
+
- !ruby/object:Gem::Version
|
71
|
+
hash: 3
|
72
|
+
segments:
|
73
|
+
- 0
|
74
|
+
version: "0"
|
75
|
+
requirements: []
|
76
|
+
|
77
|
+
rubyforge_project:
|
78
|
+
rubygems_version: 1.8.24
|
79
|
+
signing_key:
|
80
|
+
specification_version: 3
|
81
|
+
summary: Adaptrex
|
82
|
+
test_files: []
|
83
|
+
|