calatrava 0.5.0 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (61) hide show
  1. data/CHANGES.markdown +40 -0
  2. data/README.md +5 -0
  3. data/calatrava.gemspec +2 -3
  4. data/lib/calatrava/apache.rb +126 -0
  5. data/lib/calatrava/app.rb +2 -2
  6. data/lib/calatrava/app_builder.rb +68 -0
  7. data/lib/calatrava/configuration.rb +73 -0
  8. data/lib/calatrava/droid_app.rb +46 -0
  9. data/lib/calatrava/ios_app.rb +40 -0
  10. data/lib/calatrava/kernel.rb +79 -0
  11. data/lib/calatrava/manifest.rb +34 -11
  12. data/lib/calatrava/mobile_web_app.rb +74 -0
  13. data/lib/calatrava/project.rb +7 -191
  14. data/lib/calatrava/project_script.rb +186 -0
  15. data/lib/calatrava/shell.rb +43 -0
  16. data/lib/calatrava/tasks/assets.rb +4 -0
  17. data/lib/calatrava/tasks/automation.rb +4 -10
  18. data/lib/calatrava/tasks/haml.rb +9 -10
  19. data/lib/calatrava/tasks.rb +9 -85
  20. data/lib/calatrava/templates/config/templates/httpd.conf.erb +9 -9
  21. data/lib/calatrava/templates/droid/app/bridge.coffee +3 -0
  22. data/lib/calatrava/templates/droid/calatrava/src/com/calatrava/CalatravaPlugin.java +13 -0
  23. data/lib/calatrava/templates/droid/calatrava/src/com/calatrava/bridge/AlertPlugin.java +61 -0
  24. data/lib/calatrava/templates/droid/calatrava/src/com/calatrava/bridge/AnnotationRegistrar.java +71 -0
  25. data/lib/calatrava/templates/droid/calatrava/src/com/calatrava/bridge/KernelBridge.java +3 -4
  26. data/lib/calatrava/templates/droid/calatrava/src/com/calatrava/bridge/Launcher.java +2 -1
  27. data/lib/calatrava/templates/droid/calatrava/src/com/calatrava/bridge/PageRegistry.java +8 -29
  28. data/lib/calatrava/templates/droid/calatrava/src/com/calatrava/bridge/PluginCommand.java +8 -0
  29. data/lib/calatrava/templates/droid/calatrava/src/com/calatrava/bridge/PluginRegistry.java +112 -0
  30. data/lib/calatrava/templates/droid/calatrava/src/com/calatrava/bridge/RegisteredActivity.java +3 -14
  31. data/lib/calatrava/templates/droid/calatrava/src/com/calatrava/bridge/RegisteredPlugin.java +10 -0
  32. data/lib/calatrava/templates/droid/calatrava/src/com/calatrava/bridge/Registration.java +8 -0
  33. data/lib/calatrava/templates/droid/calatrava/src/com/calatrava/bridge/RhinoService.java +1 -0
  34. data/lib/calatrava/templates/droid/calatrava/src/com/calatrava/shell/WebViewActivity.java +1 -1
  35. data/lib/calatrava/templates/ios/Podfile.calatrava +6 -1
  36. data/lib/calatrava/templates/ios/src/ConversionFormViewController.m +1 -1
  37. data/lib/calatrava/templates/kernel/app/calatrava.coffee +32 -5
  38. data/lib/calatrava/templates/kernel/app/converter/controller.converter.coffee +11 -4
  39. data/lib/calatrava/templates/kernel/plugins/alert.coffee +9 -0
  40. data/lib/calatrava/templates/shell/layouts/single_page.haml +3 -3
  41. data/lib/calatrava/templates/web/app/source/alert.web.coffee +13 -0
  42. data/lib/calatrava/templates/web/app/source/bridge.coffee +10 -0
  43. data/lib/calatrava/templates/web/app/views/index.haml +5 -5
  44. data/lib/calatrava/version.rb +1 -1
  45. data/lib/calatrava.rb +15 -1
  46. data/spec/app_builder_spec.rb +46 -0
  47. data/spec/kernel_spec.rb +51 -0
  48. data/spec/manifest_spec.rb +62 -0
  49. data/spec/mobile_web_app_spec.rb +49 -0
  50. data/spec/shell_spec.rb +54 -0
  51. data/spec/spec_helper.rb +4 -0
  52. metadata +60 -49
  53. data/Plans.md +0 -20
  54. data/lib/calatrava/tasks/apache.rb +0 -54
  55. data/lib/calatrava/tasks/build.rb +0 -1
  56. data/lib/calatrava/tasks/configuration.rb +0 -41
  57. data/lib/calatrava/tasks/droid.rb +0 -83
  58. data/lib/calatrava/tasks/ios.rb +0 -73
  59. data/lib/calatrava/tasks/kernel.rb +0 -52
  60. data/lib/calatrava/tasks/shell.rb +0 -17
  61. data/lib/calatrava/tasks/web.rb +0 -87
