wagons 0.2.2 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (71) hide show
  1. checksums.yaml +8 -8
  2. data/Rakefile +4 -6
  3. data/lib/generators/wagon/templates/%singular_name%.gemspec.tt +12 -11
  4. data/lib/generators/wagon/templates/{script → bin}/rails.tt +3 -2
  5. data/lib/generators/wagon/templates/config/routes.rb +1 -1
  6. data/lib/generators/wagon/templates/lib/%singular_name%/version.rb.tt +2 -2
  7. data/lib/generators/wagon/templates/lib/%singular_name%.rb.tt +0 -1
  8. data/lib/generators/wagon/wagon_generator.rb +4 -6
  9. data/lib/wagons/extensions/application.rb +2 -4
  10. data/lib/wagons/extensions/require_optional.rb +2 -2
  11. data/lib/wagons/extensions/test_case.rb +5 -7
  12. data/lib/wagons/installer.rb +52 -56
  13. data/lib/wagons/railtie.rb +2 -2
  14. data/lib/wagons/version.rb +1 -1
  15. data/lib/wagons/view_helper.rb +14 -16
  16. data/lib/wagons/wagon.rb +6 -8
  17. data/lib/wagons.rb +8 -10
  18. data/test/ci/rails3.gemfile.lock +108 -0
  19. data/test/dummy/Gemfile.lock +52 -48
  20. data/test/dummy/app/controllers/people_controller.rb +1 -3
  21. data/test/dummy/app/models/person.rb +1 -1
  22. data/test/dummy/config/application.rb +3 -4
  23. data/test/dummy/config/boot.rb +1 -1
  24. data/test/dummy/config/environments/development.rb +1 -1
  25. data/test/dummy/config/environments/production.rb +1 -1
  26. data/test/dummy/config/environments/test.rb +2 -2
  27. data/test/dummy/config/initializers/session_store.rb +1 -1
  28. data/test/dummy/config/initializers/wagon_app_version.rb +1 -1
  29. data/test/dummy/config/initializers/wrap_parameters.rb +1 -1
  30. data/test/dummy/config/routes.rb +3 -3
  31. data/test/dummy/db/development.sqlite3 +0 -0
  32. data/test/dummy/db/fixtures/development/people.rb +3 -3
  33. data/test/dummy/db/fixtures/test/people.rb +3 -3
  34. data/test/dummy/db/schema.rb +5 -5
  35. data/test/dummy/db/test.sqlite3 +0 -0
  36. data/test/dummy/log/development.log +1528 -1015
  37. data/test/dummy/log/test.log +11807 -6530
  38. data/test/dummy/test/models/person_test.rb +5 -5
  39. data/test/dummy/test/test_helper.rb +1 -1
  40. data/test/dummy/tmp/cache/assets/CD8/370/sprockets%2F357970feca3ac29060c1e3861e2c0953 +0 -0
  41. data/test/dummy/tmp/cache/assets/D32/A10/sprockets%2F13fe41fee1fe35b49d145bcc06610705 +0 -0
  42. data/test/dummy/tmp/cache/assets/D4E/1B0/sprockets%2Ff7cbd26ba1d28d48de824f0e94586655 +0 -0
  43. data/test/dummy/tmp/cache/assets/D5A/EA0/sprockets%2Fd771ace226fc8215a3572e0aa35bb0d6 +0 -0
  44. data/test/dummy/tmp/cache/assets/DDC/400/sprockets%2Fcffd775d018f68ce5dba1ee0d951a994 +0 -0
  45. data/test/dummy/tmp/cache/assets/E04/890/sprockets%2F2f5173deea6c795b8fdde723bb4b63af +0 -0
  46. data/test/dummy/tmp/cache/assets/test/sprockets/13fe41fee1fe35b49d145bcc06610705 +0 -0
  47. data/test/dummy/tmp/cache/assets/test/sprockets/2f5173deea6c795b8fdde723bb4b63af +0 -0
  48. data/test/dummy/tmp/cache/assets/test/sprockets/357970feca3ac29060c1e3861e2c0953 +0 -0
  49. data/test/dummy/tmp/cache/assets/test/sprockets/cffd775d018f68ce5dba1ee0d951a994 +0 -0
  50. data/test/dummy/tmp/cache/assets/test/sprockets/d771ace226fc8215a3572e0aa35bb0d6 +0 -0
  51. data/test/dummy/tmp/cache/assets/test/sprockets/f7cbd26ba1d28d48de824f0e94586655 +0 -0
  52. data/test/dummy/vendor/wagons/superliner/Gemfile.lock +53 -49
  53. data/test/dummy/vendor/wagons/superliner/app/controllers/cities_controller.rb +1 -2
  54. data/test/dummy/vendor/wagons/superliner/app/models/city.rb +2 -2
  55. data/test/dummy/vendor/wagons/superliner/db/fixtures/cities.rb +1 -1
  56. data/test/dummy/vendor/wagons/superliner/db/migrate/20120606125058_create_cities.rb +1 -1
  57. data/test/dummy/vendor/wagons/superliner/dummy_superliner.gemspec +11 -11
  58. data/test/dummy/vendor/wagons/superliner/lib/dummy_superliner/version.rb +2 -2
  59. data/test/dummy/vendor/wagons/superliner/lib/dummy_superliner/wagon.rb +3 -4
  60. data/test/dummy/vendor/wagons/superliner/lib/dummy_superliner.rb +1 -1
  61. data/test/dummy/vendor/wagons/superliner/script/rails +1 -1
  62. data/test/dummy/vendor/wagons/superliner/test/controllers/cities_controller_test.rb +5 -7
  63. data/test/dummy/vendor/wagons/superliner/test/controllers/people_controller_test.rb +2 -4
  64. data/test/dummy/vendor/wagons/superliner/test/models/city_test.rb +3 -3
  65. data/test/dummy/vendor/wagons/superliner/test/models/person_test.rb +5 -7
  66. data/test/dummy/vendor/wagons/superliner/test/test_helper.rb +1 -2
  67. data/test/dummy/vendor/wagons/superliner/test/wagon_test.rb +23 -24
  68. data/test/test_helper.rb +5 -5
  69. data/test/wagons_installer_test.rb +72 -75
  70. data/test/wagons_test.rb +1 -1
  71. metadata +174 -160
