gbdev-common_project_tasks 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/LICENSE ADDED
@@ -0,0 +1,7 @@
1
+ Licensing terms follow:
2
+
3
+ This software is placed under the Creative Commons Attribution-Share ALike 3.0 Unported License
4
+
5
+ http://creativecommons.org/licenses/by-sa/3.0/
6
+
7
+ MIT
data/README ADDED
@@ -0,0 +1,41 @@
1
+ CommonProjectTasks
2
+ ===============
3
+
4
+ Rails gem/plugin to load common project tasks.
5
+
6
+
7
+ Once the plugin is installed add the following to {RAILS_ROOT}/Rakefile
8
+
9
+ require 'common_project_tasks'
10
+
11
+
12
+
13
+ Each project will need a {RAILS_ROOT}/config/app_vars.yml file. Each environment list in the database.yml
14
+ file should also be listed in app_vars.yml. The supported attributes are:
15
+
16
+ * rebuild_database [true/false]
17
+ * load_fixtures [true/false]
18
+ * fixtures [fixture1,fixture2,fixture3] (specify in order you want them to load)
19
+
20
+
21
+ The app_vars.yml file should look something like.
22
+ Note: This example can be found in {COMMON_PROJECT_TASKS_PLUGIN}/examples/app_vars.yml.
23
+
24
+ ###############################################
25
+ app_vars: &app_vars
26
+ rebuild_database: true
27
+ load_fixtures: true
28
+ fixtures: 'states,users,permissions'
29
+
30
+ development:
31
+ <<: *app_vars
32
+
33
+ test:
34
+ <<: *app_vars
35
+
36
+ production:
37
+ rebuild_database: false
38
+ load_fixtures: false
39
+ <<: *app_vars
40
+
41
+ ###############################################
@@ -0,0 +1 @@
1
+ load 'common_project_tasks/app.rake'
@@ -0,0 +1,59 @@
1
+ namespace :app do
2
+ desc 'Setup the application. Usage: rake app:setup. Set RAILS_ENV for other environments. The default is development'
3
+ task :setup do
4
+ ENV['RAILS_ENV'] = 'development' unless ENV.include?('RAILS_ENV')
5
+
6
+ file = "#{RAILS_ROOT}/config/app_vars.yml"
7
+ app_vars = YAML::load(ERB.new(IO.read(file)).result)
8
+
9
+ file = "#{RAILS_ROOT}/config/database.yml"
10
+ database = YAML::load(ERB.new(IO.read(file)).result)
11
+
12
+ # update git submodules in case new ones were added
13
+ system('git submodule init')
14
+ system('git submodule update')
15
+
16
+ if !app_vars[ENV['RAILS_ENV']]['rebuild_database'].nil? and app_vars[ENV['RAILS_ENV']]['rebuild_database'] == true
17
+ Rake::Task['db:drop'].invoke
18
+ Rake::Task['db:create'].invoke
19
+ end
20
+
21
+ Rake::Task['db:migrate'].invoke
22
+
23
+ if !app_vars[ENV['RAILS_ENV']]['load_fixtures'].nil? and app_vars[ENV['RAILS_ENV']]['load_fixtures'] == true
24
+ ENV['FIXTURES'] = app_vars[ENV['RAILS_ENV']]['fixtures']
25
+ Rake::Task['spec:db:fixtures:load'].invoke
26
+ end
27
+ end
28
+
29
+ ##############################################
30
+ # The tasks below will not work because the
31
+ # commandline argument RAILS_ENV has already
32
+ # been read by the Rails environment by the
33
+ # time this task is executed.
34
+ ##############################################
35
+
36
+ # desc 'Setup the application for production.'
37
+ # task :setup_production => :environment do
38
+ # ENV['RAILS_ENV'] = 'production'
39
+ # Rake::Task['app:setup'].invoke
40
+ # end
41
+ #
42
+ # desc 'Setup the application for development.'
43
+ # task :setup_development => :environment do
44
+ # ENV['RAILS_ENV'] = 'development'
45
+ # Rake::Task['app:setup'].invoke
46
+ # end
47
+ #
48
+ # desc 'Setup the application for testing.'
49
+ # task :setup_test => :environment do
50
+ # ENV['RAILS_ENV'] = 'test'
51
+ # Rake::Task['app:setup'].invoke
52
+ # end
53
+ #
54
+ # desc 'Setup the application for production, development and testing environments.'
55
+ # task :setup_all => [:setup_production, :setup_development, :setup_test]
56
+ end
57
+
58
+
59
+
metadata ADDED
@@ -0,0 +1,70 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: gbdev-common_project_tasks
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Wes Hays
8
+ - John Dell
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+
13
+ date: 2009-01-11 00:00:00 -08:00
14
+ default_executable:
15
+ dependencies:
16
+ - !ruby/object:Gem::Dependency
17
+ name: rake
18
+ version_requirement:
19
+ version_requirements: !ruby/object:Gem::Requirement
20
+ requirements:
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: 0.8.3
24
+ version:
25
+ description: Rails gem/plugin to load common project tasks.
26
+ email: gems@gbdev.com
27
+ executables: []
28
+
29
+ extensions: []
30
+
31
+ extra_rdoc_files:
32
+ - README
33
+ - LICENSE
34
+ files:
35
+ - LICENSE
36
+ - README
37
+ - lib/common_project_tasks.rb
38
+ - lib/common_project_tasks/app.rake
39
+ has_rdoc: true
40
+ homepage: http://github.com/gbdev/common_project_tasks
41
+ post_install_message:
42
+ rdoc_options:
43
+ - --title
44
+ - Common Project Tasks Documentation
45
+ - --main
46
+ - README
47
+ - -q
48
+ require_paths:
49
+ - lib/
50
+ required_ruby_version: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: "0"
55
+ version:
56
+ required_rubygems_version: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - ">="
59
+ - !ruby/object:Gem::Version
60
+ version: "0"
61
+ version:
62
+ requirements: []
63
+
64
+ rubyforge_project: Project on www.github.com
65
+ rubygems_version: 1.2.0
66
+ signing_key:
67
+ specification_version: 2
68
+ summary: Rails gem/plugin to load common project tasks.
69
+ test_files: []
70
+