@@ -1,19 +1,7 @@
1
- require 'mustache'
2
- require 'yaml'
3
- require 'xcoder'
4
- require 'xcodeproj'
5
-
6
- require 'calatrava/resources_build_phase'
7
-
8
1
  module Calatrava
9
2
 
10
3
  class Project
11
4
 
12
- def sh(cmd)
13
- $stdout.puts cmd
14
- system(cmd)
15
- end
16
-
17
5
  def self.here(directory)
18
6
  @@current = Project.new(directory)
19
7
  end
@@ -22,7 +10,7 @@ module Calatrava
22
10
  @@current
23
11
  end
24
12
 
25
- attr_reader :name
13
+ attr_reader :name, :config, :kernel, :mobile_web, :ios, :droid
26
14
 
27
15
  def initialize(name, overrides = {})
28
16
  @name = name
@@ -35,185 +23,13 @@ module Calatrava
35
23
  @name = @options[:project_name]
36
24
  end
37
25
  @options.merge! overrides
38
- end
39
-
40
- def dev?
41
- @options[:is_dev]
42
- end
43
-
44
- def create(template)
45
- create_project(template)
46
- create_directory_tree(template)
47
- create_files(template)
48
-
49
- create_android_tree(template)
50
- create_ios_tree(template)
51
- end
52
-
53
- def create_project(template)
54
- FileUtils.mkdir_p @name
55
- File.open(File.join(@name, 'calatrava.yml'), "w+") do |f|
56
- f.print({:project_name => @name}.to_yaml)
57
- end
58
- end
59
-
60
- def target_item(item)
61
- item.gsub("CALATRAVA_TMPL", @name)
62
- end
63
-
64
- def create_directory_tree(template)
65
- template.walk_directories do |dir|
66
- FileUtils.mkdir_p(File.join(@name, target_item(dir)))
67
- end
68
- end
69
-
70
- def create_files(template)
71
- template.walk_files do |file_info|
72
- target_name = target_item(file_info[:name])
73
- if File.extname(file_info[:name]) == ".calatrava"
74
- File.open(File.join(@name, target_name.gsub(".calatrava", "")), "w+") do |f|
75
- expanded = Mustache.render(IO.read(file_info[:path]),
76
- :project_name => @name,
77
- :project_slug => @slug,
78
- :project_title => @title,
79
- :dev? => dev?)
80
- f.print(expanded)
81
- end
82
- else
83
- FileUtils.cp(file_info[:path], File.join(@name, target_name))
84
- end
85
- end
86
- end
87
-
88
- def create_android_tree(template)
89
- Dir.chdir(File.join(@name, "droid")) do
90
- sh "android create project --name '#{@slug}' --path '#{@name}' --package com.#{@slug} --target android-10 --activity #{@title}"
91
-
92
- Dir.walk("calatrava") do |item|
93
- target_item = item.sub('calatrava', @name)
94
- FileUtils.mkdir_p(target_item) if File.directory? item
95
- FileUtils.cp(item, target_item) if File.file? item
96
- end
97
- Dir.chdir "#{@name}" do
98
- Dir.chdir "#{@name}" do
99
- FileUtils.mv "build.xml", "../build.xml"
100
- FileUtils.mv "AndroidManifest.xml", "../AndroidManifest.xml"
101
- end
102
- FileUtils.rm_rf "#{@name}"
103
- Dir.chdir "src/com/#{@name}" do
104
- FileUtils.mv "Title.java", "#{@title}.java"
105
- end
106
- end
107
-
108
- FileUtils.rm_rf "calatrava"
109
- end
110
- end
111
-
112
- def create_ios_project
113
- Xcodeproj::Project.new.tap do |proj|
114
- %w{Foundation UIKit CoreGraphics}.each { |fw| proj.add_system_framework fw }
115
- end
116
- end
117
-
118
- def create_ios_project_groups(base_dir, proj, target)
119
- source_files_for_target = []
120
-
121
- walker = lambda do |item, group|
122
- if item.directory?
123
- group_name = item.basename
124
- child_group = group.create_group group_name
125
- item.each_child { |item| walker.call(item, child_group) }
126
- elsif item.file?
127
- file_path = item.relative_path_from(base_dir)
128
- group.create_file file_path.to_s
129
- source_files_for_target << Xcodeproj::Project::Object::PBXNativeTarget::SourceFileDescription.new(file_path, "", nil)
130
- else
131
- raise 'what is it then?!'
132
- end
133
- end
134
- (base_dir + "src").each_child { |item| walker.call(item, proj.main_group) }
135
- target.add_source_files source_files_for_target
136
- end
137
-
138
- def create_ios_folder_references(base_dir, proj, target)
139
- FileUtils.mkdir_p "ios/public"
140
- public_folder = proj.main_group.create_file "public"
141
- public_folder.last_known_file_type = 'folder'
142
- build_file = public_folder.build_files.new
143
-
144
- shared_phase = Xcodeproj::Project::Object::PBXResourcesBuildPhase.new(proj,nil,{})
145
-
146
- shared_phase << build_file
147
- target.build_phases << shared_phase
148
-
149
- end
150
-
151
- def create_ios_project_target(proj)
152
- target = Xcodeproj::Project::Object::PBXNativeTarget.new(proj,
153
- nil,
154
- 'productType' => 'com.apple.product-type.application',
155
- 'productName' => @name)
156
-
157
- target.build_configurations.each do |config|
158
- config.build_settings.merge!(Xcodeproj::Project::Object::XCBuildConfiguration::COMMON_BUILD_SETTINGS[:ios])
159
-
160
- # E.g. [:ios, :release]
161
- extra_settings_key = [:ios, config.name.downcase.to_sym]
162
- if extra_settings = Xcodeproj::Project::Object::XCBuildConfiguration::COMMON_BUILD_SETTINGS[extra_settings_key]
163
- config.build_settings.merge!(extra_settings)
164
- end
165
-
166
- config.build_settings.merge!({
167
- "GCC_PREFIX_HEADER" => "src/#{@name}-Prefix.pch",
168
- "OTHER_LDFLAGS" => ['-ObjC', '-all_load'],
169
- "INFOPLIST_FILE" => "src/#{@name}-Info.plist",
170
- "SKIP_INSTALL" => "NO",
171
- "IPHONEOS_DEPLOYMENT_TARGET" => "5.0",
172
- })
173
- config.build_settings.delete "DSTROOT"
174
- config.build_settings.delete "INSTALL_PATH"
175
-
176
- end
177
-
178
- calatrava_phase = Xcodeproj::Project::Object::PBXShellScriptBuildPhase.new(proj,nil,{})
179
- target.build_phase_references.insert(0,calatrava_phase.uuid) # hacky manual way to get build phase inserted in the right place
180
-
181
- calatrava_phase.name = "Build Calatrava Kernel & Shell"
182
- calatrava_phase.shell_script = <<-EOS.split("\n").collect(&:strip).join("\n")
183
- source ${SRCROOT}/../build_env.sh
184
- bundle exec rake ios:xcode:prebuild
185
- EOS
186
-
187
- proj.targets << target
188
- target
189
- end
190
-
191
- def create_ios_tree(template)
192
- proj = create_ios_project
193
- base_dir = Pathname.new(@name) + "ios"
194
-
195
- target = create_ios_project_target(proj)
196
- create_ios_project_groups(base_dir, proj, target)
197
- create_ios_folder_references(base_dir, proj, target)
198
-
199
- proj.save_as (base_dir + "#{@name}.xcodeproj").to_s
200
- end
201
-
202
- def modules
203
- Dir[File.join(@path, 'kernel/app/*')].select { |n| File.directory? n }.collect { |n| File.basename n }
204
- end
205
-
206
- def src_paths
207
- modules.collect { |m| "app/#{m}" }.join(':')
208
- end
209
26
 