@@ -1,19 +1,19 @@
1
1
  require 'test_helper'
2
2
 
3
3
  class PersonTest < ActiveSupport::TestCase
4
- test "person without name is invalid" do
4
+ test 'person without name is invalid' do
5
5
  person = Person.new
6
6
  assert !person.valid?
7
7
  end
8
-
9
- test "person has no idea about a city" do
8
+
9
+ test 'person has no idea about a city' do
10
10
  person = Person.new
11
11
  assert_raise(NoMethodError) do
12
12
  person.city_id = 42
13
13
  end
14
14
  end
15
-
16
- test "wagon models are not loaded in main application tests" do
15
+
16
+ test 'wagon models are not loaded in main application tests' do
17
17
  assert_raise(NameError) do
18
18
  City.new
19
19
  end
@@ -1,4 +1,4 @@
1
- ENV["RAILS_ENV"] = "test"
1
+ ENV['RAILS_ENV'] = 'test'
2
2
  require File.expand_path('../../config/environment', __FILE__)
3
3
  require 'rails/test_help'
4
4
 
@@ -4,9 +4,9 @@ PATH
4
4
  dummy_superliner (0.0.1)
5
5
 
6
6
  PATH
7
- remote: /home/pzumkehr/src/ruby/wagons
7
+ remote: /Users/pascal/Code/ruby/wagons
8
8
  specs:
9
- wagons (0.2.2)
9
+ wagons (0.3.0)
10
10
  bundler (>= 1.1)
11
11
  rails (>= 3.2)
12
12
  seed-fu-ndo (>= 0.0.2)
@@ -15,86 +15,90 @@ GEM
15
15
  remote: https://rubygems.org/
