wagons 0.0.1 → 0.0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (64) hide show
  1. data/MIT-LICENSE +1 -1
  2. data/README.rdoc +135 -9
  3. data/Rakefile +13 -5
  4. data/lib/generators/wagon/templates/%singular_name%.gemspec.tt +0 -2
  5. data/lib/generators/wagon/templates/.gitignore +5 -0
  6. data/lib/generators/wagon/templates/Gemfile.tt +5 -9
  7. data/lib/generators/wagon/templates/app/assets/images/.empty_directory +0 -0
  8. data/lib/generators/wagon/templates/app/controllers/.empty_directory +0 -0
  9. data/lib/generators/wagon/templates/app/models/.empty_directory +0 -0
  10. data/lib/generators/wagon/templates/app/views/.empty_directory +0 -0
  11. data/lib/generators/wagon/templates/db/fixtures/development/.empty_directory +0 -0
  12. data/lib/generators/wagon/templates/db/migrate/.empty_directory +0 -0
  13. data/lib/generators/wagon/templates/lib/%singular_name%/wagon.rb.tt +7 -4
  14. data/lib/generators/wagon/templates/test/fixtures/.empty_directory +0 -0
  15. data/lib/generators/wagon/wagon_generator.rb +23 -4
  16. data/lib/tasks/wagons.rake +119 -20
  17. data/lib/wagons/extensions/application.rb +14 -0
  18. data/lib/wagons/extensions/require_optional.rb +9 -0
  19. data/lib/wagons/{test_case.rb → extensions/test_case.rb} +4 -1
  20. data/lib/wagons/installer.rb +313 -0
  21. data/lib/wagons/railtie.rb +1 -1
  22. data/lib/wagons/version.rb +1 -1
  23. data/lib/wagons/view_helper.rb +58 -0
  24. data/lib/wagons/wagon.rb +125 -109
  25. data/lib/wagons/wagon_tasks.rake +9 -7
  26. data/lib/wagons.rb +44 -7
  27. data/test/dummy/Gemfile +8 -2
  28. data/test/dummy/Gemfile.lock +51 -48
  29. data/test/dummy/app/assets/javascripts/application.js +0 -2
  30. data/test/dummy/app/controllers/people_controller.rb +6 -0
  31. data/test/dummy/app/views/people/index.html.erb +6 -0
  32. data/test/dummy/app/views/shared/_sidebar.html.erb +3 -0
  33. data/test/dummy/config/initializers/wagon_app_version.rb +7 -0
  34. data/test/dummy/config/routes.rb +3 -0
  35. data/test/dummy/db/development.sqlite3 +0 -0
  36. data/test/dummy/db/schema.rb +1 -1
  37. data/test/dummy/db/test.sqlite3 +0 -0
  38. data/test/dummy/log/development.log +1230 -1586
  39. data/test/dummy/log/test.log +6458 -1772
  40. data/test/dummy/test/unit/person_test.rb +6 -0
  41. data/test/dummy/tmp/cache/assets/CD8/370/sprockets%2F357970feca3ac29060c1e3861e2c0953 +0 -0
  42. data/test/dummy/tmp/cache/assets/D32/A10/sprockets%2F13fe41fee1fe35b49d145bcc06610705 +0 -0
  43. data/test/dummy/tmp/cache/assets/D4E/1B0/sprockets%2Ff7cbd26ba1d28d48de824f0e94586655 +0 -0
  44. data/test/dummy/tmp/cache/assets/D5A/EA0/sprockets%2Fd771ace226fc8215a3572e0aa35bb0d6 +0 -0
  45. data/test/dummy/tmp/cache/assets/DDC/400/sprockets%2Fcffd775d018f68ce5dba1ee0d951a994 +0 -0
  46. data/test/dummy/tmp/cache/assets/E04/890/sprockets%2F2f5173deea6c795b8fdde723bb4b63af +0 -0
  47. data/test/dummy/tmp/pids/server.pid +1 -0
  48. data/test/dummy/vendor/wagons/superliner/Gemfile +1 -5
  49. data/test/dummy/vendor/wagons/superliner/Gemfile.lock +46 -48
  50. data/test/dummy/vendor/wagons/superliner/app/controllers/cities_controller.rb +6 -0
  51. data/test/dummy/vendor/wagons/superliner/app/views/cities/index.html.erb +7 -0
  52. data/test/dummy/vendor/wagons/superliner/app/views/people/_list_superliner.html.erb +3 -0
  53. data/test/dummy/vendor/wagons/superliner/app/views/shared/_sidebar_superliner.html.erb +1 -0
  54. data/test/dummy/vendor/wagons/superliner/config/routes.rb +1 -1
  55. data/test/dummy/vendor/wagons/superliner/db/migrate/{20120606125258_create_cities.rb → 20120606125058_create_cities.rb} +0 -0
  56. data/test/dummy/vendor/wagons/superliner/dummy_superliner.gemspec +0 -2
  57. data/test/dummy/vendor/wagons/superliner/lib/dummy_superliner/wagon.rb +3 -1
  58. data/test/dummy/vendor/wagons/superliner/test/functionals/cities_controller_test.rb +12 -0
  59. data/test/dummy/vendor/wagons/superliner/test/functionals/people_controller_test.rb +14 -0
  60. data/test/dummy/vendor/wagons/superliner/test/unit/city_test.rb +4 -1
  61. data/test/dummy/vendor/wagons/superliner/test/wagon_test.rb +7 -5
  62. data/test/wagons_installer_test.rb +225 -0
  63. metadata +241 -169
  64. data/test/dummy/dummy.gemspec +0 -17