210
- def build_ios(options = {})
211
- proj = Xcode.project("ios/#{@name}.xcworkspace")
212
- builder = proj.target(@name).config('Debug').builder
213
- builder.clean
214
- builder.sdk = options[:sdk] || :iphonesimulator
215
- builder.build
216
- builder.package
27
+ @config = Configuration.new
28
+ @kernel = Kernel.new(@path)
29
+ @shell = Shell.new(@path)
30
+ @mobile_web = MobileWebApp.new(@path, Manifest.new(@path, 'web', @kernel, @shell))
31
+ @ios = IosApp.new(@path, Manifest.new(@path, 'ios', @kernel, @shell))
32
+ @droid = DroidApp.new(@path, @name, Manifest.new(@path, 'droid', @kernel, @shell))
217
33
  end
218
34
 
219
35
  end
@@ -0,0 +1,186 @@
1
+ require 'mustache'
2
+ require 'yaml'
3
+ require 'xcodeproj'
4
+
5
+ module Calatrava
6
+
7
+ class ProjectScript
8
+
9
+ attr_reader :name
10
+
11
+ def initialize(name, overrides = {})
12
+ @name = name
13
+ @slug = name.gsub(" ", "_").downcase
14
+ @title = @name[0..0].upcase + @name[1..-1]
15
+ @options = overrides
16
+ end
17
+
18
+ def sh(cmd)
19
+ $stdout.puts cmd
20
+ system(cmd)
21
+ end
22
+
23
+ def dev?
24
+ @options[:is_dev]
25
+ end
26
+
27
+ def create(template)
28
+ create_project(template)
29
+ create_directory_tree(template)
30
+ create_files(template)
31
+
32
+ create_android_tree(template)
33
+ create_ios_tree(template)
34
+ end
35
+
36
+ def create_project(template)
37
+ FileUtils.mkdir_p @name
38
+ File.open(File.join(@name, 'calatrava.yml'), "w+") do |f|
39
+ f.print({:project_name => @name}.to_yaml)
40
+ end
41
+ end
42
+
43
+ def target_item(item)
44
+ item.gsub("CALATRAVA_TMPL", @name)
45
+ end
46
+
47
+ def create_directory_tree(template)
48
+ template.walk_directories do |dir|
49
+ FileUtils.mkdir_p(File.join(@name, target_item(dir)))
50
+ end
51
+ end
52
+
53
+ def create_files(template)
54
+ template.walk_files do |file_info|
55
+ target_name = target_item(file_info[:name])
56
+ if File.extname(file_info[:name]) == ".calatrava"
57
+ File.open(File.join(@name, target_name.gsub(".calatrava", "")), "w+") do |f|
58
+ expanded = Mustache.render(IO.read(file_info[:path]),
59
+ :project_name => @name,
60
+ :project_slug => @slug,
61
+ :project_title => @title,
62
+ :dev? => dev?)
63
+ f.print(expanded)
64
+ end
65
+ else
66
+ FileUtils.cp(file_info[:path], File.join(@name, target_name))
67
+ end
68
+ end
69
+ end
70
+
71
+ def create_android_tree(template)
72
+ Dir.chdir(File.join(@name, "droid")) do
73
+ sh "android create project --name '#{@slug}' --path '#{@name}' --package com.#{@slug} --target android-10 --activity #{@title}"
74
+
75
+ Dir.walk("calatrava") do |item|
76
+ target_item = item.sub('calatrava', @name)
77
+ FileUtils.mkdir_p(target_item) if File.directory? item
78
+ FileUtils.cp(item, target_item) if File.file? item
79
+ end
80
+ Dir.chdir "#{@name}" do
81
+ Dir.chdir "#{@name}" do
82
+ FileUtils.mv "build.xml", "../build.xml"
83
+ FileUtils.mv "AndroidManifest.xml", "../AndroidManifest.xml"
84
+ end
85
+ FileUtils.rm_rf "#{@name}"
86
+ Dir.chdir "src/com/#{@name}" do
87
+ FileUtils.mv "Title.java", "#{@title}.java"
88
+ end
89
+ end
90
+
91
+ FileUtils.rm_rf "calatrava"
92
+ end
93
+ end
94
+
95
+ def create_ios_project
96
+ Xcodeproj::Project.new.tap do |proj|
97
+ %w{Foundation UIKit CoreGraphics}.each { |fw| proj.add_system_framework fw }
98
+ end
99
+ end
100
+
101
+ def create_ios_project_groups(base_dir, proj, target)
102
+ source_files_for_target = []
103
+
104
+ walker = lambda do |item, group|
105
+ if item.directory?
106
+ group_name = item.basename
107
+ child_group = group.create_group group_name
108
+ item.each_child { |item| walker.call(item, child_group) }
109
+ elsif item.file?
110
+ file_path = item.relative_path_from(base_dir)
111
+ group.create_file file_path.to_s
112
+ source_files_for_target << Xcodeproj::Project::Object::PBXNativeTarget::SourceFileDescription.new(file_path, "", nil)
113
+ else
114
+ raise 'what is it then?!'
115
+ end
116
+ end
117
+ (base_dir + "src").each_child { |item| walker.call(item, proj.main_group) }
118
+ target.add_source_files source_files_for_target
119
+ end
120
+
121
+ def create_ios_folder_references(base_dir, proj, target)
122
+ public_folder = proj.main_group.create_file "public"
123
+ public_folder.last_known_file_type = 'folder'
124
+ build_file = public_folder.build_files.new
125
+
126
+ shared_phase = Xcodeproj::Project::Object::PBXResourcesBuildPhase.new(proj,nil,{})
127
+
128
+ shared_phase << build_file
129
+ target.build_phases << shared_phase
130
+
131
+ end
132
+
133
+ def create_ios_project_target(proj)
134
+ target = Xcodeproj::Project::Object::PBXNativeTarget.new(proj,
135
+ nil,
136
+ 'productType' => 'com.apple.product-type.application',
137
+ 'productName' => @name)
138
+
139
+ target.build_configurations.each do |config|
140
+ config.build_settings.merge!(Xcodeproj::Project::Object::XCBuildConfiguration::COMMON_BUILD_SETTINGS[:ios])
141
+
142
+ # E.g. [:ios, :release]
143
+ extra_settings_key = [:ios, config.name.downcase.to_sym]
144
+ if extra_settings = Xcodeproj::Project::Object::XCBuildConfiguration::COMMON_BUILD_SETTINGS[extra_settings_key]
145
+ config.build_settings.merge!(extra_settings)
146
+ end
147
+
148
+ config.build_settings.merge!({
149
+ "GCC_PREFIX_HEADER" => "src/#{@name}-Prefix.pch",
150
+ "OTHER_LDFLAGS" => ['-ObjC', '-all_load'],
151
+ "INFOPLIST_FILE" => "src/#{@name}-Info.plist",
152
+ "SKIP_INSTALL" => "NO",
153
+ "IPHONEOS_DEPLOYMENT_TARGET" => "5.0",
154
+ })
155
+ config.build_settings.delete "DSTROOT"
156
+ config.build_settings.delete "INSTALL_PATH"
157
+
158
+ end
159
+
160
+ calatrava_phase = Xcodeproj::Project::Object::PBXShellScriptBuildPhase.new(proj,nil,{})
161
+ target.build_phase_references.insert(0,calatrava_phase.uuid) # hacky manual way to get build phase inserted in the right place
162
+
163
+ calatrava_phase.name = "Build Calatrava Kernel & Shell"
164
+ calatrava_phase.shell_path = '/bin/bash'
165
+ calatrava_phase.shell_script = <<-EOS.split("\n").collect(&:strip).join("\n")
166
+ source ${SRCROOT}/../build_env.sh
167
+ bundle exec rake ios:xcode:prebuild
168
+ EOS
169
+
170
+ proj.targets << target
171
+ target
172
+ end
173
+
174
+ def create_ios_tree(template)
175
+ proj = create_ios_project
176
+ base_dir = Pathname.new(@name) + "ios"
177
+
178
+ target = create_ios_project_target(proj)
179
+ create_ios_project_groups(base_dir, proj, target)
180
+ create_ios_folder_references(base_dir, proj, target)
181
+
182
+ proj.save_as (base_dir + "#{@name}.xcodeproj").to_s
183
+ end
184
+ end
185
+
186
+ end
@@ -0,0 +1,43 @@
1
+ module Calatrava
2
+
3
+ class Shell
4
+ def initialize(proj_path)
5
+ @path = proj_path
6
+ end
7
+
8
+ def coffee_files
9
+ Dir.chdir @path do
10
+ Dir["shell/support/*.coffee"] + Dir["shell/support/*.coffee"]
11
+ end
12
+ end
13
+
14
+ def haml_files
15
+ Dir.chdir @path do
16
+ Dir["shell/support/*.haml"]
17
+ end
18
+ end
19
+
20
+ def css_files
21
+ Dir.chdir @path do
22
+ Dir["shell/stylesheets/*.sass"] + Dir["shell/stylesheets/*.css"]
23
+ end
24
+ end
25
+
26
+ def features
27
+ Dir.chdir @path do
28
+ Dir["shell/pages/*"].collect do |f|
29
+ if File.directory?(f)
30
+ {
31
+ :name => File.basename(f),
32
+ :coffee => Dir["#{f}/*.coffee"],
33
+ :haml => Dir["#{f}/*.haml"]
34
+ }
35
+ else
36
+ nil
37
+ end
38
+ end.compact
39
+ end
40
+ end
41
+ end
42
+
43
+ end
@@ -1,3 +1,7 @@
1
+ def cp_ne(source, dest_dir)
2
+ cp Dir[source], dest_dir
3
+ end
4
+
1
5
  def coffee(in_dir_or_file, out_dir)