16
16
  remote: https://rubygems.org/
17
17
  specs:
18
- actionmailer (4.0.3)
19
- actionpack (= 4.0.3)
18
+ actionmailer (4.1.1)
19
+ actionpack (= 4.1.1)
20
+ actionview (= 4.1.1)
20
21
  mail (~> 2.5.4)
21
- actionpack (4.0.3)
22
- activesupport (= 4.0.3)
23
- builder (~> 3.1.0)
24
- erubis (~> 2.7.0)
22
+ actionpack (4.1.1)
23
+ actionview (= 4.1.1)
24
+ activesupport (= 4.1.1)
25
25
  rack (~> 1.5.2)
26
26
  rack-test (~> 0.6.2)
27
- activemodel (4.0.3)
28
- activesupport (= 4.0.3)
29
- builder (~> 3.1.0)
30
- activerecord (4.0.3)
31
- activemodel (= 4.0.3)
32
- activerecord-deprecated_finders (~> 1.0.2)
33
- activesupport (= 4.0.3)
34
- arel (~> 4.0.0)
35
- activerecord-deprecated_finders (1.0.3)
36
- activesupport (4.0.3)
37
- i18n (~> 0.6, >= 0.6.4)
38
- minitest (~> 4.2)
39
- multi_json (~> 1.3)
27
+ actionview (4.1.1)
28
+ activesupport (= 4.1.1)
29
+ builder (~> 3.1)
30
+ erubis (~> 2.7.0)
31
+ activemodel (4.1.1)
32
+ activesupport (= 4.1.1)
33
+ builder (~> 3.1)
34
+ activerecord (4.1.1)
35
+ activemodel (= 4.1.1)
36
+ activesupport (= 4.1.1)
37
+ arel (~> 5.0.0)
38
+ activesupport (4.1.1)
39
+ i18n (~> 0.6, >= 0.6.9)
40
+ json (~> 1.7, >= 1.7.7)
41
+ minitest (~> 5.1)
40
42
  thread_safe (~> 0.1)
41
- tzinfo (~> 0.3.37)
42
- arel (4.0.2)
43
- atomic (1.1.15)
44
- builder (3.1.4)
43
+ tzinfo (~> 1.1)
44
+ arel (5.0.1.20140414130214)
45
+ builder (3.2.2)
45
46
  erubis (2.7.0)
46
47
  hike (1.2.3)
47
48
  i18n (0.6.9)
49
+ json (1.8.1)
48
50
  mail (2.5.4)
49
51
  mime-types (~> 1.16)
50
52
  treetop (~> 1.4.8)
51
- metaclass (0.0.1)
53
+ metaclass (0.0.4)
52
54
  mime-types (1.25.1)
53
- minitest (4.7.5)
54
- mocha (0.14.0)
55
+ minitest (5.3.4)
56
+ mocha (1.1.0)
55
57
  metaclass (~> 0.0.1)
56
- multi_json (1.8.4)
58
+ multi_json (1.10.1)
57
59
  polyglot (0.3.4)
58
60
  rack (1.5.2)
59
61
  rack-test (0.6.2)
60
62
  rack (>= 1.0)
61
- rails (4.0.3)
62
- actionmailer (= 4.0.3)
63
- actionpack (= 4.0.3)
64
- activerecord (= 4.0.3)
65
- activesupport (= 4.0.3)
63
+ rails (4.1.1)
64
+ actionmailer (= 4.1.1)
65
+ actionpack (= 4.1.1)
66
+ actionview (= 4.1.1)
67
+ activemodel (= 4.1.1)
68
+ activerecord (= 4.1.1)
69
+ activesupport (= 4.1.1)
66
70
  bundler (>= 1.3.0, < 2.0)
67
- railties (= 4.0.3)
68
- sprockets-rails (~> 2.0.0)
69
- railties (4.0.3)
70
- actionpack (= 4.0.3)
71
- activesupport (= 4.0.3)
71
+ railties (= 4.1.1)
72
+ sprockets-rails (~> 2.0)
73
+ railties (4.1.1)
74
+ actionpack (= 4.1.1)
75
+ activesupport (= 4.1.1)
72
76
  rake (>= 0.8.7)