data/lib/wagons.rb CHANGED
@@ -2,14 +2,51 @@ require 'seed-fu-ndo'
2
2
 
3
3
  require 'wagons/wagon'
4
4
  require 'wagons/railtie'
5
- require 'wagons/test_case'
5
+ require 'wagons/installer'
6
+ require 'wagons/view_helper'
7
+ require 'wagons/version'
6
8
 
9
+ require 'wagons/extensions/application'
10
+ require 'wagons/extensions/require_optional'
11
+ require 'wagons/extensions/test_case'
12
+
13
+
14
+ # Utility class to find single wagons and provide additional information
15
+ # about the main application.
7
16
  module Wagons
17
+ # All wagons installed in the current Rails application.
18
+ def self.all
19
+ Rails.application.railties.all.select {|r| r.is_a?(Wagon) }
20
+ end
21
+
22
+ # Find a wagon by its name.
23
+ def self.find(name)
24
+ name = name.to_s
25
+ all.find {|wagon| wagon.wagon_name == name || wagon.gem_name == name }
26
+ end
27
+
28
+ # The name of the main Rails application.
29
+ # By default, this is the underscored name of the application module.
30
+ # This name is directly used for the gem names,
31
+ def self.app_name
32
+ @app_name ||= Rails.application.class.name.split('::').first.underscore
33
+ end
34
+
35
+ # Set the application name. Should be lowercase with underscores.
36
+ # Do this in an initializer.
37
+ def self.app_name=(name)
38
+ @app_name = name
39
+ end
40
+
41
+ # The version of the main application.
42
+ def self.app_version
43
+ @app_version ||= Gem::Version.new("0")
44
+ end
45
+
46
+ # Set the version of the main application.
47
+ # Do this in an initializer.
48
+ def self.app_version=(version)
49
+ @app_version = version.is_a?(Gem::Version) ? version : Gem::Version.new(version)
50
+ end
8
51
  end
9
52
 
10
- # Requires the specified argument but silently ignores an LoadErrors.
11
- def optional_require(*args)
12
- require *args
13
- rescue LoadError
14
- # that's fine, it's an optional require
15
- end
data/test/dummy/Gemfile CHANGED
@@ -1,8 +1,14 @@
1
1
  source "http://rubygems.org"
2
2
 
3
- gemspec
3
+ gem 'wagons', :path => File.expand_path(__FILE__).split("test#{File::SEPARATOR}dummy").first
4
4
 
5
- gem 'wagons', :path => '../../'
5
+ group :development, :test do
6
+ gem 'sqlite3'
7
+ end
8
+
9
+ group :test do
10
+ gem 'mocha', :require => false
11
+ end
6
12
 