2
6
  if !Dir["#{in_dir_or_file}/**/*.coffee"].empty? || File.exists?(in_dir_or_file)
3
7
  $stdout.puts "coffee #{in_dir_or_file} -> #{out_dir}"
@@ -1,21 +1,15 @@
1
+ FEATURES_DIR = File.join('.', 'features').freeze
2
+ FEATURE_RESULTS_DIR = File.join('.', 'results').freeze
3
+
1
4
  namespace :automation do
2
5
  namespace :web do
3
6
  desc "Runs cucumber tests against the web app"
4
- task :features, [:file] => [:apache_for_features, :create_sim_link, :copy_steps_file, :clean_up_results_dir] do |t, args|
7
+ task :features, [:file] => [:create_sim_link, :copy_steps_file, :clean_up_results_dir] do |t, args|
5
8
  ENV['PATH'] = "#{ROOT_DIR}/web/features:#{ENV['PATH']}"
6
9
  features_to_be_run = args[:file] ? "#{FEATURES_DIR}/#{args[:file]}" : FEATURES_DIR
7
10
  sh "cucumber --strict --tags @all,@web --tags ~@wip #{features_to_be_run} --format html --out #{FEATURE_RESULTS_DIR}/report.html --format pretty"
8
11
  end
9
12
 
