depo 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
data/README.rdoc CHANGED
@@ -21,10 +21,6 @@ Is attempt to automate many tasks and practices in building RIA using Dojo and R
21
21
  * Generators for custom widgets (DijitGenerator) and one page applications
22
22
  * ActionView Helper
23
23
 
24
- == CHANGELOG:
25
- - 0.0.3 - Various template fixes.
26
-
27
-
28
24
  == SAMPLE CONFIGURATION:
29
25
  Depo.configure {
30
26
  author 'niquola'
data/Rakefile CHANGED
@@ -27,9 +27,10 @@ end
27
27
 
28
28
  PKG_FILES = FileList[ '[a-zA-Z]*', 'generators/**/*', 'lib/**/*', 'rails/**/*', 'tasks/**/*', 'test/**/*' ]
29
29
 
30
+ require 'lib/depo.rb'
30
31
  spec = Gem::Specification.new do |s|
31
32
  s.name = "depo"
32
- s.version = "0.0.3"
33
+ s.version = Depo::VERSION
33
34
  s.author = "niquola, smecsia"
34
35
  s.email = "niquola@gmail.com"
35
36
  #s.homepage = ""
@@ -24,8 +24,10 @@ class DijitGenerator < Rails::Generator::Base
24
24
  m.directory dijit.package_path
25
25
  m.directory dijit.style_dir_path
26
26
  m.directory dijit.test_dir_path
27
+ m.directory dijit.template_dir_path
27
28
 
28
29
  m.template "class.js", dijit.class_path, assigns
30
+ m.template "template.html", dijit.template_path, assigns
29
31
  m.template "test.js", dijit.test_code_path,assigns if test?
30
32
  m.template "test.html", dijit.test_page_path,assigns if test?
31
33
  m.template "style.css", dijit.style_path,assigns if style?
@@ -0,0 +1,6 @@
1
+ <div class="${baseClass}">
2
+ <div class="${baseClass}Container"
3
+ dojoAttachPoint='containerNode'
4
+ >
5
+ </div>
6
+ </div>
@@ -7,20 +7,9 @@
7
7
  <script type="text/javascript" src="/ria/src/dojo/dojo.js" djConfig="isDebug:false,parseOnLoad:true"> </script>
8
8
  <script src="<%= dijit_class_name %>.js"></script>
9
9
  <%= config.generators.head_of_test_page %>
10
- <link rel="stylesheet" href="<%= style_webpath %>" type="text/css" />
10
+ <link rel="stylesheet" href="/<%= style_path %>" type="text/css" />
11
11
  </head>
12
- <style>
13
- #id<%= dijit_class_name %>{
14
- position:absolute;
15
- top:1em;
16
- left:1em;
17
- bottom:1em;
18
- right:1em;
19
- border:1px solid #aaa;
20
- }
21
- </style>
22
12
  <body class="app">
23
- <div id="id<%= dijit_class_name %>" dojoType="<%= dijit_full_name %>" jsId="dijit<%= dijit_class_name %>"></div>
24
13
  </body>
25
14
  </html>
26
15
 
data/lib/depo/build.rb CHANGED
@@ -24,7 +24,7 @@ module Depo
24
24
 
25
25
  def profile_template
26
26
  return @template if @template
27
- tpl_string = IO.readlines("#{File.dirname(__FILE__)}/templates/profile.js",'').to_s
27
+ tpl_string = File.read("#{File.dirname(__FILE__)}/templates/profile.js")
28
28
  @template = ERB.new(tpl_string)
29
29
  end
30
30
 
@@ -22,7 +22,7 @@ module Depo
22
22
  if parts.length > 2
23
23
  cmps[:modules] = parts[1..-2]
24
24
  end
25
- cmps[:dijit_full_name]=dijit_full_name
25
+ cmps[:dijit_full_name]=dijit_full_name
26
26
  @cmp_hash=cmps
27
27
  @cmp = OpenStruct.new(cmps)
28
28
  end
@@ -55,14 +55,10 @@ module Depo
55
55
  File.join(*args.flatten.unshift(Depo.config.src_path))
56
56
  end
57
57
 
58
- def from_websrc(*args)
59
- File.join(*args.flatten.unshift(Depo.config.src_webpath))
60
- end
61
-
62
58
  def j(*args)
63
59
  File.join(*args)
64
60
  end
65
-
61
+
66
62
  prop :package_path do
67
63
  from_src cmp.base_module, cmp.modules
68
64
  end
@@ -71,10 +67,6 @@ module Depo
71
67
  from_src cmp.base_module,'themes', Depo.config.default_theme, cmp.modules
