tog-desert 0.3.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (42) hide show
  1. data/CHANGES +28 -0
  2. data/MIT-LICENSE +20 -0
  3. data/README.rdoc +295 -0
  4. data/Rakefile +100 -0
  5. data/generators/desert_plugin/USAGE +14 -0
  6. data/generators/desert_plugin/desert_plugin_generator.rb +73 -0
  7. data/generators/desert_plugin/templates/empty_file +0 -0
  8. data/generators/desert_plugin/templates/plugin_migration.rb +11 -0
  9. data/generators/desert_plugin/templates/routes.rb +4 -0
  10. data/generators/desert_plugin/templates/spec_helper.rb +8 -0
  11. data/init.rb +0 -0
  12. data/lib/desert/manager.rb +116 -0
  13. data/lib/desert/plugin.rb +74 -0
  14. data/lib/desert/plugin_migrations/extensions/1.0/schema_statements.rb +34 -0
  15. data/lib/desert/plugin_migrations/extensions/2.1/schema_statements.rb +12 -0
  16. data/lib/desert/plugin_migrations/extensions/schema_statements.rb +6 -0
  17. data/lib/desert/plugin_migrations/migrator.rb +54 -0
  18. data/lib/desert/plugin_migrations.rb +3 -0
  19. data/lib/desert/plugin_templates/1.2.0/action_mailer.rb +21 -0
  20. data/lib/desert/plugin_templates/1.2.0/action_view.rb +53 -0
  21. data/lib/desert/plugin_templates/1.99.0/action_mailer.rb +25 -0
  22. data/lib/desert/plugin_templates/1.99.0/action_view.rb +38 -0
  23. data/lib/desert/plugin_templates/2.0.0/action_mailer.rb +23 -0
  24. data/lib/desert/plugin_templates/2.0.2/action_view.rb +26 -0
  25. data/lib/desert/plugin_templates/2.1.0/action_view.rb +13 -0
  26. data/lib/desert/plugin_templates/action_controller.rb +14 -0
  27. data/lib/desert/plugin_templates/action_view.rb +16 -0
  28. data/lib/desert/plugin_templates/edge/action_view.rb +10 -0
  29. data/lib/desert/plugin_templates.rb +10 -0
  30. data/lib/desert/rails/1.2.0/initializer.rb +20 -0
  31. data/lib/desert/rails/2.0.0/plugin.rb +22 -0
  32. data/lib/desert/rails/dependencies.rb +87 -0
  33. data/lib/desert/rails/migration.rb +36 -0
  34. data/lib/desert/rails/observer.rb +22 -0
  35. data/lib/desert/rails/route_set.rb +23 -0
  36. data/lib/desert/rails.rb +11 -0
  37. data/lib/desert/ruby/object.rb +34 -0
  38. data/lib/desert/ruby.rb +2 -0
  39. data/lib/desert/supported_rails_versions.rb +9 -0
  40. data/lib/desert/version_checker.rb +26 -0
  41. data/lib/desert.rb +14 -0
  42. metadata +95 -0