7
13
  # Include the wagons you want attached in Wagonfile.
8
14
  # Do not check Wagonfile into source control.
@@ -1,85 +1,86 @@
1
1
  PATH
2
- remote: .
2
+ remote: /Users/pascal/Code/ruby/wagons
3
3
  specs:
4
- dummy (0.0.0)
5
- sqlite3
6
- wagons
4
+ wagons (0.0.9)
5
+ bundler (>= 1.1)
6
+ rails (>= 3.2)
7
+ seed-fu-ndo (>= 0.0.2)
7
8
 
8
9
  PATH
9
- remote: ../..
10
+ remote: vendor/wagons/superliner
10
11
  specs:
11
- wagons (0.0.1)
12
- rails (>= 3.2.3)
13
- seed-fu-ndo
12
+ dummy_superliner (0.0.1)
14
13
 
15
14
  PATH
16
- remote: vendor/wagons/superliner
15
+ remote: vendor/wagons/test_wagon
17
16
  specs:
18
- dummy_superliner (0.0.1)
19
- dummy
17
+ dummy_test_wagon (0.0.1)
20
18
 
21
19
  GEM
22
20
  remote: http://rubygems.org/
23
21
  specs:
24
- actionmailer (3.2.5)
25
- actionpack (= 3.2.5)
22
+ actionmailer (3.2.8)
23
+ actionpack (= 3.2.8)
26
24
  mail (~> 2.4.4)
27
- actionpack (3.2.5)
28
- activemodel (= 3.2.5)
29
- activesupport (= 3.2.5)
25
+ actionpack (3.2.8)
26
+ activemodel (= 3.2.8)
27
+ activesupport (= 3.2.8)
30
28
  builder (~> 3.0.0)
31
29
  erubis (~> 2.7.0)
32
- journey (~> 1.0.1)
30
+ journey (~> 1.0.4)
33
31
  rack (~> 1.4.0)
34
32
  rack-cache (~> 1.2)
35
33
  rack-test (~> 0.6.1)
36
34
  sprockets (~> 2.1.3)
37
- activemodel (3.2.5)
38
- activesupport (= 3.2.5)
35
+ activemodel (3.2.8)
36
+ activesupport (= 3.2.8)
39
37
  builder (~> 3.0.0)
40
- activerecord (3.2.5)
41
- activemodel (= 3.2.5)
42
- activesupport (= 3.2.5)
38
+ activerecord (3.2.8)
39
+ activemodel (= 3.2.8)
40
+ activesupport (= 3.2.8)
43
41
  arel (~> 3.0.2)
44
42
  tzinfo (~> 0.3.29)
45
- activeresource (3.2.5)
46
- activemodel (= 3.2.5)
47
- activesupport (= 3.2.5)
48
- activesupport (3.2.5)
43
+ activeresource (3.2.8)
44
+ activemodel (= 3.2.8)
45
+ activesupport (= 3.2.8)
46
+ activesupport (3.2.8)
49
47
  i18n (~> 0.6)
50
48
  multi_json (~> 1.0)
51
49
  arel (3.0.2)
52
- builder (3.0.0)
50
+ builder (3.0.4)
53
51
  erubis (2.7.0)
54
52
  hike (1.2.1)
55
- i18n (0.6.0)
56
- journey (1.0.3)
57
- json (1.7.3)
53
+ i18n (0.6.1)
54
+ journey (1.0.4)
55
+ json (1.7.5)
58
56
  mail (2.4.4)
59
57
  i18n (>= 0.4.0)
60
58
  mime-types (~> 1.16)
61
59
  treetop (~> 1.4.8)
62
- mime-types (1.18)
63
- multi_json (1.3.6)
60
+ metaclass (0.0.1)
61
+ mime-types (1.19)
62
+ mocha (0.12.3)
63
+ metaclass (~> 0.0.1)
64
+ multi_json (1.3.7)
64
65
  polyglot (0.3.3)
65
66
  rack (1.4.1)
66
67
  rack-cache (1.2)
67
68
  rack (>= 0.4)
68
69
  rack-ssl (1.3.2)
69
70
  rack
70
- rack-test (0.6.1)
71
+ rack-test (0.6.2)
71
72
  rack (>= 1.0)
