wagons 0.0.1

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 (87) hide show
  1. data/MIT-LICENSE +20 -0
  2. data/README.rdoc +21 -0
  3. data/Rakefile +36 -0
  4. data/lib/generators/wagon/USAGE +7 -0
  5. data/lib/generators/wagon/templates/%singular_name%.gemspec.tt +21 -0
  6. data/lib/generators/wagon/templates/Gemfile.tt +20 -0
  7. data/lib/generators/wagon/templates/Rakefile.tt +12 -0
  8. data/lib/generators/wagon/templates/config/routes.rb +3 -0
  9. data/lib/generators/wagon/templates/lib/%singular_name%/version.rb.tt +3 -0
  10. data/lib/generators/wagon/templates/lib/%singular_name%/wagon.rb.tt +13 -0
  11. data/lib/generators/wagon/templates/lib/%singular_name%.rb.tt +7 -0
  12. data/lib/generators/wagon/templates/script/rails.tt +11 -0
  13. data/lib/generators/wagon/templates/test/%singular_name%_test.rb.tt +7 -0
  14. data/lib/generators/wagon/templates/test/test_helper.rb.tt +10 -0
  15. data/lib/generators/wagon/wagon_generator.rb +21 -0
  16. data/lib/tasks/wagons.rake +112 -0
  17. data/lib/wagons/railtie.rb +8 -0
  18. data/lib/wagons/test_case.rb +10 -0
  19. data/lib/wagons/version.rb +3 -0
  20. data/lib/wagons/wagon.rb +112 -0
  21. data/lib/wagons/wagon_tasks.rake +145 -0
  22. data/lib/wagons.rb +15 -0
  23. data/test/dummy/Gemfile +13 -0
  24. data/test/dummy/Gemfile.lock +113 -0
  25. data/test/dummy/README.rdoc +261 -0
  26. data/test/dummy/Rakefile +7 -0
  27. data/test/dummy/Wagonfile +6 -0
  28. data/test/dummy/app/assets/javascripts/application.js +15 -0
  29. data/test/dummy/app/assets/stylesheets/application.css +13 -0
  30. data/test/dummy/app/controllers/application_controller.rb +3 -0
  31. data/test/dummy/app/helpers/application_helper.rb +2 -0
  32. data/test/dummy/app/models/person.rb +5 -0
  33. data/test/dummy/app/views/layouts/application.html.erb +14 -0
  34. data/test/dummy/config/application.rb +60 -0
  35. data/test/dummy/config/boot.rb +6 -0
  36. data/test/dummy/config/database.yml +25 -0
  37. data/test/dummy/config/environment.rb +5 -0
  38. data/test/dummy/config/environments/development.rb +37 -0
  39. data/test/dummy/config/environments/production.rb +67 -0
  40. data/test/dummy/config/environments/test.rb +37 -0
  41. data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
  42. data/test/dummy/config/initializers/inflections.rb +15 -0
  43. data/test/dummy/config/initializers/mime_types.rb +5 -0
  44. data/test/dummy/config/initializers/secret_token.rb +7 -0
  45. data/test/dummy/config/initializers/session_store.rb +8 -0
  46. data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
  47. data/test/dummy/config/locales/en.yml +5 -0
  48. data/test/dummy/config/routes.rb +58 -0
  49. data/test/dummy/config.ru +4 -0
  50. data/test/dummy/db/development.sqlite3 +0 -0
  51. data/test/dummy/db/fixtures/development/people.rb +4 -0
  52. data/test/dummy/db/fixtures/test/people.rb +4 -0
  53. data/test/dummy/db/migrate/20120606125104_create_people.rb +10 -0
  54. data/test/dummy/db/schema.rb +23 -0
  55. data/test/dummy/db/test.sqlite3 +0 -0
  56. data/test/dummy/dummy.gemspec +17 -0
  57. data/test/dummy/log/development.log +2017 -0
  58. data/test/dummy/log/test.log +2311 -0
  59. data/test/dummy/public/404.html +26 -0
  60. data/test/dummy/public/422.html +26 -0
  61. data/test/dummy/public/500.html +25 -0
  62. data/test/dummy/public/favicon.ico +0 -0
  63. data/test/dummy/script/rails +6 -0
  64. data/test/dummy/test/fixtures/people.yml +9 -0
  65. data/test/dummy/test/test_helper.rb +13 -0
  66. data/test/dummy/test/unit/person_test.rb +15 -0
  67. data/test/dummy/vendor/wagons/superliner/Gemfile +14 -0
  68. data/test/dummy/vendor/wagons/superliner/Gemfile.lock +113 -0
  69. data/test/dummy/vendor/wagons/superliner/Rakefile +13 -0
  70. data/test/dummy/vendor/wagons/superliner/app/models/city.rb +7 -0
  71. data/test/dummy/vendor/wagons/superliner/config/routes.rb +3 -0
  72. data/test/dummy/vendor/wagons/superliner/db/development.sqlite3 +0 -0
  73. data/test/dummy/vendor/wagons/superliner/db/fixtures/cities.rb +1 -0
  74. data/test/dummy/vendor/wagons/superliner/db/migrate/20120606125258_create_cities.rb +11 -0
  75. data/test/dummy/vendor/wagons/superliner/dummy_superliner.gemspec +21 -0
  76. data/test/dummy/vendor/wagons/superliner/lib/dummy_superliner/version.rb +3 -0
  77. data/test/dummy/vendor/wagons/superliner/lib/dummy_superliner/wagon.rb +14 -0
  78. data/test/dummy/vendor/wagons/superliner/lib/dummy_superliner.rb +6 -0
  79. data/test/dummy/vendor/wagons/superliner/script/rails +11 -0
  80. data/test/dummy/vendor/wagons/superliner/test/fixtures/cities.yml +11 -0
  81. data/test/dummy/vendor/wagons/superliner/test/test_helper.rb +10 -0
  82. data/test/dummy/vendor/wagons/superliner/test/unit/city_test.rb +9 -0
  83. data/test/dummy/vendor/wagons/superliner/test/unit/person_test.rb +16 -0
  84. data/test/dummy/vendor/wagons/superliner/test/wagon_test.rb +51 -0
  85. data/test/test_helper.rb +15 -0
  86. data/test/wagons_test.rb +7 -0
  87. metadata +256 -0