@@ -0,0 +1,11 @@
1
+ dir = File.dirname(__FILE__)
2
+ if Desert::VersionChecker.rails_version_is_below_1990?
3
+ require "#{dir}/rails/1.2.0/initializer"
4
+ else
5
+ require "#{dir}/rails/2.0.0/plugin"
6
+ end
7
+ require "#{dir}/rails/dependencies"
8
+ require "#{dir}/rails/migration"
9
+
10
+ require "#{dir}/rails/route_set"
11
+ require "#{dir}/rails/observer"
@@ -0,0 +1,34 @@
1
+ class Object
2
+ def require_with_desert(path)
3
+ relative_include_path = (path =~ /\.rb$/) ? path : "#{path}.rb"
4
+ if $".include?(relative_include_path)
5
+ return false
6
+ else
7
+ __each_matching_file(path) do |expanded_path|
8
+ require_without_desert expanded_path
9
+ end
10
+ $" << relative_include_path
11
+ return true
12
+ end
13
+ end
14
+ alias_method_chain :require, :desert
15
+
16
+ def load_with_desert(file)
17
+ __each_matching_file(file) do |file|
18
+ load_without_desert file
19
+ end
20
+ end
21
+ alias_method_chain :load, :desert
22
+
23
+ private
24
+ def __each_matching_file(file)
25
+ files = Desert::Manager.instance.files_on_load_path(file)
26
+ desert_file_exists = files.empty? ? false : true
27
+ files.each do |component_file|
28
+ yield(component_file)
29
+ end
30
+
31
+ return true if desert_file_exists
32
+ yield(file)
33
+ end
34
+ end
@@ -0,0 +1,2 @@
1
+ dir = File.dirname(__FILE__)
2
+ require "#{dir}/ruby/object"
@@ -0,0 +1,9 @@
1
+ module Desert
2
+ SUPPORTED_RAILS_VERSIONS = {
3
+ "1.2.5" => {'version' => '1.2.5', 'git_tag' => 'v1.2.5'},
4
+ "1.99.0" => {'version' => '1.99.0', 'git_tag' => 'v2.0.0_RC1'},
5
+ "2.0.2" => {'version' => '2.0.2', 'git_tag' => 'v2.0.2'},
6
+ "2.1.0" => {'version' => '2.1.0', 'git_tag' => 'v2.1.0'},
7
+ "edge" => {'version' => 'edge', 'git_tag' => 'master'},
8
+ }
9
+ end
@@ -0,0 +1,26 @@
1
+ module Desert
2
+ class VersionChecker
3
+ class << self
4
+ def current_rails_version_matches?(version_requirement)
5
+ version_matches?(::Rails::VERSION::STRING, version_requirement)
6
+ end
7
+
8
+ def version_matches?(version, version_requirement)
9
+ Gem::Version::Requirement.new([version_requirement]).satisfied_by?(Gem::Version.new(version))
10
+ end
11
+
12
+ def rails_version_is_below_1990?
13
+ result = current_rails_version_matches?('<1.99.0')
14
+ result
15
+ end
16
+
17
+ def rails_version_is_below_rc2?
18
+ current_rails_version_matches?('<1.99.1')
19
+ end
20
+
21
+ def rails_version_is_1991?
22
+ current_rails_version_matches?('=1.99.1')
23
+ end
24
+ end
25
+ end
26
+ end
data/lib/desert.rb ADDED
@@ -0,0 +1,14 @@
1
+ require "active_support"
2
+ require "active_record"
3
+ require "action_controller"
4
+ require "action_mailer"
5
+
6
+ dir = File.dirname(__FILE__)
7
+ require "#{dir}/desert/supported_rails_versions"
8
+ require "#{dir}/desert/plugin"
9
+ require "#{dir}/desert/manager"
10
+ require "#{dir}/desert/version_checker"
11
+ require "#{dir}/desert/rails"
12
+ require "#{dir}/desert/ruby"
13
+ require "#{dir}/desert/plugin_migrations"
14
+ require "#{dir}/desert/plugin_templates"
metadata ADDED
@@ -0,0 +1,95 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: tog-desert
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.3.4
5
+ platform: ruby
6
+ authors:
7
+ - Pivotal Labs
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2008-09-08 00:00:00 -07:00
13
+ default_executable:
14
+ dependencies: []
15
+
16
+ description: Desert is a component framework for Rails that allows your plugins to be packaged as mini Rails apps.
17
+ email: opensource@pivotallabs.com
18
+ executables: []
19
+
20
+ extensions: []
21
+
22
+ extra_rdoc_files: []
23
+
24
+ files:
25
+ - CHANGES
26
+ - MIT-LICENSE
27
+ - Rakefile
28
+ - README.rdoc
29
+ - init.rb
30
+ - lib/desert/manager.rb
31
+ - lib/desert/plugin.rb
32
+ - lib/desert/plugin_migrations/extensions/1.0/schema_statements.rb
33
+ - lib/desert/plugin_migrations/extensions/2.1/schema_statements.rb
34
+ - lib/desert/plugin_migrations/extensions/schema_statements.rb
35
+ - lib/desert/plugin_migrations/migrator.rb
36
+ - lib/desert/plugin_migrations.rb
37
+ - lib/desert/plugin_templates/1.2.0/action_mailer.rb
38
+ - lib/desert/plugin_templates/1.2.0/action_view.rb
39
+ - lib/desert/plugin_templates/1.99.0/action_mailer.rb
40
+ - lib/desert/plugin_templates/1.99.0/action_view.rb
41
+ - lib/desert/plugin_templates/2.0.0/action_mailer.rb
42
+ - lib/desert/plugin_templates/2.0.2/action_view.rb
43
+ - lib/desert/plugin_templates/2.1.0/action_view.rb
44
+ - lib/desert/plugin_templates/action_controller.rb
45
+ - lib/desert/plugin_templates/action_view.rb
46
+ - lib/desert/plugin_templates/edge/action_view.rb
47
+ - lib/desert/plugin_templates.rb
48
+ - lib/desert/rails/1.2.0/initializer.rb
49
+ - lib/desert/rails/2.0.0/plugin.rb
50
+ - lib/desert/rails/dependencies.rb
51
+ - lib/desert/rails/migration.rb
52
+ - lib/desert/rails/observer.rb
53
+ - lib/desert/rails/route_set.rb
54
+ - lib/desert/rails.rb
55
+ - lib/desert/ruby/object.rb
56
+ - lib/desert/ruby.rb
57
+ - lib/desert/supported_rails_versions.rb
58
+ - lib/desert/version_checker.rb
59
+ - lib/desert.rb
60
+ - generators/desert_plugin
61
+ - generators/desert_plugin/desert_plugin_generator.rb
62
+ - generators/desert_plugin/templates
63
+ - generators/desert_plugin/templates/empty_file
64
+ - generators/desert_plugin/templates/plugin_migration.rb
65
+ - generators/desert_plugin/templates/routes.rb
66
+ - generators/desert_plugin/templates/spec_helper.rb
67
+ - generators/desert_plugin/USAGE
68
+ has_rdoc: true
69
+ homepage: http://pivotallabs.com
70
+ post_install_message:
71
+ rdoc_options: []
72
+
73
+ require_paths:
74
+ - lib
75
+ required_ruby_version: !ruby/object:Gem::Requirement
76
+ requirements:
77
+ - - ">="
78
+ - !ruby/object:Gem::Version
79
+ version: "0"
80
+ version:
81
+ required_rubygems_version: !ruby/object:Gem::Requirement
82
+ requirements:
83
+ - - ">="
84
+ - !ruby/object:Gem::Version
85
+ version: "0"
86
+ version:
87
+ requirements: []
88
+
89
+ rubyforge_project: desert
90
+ rubygems_version: 1.2.0
91
+ signing_key:
92
+ specification_version: 2
93
+ summary: Desert is a component framework for Rails that allows your plugins to be packaged as mini Rails apps.
94
+ test_files: []
95
+