73
77
  thor (>= 0.18.1, < 2.0)
74
- rake (10.1.1)
75
- seed-fu (2.3.0)
76
- activerecord (>= 3.1, < 4.1)
77
- activesupport (>= 3.1, < 4.1)
78
+ rake (10.3.2)
79
+ seed-fu (2.3.1)
80
+ activerecord (>= 3.1, < 4.2)
81
+ activesupport (>= 3.1, < 4.2)
78
82
  seed-fu-ndo (0.0.2)
79
83
  seed-fu (>= 2.2.0)
80
- sprockets (2.11.0)
84
+ sprockets (2.12.1)
81
85
  hike (~> 1.2)
82
86
  multi_json (~> 1.0)
83
87
  rack (~> 1.0)
84
88
  tilt (~> 1.1, != 1.3.0)
85
- sprockets-rails (2.0.1)
89
+ sprockets-rails (2.1.3)
86
90
  actionpack (>= 3.0)
87
91
  activesupport (>= 3.0)
88
92
  sprockets (~> 2.8)
89
93
  sqlite3 (1.3.9)
90
- thor (0.18.1)
91
- thread_safe (0.2.0)
92
- atomic (>= 1.1.7, < 2)
94
+ thor (0.19.1)
95
+ thread_safe (0.3.3)
93
96
  tilt (1.4.1)
94
97
  treetop (1.4.15)
95
98
  polyglot
96
99
  polyglot (>= 0.3.1)
97
- tzinfo (0.3.38)
100
+ tzinfo (1.2.0)
101
+ thread_safe (~> 0.1)
98
102
 
99
103
  PLATFORMS
100
104
  ruby
@@ -1,6 +1,5 @@
1
1
  class CitiesController < ApplicationController
2
-
3
2
  def index
4
3
  @cities = City.all
5
4
  end
6
- end
5
+ end
@@ -1,5 +1,5 @@
1
1
  class City < ActiveRecord::Base
2
2
  has_many :people
3
-
4
- validates :name, :presence => true
3
+
4
+ validates :name, presence: true
5
5
  end
@@ -1 +1 @@
1
- City.seed(:name, {:name => 'Paris'})
1
+ City.seed(:name, name: 'Paris')
@@ -5,7 +5,7 @@ class CreateCities < ActiveRecord::Migration
5
5
 
6
6
  t.timestamps
7
7
  end
8
-
8
+
9
9
  add_column :people, :city_id, :integer
10
10
  end
11
11
  end
@@ -1,19 +1,19 @@
1
- $:.push File.expand_path("../lib", __FILE__)
1
+ $LOAD_PATH.push File.expand_path('../lib', __FILE__)
2
2
 
3
3
  # Maintain your wagon's version:
4
- require "dummy_superliner/version"
4
+ require 'dummy_superliner/version'
5
5
 
6
6
  # Describe your gem and declare its dependencies:
7
7
  Gem::Specification.new do |s|
8
- s.name = "dummy_superliner"
8
+ s.name = 'dummy_superliner'
9
9
  s.version = DummySuperliner::VERSION
10
- s.authors = ["Your name"]
11
- s.email = ["Your email"]
12
- #s.homepage = "TODO"
13
- s.summary = "Superliner"
14
- s.description = "Superliner description"
10
+ s.authors = ['Your name']
11
+ s.email = ['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/**/*']
15
18
 
16
- s.files = Dir["{app,config,db,lib}/**/*"] + ["Rakefile"]
17
- s.test_files = Dir["test/**/*"]
18
-
19
19
  end
@@ -1,3 +1,3 @@
1
1
  module DummySuperliner
2
- VERSION = "0.0.1"
3
- end
2
+ VERSION = '0.0.1'
3
+ end
@@ -1,16 +1,15 @@
1
1
  module DummySuperliner