10
- desc "launch a daemon apache instance on port 8888 which will serve the features and mock the backend services"
11
- task :apache_for_features => ['web:build', APACHE_LOGS_DIR] do
12
- create_plist
13
- configure_apache
14
- `launchctl unload #{APACHE_DIR}/com.jenkins.calatrava.apache.plist`
15
- `launchctl load -w #{APACHE_DIR}/com.jenkins.calatrava.apache.plist`
16
- `sleep 5`
17
- end
18
-
19
13
  desc "create sim link for the ios step_definitions and support folder"
20
14
  task :create_sim_link do
21
15
  sh "rm -rf #{FEATURES_DIR}/step_definitions"
@@ -6,9 +6,9 @@ module HamlSupport
6
6
 
7
7
  attr_reader :page_name
8
8
 
9
- def initialize(feature = nil, page = nil)
10
- @feature = feature
11
- @page_name = page
9
+ def initialize(page_path = nil)
10
+ @page_path = page_path
11
+ @page_name = File.basename(@page_path, '.haml') if @page_path
12
12
  end
13
13
 
14
14
  def content_for(named_chunk)
@@ -23,13 +23,13 @@ module HamlSupport
23
23
  end
24
24
 
25
25
  def render_partial(partial_name, locals = {})
26
- partial_template = IO.read("#{partial_name}.haml")
26
+ partial_name = "#{partial_name}.haml" unless partial_name =~ /haml$/
27
+ partial_template = IO.read partial_name
27
28
  Haml::Engine.new(partial_template).render(self, locals)
