depo 0.0.1
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/MIT-LICENSE +20 -0
- data/README.rdoc +71 -0
- data/Rakefile +50 -0
- data/generators/depo_config/USAGE +5 -0
- data/generators/depo_config/depo_config_generator.rb +8 -0
- data/generators/depo_config/templates/depo.rb +9 -0
- data/generators/dijit/USAGE +0 -0
- data/generators/dijit/dijit_generator.rb +34 -0
- data/generators/dijit/templates/class.js +30 -0
- data/generators/dijit/templates/style.css +4 -0
- data/generators/dijit/templates/test.html +15 -0
- data/generators/dijit/templates/test.js +11 -0
- data/generators/dpage/USAGE +33 -0
- data/generators/dpage/dpage_generator.rb +39 -0
- data/generators/dpage/templates/app/controllers.js +12 -0
- data/generators/dpage/templates/app/models.js +5 -0
- data/generators/dpage/templates/app/views.js +4 -0
- data/generators/dpage/templates/controller.rb +8 -0
- data/generators/dpage/templates/default_stylesheets/all.css +0 -0
- data/generators/dpage/templates/default_stylesheets/common.css +11 -0
- data/generators/dpage/templates/default_stylesheets/reset.css +51 -0
- data/generators/dpage/templates/default_stylesheets/theme_override.css +3 -0
- data/generators/dpage/templates/dpage.css +6 -0
- data/generators/dpage/templates/dpage.js +4 -0
- data/generators/dpage/templates/helper.rb +9 -0
- data/generators/dpage/templates/helper_test.rb +5 -0
- data/generators/dpage/templates/view.haml +28 -0
- data/init.rb +2 -0
- data/install.rb +1 -0
- data/lib/depo/build.rb +53 -0
- data/lib/depo/config.rb +82 -0
- data/lib/depo/dijit_conventions.rb +101 -0
- data/lib/depo/tasks.rb +1 -0
- data/lib/depo/templates/dojo_src.tpl +4 -0
- data/lib/depo/templates/profile.js +8 -0
- data/lib/depo/view_helpers.rb +32 -0
- data/lib/depo.rb +36 -0
- data/tasks/depo.rake +29 -0
- data/test/action_pack_test.rb +49 -0
- data/test/build_profile_test.rb +32 -0
- data/test/config_test.rb +55 -0
- data/test/database.yml +6 -0
- data/test/generators_test.rb +59 -0
- data/test/path_utils_test.rb +18 -0
- data/test/rails_root/public/ria/src/app/my/Dijit.js +28 -0
- data/test/rails_root/public/ria/src/app/tests/my/Dijit.html +16 -0
- data/test/rails_root/public/ria/src/app/tests/my/Dijit.js +11 -0
- data/test/rails_root/public/ria/src/app/themes/tundra/my/Dijit.css +4 -0
- data/test/test_helper.rb +104 -0
- data/uninstall.rb +1 -0
- metadata +133 -0
data/MIT-LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2010 [name of plugin creator]
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.rdoc
ADDED
@@ -0,0 +1,71 @@
|
|
1
|
+
= Depo (Dojo On Rails)
|
2
|
+
|
3
|
+
Is attempt to automate many tasks and practices in building RIA using Dojo and Rails.
|
4
|
+
|
5
|
+
== Installation
|
6
|
+
|
7
|
+
1. sudo gem install depo
|
8
|
+
or in config/environment.rb:
|
9
|
+
...
|
10
|
+
config.gem 'depo'
|
11
|
+
...
|
12
|
+
>> sudo rake gems:install
|
13
|
+
1. rake dojo:install
|
14
|
+
|
15
|
+
|
16
|
+
== FEATURES ABSTRACT:
|
17
|
+
|
18
|
+
* Some conventions and practices about Dojo-Rails project structure and management
|
19
|
+
* Automate dojo installation and update
|
20
|
+
* Automate builds
|
21
|
+
* Generators for custom widgets (DijitGenerator) and one page applications
|
22
|
+
* ActionView Helper
|
23
|
+
|
24
|
+
== SAMPLE CONFIGURATION:
|
25
|
+
Depo.configure {
|
26
|
+
author 'niquola'
|
27
|
+
themes ['basic']
|
28
|
+
default_theme 'basic'
|
29
|
+
dojo_version '1.4.1'
|
30
|
+
base_webpath '/myapplication'
|
31
|
+
|
32
|
+
build_options {
|
33
|
+
cssOptimize 'comments.keepLines'
|
34
|
+
optimize 'shrinksafe.keepLines'
|
35
|
+
cssImportIgnore '../dijit.css'
|
36
|
+
internStrings 'true'
|
37
|
+
}
|
38
|
+
|
39
|
+
build_profile {
|
40
|
+
libs<< 'app'
|
41
|
+
|
42
|
+
pages<< "app.pages.dashboard"
|
43
|
+
pages<< "app.pages.admin"
|
44
|
+
}
|
45
|
+
}
|
46
|
+
|
47
|
+
|
48
|
+
== LICENSE:
|
49
|
+
|
50
|
+
(The MIT License)
|
51
|
+
|
52
|
+
Copyright (c) 2010 niquola
|
53
|
+
|
54
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
55
|
+
a copy of this software and associated documentation files (the
|
56
|
+
'Software'), to deal in the Software without restriction, including
|
57
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
58
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
59
|
+
permit persons to whom the Software is furnished to do so, subject to
|
60
|
+
the following conditions:
|
61
|
+
|
62
|
+
The above copyright notice and this permission notice shall be
|
63
|
+
included in all copies or substantial portions of the Software.
|
64
|
+
|
65
|
+
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
66
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
67
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
68
|
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
69
|
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
70
|
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
71
|
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/Rakefile
ADDED
@@ -0,0 +1,50 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'rake'
|
3
|
+
require 'rake/testtask'
|
4
|
+
require 'rake/rdoctask'
|
5
|
+
require 'rake/gempackagetask'
|
6
|
+
|
7
|
+
desc 'Default: run unit tests.'
|
8
|
+
task :default => :test
|
9
|
+
|
10
|
+
desc 'Test the dojo_on_rails plugin.'
|
11
|
+
Rake::TestTask.new(:test) do |t|
|
12
|
+
t.libs << 'lib'
|
13
|
+
t.libs << 'test'
|
14
|
+
#t.pattern = 'test/*_test.rb'
|
15
|
+
t.test_files = FileList['test/*_test.rb']
|
16
|
+
t.verbose = true
|
17
|
+
end
|
18
|
+
|
19
|
+
desc 'Generate documentation for the dojo_on_rails plugin.'
|
20
|
+
Rake::RDocTask.new(:rdoc) do |rdoc|
|
21
|
+
rdoc.rdoc_dir = 'rdoc'
|
22
|
+
rdoc.title = 'depo'
|
23
|
+
rdoc.options << '--line-numbers' << '--inline-source'
|
24
|
+
rdoc.rdoc_files.include('README.rdoc')
|
25
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
26
|
+
end
|
27
|
+
|
28
|
+
PKG_FILES = FileList[ '[a-zA-Z]*', 'generators/**/*', 'lib/**/*', 'rails/**/*', 'tasks/**/*', 'test/**/*' ]
|
29
|
+
|
30
|
+
spec = Gem::Specification.new do |s|
|
31
|
+
s.name = "depo"
|
32
|
+
s.version = "0.0.1"
|
33
|
+
s.author = "niquola, smecsia"
|
34
|
+
s.email = "niquola@gmail.com"
|
35
|
+
#s.homepage = ""
|
36
|
+
s.platform = Gem::Platform::RUBY
|
37
|
+
s.summary = "Rails & Dojo integration"
|
38
|
+
s.add_dependency('dojo_src')
|
39
|
+
s.add_dependency('rails', '>= 2.3.5')
|
40
|
+
s.add_dependency('kung_figure', '0.0.2')
|
41
|
+
s.files = PKG_FILES.to_a
|
42
|
+
s.require_path = "lib"
|
43
|
+
s.has_rdoc = false
|
44
|
+
s.extra_rdoc_files = ["README.rdoc"]
|
45
|
+
end
|
46
|
+
|
47
|
+
desc 'Turn this plugin into a gem.'
|
48
|
+
Rake::GemPackageTask.new(spec) do |pkg|
|
49
|
+
pkg.gem_spec = spec
|
50
|
+
end
|
File without changes
|
@@ -0,0 +1,34 @@
|
|
1
|
+
class DijitGenerator < Rails::Generator::Base
|
2
|
+
attr :dijit
|
3
|
+
|
4
|
+
def extract_opts!(args)
|
5
|
+
@dijit_full_name = args.shift
|
6
|
+
@dijit=Depo::DijitConventions.new(@dijit_full_name)
|
7
|
+
end
|
8
|
+
|
9
|
+
def assigns
|
10
|
+
@assigns ||= {:assigns=>dijit.to_hash.merge(:config=>Depo.config)}
|
11
|
+
end
|
12
|
+
|
13
|
+
def test?
|
14
|
+
true
|
15
|
+
end
|
16
|
+
|
17
|
+
def style?
|
18
|
+
true
|
19
|
+
end
|
20
|
+
|
21
|
+
def manifest
|
22
|
+
record do |m|
|
23
|
+
extract_opts!(args)
|
24
|
+
m.directory dijit.package_path
|
25
|
+
m.directory dijit.style_dir_path
|
26
|
+
m.directory dijit.test_dir_path
|
27
|
+
|
28
|
+
m.template "class.js", dijit.class_path, assigns
|
29
|
+
m.template "test.js", dijit.test_code_path,assigns if test?
|
30
|
+
m.template "test.html", dijit.test_page_path,assigns if test?
|
31
|
+
m.template "style.css", dijit.style_path,assigns if style?
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
/**
|
2
|
+
* <%= dijit_full_name %>
|
3
|
+
* Created by <%= config.author %>
|
4
|
+
**/
|
5
|
+
dojo.provide("<%= dijit_full_name %>");
|
6
|
+
<% if dijit_base_class != 'null' %>
|
7
|
+
dojo.require("<%= dijit_base_class %>");
|
8
|
+
<% end %>
|
9
|
+
(function () {
|
10
|
+
//here go private vars and functions
|
11
|
+
dojo.declare("<%= dijit_full_name %>",<%= dijit_base_class %>, {
|
12
|
+
// summary:
|
13
|
+
// HERE WIDGET SUMMARY
|
14
|
+
|
15
|
+
// baseClass: [protected] String
|
16
|
+
baseClass: "<%= dijit_style_class_name %>",
|
17
|
+
//templateString: dojo.cache("<%= dijit_package_name %>", "templates/<%= dijit_class_name %>.html"),
|
18
|
+
//widgetsInTemplate: true,
|
19
|
+
//buildRendering: function () {
|
20
|
+
//this.inherited(arguments);
|
21
|
+
//},
|
22
|
+
//layout: function () {
|
23
|
+
//var cb = this._contentBox;
|
24
|
+
//dojo.marginBox(this.containerNode, cb);
|
25
|
+
//},
|
26
|
+
//postCreate: function () {
|
27
|
+
//this.inherited(arguments);
|
28
|
+
//}
|
29
|
+
});
|
30
|
+
});
|
@@ -0,0 +1,15 @@
|
|
1
|
+
<?xml version='1.0' encoding='utf-8' ?>
|
2
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
3
|
+
<html>
|
4
|
+
<head>
|
5
|
+
<title><%= dijit_full_name %></title>
|
6
|
+
|
7
|
+
<script type="text/javascript" src="/ria/src/dojo/dojo.js" djConfig="isDebug:false,parseOnLoad:true"> </script>
|
8
|
+
<script src="<%= dijit_class_name %>.js"></script>
|
9
|
+
<%= config.generators.head_of_test_page %>
|
10
|
+
<link rel="stylesheet" href="/<%= style_path %>" type="text/css" />
|
11
|
+
</head>
|
12
|
+
<body class="app">
|
13
|
+
</body>
|
14
|
+
</html>
|
15
|
+
|
@@ -0,0 +1,33 @@
|
|
1
|
+
Description:
|
2
|
+
Stubs out a new controller,its views and page.js with page.css. Pass the controller name, either
|
3
|
+
CamelCased or under_scored, and a list of views as arguments. The name of js will be action name.
|
4
|
+
|
5
|
+
|
6
|
+
TODO update documentation
|
7
|
+
|
8
|
+
To create a controller within a module, specify the controller name as a
|
9
|
+
path like 'parent_module/controller_name'.
|
10
|
+
|
11
|
+
This generates a controller class in app/controllers, view templates in
|
12
|
+
app/views/controller_name, a helper class in app/helpers, a functional
|
13
|
+
test suite in test/functional and a helper test suite in test/unit/helpers.
|
14
|
+
|
15
|
+
Example:
|
16
|
+
`./script/generate controller CreditCard open debit credit close`
|
17
|
+
|
18
|
+
Credit card controller with URLs like /credit_card/debit.
|
19
|
+
Controller: app/controllers/credit_card_controller.rb
|
20
|
+
Functional Test: test/functional/credit_card_controller_test.rb
|
21
|
+
Views: app/views/credit_card/debit.html.erb [...]
|
22
|
+
Helper: app/helpers/credit_card_helper.rb
|
23
|
+
Helper Test: test/unit/helpers/credit_card_helper_test.rb
|
24
|
+
|
25
|
+
Modules Example:
|
26
|
+
`./script/generate controller 'admin/credit_card' suspend late_fee`
|
27
|
+
|
28
|
+
Credit card admin controller with URLs /admin/credit_card/suspend.
|
29
|
+
Controller: app/controllers/admin/credit_card_controller.rb
|
30
|
+
Functional Test: test/functional/admin/credit_card_controller_test.rb
|
31
|
+
Views: app/views/admin/credit_card/debit.html.erb [...]
|
32
|
+
Helper: app/helpers/admin/credit_card_helper.rb
|
33
|
+
Helper Test: test/unit/helpers/admin/credit_card_helper_test.rb
|
@@ -0,0 +1,39 @@
|
|
1
|
+
class DpageGenerator < Rails::Generator::NamedBase
|
2
|
+
def manifest
|
3
|
+
record do |m|
|
4
|
+
# Check for class naming collisions.
|
5
|
+
m.class_collisions "#{class_name}Controller", "#{class_name}ControllerTest", "#{class_name}Helper", "#{class_name}HelperTest"
|
6
|
+
|
7
|
+
action = actions[0]
|
8
|
+
page=Depo::DijitConventions.new("#{Depo.config.default_page_lib}.#{action}")
|
9
|
+
|
10
|
+
# Controller, helper, views, and test directories.
|
11
|
+
m.directory File.join('app/controllers', class_path)
|
12
|
+
m.directory File.join('app/helpers', class_path)
|
13
|
+
m.directory File.join('app/views', class_path, file_name)
|
14
|
+
m.directory File.join('test/unit/helpers', class_path)
|
15
|
+
m.directory page.package_path
|
16
|
+
|
17
|
+
# Controller class, functional test, and helper class.
|
18
|
+
m.template 'controller.rb',
|
19
|
+
File.join('app/controllers',
|
20
|
+
class_path,
|
21
|
+
"#{file_name}_controller.rb")
|
22
|
+
|
23
|
+
m.template 'helper.rb',
|
24
|
+
File.join('app/helpers',
|
25
|
+
class_path,
|
26
|
+
"#{file_name}_helper.rb")
|
27
|
+
|
28
|
+
m.template 'helper_test.rb',
|
29
|
+
File.join('test/unit/helpers',
|
30
|
+
class_path,
|
31
|
+
"#{file_name}_helper_test.rb")
|
32
|
+
|
33
|
+
path = File.join('app/views', class_path, file_name, "#{action}.haml")
|
34
|
+
m.template 'view.haml', path, :assigns => { :action => action, :path => path }
|
35
|
+
|
36
|
+
m.template 'dpage.js', page.class_path, :assigns => { :page_name=> page.dijit_full_name }
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
(function() {
|
2
|
+
var controllers = dojo.provide('<%= app_name%>.controllers');
|
3
|
+
//published actions
|
4
|
+
controllers.actions = {
|
5
|
+
startup: function() {},
|
6
|
+
exit: function() {}
|
7
|
+
};
|
8
|
+
//views topics two level hash
|
9
|
+
controllers.views = {};
|
10
|
+
//models topics three level hash
|
11
|
+
controllers.models = {};
|
12
|
+
})();
|
File without changes
|
@@ -0,0 +1,51 @@
|
|
1
|
+
html, body, div, span, applet, object, iframe,
|
2
|
+
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
|
3
|
+
a, abbr, acronym, address, big, cite, code,
|
4
|
+
del, dfn, em, font, img, ins, kbd, q, s, samp,
|
5
|
+
small, strike, strong, sub, sup, tt, var,
|
6
|
+
b, u, i, center,
|
7
|
+
dl, dt, dd, ol, ul, li,
|
8
|
+
fieldset, form, label, legend,
|
9
|
+
table, caption, tbody, tfoot, thead, tr, th, td {
|
10
|
+
margin: 0;
|
11
|
+
padding: 0;
|
12
|
+
border: 0;
|
13
|
+
outline: 0;
|
14
|
+
font-size: 100%;
|
15
|
+
vertical-align: baseline;
|
16
|
+
background: transparent;
|
17
|
+
}
|
18
|
+
body {
|
19
|
+
line-height: 1;
|
20
|
+
}
|
21
|
+
ol, ul {
|
22
|
+
list-style: none;
|
23
|
+
}
|
24
|
+
blockquote, q {
|
25
|
+
quotes: none;
|
26
|
+
}
|
27
|
+
blockquote:before, blockquote:after,
|
28
|
+
q:before, q:after {
|
29
|
+
content: '';
|
30
|
+
content: none;
|
31
|
+
}
|
32
|
+
|
33
|
+
/* remember to define focus styles! */
|
34
|
+
:focus {
|
35
|
+
outline: 0;
|
36
|
+
}
|
37
|
+
|
38
|
+
/* remember to highlight inserts somehow! */
|
39
|
+
ins {
|
40
|
+
text-decoration: none;
|
41
|
+
}
|
42
|
+
del {
|
43
|
+
text-decoration: line-through;
|
44
|
+
}
|
45
|
+
|
46
|
+
/* tables still need 'cellspacing="0"' in the markup */
|
47
|
+
table {
|
48
|
+
border-collapse: collapse;
|
49
|
+
border-spacing: 0;
|
50
|
+
}
|
51
|
+
|
@@ -0,0 +1,28 @@
|
|
1
|
+
|
2
|
+
!!! XML
|
3
|
+
!!! Strict
|
4
|
+
%html
|
5
|
+
%head
|
6
|
+
%title <%= action %>
|
7
|
+
=dojo :app=> '<%= action %>'
|
8
|
+
%body{:class=>theme}
|
9
|
+
#mainContainer{ :dojoType => "dijit.layout.BorderContainer"}
|
10
|
+
#topContainer{ :region => "top", :dojoType => "dijit.layout.ContentPane" }
|
11
|
+
%h1#logo Dojo On Rails
|
12
|
+
#leftContainer{ :region => "leading", :dojoType => "dijit.layout.AccordionContainer" }
|
13
|
+
%div{ :dojoType => "dijit.layout.ContentPane", :title => "pane #1" }
|
14
|
+
accordion pane #1
|
15
|
+
%div{ :dojoType => "dijit.layout.ContentPane", :title => "pane #2" }
|
16
|
+
accordion pane #2
|
17
|
+
%div{ :dojoType => "dijit.layout.ContentPane", :title => "pane #3" }
|
18
|
+
accordion pane #3
|
19
|
+
#centerContainer{ :region => "center", :dojoType => "dijit.layout.TabContainer" }
|
20
|
+
%div{ :dojoType => "dijit.layout.ContentPane", :title => "Content Viewer" , :jsId=>'views.contentViewer'}
|
21
|
+
WE NEED YOUR HELP
|
22
|
+
%div{ :dojoType => "dijit.layout.ContentPane", :title => "tab #2" }
|
23
|
+
TEST IT AND SEND FEEDBACK TO US
|
24
|
+
%div{ :dojoType => "dijit.layout.ContentPane", :title => "tab #3" }
|
25
|
+
PARTICIPATE IN DEVELOPMENT
|
26
|
+
#trailingContainer{ :region => "trailing", :dojoType => "dijit.layout.ContentPane" , :jsId=> 'views.console'}
|
27
|
+
%h3 Log:
|
28
|
+
#bottomContainer{ :region => "bottom", :dojoType => "dijit.layout.ContentPane" } nicolA
|
data/init.rb
ADDED
data/install.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
# Install hook code here
|
data/lib/depo/build.rb
ADDED
@@ -0,0 +1,53 @@
|
|
1
|
+
require 'erb'
|
2
|
+
require 'fileutils'
|
3
|
+
|
4
|
+
module Depo
|
5
|
+
class Build
|
6
|
+
class << self
|
7
|
+
def generate_profile(opts={})
|
8
|
+
@rails_root = opts[:rails_root] if opts.key?(:rails_root)
|
9
|
+
profile_content = profile_template.result(binding)
|
10
|
+
open(profile_path,'w') do |f|
|
11
|
+
f<< profile_content
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
def profile_path
|
16
|
+
raise "I need RAILS ROOT to generate profile" unless Object.const_defined? :RAILS_ROOT
|
17
|
+
file_path = File.join(RAILS_ROOT,Depo.config.profile_path)
|
18
|
+
file_dir = File.dirname(file_path)
|
19
|
+
unless File.exists?(file_dir)
|
20
|
+
FileUtils.mkdir_p(file_dir)
|
21
|
+
end
|
22
|
+
file_path
|
23
|
+
end
|
24
|
+
|
25
|
+
def profile_template
|
26
|
+
return @template if @template
|
27
|
+
tpl_string = IO.readlines("#{File.dirname(__FILE__)}/templates/profile.js",'').to_s
|
28
|
+
@template = ERB.new(tpl_string)
|
29
|
+
end
|
30
|
+
|
31
|
+
def layers
|
32
|
+
Depo.config.build_profile.pages.map do |page|
|
33
|
+
file="../#{page.gsub('.','/')}.js"
|
34
|
+
<<-JS
|
35
|
+
{
|
36
|
+
name:"#{file}",
|
37
|
+
dependencies: ["#{page}"]
|
38
|
+
}
|
39
|
+
JS
|
40
|
+
end.join(',')
|
41
|
+
end
|
42
|
+
|
43
|
+
def prefixes
|
44
|
+
result = %w{dijit dojox}.map{|lib| %Q<["#{lib}","../#{lib}"]>}
|
45
|
+
Depo.config.build_profile.libs.each do |lib|
|
46
|
+
result<< %Q<["#{lib}","#{@rails_root}/#{Depo.config.src_path}/#{lib}"]>
|
47
|
+
end
|
48
|
+
"#{result.join(',')}"
|
49
|
+
end
|
50
|
+
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
data/lib/depo/config.rb
ADDED
@@ -0,0 +1,82 @@
|
|
1
|
+
module Depo
|
2
|
+
class Config < KungFigure::Base
|
3
|
+
define_prop :root,'public/ria'
|
4
|
+
define_prop :webroot,'public'
|
5
|
+
define_prop :base_webpath,''
|
6
|
+
define_prop :author,'NotConfigured'
|
7
|
+
define_prop :themes,['tundra']
|
8
|
+
define_prop :default_theme,'tundra'
|
9
|
+
define_prop :profile_path,'tmp/dojo_build_profile.js'
|
10
|
+
define_prop :default_page_lib,'app.pages'
|
11
|
+
define_prop :dojo_version,'1.4.102'
|
12
|
+
define_prop :enable_dojofy, true
|
13
|
+
|
14
|
+
def src_path
|
15
|
+
"#{root}/src"
|
16
|
+
end
|
17
|
+
|
18
|
+
def builds_path
|
19
|
+
"#{root}/builds"
|
20
|
+
end
|
21
|
+
|
22
|
+
def root_webpath
|
23
|
+
"#{base_webpath}#{root.gsub(webroot, "")}"
|
24
|
+
end
|
25
|
+
|
26
|
+
def src_webpath
|
27
|
+
"#{base_webpath}#{src_path.gsub(webroot, "")}"
|
28
|
+
end
|
29
|
+
|
30
|
+
def last_build_webpath
|
31
|
+
"#{base_webpath}#{(Dir[File.join(builds_path,'*')].max).to_s.gsub(webroot, "")}"
|
32
|
+
end
|
33
|
+
|
34
|
+
def env_dj_config(env)
|
35
|
+
return (env == "production") ? environments.productionDjConfig : environments.developmentDjConfig
|
36
|
+
end
|
37
|
+
|
38
|
+
def env_root_webpath(env)
|
39
|
+
return (env == "production") ? last_build_webpath : src_webpath
|
40
|
+
end
|
41
|
+
|
42
|
+
def buildscripts_path
|
43
|
+
File.join(src_path,'util','buildscripts')
|
44
|
+
end
|
45
|
+
|
46
|
+
def to_hash
|
47
|
+
@props
|
48
|
+
end
|
49
|
+
|
50
|
+
class Generators < KungFigure::Base
|
51
|
+
define_prop :head_of_test_page,''
|
52
|
+
end
|
53
|
+
|
54
|
+
class Environments < KungFigure::Base
|
55
|
+
define_prop :developmentDjConfig, 'parseOnLoad:true,isDebug:true'
|
56
|
+
define_prop :productionDjConfig, 'parseOnLoad:true,isDebug:false'
|
57
|
+
end
|
58
|
+
|
59
|
+
class BuildProfile < KungFigure::Base
|
60
|
+
define_prop :libs,[]
|
61
|
+
define_prop :pages,[]
|
62
|
+
end
|
63
|
+
|
64
|
+
class BuildOptions < KungFigure::Base
|
65
|
+
define_prop :cssOptimize,'comments.keepLines'
|
66
|
+
define_prop :optimize,'shrinksafe.keepLines'
|
67
|
+
define_prop :cssImportIgnore,'../dijit.css'
|
68
|
+
define_prop :internStrings, 'false'
|
69
|
+
|
70
|
+
#FIXME: fix kung_figure to do such things simpler
|
71
|
+
def get_options
|
72
|
+
{
|
73
|
+
:cssOptimize => cssOptimize,
|
74
|
+
:optimize=> optimize,
|
75
|
+
:cssImportIgnore=>cssImportIgnore,
|
76
|
+
:internStrings=>internStrings
|
77
|
+
}
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
end
|