2
2
  class Wagon < Rails::Engine
3
3
  include Wagons::Wagon
4
-
4
+
5
5
  # Add a load path for this specific Wagon
6
- #config.autoload_paths += %W( #{config.root}/lib )
6
+ # config.autoload_paths += %W( #{config.root}/lib )
7
7
 
8
8
  app_requirement '>= 1.0.0'
9
9
 
10
10
  config.to_prepare do
11
11
  # extend application classes here
12
12
  Person.belongs_to :city
13
- end
14
-
13
+ end
15
14
  end
16
15
  end
@@ -1,6 +1,6 @@
1
1
  require 'wagons'
2
2
  # require 'your_wagon_dependencies'
3
- require "dummy_superliner/wagon"
3
+ require 'dummy_superliner/wagon'
4
4
 
5
5
  module DummySuperliner
6
6
  end
@@ -8,4 +8,4 @@ ENGINE_PATH = File.expand_path('lib/dummy_superliner/engine', ENGINE_ROOT)
8
8
 
9
9
  load File.expand_path('../../app_root.rb', __FILE__)
10
10
 
11
- load File.expand_path('script/rails', ENV["APP_ROOT"])
11
+ load File.expand_path('script/rails', ENV['APP_ROOT'])
@@ -1,12 +1,10 @@
1
1
  require 'test_helper'
2
2
 
3
3
  class CitiesControllerTest < ActionController::TestCase
4
-
5
- test "wagon view paths preceed application view paths" do
6
- paths = @controller.view_paths.collect {|p| p }
7
- i_app = paths.index {|p| p.to_s.ends_with?('/dummy/app/views') }
8
- i_wagon = paths.index {|p| p.to_s.ends_with?('/superliner/app/views') }
4
+ test 'wagon view paths preceed application view paths' do
5
+ paths = @controller.view_paths.map { |p| p }
6
+ i_app = paths.index { |p| p.to_s.ends_with?('/dummy/app/views') }
7
+ i_wagon = paths.index { |p| p.to_s.ends_with?('/superliner/app/views') }
9
8
  assert i_wagon < i_app
10
9
  end
11
-
12
- end
10
+ end
@@ -1,8 +1,7 @@
1
1
  require 'test_helper'
2
2
 
3
3
  class PeopleControllerTest < ActionController::TestCase
4
-
5
- test "extensions are rendered with locals" do
4
+ test 'extensions are rendered with locals' do
6
5
  get :index
7
6
  assert_template 'index'
8
7
  assert_template '_list_superliner'
@@ -12,5 +11,4 @@ class PeopleControllerTest < ActionController::TestCase
12
11
  assert_match /Superliner Details/, @response.body
13
12
  assert_no_match /Main Details/, @response.body
14
13
  end
15
-
16
- end
14
+ end
@@ -1,12 +1,12 @@
1
1
  require 'test_helper'
2
2
 
3
3
  class CityTest < ActiveSupport::TestCase
4
- test "city without name is invalid" do
4
+ test 'city without name is invalid' do
5
5
  city = City.new
6
6
  assert !city.valid?
7
7
  end
8
-
9
- test "fixtures from wagon are loaded" do
8
+
9
+ test 'fixtures from wagon are loaded' do
10
10
  assert_equal 'London', cities(:london).name
11
11
  end
12
12
  end
@@ -1,16 +1,14 @@
1
1
  require 'test_helper'
2
2
 
3
3
  class PersonTest < ActiveSupport::TestCase
4
-
5
- test "test seeds from application are loaded" do
6
- assert Person.where(:name => 'Pascal').exists?
4
+ test 'test seeds from application are loaded' do
5
+ assert Person.where(name: 'Pascal').exists?
7
6
  end
8
-
9
- test "person can live in a city" do
10
- person = Person.new(:name => 'Fred')
7
+
8
+ test 'person can live in a city' do
9
+ person = Person.new(name: 'Fred')
11
10
  person.city = cities(:london)