28
29
  end
29
30
 
30
- def render_page(page_name = nil, locals = {})
31
- page_name = File.join(@feature, @page_name) unless page_name
32
- page_template = IO.read(File.join('shell/pages', "#{page_name}.haml"))
31
+ def render_page(locals = {})
32
+ page_template = IO.read(@page_path)
33
33
  Haml::Engine.new(page_template).render(self, locals)
34
34
  end
35
35
 
@@ -37,10 +37,10 @@ module HamlSupport
37
37
 
38
38
  class << self
39
39
 
40
- def compile_hybrid_page(feature, page_path, output_path, options = {})
40
+ def compile_hybrid_page(page_path, output_path, options = {})
41
41
  puts "haml page: #{page_path} -> #{output_path}"
42
42
 
43
- options[:helper] = Helper.new(feature, File.basename(page_path, ".haml"))
43
+ options[:helper] = Helper.new(page_path)
44
44
  options[:template] = "shell/layouts/single_page.haml"
45
45
  options[:out] = File.join(output_path, File.basename(page_path, '.*') + '.html')
46
46
 
@@ -63,7 +63,6 @@ module HamlSupport
63
63
 
64
64
  html = Haml::Engine.new(template).render(options[:helper])
65
65
 
66
- html.gsub!("file:///android_asset/hybrid", "../assets") if options[:platform] == 'ios'
67
66
  IO.write(html_path, html)
