compass_ae_starter_kit 2.0.0 → 2.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,4 @@
1
+ require "compass_ae_starter_kit/version"
1
2
  require 'compass_ae_starter_kit/file_support'
2
3
  require 'compass_ae_starter_kit/engine'
3
4
 
@@ -1,8 +1,10 @@
1
1
  module CompassAeStarterKit
2
+ RAILS_MAJOR = 3
3
+ RAILS_MINOR = 1
4
+ RAILS_TINY = '*'
2
5
  class CompassAE
3
6
  class << self
4
-
5
- def banner
7
+ def banner
6
8
  %(
7
9
  Usage:
8
10
  compass_ae new <app_name> [rails_opt] Creates a new Rails Compass AE Application
@@ -11,35 +13,50 @@ Usage:
11
13
  compass_ae dev <app_name> [rails_opt] Creates a new Rails Compass AE Application and clones our repository and points the Compass AE gems to it
12
14
  rails_opt: all the options accepted by the rails command
13
15
 
14
- compass_ae --help|-h This help screen
16
+ compass_ae --help|-h This help screen
15
17
  )
16
18
  end
17
19
 
18
20
  def run
19
- template_path = File.join(File.dirname(__FILE__), '../templates/default_template.rb')
21
+ #Get rails version
22
+ major, minor, tiny = `rails -v`.gsub!('Rails ', '').gsub!("\n",'').split('.').collect{|version| version.to_i}
23
+ if version_allowed?(RAILS_MAJOR, major) and version_allowed?(RAILS_MINOR, minor) and version_allowed?(RAILS_TINY, tiny)
24
+ template_path = File.join(File.dirname(__FILE__), '../templates/default_template.rb')
20
25
 
21
- if ARGV.first != "new" and ARGV.first != "dev"
22
- ARGV[0] = "--help"
23
- end
26
+ if ARGV.first != "new" and ARGV.first != "dev"
27
+ ARGV[0] = "--help"
28
+ end
24
29
 
25
- if ARGV.first == "dev"
26
- template_path = File.join(File.dirname(__FILE__), '../templates/development_template.rb')
27
- ARGV[0] = "new"
30
+ if ARGV.first == "dev"
31
+ template_path = File.join(File.dirname(__FILE__), '../templates/development_template.rb')
32
+ ARGV[0] = "new"
33
+ end
34
+
35
+ command = ARGV.shift
36
+ case command
37
+ when '--help'
38
+ puts self.banner
39
+ when 'new'
40
+ app_name = ARGV.shift
41
+ raise "The application name is missing!" if app_name.nil?
42
+ puts 'Generating Rails infrastructure...'
43
+ system "rails new #{app_name} #{ARGV * ' '} -m #{template_path}"
44
+ Dir.chdir app_name
45
+ system "rake db:migrate"
46
+ system "rake db:migrate_data"
47
+ end
48
+ else
49
+ puts "Installed Rails version is not compatible #{[major, minor, tiny].compact.join('.')}, please install #{[RAILS_MAJOR, RAILS_MINOR, RAILS_TINY].compact.join('.')}"
28
50
  end
29
51
 
30
- command = ARGV.shift
31
- case command
32
- when '--help'
33
- puts self.banner
34
- when 'new'
35
- app_name = ARGV.shift
36
- raise "The application name is missing!" if app_name.nil?
37
- puts 'Generating Rails infrastructure...'
38
- system "rails new #{app_name} #{ARGV * ' '} -m #{template_path}"
39
- Dir.chdir app_name
40
- system "rake db:migrate"
41
- system "rake db:migrate_data"
52
+ end
53
+
54
+ def version_allowed?(allowed_version, version)
55
+ result = true
56
+ unless(allowed_version == '*')
57
+ result = (allowed_version == version)
42
58
  end
59
+ result
43
60
  end
44
61
 
45
62
  end#self
@@ -5,16 +5,13 @@ FileUtils.cp File.join(File.dirname(__FILE__),'../../../public','index.html'), '
5
5
 