@@ -0,0 +1,26 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>The page you were looking for doesn't exist (404)</title>
5
+ <style type="text/css">
6
+ body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
7
+ div.dialog {
8
+ width: 25em;
9
+ padding: 0 4em;
10
+ margin: 4em auto 0 auto;
11
+ border: 1px solid #ccc;
12
+ border-right-color: #999;
13
+ border-bottom-color: #999;
14
+ }
15
+ h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
16
+ </style>
17
+ </head>
18
+
19
+ <body>
20
+ <!-- This file lives in public/404.html -->
21
+ <div class="dialog">
22
+ <h1>The page you were looking for doesn't exist.</h1>
23
+ <p>You may have mistyped the address or the page may have moved.</p>
24
+ </div>
25
+ </body>
26
+ </html>
@@ -0,0 +1,26 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>The change you wanted was rejected (422)</title>
5
+ <style type="text/css">
6
+ body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
7
+ div.dialog {
8
+ width: 25em;
9
+ padding: 0 4em;
10
+ margin: 4em auto 0 auto;
11
+ border: 1px solid #ccc;
12
+ border-right-color: #999;
13
+ border-bottom-color: #999;
14
+ }
15
+ h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
16
+ </style>
17
+ </head>
18
+
19
+ <body>
20
+ <!-- This file lives in public/422.html -->
21
+ <div class="dialog">
22
+ <h1>The change you wanted was rejected.</h1>
23
+ <p>Maybe you tried to change something you didn't have access to.</p>
24
+ </div>
25
+ </body>
26
+ </html>
@@ -0,0 +1,25 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>We're sorry, but something went wrong (500)</title>
5
+ <style type="text/css">
6
+ body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
7
+ div.dialog {
8
+ width: 25em;
9
+ padding: 0 4em;
10
+ margin: 4em auto 0 auto;
11
+ border: 1px solid #ccc;
12
+ border-right-color: #999;
13
+ border-bottom-color: #999;
14
+ }
15
+ h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
16
+ </style>
17
+ </head>
18
+
19
+ <body>
20
+ <!-- This file lives in public/500.html -->
21
+ <div class="dialog">
22
+ <h1>We're sorry, but something went wrong.</h1>
23
+ </div>
24
+ </body>
25
+ </html>
File without changes
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env ruby
2
+ # This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
3
+
4
+ APP_PATH = File.expand_path('../../config/application', __FILE__)
5
+ require File.expand_path('../../config/boot', __FILE__)
6
+ require 'rails/commands'
@@ -0,0 +1,9 @@
1
+ # Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html
2
+
3
+ mom:
4
+ name: Your Mother
5
+ birthday: 2001-06-06
6
+
7
+ pascal:
8
+ name: Pascal
9
+ birthday: 1980-08-12
@@ -0,0 +1,13 @@
1
+ ENV["RAILS_ENV"] = "test"
2
+ require File.expand_path('../../config/environment', __FILE__)
3
+ require 'rails/test_help'
4
+
5
+ class ActiveSupport::TestCase
6
+ # Setup all fixtures in test/fixtures/*.(yml|csv) for all tests in alphabetical order.
7
+ #
8
+ # Note: You'll currently still have to declare fixtures explicitly in integration tests
9
+ # -- they do not yet inherit this setting
10
+ fixtures :all
11
+
12
+ # Add more helper methods to be used by all tests here...
13
+ end
@@ -0,0 +1,15 @@
1
+ require 'test_helper'
2
+
3
+ class PersonTest < ActiveSupport::TestCase
4
+ test "person without name is invalid" do
5
+ person = Person.new
6
+ assert !person.valid?
7
+ end
8
+
9
+ test "person has no idea about a city" do
10
+ person = Person.new
11
+ assert_raise(NoMethodError) do
12
+ person.city_id = 42
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,14 @@
1
+ ENV['APP_ROOT'] ||= File.expand_path(__FILE__).split("vendor#{File::SEPARATOR}wagons").first
2
+
3
+ source "http://rubygems.org"
4
+
5
+ # Declare your gem's dependencies in dummy_superliner.gemspec.
6
+ # Bundler will treat runtime dependencies like base dependencies, and
7
+ # development dependencies will be added by default to the :development group.
8
+ gemspec
9
+
10
+ group :development, :test do
11
+ gem 'wagons', :path => "#{ENV["APP_ROOT"]}/../.."
12
+ gem 'dummy', :path => ENV["APP_ROOT"]
13
+ end
14
+
@@ -0,0 +1,113 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ dummy_superliner (0.0.1)
5
+ dummy
6
+
7
+ PATH
8
+ remote: /home/tgdzupa7/workspace/wagons
9
+ specs:
10
+ wagons (0.0.1)
11
+ rails (>= 3.2)
12
+ seed-fu-ndo
13
+
14
+ PATH
15
+ remote: /home/tgdzupa7/workspace/wagons/test/dummy
16
+ specs:
17
+ dummy (0.0.0)
18
+ sqlite3
19
+ wagons
20
+
21
+ GEM
22
+ remote: http://rubygems.org/
23
+ specs:
24
+ actionmailer (3.2.5)
25
+ actionpack (= 3.2.5)
26
+ mail (~> 2.4.4)
27
+ actionpack (3.2.5)
28
+ activemodel (= 3.2.5)
29
+ activesupport (= 3.2.5)
30
+ builder (~> 3.0.0)
31
+ erubis (~> 2.7.0)
32
+ journey (~> 1.0.1)
33
+ rack (~> 1.4.0)
34
+ rack-cache (~> 1.2)
35
+ rack-test (~> 0.6.1)
36
+ sprockets (~> 2.1.3)
37
+ activemodel (3.2.5)
38
+ activesupport (= 3.2.5)
39
+ builder (~> 3.0.0)
40
+ activerecord (3.2.5)
41
+ activemodel (= 3.2.5)
42
+ activesupport (= 3.2.5)
43
+ arel (~> 3.0.2)
44
+ tzinfo (~> 0.3.29)
45
+ activeresource (3.2.5)
46
+ activemodel (= 3.2.5)
47
+ activesupport (= 3.2.5)
48
+ activesupport (3.2.5)
49
+ i18n (~> 0.6)
50
+ multi_json (~> 1.0)
51
+ arel (3.0.2)
52
+ builder (3.0.0)
53
+ erubis (2.7.0)
54
+ hike (1.2.1)
55
+ i18n (0.6.0)
56
+ journey (1.0.3)
57
+ json (1.7.3)
58
+ mail (2.4.4)
59
+ i18n (>= 0.4.0)
60
+ mime-types (~> 1.16)
61
+ treetop (~> 1.4.8)
62
+ mime-types (1.18)
63
+ multi_json (1.3.6)
64
+ polyglot (0.3.3)
65
+ rack (1.4.1)
66
+ rack-cache (1.2)
67
+ rack (>= 0.4)
68
+ rack-ssl (1.3.2)
69
+ rack
70
+ rack-test (0.6.1)
71
+ 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)
78
+ bundler (~> 1.0)
79
+ railties (= 3.2.5)
80
+ railties (3.2.5)
81
+ actionpack (= 3.2.5)
82
+ activesupport (= 3.2.5)
83
+ rack-ssl (~> 1.3.2)
84
+ rake (>= 0.8.7)
85
+ rdoc (~> 3.4)
86
+ thor (>= 0.14.6, < 2.0)
87
+ rake (0.9.2.2)
88
+ rdoc (3.12)
89
+ json (~> 1.4)
90
+ seed-fu (2.2.0)
91
+ activerecord (~> 3.1)
92
+ activesupport (~> 3.1)
93
+ seed-fu-ndo (0.0.1)
94
+ seed-fu (>= 2.2.0)
95
+ sprockets (2.1.3)
96
+ hike (~> 1.2)
97
+ rack (~> 1.0)
98
+ tilt (~> 1.1, != 1.3.0)
99
+ sqlite3 (1.3.6)
100
+ thor (0.15.2)
101
+ tilt (1.3.3)
102
+ treetop (1.4.10)
103
+ polyglot
104
+ polyglot (>= 0.3.1)
105
+ tzinfo (0.3.33)
106
+
107
+ PLATFORMS
108
+ ruby
109
+
110
+ DEPENDENCIES
111
+ dummy!
112
+ dummy_superliner!
113
+ wagons!
@@ -0,0 +1,13 @@
1
+ #!/usr/bin/env rake
2
+
3
+ begin
4
+ require 'bundler/setup'
5
+ rescue LoadError => e
6
+ puts e.message
7
+ puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
8
+ end
9
+
10
+ ENGINE_PATH = File.expand_path('..', __FILE__)
11
+ ENV['APP_ROOT'] ||= File.expand_path(__FILE__).split("vendor#{File::SEPARATOR}wagons").first
12
+
13
+ load 'wagons/wagon_tasks.rake'
@@ -0,0 +1,7 @@
1
+ class City < ActiveRecord::Base
2
+ attr_accessible :name
3
+
4
+ has_many :people
5
+
6
+ validates :name, :presence => true
7
+ end
@@ -0,0 +1,3 @@
1
+ Rails.application.routes.draw do
2
+
3
+ end
@@ -0,0 +1 @@
1
+ City.seed(:name, {:name => 'Paris'})
@@ -0,0 +1,11 @@
1
+ class CreateCities < ActiveRecord::Migration
2
+ def change
3
+ create_table :cities do |t|
4
+ t.string :name
5
+
6
+ t.timestamps
7
+ end
8
+
9
+ add_column :people, :city_id, :integer
10
+ end
11
+ end
@@ -0,0 +1,21 @@
1
+ $:.push File.expand_path("../lib", __FILE__)
2
+
3
+ # Maintain your wagon's version:
4
+ require "dummy_superliner/version"
5
+
6
+ # Describe your gem and declare its dependencies:
7
+ Gem::Specification.new do |s|
8
+ s.name = "dummy_superliner"
9
+ s.version = DummySuperliner::VERSION
10
+ s.authors = ["TODO: Your name"]
11
+ s.email = ["TODO: Your email"]
12
+ #s.homepage = "TODO"
13
+ s.summary = "Superliner"
14
+ s.description = "Superliner description"
15
+
16
+ s.files = Dir["{app,config,db,lib}/**/*"] + ["Rakefile"]
17
+ s.test_files = Dir["test/**/*"]
18
+
19
+ s.add_dependency "dummy"
20
+
21
+ end
@@ -0,0 +1,3 @@
1
+ module DummySuperliner
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,14 @@
1
+ module DummySuperliner
2
+ class Wagon < Rails::Engine
3
+ include ::Wagon
4
+
5
+ # Add a load path for this specific Wagon
6
+ #config.autoload_paths += %W( #{config.root}/lib )
7
+
8
+ config.to_prepare do
9
+ # extend application classes here
10
+ Person.belongs_to :city
11
+ end
12
+
13
+ end
14
+ end
@@ -0,0 +1,6 @@
1
+ require 'wagons'
2
+ # require 'your_wagon_dependencies'
3
+ require "dummy_superliner/wagon"
4
+
5
+ module DummySuperliner
6
+ end
@@ -0,0 +1,11 @@
1
+ #!/usr/bin/env ruby
2
+ # This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
3
+
4
+ ENGINE_ROOT = File.expand_path('../..', __FILE__)
5
+
6
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('Gemfile', ENGINE_ROOT)
7
+ ENGINE_PATH = File.expand_path('lib/dummy_superliner/engine', ENGINE_ROOT)
8
+
9
+ ENV['APP_ROOT'] ||= File.expand_path(__FILE__).split("vendor#{File::SEPARATOR}wagons").first
10
+
11
+ load File.expand_path('script/rails', ENV["APP_ROOT"])
@@ -0,0 +1,11 @@
1
+ # Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html
2
+
3
+ london:
4
+ name: London
5
+ created_at: 2012-06-06
6
+ updated_at: 2012-06-06
7
+
8
+ tokio:
9
+ name: Tokio
10
+ created_at: 2012-01-06
11
+ updated_at: 2012-01-06
@@ -0,0 +1,10 @@
1
+ # Configure Rails Environment
2
+ ENV['APP_ROOT'] ||= File.expand_path(__FILE__).split("vendor#{File::SEPARATOR}wagons").first
3
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
4
+
5
+ require File.join(ENV["APP_ROOT"], 'test', 'test_helper.rb')
6
+
7
+
8
+ class ActiveSupport::TestCase
9
+ self.reset_fixture_path File.expand_path("../fixtures", __FILE__)
10
+ end
@@ -0,0 +1,9 @@
1
+ require 'test_helper'
2
+
3
+ class CityTest < ActiveSupport::TestCase
4
+ test "city without name is invalid" do
5
+ city = City.new
6
+ assert !city.valid?
7
+ end
8
+
9
+ end
@@ -0,0 +1,16 @@
1
+ require 'test_helper'
2
+
3
+ class PersonTest < ActiveSupport::TestCase
4
+
5
+ test "test seeds from application are loaded" do
6
+ assert Person.where(:name => 'Pascal').exists?
7
+ end
8
+
9
+ test "person can live in a city" do
10
+ person = Person.new(:name => 'Fred')
11
+ person.city = cities(:london)
12
+ assert person.save
13
+ assert cities(:london).people.include?(person)
14
+ end
15
+
16
+ end
@@ -0,0 +1,51 @@
1
+ require 'test_helper'
2
+
3
+ class WagonTest < ActiveSupport::TestCase
4
+ attr_reader :wagon
5
+ def setup
6
+ @wagon = Wagon.find(:superliner)
7
+ end
8
+
9
+ test "all includes current wagon" do
10
+ assert Wagon.all.include?(wagon)
11
+ end
12
+
13
+ test "app name is correct" do
14
+ assert_equal 'dummy', Wagon.app_name
15
+ end
16
+
17
+ test "find for inexisting return nil" do
18
+ assert_nil Wagon.find(:not_existing)
19
+ end
20
+
21
+ test "version can be read from gemspec" do
22
+ assert_equal Gem::Version.new('0.0.1'), wagon.version
23
+ end
24
+
25
+ test "label can be read from gemspec" do
26
+ assert_equal 'Superliner', wagon.label
27
+ end
28
+
29
+ test "wagon_name does not have app prefix" do
30
+ assert_equal 'superliner', wagon.wagon_name
31
+ end
32
+
33
+ test "gem_name has app prefix" do
34
+ assert_equal 'dummy_superliner', wagon.gem_name
35
+ end
36
+
37
+ test "description can be read from gemspec" do
38
+ assert_equal 'Superliner description', wagon.description
39
+ end
40
+
41
+ test "dependencies is empty" do
42
+ assert_equal [], wagon.dependencies
43
+ end
44
+
45
+ test "all_dependencies is empty" do
46
+ assert_equal [], wagon.all_dependencies
47
+ end
48
+
49
+
50
+
51
+ end
@@ -0,0 +1,15 @@
1
+ # Configure Rails Environment
2
+ ENV["RAILS_ENV"] = "test"
3
+
4
+ require File.expand_path("../dummy/config/environment.rb", __FILE__)
5
+ require "rails/test_help"
6
+
7
+ Rails.backtrace_cleaner.remove_silencers!
8
+
9
+ # Load support files
10
+ Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
11
+
12
+ # Load fixtures from the engine
13
+ if ActiveSupport::TestCase.method_defined?(:fixture_path=)
14
+ ActiveSupport::TestCase.fixture_path = File.expand_path("../fixtures", __FILE__)
15
+ end
@@ -0,0 +1,7 @@
1
+ require 'test_helper'
2
+
3
+ class WagonsTest < ActiveSupport::TestCase
4
+ test "truth" do
5
+ assert_kind_of Module, Wagons
6
+ end
7
+ end