12
11
  assert person.save
13
12
  assert cities(:london).people.include?(person)
14
13
  end
15
-
16
14
  end
@@ -4,7 +4,6 @@ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
4
4
 
5
5
  require File.expand_path('test/test_helper.rb', ENV['APP_ROOT'])
6
6
 
7
-
8
7
  class ActiveSupport::TestCase
9
- self.reset_fixture_path File.expand_path("../fixtures", __FILE__)
8
+ reset_fixture_path File.expand_path('../fixtures', __FILE__)
10
9
  end
@@ -5,49 +5,48 @@ class WagonTest < ActiveSupport::TestCase
5
5
  def setup
6
6
  @wagon = Wagons.find(:superliner)
7
7
  end
8
-
9
- test "all includes current wagon" do
8
+
9
+ test 'all includes current wagon' do
10
10
  assert Wagons.all.include?(wagon)
11
11
  end
12
-
13
- test "app name is correct" do
12
+
13
+ test 'app name is correct' do
14
14
  assert_equal 'dummy', Wagons.app_name
15
15
  end
16
-
17
- test "find for inexisting return nil" do
16
+
17
+ test 'find for inexisting return nil' do
18
18
  assert_nil Wagons.find(:not_existing)
19
19
  end
20
-
21
- test "version can be read from gemspec" do
20
+
21
+ test 'version can be read from gemspec' do
22
22
  assert_equal Gem::Version.new('0.0.1'), wagon.version
23
23
  end
24
-
25
- test "label can be read from gemspec" do
24
+
25
+ test 'label can be read from gemspec' do
26
26
  assert_equal 'Superliner', wagon.label
27
27
  end
28
-
29
- test "wagon_name does not have app prefix" do
28
+
29
+ test 'wagon_name does not have app prefix' do
30
30
  assert_equal 'superliner', wagon.wagon_name
31
31
  end
32
-
33
- test "gem_name has app prefix" do
32
+
33
+ test 'gem_name has app prefix' do
34
34
  assert_equal 'dummy_superliner', wagon.gem_name
35
35
  end
36
-
37
- test "description can be read from gemspec" do
36
+
37
+ test 'description can be read from gemspec' do
38
38
  assert_equal 'Superliner description', wagon.description
39
39
  end
40
-
41
- test "dependencies is empty" do
40
+
41
+ test 'dependencies is empty' do
42
42
  assert_equal [], wagon.dependencies
43
43
  end
44
-
45
- test "all_dependencies is empty" do
44
+
45
+ test 'all_dependencies is empty' do
46
46
  assert_equal [], wagon.all_dependencies
47
47
  end
48
-
49
- test "existing seeds" do
50
- assert_equal({City => City.where(:name => 'Paris')}, wagon.existing_seeds)
48
+
49
+ test 'existing seeds' do
50
+ assert_equal({ City => City.where(name: 'Paris') }, wagon.existing_seeds)
51
51
  end
52
-
53
52
  end
data/test/test_helper.rb CHANGED
@@ -1,9 +1,9 @@
1
1
  # Configure Rails Environment
2
- ENV["RAILS_ENV"] = "test"
2
+ ENV['RAILS_ENV'] = 'test'
3
3
 
4
- require File.expand_path("../dummy/config/environment.rb", __FILE__)
5
- require "rails/test_help"
6
- require "mocha/setup"
4
+ require File.expand_path('../dummy/config/environment.rb', __FILE__)
5
+ require 'rails/test_help'
6
+ require 'mocha/setup'
7
7
 
8
8
  Rails.backtrace_cleaner.remove_silencers!
9
9
 
@@ -12,5 +12,5 @@ Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
12
12
 
13
13
  # Load fixtures from the engine
14
14
  if ActiveSupport::TestCase.method_defined?(:fixture_path=)
15
- ActiveSupport::TestCase.fixture_path = File.expand_path("../fixtures", __FILE__)
15
+ ActiveSupport::TestCase.fixture_path = File.expand_path('../fixtures', __FILE__)
16
16
  end