6
6
  CompassAeStarterKit::FileSupport.patch_file 'config/initializers/session_store.rb',
7
7
  "# #{app_const}.config.session_store :active_record_store",
8
- "#{app_const}.config.session_store :active_record_store",
8
+ "#{app_const}.config.session_store :active_record_store #use active_record for session storage, this is needed for knitkit",
9
9
  :patch_mode => :change
10
10
 
11
11
  CompassAeStarterKit::FileSupport.patch_file 'config/routes.rb',
12
12
  "#{app_const}.routes.draw do",
13
- " mount ErpApp::Engine => '/erp_app'
14
- mount RailsDbAdmin::Engine => '/rails_db_admin'
15
- mount Knitkit::Engine => '/knitkit'
16
- mount ErpTechSvcs::Engine => '/erp_tech_svcs'
17
- mount CompassAeConsole::Engine => '/compass_ae_console'",
13
+ " #mount CompassAE engines
14
+ ErpBaseErpSvcs.mount_compass_ae_engines(self)",
18
15
  :patch_mode => :insert_after
19
16
 
20
17
  CompassAeStarterKit::FileSupport.patch_file 'config/environments/production.rb',
@@ -5,16 +5,13 @@ FileUtils.cp File.join(File.dirname(__FILE__),'../../../public','index.html'), '
5
5
 
6
6
  CompassAeStarterKit::FileSupport.patch_file 'config/initializers/session_store.rb',
7
7
  "# #{app_const}.config.session_store :active_record_store",
8
- "#{app_const}.config.session_store :active_record_store",
8
+ "#{app_const}.config.session_store :active_record_store #use active_record for session storage, this is needed for knitkit",
9
9
  :patch_mode => :change
10
10
 
11
11
  CompassAeStarterKit::FileSupport.patch_file 'config/routes.rb',
12
12
  "#{app_const}.routes.draw do",
13
- " mount ErpApp::Engine => '/erp_app'
14
- mount RailsDbAdmin::Engine => '/rails_db_admin'
15
- mount Knitkit::Engine => '/knitkit'
16
- mount ErpTechSvcs::Engine => '/erp_tech_svcs'
17
- mount CompassAeConsole::Engine => '/compass_ae_console'",
13
+ " #mount CompassAE engines
14
+ ErpBaseErpSvcs.mount_compass_ae_engines(self)",
18
15
  :patch_mode => :insert_after
19
16
 
20
17
  CompassAeStarterKit::FileSupport.patch_file 'config/environments/production.rb',
@@ -2,7 +2,7 @@ module CompassAeStarterKit
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 2
4
4
  MINOR = 0
5
- TINY = 0
5
+ TINY = 1
6
6
 
7
7
  STRING = [MAJOR, MINOR, TINY].compact.join('.')
8
8
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: compass_ae_starter_kit
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.0.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-03-03 00:00:00.000000000Z
12
+ date: 2012-05-17 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
16
- requirement: &83533580 !ruby/object:Gem::Requirement
16
+ requirement: &82892770 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,7 +21,7 @@ dependencies:
21
21
  version: 3.1.0
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *83533580
24
+ version_requirements: *82892770
25
25
  description: Contains compass_ae command to create a new Compass AE application
26
26
  email:
27
27
  - russonrails@gmail.com
@@ -41,7 +41,8 @@ files:
41
41
  - public/index.html
42
42
  - GPL-3-LICENSE
43
43
  - README.md
44
- - bin/compass_ae
44
+ - !binary |-
45
+ YmluL2NvbXBhc3NfYWU=
45
46
  homepage: http://development.compassagile.com
46
47
  licenses: []
47
48
  post_install_message:
@@ -62,7 +63,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
62
63
  version: '0'
63
64
  requirements: []
64
65
  rubyforge_project:
65
- rubygems_version: 1.8.17
66
+ rubygems_version: 1.8.10
66
67
  signing_key:
67
68
  specification_version: 3
68
69
  summary: Gem to help get the Compass AE framework up a running