68
67
  end
69
68
  end
@@ -3,91 +3,15 @@ require 'calatrava'
3
3
 
4
4
  Calatrava::Project.here('.')
5
5
 
6
- def cp_ne(source, dest_dir)
7
- cp Dir[source], dest_dir
8
- end
9
-
10
- ROOT_DIR = "."
11
- BUILD_DIR = File.join(ROOT_DIR, 'build').freeze
12
-
13
- SHELL_DIR = File.join(ROOT_DIR, 'shell').freeze
14
- SHELL_LAYOUTS_DIR = File.join(SHELL_DIR, 'layouts').freeze
15
- SHELL_VIEWS_DIR = File.join(SHELL_DIR, 'views').freeze
16
- SHELL_PARTIALS_DIR = File.join(SHELL_DIR, 'partials').freeze
17
- SHELL_JS_DIR = File.join(SHELL_DIR, 'support').freeze
18
-
19
- FEATURES_DIR = File.join(ROOT_DIR, 'features').freeze
20
- FEATURE_RESULTS_DIR = File.join(ROOT_DIR, 'results').freeze
21
-
22
-
23
- KERNEL_DIR = File.join(ROOT_DIR, 'kernel').freeze
24
- KERNEL_JS_DIR = File.join(KERNEL_DIR, 'app').freeze
25
- KERNEL_SPEC_DIR = File.join(KERNEL_DIR, 'spec').freeze
26
-
27
- BUILD_CORE_DIR = File.join(BUILD_DIR, 'core').freeze
28
- BUILD_CORE_KERNEL_DIR = File.join(BUILD_CORE_DIR, 'kernel').freeze
29
- BUILD_CORE_CSS_DIR = File.join(BUILD_CORE_DIR, 'stylesheets').freeze
30
-
31
- ASSETS_DIR = File.join(ROOT_DIR, 'assets').freeze
32
- ASSETS_IMG_DIR = File.join(ASSETS_DIR, 'images').freeze
33
- ASSETS_LIB_DIR = File.join(ASSETS_DIR, 'lib').freeze
34
- ASSETS_CSS_DIR = File.join(ASSETS_DIR, 'stylesheets').freeze
35
- ASSETS_FONTS_DIR = File.join(ASSETS_DIR, 'fonts').freeze
36
-
37
- APACHE_DIR = File.join(ROOT_DIR, 'web', 'apache').freeze
38
- WEB_DIR = File.join(ROOT_DIR, 'web').freeze
39
- APACHE_LOGS_DIR = File.join(APACHE_DIR, 'logs').freeze
40
-
41
- CONFIG_DIR = File.join(ROOT_DIR, 'config').freeze
42
- CONFIG_YAML = File.join(CONFIG_DIR, 'environments.yml').freeze
43
- CONFIG_TEMPLATE_DIR = File.join(CONFIG_DIR, 'templates').freeze
44
- CONFIG_RESULT_DIR = File.join(CONFIG_DIR, 'result').freeze
45
- directory CONFIG_RESULT_DIR
46
-
47
- CONFIG = {}
48
-
49
- [:ios, :droid, :web].each do |os|
50
- CONFIG[os] = {}
51
- CONFIG[os][:root] = File.join(ROOT_DIR, os.to_s)
52
- CONFIG[os][:public] = case os
53
- when :droid
54
- File.join(CONFIG[os][:root], Calatrava::Project.current.name, 'assets', 'hybrid').freeze
55
- else
56
- File.join(CONFIG[os][:root], 'public').freeze
57
- end
58
- CONFIG[os][:html] = File.join(CONFIG[os][:public], 'views').freeze
59
- CONFIG[os][:assets] = case os
60
- when :ios
61
- File.join(CONFIG[os][:public], 'assets').freeze
62
- else
63
- CONFIG[os][:public]
64
- end
65
- CONFIG[os][:imgs] = File.join(CONFIG[os][:assets], 'images').freeze
66
- CONFIG[os][:js] = File.join(CONFIG[os][:assets], 'scripts').freeze
67
- CONFIG[os][:css] = File.join(CONFIG[os][:assets], 'styles').freeze
68
- CONFIG[os][:fonts] = File.join(CONFIG[os][:assets], 'fonts').freeze
69
- CONFIG[os][:layout] = File.join(CONFIG[os][:root], "app", "views").freeze
70
-
71
- directory CONFIG[os][:public]
72
- directory CONFIG[os][:html]
73
- directory CONFIG[os][:assets]
74
- directory CONFIG[os][:imgs]
75
- directory CONFIG[os][:js]
76
- directory CONFIG[os][:css]
77
- directory CONFIG[os][:fonts]
78
- end
79
-
80
- CONFIG[:ios][:project_name] = Calatrava::Project.current.name
81
- CONFIG[:ios][:app_dir] = File.join(CONFIG[:ios][:root], 'Source', Calatrava::Project.current.name)
82
- CONFIG[:ios][:cucumber] = FEATURES_DIR
6
+ Dir["#{File.join(File.dirname(__FILE__), 'tasks')}/*.rb"].each { |t| require t }
83
7
 
