compass_ae_starter_kit 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
data/README.md ADDED
@@ -0,0 +1,66 @@
1
+
2
+ Compass AE Starter Kit
3
+ ======================
4
+
5
+ Want to get started using the Compass AE framework but think its too complicated, well below are 5 easy steps to get you started.
6
+
7
+ ##prerequisites
8
+
9
+ * [Rails] -- (~> 3.1.1)
10
+ * [bundler] -- (1.0.21 ruby)
11
+ * [wkhtmltopdf] -- (used by pdfkit https://github.com/jdpace/PDFKit)
12
+ * [ImageMagick] -- (used by quick_magick http://quickmagick.rubyforge.org/quick_magick/)
13
+ * [Solr] -- (used by sunspot http://outoftime.github.com/sunspot/ only needed if erp_search module is installed)
14
+
15
+
16
+ ##Installation (Gems Only)
17
+
18
+ (Step 1) Create a new rails application
19
+
20
+ rails new compass_demo
21
+
22
+ (Step 2) Add our local gem repository to your Gemfile
23
+
24
+ source 'http://development.compassagile.com:8080'
25
+
26
+ (Step 3) Add compass_ae_starter_kit gem to your Gemfile
27
+
28
+ gem 'compass_ae_starter_kit'
29
+
30
+ (Step 4) Bundle it up
31
+
32
+ bundle install
33
+
34
+ (Step 5) Initialize the Compass AE framework
35
+
36
+ rake compass_ae_starter_kit:initialize
37
+
38
+ Follow the instructions and Enjoy !
39
+
40
+ ##Notes
41
+
42
+ ### Options
43
+
44
+ You can install all Compass AE engines via
45
+
46
+ rake compass_ae_starter_kit:install:all
47
+
48
+ OR
49
+
50
+ You can install all Compass AE engines except some
51
+
52
+ rake compass_ae_starter_kit:install:all except=erp_products,erp_rules
53
+
54
+ OR
55
+
56
+ You can install engines that you choose
57
+
58
+ rake compass_ae_starter_kit:install engines=erp_app,erp_forms,knitkit,rails_db_admin
59
+
60
+ ### Development
61
+
62
+ If you want the source from our GIT repositories and not just the gems you can pass an optional argument to the install task
63
+
64
+ rake compass_ae_starter_kit:install:core development=true
65
+
66
+ This will clone our GIT repositories and point your Gemfile.rb to them
@@ -0,0 +1,97 @@
1
+ ---
2
+ - :name: erp_base_erp_svcs
3
+ :git:
4
+ :name: Compass-AE-Kernel
5
+ :url: https://github.com/portablemind/Compass-AE-Kernel.git
6
+ :is_group: true
7
+ - :name: erp_tech_svcs
8
+ :has_routes: true
9
+ :git:
10
+ :name: Compass-AE-Kernel
11
+ :url: https://github.com/portablemind/Compass-AE-Kernel.git
12
+ :is_group: true
13
+ - :name: erp_app
14
+ :has_routes: true
15
+ :git:
16
+ :name: Application-Stack---Suite
17
+ :url: https://github.com/portablemind/Application-Stack---Suite.git
18
+ :is_group: true
19
+ - :name: erp_forms
20
+ :has_routes: true
21
+ :git:
22
+ :name: Application-Stack---Suite
23
+ :url: https://github.com/portablemind/Application-Stack---Suite.git
24
+ :is_group: true
25
+ - :name: knitkit
26
+ :has_routes: true
27
+ :git:
28
+ :name: Knitkit-CMS
29
+ :url: https://github.com/portablemind/Knitkit-CMS.git
30
+ - :name: rails_db_admin
31
+ :has_routes: true
32
+ :git:
33
+ :name: Rails-DB-Admin
34
+ :url: https://github.com/portablemind/Rails-DB-Admin.git
35
+ - :name: compass_ae_console
36
+ :has_routes: true
37
+ :git:
38
+ :name: Compass-AE-Console
39
+ :url: https://github.com/portablemind/Compass-AE-Console.git
40
+ - :name: erp_agreements
41
+ :git:
42
+ :name: Erp-Modules
43
+ :url: https://github.com/portablemind/Erp-Modules.git
44
+ :is_group: true
45
+ - :name: erp_commerce
46
+ :git:
47
+ :name: Erp-Modules
48
+ :url: https://github.com/portablemind/Erp-Modules.git
49
+ :is_group: true
50
+ - :name: erp_communication_events
51
+ :git:
52
+ :name: Erp-Modules
53
+ :url: https://github.com/portablemind/Erp-Modules.git
54
+ :is_group: true
55
+ - :name: erp_financial_accounting
56
+ :git:
57
+ :name: Erp-Modules
58
+ :url: https://github.com/portablemind/Erp-Modules.git
59
+ :is_group: true
60
+ - :name: erp_inventory
61
+ :git:
62
+ :name: Erp-Modules
63
+ :url: https://github.com/portablemind/Erp-Modules.git
64
+ :is_group: true
65
+ - :name: erp_invoicing
66
+ :has_routes: true
67
+ :git:
68
+ :name: Erp-Modules
69
+ :url: https://github.com/portablemind/Erp-Modules.git
70
+ :is_group: true
71
+ - :name: erp_orders
72
+ :has_routes: true
73
+ :git:
74
+ :name: Erp-Modules
75
+ :url: https://github.com/portablemind/Erp-Modules.git
76
+ :is_group: true
77
+ - :name: erp_products
78
+ :has_routes: true
79
+ :git:
80
+ :name: Erp-Modules
81
+ :url: https://github.com/portablemind/Erp-Modules.git
82
+ :is_group: true
83
+ - :name: erp_rules
84
+ :git:
85
+ :name: Erp-Modules
86
+ :url: https://github.com/portablemind/Erp-Modules.git
87
+ :is_group: true
88
+ - :name: erp_txns_and_accts
89
+ :git:
90
+ :name: Erp-Modules
91
+ :url: https://github.com/portablemind/Erp-Modules.git
92
+ :is_group: true
93
+ - :name: erp_work_effort
94
+ :git:
95
+ :name: Erp-Modules
96
+ :url: https://github.com/portablemind/Erp-Modules.git
97
+ :is_group: true
@@ -0,0 +1,9 @@
1
+ module CompassAeStarterKit
2
+ class Engine < Rails::Engine
3
+ isolate_namespace CompassAeStarterKit
4
+
5
+ rake_tasks do
6
+ Dir[File.join('../',File.dirname(__FILE__),'tasks/*.rake')].each { |f| load f }
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,37 @@
1
+ module CompassAeStarterKit
2
+ class FileSupport
3
+ class << self
4
+
5
+ def patch_file(path, current, insert, options = {})
6
+ options = {
7
+ :patch_mode => :insert_after
8
+ }.merge(options)
9
+
10
+ old_text = current
11
+ new_text = patch_string(current, insert, options[:patch_mode])
12
+
13
+ content = File.open(path) { |f| f.read }
14
+ content.gsub!(old_text, new_text) unless content =~ /#{Regexp.escape(insert)}/mi
15
+ File.open(path, 'w') { |f| f.puts(content) }
16
+ end
17
+
18
+ def append_file(path, content)
19
+ File.open(path, 'a') { |f| f.puts(content) }
20
+ end
21
+
22
+ def patch_string(current, insert, mode = :insert_after)
23
+ case mode
24
+ when :change
25
+ "#{insert}"
26
+ when :insert_after
27
+ "#{current}\n#{insert}"
28
+ when :insert_before
29
+ "#{insert}\n#{current}"
30
+ else
31
+ patch_string(current, insert, :insert_after)
32
+ end
33
+ end
34
+
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,3 @@
1
+ module CompassAeStarterKit
2
+ VERSION = "1.0.0"
3
+ end
@@ -0,0 +1,6 @@
1
+ require 'compass_ae_starter_kit/file_support'
2
+ require 'compass_ae_starter_kit/engine'
3
+
4
+ module CompassAeStarterKit
5
+
6
+ end
@@ -0,0 +1,235 @@
1
+ require 'yaml'
2
+ require 'fileutils'
3
+
4
+ namespace :compass_ae_starter_kit do
5
+
6
+ desc 'sets up all configuration files and initilizers to run Compass AE'
7
+ task :initialize => :environment do
8
+ #remove public index file from Rails application so Compass AE splash will show
9
+ File.unlink 'public/index.html' rescue Errno::ENOENT
10
+ FileUtils.cp File.join(File.dirname(__FILE__),'../../public','index.html'), 'public/index.html'
11
+
12
+ CompassAeStarterKit::FileSupport.patch_file 'config/initializers/session_store.rb',
13
+ "# #{Rails.application.class.parent_name}::Application.config.session_store :active_record_store",
14
+ " #{Rails.application.class.parent_name}::Application.config.session_store :active_record_store",
15
+ :patch_mode => :change
16
+
17
+ CompassAeStarterKit::FileSupport.patch_file 'config/environments/production.rb',
18
+ " config.serve_static_assets = false",
19
+ " config.serve_static_assets = true",
20
+ :patch_mode => :change
21
+
22
+ CompassAeStarterKit::FileSupport.patch_file 'config/environments/production.rb',
23
+ " config.assets.compile = false",
24
+ " config.assets.compile = true",
25
+ :patch_mode => :change
26
+
27
+ puts <<-end
28
+
29
+ Thanks for initializing Compass AE!
30
+
31
+ We've performed the following tasks:
32
+
33
+ * Replaced the index.html page from /public with our Compass AE splash screen
34
+ * patched config/initializers/session_store.rb to use ActiveRecord for your session store
35
+ * patched config/environments/production.rb and set config.serve_static_assets = true
36
+ * patched config/environments/production.rb and set config.assets.compile = true
37
+
38
+ Next Steps:
39
+
40
+ Install the Compass AE frameworks core engines
41
+
42
+ If you only want the gems and not the source:
43
+
44
+ rake compass_ae_starter_kit:install:core
45
+
46
+ If you want to clone the git repositories and have the source for development
47
+
48
+ rake compass_ae_starter_kit:install:core development=true
49
+
50
+ enjoy!
51
+
52
+ end
53
+ end
54
+
55
+ namespace :install do
56
+ desc 'install core Compass AE engines'
57
+ task :core do
58
+ ENV['engines'] = 'core'
59
+ Rake::Task['compass_ae_starter_kit:install'].invoke
60
+ end
61
+
62
+ desc 'install all Compass AE engines'
63
+ task :all do
64
+ ENV['engines'] = 'all'
65
+ Rake::Task['compass_ae_starter_kit:install'].invoke
66
+ end
67
+
68
+ end#:install
69
+
70
+ desc 'install selected compass engines (engines=core or engines=all or engines=name1,name2)'
71
+ task :install => :environment do
72
+ # call the perform method set to :install
73
+ engines = perform(:install_engines)
74
+
75
+ puts "Installed the following engines #{engines.collect{|engine|engine[:name]}.join(',')}"
76
+
77
+ puts <<-end
78
+
79
+ Thanks for installing Compass AE!
80
+
81
+ We've performed the following tasks:
82
+
83
+ * Updated your Gemfile with the installed engines
84
+ * patched config/routes.rb to mount the engines
85
+
86
+ Next Steps:
87
+
88
+ 1. bundle install
89
+ 2. rake db:migrate
90
+ 3. rake db:migrate_data
91
+
92
+ Then startup your server...
93
+
94
+ rails s
95
+ open http://localhost:3000/
96
+
97
+ You should see the Compass AE Splash screen.
98
+
99
+ To Login to either the desktop or organizer the credentials are:
100
+
101
+ username: admin
102
+ passwrod: password
103
+
104
+ enjoy!
105
+
106
+ end
107
+
108
+ end
109
+
110
+ namespace :uninstall do
111
+ desc 'uninstall core Compass AE engines'
112
+ task :core do
113
+ ENV['engines'] = 'core'
114
+ Rake::Task['compass_ae_starter_kit:uninstall'].invoke
115
+ end
116
+
117
+ desc 'uninstall all Compass AE engines'
118
+ task :all do
119
+ ENV['engines'] = 'all'
120
+ Rake::Task['compass_ae_starter_kit:uninstall'].invoke
121
+ end
122
+
123
+ end#:uninstall
124
+
125
+ desc 'uninstall selected compass engines (engines=core or engines=all or engines=name1,name2)'
126
+ task :uninstall => :environment do
127
+ # call the perform set to :uninstall
128
+ engines = perform(:uninstall_engines)
129
+
130
+ puts "Uninstalled the following engines #{engines.collect{|engine|engine[:name]}.join(',')}"
131
+ end
132
+
133
+ def perform(method)
134
+ except = ENV['except'] ? ENV['except'].split(',') : []
135
+
136
+ engines = case ENV['engines']
137
+ when 'all'
138
+ all_engines
139
+ when 'core'
140
+ core_engines
141
+ else
142
+ select_engines(ENV['engines'].split(','))
143
+ end
144
+
145
+ #remove exceptions
146
+ except.each do |exception_engine|
147
+ engines.delete_if{|engine| engine[:name] == exception_engine}
148
+ end
149
+
150
+ send(method, engines, ENV['development']) if !engines.nil? and !engines.blank?
151
+
152
+ engines
153
+ end
154
+
155
+ def load_engines
156
+ YAML.load_file(File.join(File.dirname(__FILE__),'../../config','compass_ae_engines.yml'))
157
+ end
158
+
159
+ def all_engines
160
+ load_engines
161
+ end
162
+
163
+ def core_engines
164
+ select_engines(%w{erp_base_erp_svcs erp_tech_svcs erp_app erp_forms knitkit rails_db_admin compass_ae_console})
165
+ end
166
+
167
+ def select_engines(names)
168
+ all_engines.select{|engine| names.include?(engine[:name])}
169
+ end
170
+
171
+ def install_engines(engines, development=false)
172
+ installed_engines = Rails::Application::Railties.engines.collect{|e| e.railtie_name.camelize}
173
+
174
+ engines.each do |engine|
175
+ unless installed_engines.include?(engine[:name].camelize)
176
+ if engine[:has_routes]
177
+ CompassAeStarterKit::FileSupport.patch_file 'config/routes.rb',
178
+ "#{Rails.application.class.parent_name}::Application.routes.draw do",
179
+ " mount #{engine[:name].camelize}::Engine => '/#{engine[:name]}'",
180
+ :patch_mode => :insert_after
181
+ end
182
+
183
+ if development
184
+ git_settings = engine[:git]
185
+ git_path = File.join(Rails.root,'lib/compass')
186
+ FileUtils.mkdir_p git_path unless File.directory? git_path
187
+
188
+ engine_repo = File.join(git_path,git_settings[:name])
189
+
190
+ unless File.directory? engine_repo
191
+ Dir.chdir git_path
192
+ `git clone #{git_settings[:url]}`
193
+
194
+ Dir.chdir engine_repo
195
+ `git checkout`
196
+
197
+ Dir.chdir Rails.root
198
+ end
199
+
200
+ gem_path = git_settings[:is_group] ? File.join(engine_repo,engine[:name]) : engine_repo
201
+
202
+ CompassAeStarterKit::FileSupport.append_file 'Gemfile',
203
+ "gem '#{engine[:name]}', :path => '#{gem_path}'"
204
+ else
205
+ CompassAeStarterKit::FileSupport.append_file 'Gemfile',
206
+ "gem '#{engine[:name]}'"
207
+ end
208
+
209
+ end
210
+ end
211
+
212
+ end
213
+
214
+ def uninstall_engines(engines)
215
+ installed_engines = Rails::Application::Railties.engines.collect{|e| e.railtie_name.camelize}
216
+
217
+ engines.each do |engine|
218
+ if installed_engines.include?(engine[:name].camelize)
219
+ CompassAeStarterKit::FileSupport.patch_file 'Gemfile',
220
+ "gem '#{engine[:name]}'",
221
+ " ",
222
+ :patch_mode => :change
223
+
224
+ if engine[:has_routes]
225
+ CompassAeStarterKit::FileSupport.patch_file 'config/routes.rb',
226
+ "#{Rails.application.class.parent_name}::Application.routes.draw do",
227
+ " mount #{engine[:name].camelize}::Engine => '/#{engine[:name]}'",
228
+ " ",
229
+ :patch_mode => :change
230
+ end
231
+ end
232
+ end
233
+ end
234
+
235
+ end#:compass_ae_starter_kit
data/public/index.html ADDED
@@ -0,0 +1,221 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2
+ <html xmlns="http://www.w3.org/1999/xhtml">
3
+ <head>
4
+ <title>compass_install_splash</title>
5
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
6
+ <!-- Save for Web Styles (compass_install_splash.psd) -->
7
+ <style type="text/css">
8
+ <!--
9
+
10
+ a img {
11
+ border-style: none;
12
+ }
13
+
14
+ div.Table_01 {
15
+ position: absolute;
16
+ left: 50%;
17
+ margin-left: -512px;
18
+ top:0px;
19
+ width:1024px;
20
+ height:768px;
21
+ }
22
+
23
+ div.main-bg_ {
24
+ position:absolute;
25
+ left:0px;
26
+ top:0px;
27
+ width:100%;
28
+ height:768px;
29
+
30
+ }
31
+
32
+ div.compass-install-splash-02_ {
33
+ position:absolute;
34
+ left:15px;
35
+ top:0px;
36
+ width:1009px;
37
+ height:97px;
38
+ }
39
+
40
+ div.compass-install-splash-03_ {
41
+ position:absolute;
42
+ left:15px;
43
+ top:97px;
44
+ width:232px;
45
+ height:311px;
46
+ }
47
+
48
+ div.compass-logo_ {
49
+ position:absolute;
50
+ left:247px;
51
+ top:97px;
52
+ width:538px;
53
+ height:274px;
54
+ }
55
+
56
+ div.compass-install-splash-05_ {
57
+ position:absolute;
58
+ left:785px;
59
+ top:97px;
60
+ width:239px;
61
+ height:311px;
62
+ }
63
+
64
+ div.compass-install-splash-06_ {
65
+ position:absolute;
66
+ left:247px;
67
+ top:371px;
68
+ width:538px;
69
+ height:37px;
70
+ }
71
+
72
+ div.browse-docs-icon_ {
73
+ position:absolute;
74
+ left:180px;
75
+ top:408px;
76
+ width:285px;
77
+ height:254px;
78
+ }
79
+
80
+ div.desktop-icon_ {
81
+ position:absolute;
82
+ left:450px;
83
+ top:408px;
84
+ width:214px;
85
+ height:254px;
86
+ }
87
+
88
+ div.contact-mgt-icon_ {
89
+ position:absolute;
90
+ left:650px;
91
+ top:408px;
92
+ width:295px;
93
+ height:254px;
94
+ }
95
+
96
+ div.compass-install-splash-11_ {
97
+ position:absolute;
98
+ left:15px;
99
+ top:662px;
100
+ width:461px;
101
+ height:87px;
102
+ }
103
+
104
+ div.tn-logo_ {
105
+ position:absolute;
106
+ left:476px;
107
+ top:662px;
108
+ width:77px;
109
+ height:71px;
110
+ }
111
+
112
+ div.compass-install-splash-13_ {
113
+ position:absolute;
114
+ left:553px;
115
+ top:662px;
116
+ width:471px;
117
+ height:87px;
118
+ }
119
+
120
+ div.compass-install-splash-14_ {
121
+ position:absolute;
122
+ left:476px;
123
+ top:733px;
124
+ width:77px;
125
+ height:16px;
126
+ }
127
+
128
+ div.compass-install-splash-15_ {
129
+ position:absolute;
130
+ left:15px;
131
+ top:749px;
132
+ width:330px;
133
+ height:19px;
134
+ }
135
+
136
+ div.sponsored-by_ {
137
+ position:absolute;
138
+ left:345px;
139
+ top:749px;
140
+ width:342px;
141
+ height:19px;
142
+ }
143
+
144
+ div.compass-install-splash-17_ {
145
+ position:absolute;
146
+ left:687px;
147
+ top:749px;
148
+ width:337px;
149
+ height:19px;
150
+ }
151
+
152
+ -->
153
+ </style>
154
+ <!-- End Save for Web Styles -->
155
+ </head>
156
+ <body style="background-image:url(images/splash_screen/main_bg.png); ">
157
+ <!-- Save for Web Slices (compass_install_splash.psd) -->
158
+
159
+
160
+
161
+ <div class="Table_01">
162
+ <div class="main-bg_">
163
+ <img id="main_bg" src="images/splash_screen/main_bg.png" width="15" height="768" alt="" />
164
+ </div>
165
+ <div class="compass-install-splash-02_">
166
+ <img id="compass_install_splash_02" src="images/splash_screen/compass_install_splash_02.png" width="1009" height="97" alt="" />
167
+ </div>
168
+ <div class="compass-install-splash-03_">
169
+ <img id="compass_install_splash_03" src="images/splash_screen/compass_install_splash_03.png" width="232" height="311" alt="" />
170
+ </div>
171
+ <div class="compass-logo_">
172
+ <img id="compass_logo" src="images/splash_screen/compass_logo.png" width="538" height="274" alt="" />
173
+ </div>
174
+ <div class="compass-install-splash-05_">
175
+ <img id="compass_install_splash_05" src="images/splash_screen/compass_install_splash_05.png" width="239" height="311" alt="" />
176
+ </div>
177
+ <div class="compass-install-splash-06_">
178
+ <img id="compass_install_splash_06" src="images/splash_screen/compass_install_splash_06.png" width="538" height="37" alt="" />
179
+ </div>
180
+ <div class="browse-docs-icon_">
181
+ <a href="http://www.portablemind.com" style="border-style: none;">
182
+ <img id="browse_docs_icon" src="images/splash_screen/browse_docs_icon.png" width="285" height="254" alt="" />
183
+ </a>
184
+ </div>
185
+ <div class="desktop-icon_">
186
+ <a href="/erp_app/desktop/" style="border-style: none;">
187
+ <img id="desktop_icon" src="images/splash_screen/desktop_icon.png" width="214" height="254" alt="" />
188
+ </a>
189
+ </div>
190
+ <div class="contact-mgt-icon_">
191
+ <a href="/erp_app/organizer/" style="border-style: none;">
192
+ <img id="contact_mgt_icon" src="images/splash_screen/contact_mgt_icon.png" width="295" height="254" alt="" style="border-style: none;"/>
193
+ </a>
194
+ </div>
195
+ <div class="compass-install-splash-11_">
196
+ <img id="compass_install_splash_11" src="images/splash_screen/compass_install_splash_11.png" width="461" height="87" alt="" />
197
+ </div>
198
+ <div class="tn-logo_">
199
+ <img id="tn_logo" src="images/splash_screen/tn_logo.png" width="77" height="71" alt="" />
200
+ </div>
201
+ <div class="compass-install-splash-13_">
202
+ <img id="compass_install_splash_13" src="images/splash_screen/compass_install_splash_13.png" width="471" height="87" alt="" />
203
+ </div>
204
+ <div class="compass-install-splash-14_">
205
+ <img id="compass_install_splash_14" src="images/splash_screen/compass_install_splash_14.png" width="77" height="16" alt="" />
206
+ </div>
207
+ <div class="compass-install-splash-15_">
208
+ <img id="compass_install_splash_15" src="images/splash_screen/compass_install_splash_15.png" width="330" height="19" alt="" />
209
+ </div>
210
+ <div class="sponsored-by_">
211
+ <img id="sponsored_by" src="images/splash_screen/sponsored_by.png" width="342" height="19" alt="" />
212
+ </div>
213
+ <div class="compass-install-splash-17_">
214
+ <img id="compass_install_splash_17" src="images/splash_screen/compass_install_splash_17.png" width="337" height="19" alt="" />
215
+ </div>
216
+ </div>
217
+
218
+
219
+ <!-- End Save for Web Slices -->
220
+ </body>
221
+ </html>