72
68
  end
73
69
 
74
- prop :style_dir_webpath do
75
- from_websrc cmp.base_module,'themes', Depo.config.default_theme, cmp.modules
76
- end
77
-
78
70
  prop :test_dir_path do
79
71
  from_src cmp.base_module,'tests', cmp.modules
80
72
  end
@@ -83,10 +75,6 @@ module Depo
83
75
  j(package_path,"#{cmp.class_name}.js")
84
76
  end
85
77
 
86
- prop :style_webpath do
87
- j(style_dir_webpath, "#{cmp.class_name}.css")
88
- end
89
-
90
78
  prop :style_path do
91
79
  j(style_dir_path,"#{cmp.class_name}.css")
92
80
  end
@@ -99,6 +87,14 @@ module Depo
99
87
  j(test_dir_path,"#{cmp.class_name}.html")
100
88
  end
101
89
 
90
+ prop :template_dir_path do
91
+ j(package_path,'templates')
92
+ end
93
+
94
+ prop :template_path do
95
+ j(template_dir_path, "#{cmp.class_name}.html")
96
+ end
97
+
102
98
  prop :dijit_style_class_name do
103
99
  @dijit_full_name.split('.').map{|c| c.capitalize}.join('')
104
100
  end
@@ -1,32 +1,40 @@
1
1
  module Depo
2
+
2
3
  module ViewHelpers
4
+
3
5
  def webroot
4
6
  Depo.config.env_root_webpath(@opts[:env])
5
7
  end
8
+
6
9
  def djConfig
7
10
  Depo.config.env_dj_config(@opts[:env])
8
11
  end
12
+
9
13
  #check if ext presented and add if not
10
14
  def add_ext(str,ext)