84
- directory BUILD_CORE_DIR
85
- directory BUILD_CORE_CSS_DIR
86
- directory BUILD_CORE_KERNEL_DIR
8
+ namespace(:kernel) { Calatrava::Project.current.kernel.install_tasks }
9
+ namespace(:configure) { Calatrava::Project.current.config.install_tasks }
10
+ namespace(:droid) { Calatrava::Project.current.droid.install_tasks }
11
+ namespace(:ios) { Calatrava::Project.current.ios.install_tasks }
12
+ namespace(:web) { Calatrava::Project.current.mobile_web.install_tasks }
87
13
 
88
- Dir["#{File.join(File.dirname(__FILE__), 'tasks')}/*.rb"].each { |t| require t }
14
+ desc "Clean all apps"
15
+ task :clean => ['web:clean', 'ios:clean', 'droid:clean']
89
16
 
90
- desc "Clean all directories"
91
- task :clean => ["core:clean", "ios:clean", "bb:clean", "web:clean", "artifact:clean", "droid:clean"] do
92
- rm_rf BUILD_DIR
93
- end
17
+ task :build => ['web:build', 'ios:build', 'droid:build']
@@ -1,13 +1,13 @@
1
- LoadModule ssl_module <%=MODULES_PATH%>/mod_ssl.so
2
- LoadModule proxy_module <%=MODULES_PATH%>/mod_proxy.so
3
- LoadModule proxy_http_module <%=MODULES_PATH%>/mod_proxy_http.so
4
- LoadModule headers_module <%=MODULES_PATH%>/mod_headers.so
5
- <% if LOAD_LOG_MODULE %>
6
- LoadModule log_config_module <%=MODULES_PATH%>/mod_log_config.so
1
+ LoadModule ssl_module <%=configuration[:modules_path]%>/mod_ssl.so
2
+ LoadModule proxy_module <%=configuration[:modules_path]%>/mod_proxy.so
3
+ LoadModule proxy_http_module <%=configuration[:modules_path]%>/mod_proxy_http.so
4
+ LoadModule headers_module <%=configuration[:modules_path]%>/mod_headers.so
5
+ <% if configuration[:load_log_module] %>
6
+ LoadModule log_config_module <%=configuration[:modules_path]%>/mod_log_config.so
7
7
  <% end %>
8
- LoadModule mime_module <%=MODULES_PATH%>/mod_mime.so
9
- LoadModule dir_module <%=MODULES_PATH%>/mod_dir.so
10
- LoadModule alias_module <%=MODULES_PATH%>/mod_alias.so
8
+ LoadModule mime_module <%=configuration[:modules_path]%>/mod_mime.so
9
+ LoadModule dir_module <%=configuration[:modules_path]%>/mod_dir.so
10
+ LoadModule alias_module <%=configuration[:modules_path]%>/mod_alias.so
11
11
 
12
12
  ErrorLog "logs/error.log"
13
13
  LogLevel Debug
@@ -28,4 +28,7 @@ calatrava.bridge.runtime = (() ->
28
28
  options.method,
29
29
  options.body,
30
30
  options.headers)
31
+
32
+ callPlugin: (plugin, method, args) ->
33
+ pluginRegistry.call(plugin, method, JSON.stringify(args))
31
34
  )()
@@ -0,0 +1,13 @@
1
+ package com.calatrava;
2
+
3
+ import java.lang.annotation.Target;
4
+ import java.lang.annotation.ElementType;
5
+ import java.lang.annotation.Retention;
6
+ import java.lang.annotation.RetentionPolicy;
7
+
8
+ @Target(ElementType.TYPE)
9
+ @Retention(RetentionPolicy.RUNTIME)
10
+ public @interface CalatravaPlugin
11
+ {
12
+ String name();
13
+ }