72
- rails (3.2.5)
73
- actionmailer (= 3.2.5)
74
- actionpack (= 3.2.5)
75
- activerecord (= 3.2.5)
76
- activeresource (= 3.2.5)
77
- activesupport (= 3.2.5)
73
+ rails (3.2.8)
74
+ actionmailer (= 3.2.8)
75
+ actionpack (= 3.2.8)
76
+ activerecord (= 3.2.8)
77
+ activeresource (= 3.2.8)
78
+ activesupport (= 3.2.8)
78
79
  bundler (~> 1.0)
79
- railties (= 3.2.5)
80
- railties (3.2.5)
81
- actionpack (= 3.2.5)
82
- activesupport (= 3.2.5)
80
+ railties (= 3.2.8)
81
+ railties (3.2.8)
82
+ actionpack (= 3.2.8)
83
+ activesupport (= 3.2.8)
83
84
  rack-ssl (~> 1.3.2)
84
85
  rake (>= 0.8.7)
85
86
  rdoc (~> 3.4)
@@ -90,24 +91,26 @@ GEM
90
91
  seed-fu (2.2.0)
91
92
  activerecord (~> 3.1)
92
93
  activesupport (~> 3.1)
93
- seed-fu-ndo (0.0.1)
94
+ seed-fu-ndo (0.0.2)
94
95
  seed-fu (>= 2.2.0)
95
96
  sprockets (2.1.3)
96
97
  hike (~> 1.2)
97
98
  rack (~> 1.0)
98
99
  tilt (~> 1.1, != 1.3.0)
99
100
  sqlite3 (1.3.6)
100
- thor (0.15.2)
101
+ thor (0.16.0)
101
102
  tilt (1.3.3)
102
- treetop (1.4.10)
103
+ treetop (1.4.12)
103
104
  polyglot
104
105
  polyglot (>= 0.3.1)
105
- tzinfo (0.3.33)
106
+ tzinfo (0.3.34)
106
107
 
107
108
  PLATFORMS
108
109
  ruby
109
110
 
110
111
  DEPENDENCIES
111
- dummy!
112
112
  dummy_superliner!
113
+ dummy_test_wagon!
114
+ mocha
115
+ sqlite3
113
116
  wagons!
@@ -10,6 +10,4 @@
10
10
  // WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD
11
11
  // GO AFTER THE REQUIRES BELOW.
12
12
  //
13
- //= require jquery
14
- //= require jquery_ujs
15
13
  //= require_tree .
@@ -0,0 +1,6 @@
1
+ class PeopleController < ApplicationController
2
+
3
+ def index
4
+
5
+ end
6
+ end
@@ -0,0 +1,6 @@
1
+ <h1>People</h1>
2
+
3
+ <%= render_extensions :list, :locals => {:test => 42} %>
4
+
5
+
6
+ <%= render 'shared/sidebar' %>
@@ -0,0 +1,3 @@
1
+ <h2>Sidebar</h2>
2
+
3
+ <%= render_extensions :sidebar %>
@@ -0,0 +1,7 @@
1
+ Wagons.app_version = '1.0.0'
2
+
3
+ Wagons.all.each do |wagon|
4
+ unless wagon.app_requirement.satisfied_by?(Wagons.app_version)
5
+ raise "#{wagon.gem_name} requires application version #{wagon.app_requirement}; got #{Wagons.app_version}"
6
+ end
7
+ end
@@ -1,4 +1,7 @@
1
1
  Dummy::Application.routes.draw do
2
+
3
+ resources :people, :only => :index
4
+
2
5
  # The priority is based upon order of creation:
3
6
  # first created -> highest priority.
4
7
 
Binary file
@@ -1,3 +1,4 @@
1
+ # encoding: UTF-8
1
2
  # This file is auto-generated from the current state of the database. Instead
2
3
  # of editing this file, please use the migrations feature of Active Record to
3
4
  # incrementally modify your database, and then regenerate this schema definition.
@@ -20,4 +21,3 @@ ActiveRecord::Schema.define(:version => 20120606125104) do
20
21
  end
21
22
 
22
23
  end
23
-
Binary file