11
15
  ( str.strip=~/\.#{ext}$/ ) ? str.strip : "#{str.strip}.#{ext}"
12
16
  end
17
+
13
18
  def css
14
19
  %Q[#{webroot}/app/themes/#{theme}/#{add_ext(@opts[:app],'css')}]
15
20
  end
21
+
16
22
  def dojo(opts)
17
23
  return @dojo_tpl if @dojo_tpl
18
24
  raise "You must provide :app name in opts" unless opts[:app]
19
25
  @opts = opts
20
26
  @opts[:env] = (defined? RAILS_ENV && !opts[:env])? RAILS_ENV : opts[:env]
21
- tpl_string = IO.readlines("#{File.dirname(__FILE__)}/templates/dojo_src.tpl",'').to_s
27
+ tpl_string = File.read("#{File.dirname(__FILE__)}/templates/dojo_src.tpl")
22
28
  @dojo_tpl = ERB.new(tpl_string).result(binding)
23
29
  end
30
+
24
31
  def theme
25
32
  Depo.config.default_theme
26
33
  end
34
+
27
35
  def app_js
28
36
  %Q[#{webroot}/app/pages/#{@opts[:app]}.js]
29
37
  end
30
- end
31
38
 
39
+ end
32
40
  end
data/lib/depo.rb CHANGED
@@ -4,7 +4,7 @@ require 'kung_figure'
4
4
  require 'active_support'
5
5
 
6
6
  module Depo
7
- VERSION = '0.0.3'
7
+ VERSION = '0.0.4'
8
8
  autoload :Config, 'depo/config'
9
9
  autoload :Build, 'depo/build'
10
10
  autoload :DijitConventions, 'depo/dijit_conventions'
@@ -20,7 +20,7 @@ class ActionViewEnv
20
20
  end
21
21
  def get_template(v)
22
22
  @av_values = v
23
- tpl_string = IO.readlines(File.dirname(__FILE__) + '/../lib/depo/templates/dojo_src.tpl').to_s
23
+ tpl_string = File.read(File.dirname(__FILE__) + '/../lib/depo/templates/dojo_src.tpl')
24
24
  tpl = ERB.new(tpl_string).result(binding)
25
25
  end
26
26
  end
@@ -31,6 +31,11 @@ class GeneratorsTest < GeneratorTest
31
31
  assert_match(/dojo.provide/, result)
32
32
  assert_match(/dojo.declare/, result)
33
33
 
34
+ file = from_src("app/my/templates/Dijit.html")
35
+ assert_file file
36
+ result = read file
37
+ assert_match(/\$\{baseClass\}/, result)
38
+
34
39
  file = from_src("app/tests/my/Dijit.js")
35
40
  assert_file file
36
41
  result = read file
@@ -13,8 +13,6 @@ class DijitConventionsTest < GeneratorTest
13
13
  assert_equal('public/ria/src/app/tests/my/Dijit.js', dijit.test_code_path)
14
14
  assert_equal('public/ria/src/app/tests/my/Dijit.html', dijit.test_page_path)
15
15
 
16
- assert_equal('/ria/src/app/themes/tundra/my/Dijit.css', dijit.style_webpath)
17
-
18
16
  assert_not_nil(dijit.to_hash)
19
17
  end
20
18
  end
@@ -0,0 +1,6 @@
1
+ <div class="${baseClass}">
2
+ <div class="${baseClass}Container"
3
+ dojoAttachPoint='containerNode'
4
+ >
5
+ </div>
6
+ </div>
@@ -8,20 +8,9 @@
8
8
  <script src="Dijit.js"></script>
9
9
  <link rel="stylesheet" href="public/ria/src/common.css" type="text/css" />
10
10
 
11
- <link rel="stylesheet" href="/ria/src/app/themes/tundra/my/Dijit.css" type="text/css" />
11
+ <link rel="stylesheet" href="/public/ria/src/app/themes/tundra/my/Dijit.css" type="text/css" />
12
12
  </head>
13
- <style>
14
- #idDijit{
15
- position:absolute;
16
- top:1em;
17
- left:1em;
18
- bottom:1em;
19
- right:1em;
20
- border:1px solid #aaa;
21
- }
22
- </style>
23
13
  <body class="app">
24
- <div id="idDijit" dojoType="app.my.Dijit" jsId="dijitDijit"></div>
25
14
  </body>
26
15
  </html>
27
16
 
metadata CHANGED
@@ -1,7 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: depo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 0
8
+ - 4
9
+ version: 0.0.4
5
10
  platform: ruby
6
11
  authors:
7
12
  - niquola, smecsia
@@ -9,39 +14,49 @@ autorequire:
9
14
  bindir: bin
10
15
  cert_chain: []
11
16
 
12
- date: 2010-04-21 00:00:00 +04:00
17
+ date: 2010-05-05 00:00:00 +04:00
13
18
  default_executable:
14
19
  dependencies:
15
20
  - !ruby/object:Gem::Dependency
16
21
  name: dojo_src
17
- type: :runtime
18
- version_requirement:
19
- version_requirements: !ruby/object:Gem::Requirement
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
20
24
  requirements:
21
25
  - - ">="
22
26
  - !ruby/object:Gem::Version
27
+ segments:
28
+ - 0
23
29
  version: "0"
24
- version:
30
+ type: :runtime
31
+ version_requirements: *id001
25
32
  - !ruby/object:Gem::Dependency
26
33
  name: rails
27
- type: :runtime
28
- version_requirement:
29
- version_requirements: !ruby/object:Gem::Requirement
34
+ prerelease: false
35
+ requirement: &id002 !ruby/object:Gem::Requirement
30
36
  requirements:
31
37
  - - ">="
32
38
  - !ruby/object:Gem::Version
39
+ segments:
40
+ - 2
41
+ - 3
42
+ - 5
33
43
  version: 2.3.5
34
- version:
44
+ type: :runtime
45
+ version_requirements: *id002
35
46
  - !ruby/object:Gem::Dependency
36
47
  name: kung_figure
37
- type: :runtime
38
- version_requirement:
39
- version_requirements: !ruby/object:Gem::Requirement
48
+ prerelease: false
49
+ requirement: &id003 !ruby/object:Gem::Requirement
40
50
  requirements:
41
51
  - - "="
42
52
  - !ruby/object:Gem::Version
53
+ segments:
54
+ - 0
55
+ - 0
56
+ - 2
43
57
  version: 0.0.2
44
- version:
58
+ type: :runtime
59
+ version_requirements: *id003
45
60
  description:
46
61
  email: niquola@gmail.com
47
62
  executables: []
@@ -52,56 +67,58 @@ extra_rdoc_files:
52
67
  - README.rdoc
53
68
  files:
54
69
  - init.rb
55
- - install.rb
70
+ - Rakefile
56
71
  - uninstall.rb
57
72
  - README.rdoc
58
- - Rakefile
73
+ - install.rb
59
74
  - MIT-LICENSE
60
- - generators/dijit/USAGE
61
- - generators/dijit/templates/test.js
62
- - generators/dijit/templates/class.js
63
- - generators/dijit/templates/test.html
64
- - generators/dijit/templates/style.css
65
- - generators/dijit/dijit_generator.rb
66
- - generators/dpage/USAGE
67
- - generators/dpage/dpage_generator.rb
68
- - generators/dpage/templates/view.haml
69
- - generators/dpage/templates/helper_test.rb
70
75
  - generators/dpage/templates/dpage.css
76
+ - generators/dpage/templates/app/views.js
77
+ - generators/dpage/templates/app/controllers.js
78
+ - generators/dpage/templates/app/models.js
79
+ - generators/dpage/templates/dpage.js
71
80
  - generators/dpage/templates/controller.rb
81
+ - generators/dpage/templates/helper_test.rb
82
+ - generators/dpage/templates/view.haml
83
+ - generators/dpage/templates/helper.rb
72
84
  - generators/dpage/templates/default_stylesheets/reset.css
85
+ - generators/dpage/templates/default_stylesheets/theme_override.css
73
86
  - generators/dpage/templates/default_stylesheets/common.css
74
87
  - generators/dpage/templates/default_stylesheets/all.css
75
- - generators/dpage/templates/default_stylesheets/theme_override.css
76
- - generators/dpage/templates/helper.rb
77
- - generators/dpage/templates/dpage.js
78
- - generators/dpage/templates/app/controllers.js
79
- - generators/dpage/templates/app/models.js
80
- - generators/dpage/templates/app/views.js
88
+ - generators/dpage/USAGE
89
+ - generators/dpage/dpage_generator.rb
90
+ - generators/depo_config/templates/depo.rb
81
91
  - generators/depo_config/USAGE
82
92
  - generators/depo_config/depo_config_generator.rb
83
- - generators/depo_config/templates/depo.rb
84
- - lib/depo.rb
93
+ - generators/dijit/dijit_generator.rb
94
+ - generators/dijit/templates/style.css
95
+ - generators/dijit/templates/template.html
96
+ - generators/dijit/templates/test.html
97
+ - generators/dijit/templates/class.js
98
+ - generators/dijit/templates/test.js
99
+ - generators/dijit/USAGE
100
+ - lib/depo/config.rb
85
101
  - lib/depo/build.rb
86
102
  - lib/depo/dijit_conventions.rb
87
- - lib/depo/config.rb
88
- - lib/depo/view_helpers.rb
89
103
  - lib/depo/tasks.rb
90
104
  - lib/depo/templates/dojo_src.tpl
91
105
  - lib/depo/templates/profile.js
106
+ - lib/depo/view_helpers.rb
107
+ - lib/depo.rb
92
108
  - tasks/depo.rake
93
- - test/generators_test.rb
94
- - test/config_test.rb
95
- - test/test_helper.rb
96
- - test/database.yml
97
- - test/action_pack_test.rb
98
109
  - test/build_profile_test.rb
110
+ - test/action_pack_test.rb
99
111
  - test/path_utils_test.rb
100
- - test/rails_root/public/ria/src/DOJO_VERSION
101
- - test/rails_root/public/ria/src/app/tests/my/Dijit.js
102
- - test/rails_root/public/ria/src/app/tests/my/Dijit.html
112
+ - test/generators_test.rb
113
+ - test/database.yml
114
+ - test/rails_root/public/ria/src/app/my/templates/Dijit.html
103
115
  - test/rails_root/public/ria/src/app/my/Dijit.js
104
116
  - test/rails_root/public/ria/src/app/themes/tundra/my/Dijit.css
117
+ - test/rails_root/public/ria/src/app/tests/my/Dijit.html
118
+ - test/rails_root/public/ria/src/app/tests/my/Dijit.js
119
+ - test/rails_root/public/ria/src/DOJO_VERSION
120
+ - test/config_test.rb
121
+ - test/test_helper.rb
105
122
  has_rdoc: true
106
123
  homepage:
107
124
  licenses: []
@@ -115,18 +132,20 @@ required_ruby_version: !ruby/object:Gem::Requirement
115
132
  requirements:
116
133
  - - ">="
117
134
  - !ruby/object:Gem::Version
135
+ segments:
136
+ - 0
118
137
  version: "0"
119
- version:
120
138
  required_rubygems_version: !ruby/object:Gem::Requirement
121
139
  requirements:
122
140
  - - ">="
123
141
  - !ruby/object:Gem::Version
142
+ segments:
143
+ - 0
124
144
  version: "0"
125
- version:
126
145
  requirements: []
127
146
 
128
147
  rubyforge_project:
129
- rubygems_version: 1.3.5
148
+ rubygems_version: 1.3.6
130
149
  signing_key:
131
150
  specification_version: 3
132
151
  summary: Rails & Dojo integration