wagons 0.2.1 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ NTFiMDFkZWY5ZjY1MzE2MjRkYjlkZmJlNTZkMDY5MWYyNWEwNmNlYQ==
5
+ data.tar.gz: !binary |-
6
+ ZmQ3NzYzYTU5MzA4YmIyY2E1ZDcwMTVmOTk5Y2FiNTJlOTkxZWQzZA==
7
+ SHA512:
8
+ metadata.gz: !binary |-
9
+ NDk4NzUwMjRmNmQzNDA1ODQ4Mjk2ZGIyMDVlMmExZjc5MmY3YjNkNzY2ZmVi
10
+ ZWQ2ZWI2ZDVlOGI0ZjdkZTZkYWU4NTVjNTgwMjEyMWZmZTU5OWIyNDA1YjA2
11
+ MGFiN2FiZjQzMzA4M2ZiM2RhZmMxMmUwZDQ2Mzc3YmUzZGY1YzQ=
12
+ data.tar.gz: !binary |-
13
+ NTNlNTIwYjdlYWUzZTU3MGE3NDAwNmZkODQ1NTY0ZjU3ZDQ0MWJhMDVlMWEw
14
+ OWYxODE3ZDRkMzkwYThjYzA4NzU1NjUwYjJmZGZlYmM2YjVjODQ3NjcxNDU2
15
+ N2IwMGJhZGU5ODY3ZTQzZDM1NTQ0YjZkZTcwYWM0ZDgwYTQ0MDE=
@@ -1,3 +1,3 @@
1
1
  module Wagons
2
- VERSION = "0.2.1"
2
+ VERSION = "0.2.2"
3
3
  end
data/lib/wagons/wagon.rb CHANGED
@@ -1,116 +1,120 @@
1
1
  require 'active_support/concern'
2
2
 
3
3
  module Wagons
4
-
4
+
5
5
  # A wagon is an extension to your application train running on Rails.
6
- #
6
+ #
7
7
  # Wagons are built on Rails Engines. To change an engine to a wagon,
8
8
  # simply include this module into your own Engine.
9
9
  module Wagon
10
10
  extend ActiveSupport::Concern
11
-
11
+
12
12
  # Version from the gemspec.
13
13
  def version
14
14
  gemspec.version
15
15
  end
16
-
16
+
17
17
  # Human readable name.
18
18
  def label
19
19
  gemspec.summary
20
20
  end
21
-
21
+
22
22
  # Simple system name, without application prefix.
23
23
  def wagon_name
24
24
  gem_name.sub(/^#{Wagons.app_name}_/, '')
25
25
  end
26
-
26
+
27
27
  # Name of the gem.
28
28
  def gem_name
29
29
  class_name = self.class.name.demodulize.underscore
30
30
  engine_name.sub(/_#{class_name}$/, '')
31
31
  end
32
-
32
+
33
33
  # Description from the gemspec.
34
34
  def description
35
35
  gemspec.description
36
36
  end
37
-
37
+
38
38
  # Direct dependencies on other wagons.
39
39
  def dependencies
40
40
  gemspec.dependencies.collect(&:name).
41
41
  select {|dep| dep =~ /\A#{Wagons.app_name}_/ }.
42
42
  collect { |dep| Wagons.find(dep) || raise("No wagon #{dep} found") }
43
43
  end
44
-
44
+
45
45
  # Recursive depdencies on other wagons.
46
46
  def all_dependencies
47
47
  dependencies.collect {|dep| dep.all_dependencies + [dep] }.flatten.uniq
48
48
  end
49
-
49
+
50
50
  # Gem Specification.
51
51
  def gemspec
52
52
  Gem::Specification.find_by_name(gem_name)
53
53
  end
54
-
54
+
55
55
  # If true, this wagon may not be removed. Override as required.
56
56
  # May return a string with a message, why the wagon must not be removed.
57
57
  def protect?
58
58
  false
59
59
  end
60
-
60
+
61
61
  # Run the migrations.
62
62
  def migrate(version = nil)
63
63
  ActiveRecord::Migrator.migrate(migrations_paths, version)
64
64
  end
65
-
65
+
66
66
  # Revert the migrations.
67
67
  def revert
68
68
  ActiveRecord::Migrator.migrate(migrations_paths, 0)
69
69
  end
70
-
70
+
71
71
  # Load seed data in db/fixtures.
72
72
  def load_seed
73
73
  SeedFu.seed seed_fixtures
74
74
  end
75
-
75
+
76
76
  # Unload seed data in db/fixtures.
77
77
  def unload_seed
78
78
  SeedFuNdo.unseed seed_fixtures
79
79
  end
80
-
80
+
81
81
  # Hash of the seed models to their existing records.
82
82
  def existing_seeds
83
83
  silence_stream(STDOUT) do
84
84
  SeedFuNdo.existing_seeds seed_fixtures
85
85
  end
86
86
  end
87
-
87
+
88
88
  # The version requirement for the main application.
89
89
  def app_requirement
90
90
  self.class.app_requirement
91
91
  end
92
-
92
+
93
93
  # Paths for migration files.
94
94
  def migrations_paths
95
95
  paths['db/migrate'].existent
96
96
  end
97
-
97
+
98
98
  # Loads tasks into the main Rails application.
99
99
  # Overwritten to only load own rake tasks, without install:migrations task from Rails::Engine
100
- def load_tasks(app=self)
101
- railties.all { |r| r.load_tasks(app) }
100
+ def load_tasks(app = self)
101
+ if Rails::VERSION::MAJOR < 4
102
+ railties.all { |r| r.load_tasks(app) }
103
+ end
104
+
102
105
  extend Rake::DSL if defined? Rake::DSL
103
106
  self.class.rake_tasks.each { |block| self.instance_exec(app, &block) }
104
107
  paths["lib/tasks"].existent.sort.each { |ext| load(ext) }
108
+ self
105
109
  end
106
-
110
+
107
111
  private
108
-
112
+
109
113
  def seed_fixtures
110
114
  fixtures = root.join('db', 'fixtures')
111
115
  ENV['NO_ENV'] ? [fixtures] : [fixtures, File.join(fixtures, Rails.env)]
112
116
  end
113
-
117
+
114
118
  module ClassMethods
115
119
  # Get or set a version requirement for the main application.
116
120
  # Set the application version in config/initializers/wagon_app_version.rb.
@@ -1,7 +1,7 @@
1
1
  PATH
2
- remote: /home/tgdzupa7/workspace/wagons
2
+ remote: /home/pzumkehr/src/ruby/wagons
3
3
  specs:
4
- wagons (0.2.0)
4
+ wagons (0.2.2)
5
5
  bundler (>= 1.1)
6
6
  rails (>= 3.2)
7
7
  seed-fu-ndo (>= 0.0.2)
@@ -19,32 +19,32 @@ PATH
19
19
  GEM
20
20
  remote: https://rubygems.org/
21
21
  specs:
22
- actionmailer (4.0.2)
23
- actionpack (= 4.0.2)
22
+ actionmailer (4.0.3)
23
+ actionpack (= 4.0.3)
24
24
  mail (~> 2.5.4)
25
- actionpack (4.0.2)
26
- activesupport (= 4.0.2)
25
+ actionpack (4.0.3)
26
+ activesupport (= 4.0.3)
27
27
  builder (~> 3.1.0)
28
28
  erubis (~> 2.7.0)
29
29
  rack (~> 1.5.2)
30
30
  rack-test (~> 0.6.2)
31
- activemodel (4.0.2)
32
- activesupport (= 4.0.2)
31
+ activemodel (4.0.3)
32
+ activesupport (= 4.0.3)
33
33
  builder (~> 3.1.0)
34
- activerecord (4.0.2)
35
- activemodel (= 4.0.2)
34
+ activerecord (4.0.3)
35
+ activemodel (= 4.0.3)
36
36
  activerecord-deprecated_finders (~> 1.0.2)
37
- activesupport (= 4.0.2)
37
+ activesupport (= 4.0.3)
38
38
  arel (~> 4.0.0)
39
39
  activerecord-deprecated_finders (1.0.3)
40
- activesupport (4.0.2)
40
+ activesupport (4.0.3)
41
41
  i18n (~> 0.6, >= 0.6.4)
42
42
  minitest (~> 4.2)
43
43
  multi_json (~> 1.3)
44
44
  thread_safe (~> 0.1)
45
45
  tzinfo (~> 0.3.37)
46
- arel (4.0.1)
47
- atomic (1.1.14)
46
+ arel (4.0.2)
47
+ atomic (1.1.15)
48
48
  builder (3.1.4)
49
49
  erubis (2.7.0)
50
50
  hike (1.2.3)
@@ -57,31 +57,31 @@ GEM
57
57
  minitest (4.7.5)
58
58
  mocha (0.14.0)
59
59
  metaclass (~> 0.0.1)
60
- multi_json (1.8.2)
61
- polyglot (0.3.3)
60
+ multi_json (1.8.4)
61
+ polyglot (0.3.4)
62
62
  rack (1.5.2)
63
63
  rack-test (0.6.2)
64
64
  rack (>= 1.0)
65
- rails (4.0.2)
66
- actionmailer (= 4.0.2)
67
- actionpack (= 4.0.2)
68
- activerecord (= 4.0.2)
69
- activesupport (= 4.0.2)
65
+ rails (4.0.3)
66
+ actionmailer (= 4.0.3)
67
+ actionpack (= 4.0.3)
68
+ activerecord (= 4.0.3)
69
+ activesupport (= 4.0.3)
70
70
  bundler (>= 1.3.0, < 2.0)
71
- railties (= 4.0.2)
71
+ railties (= 4.0.3)
72
72
  sprockets-rails (~> 2.0.0)
73
- railties (4.0.2)
74
- actionpack (= 4.0.2)
75
- activesupport (= 4.0.2)
73
+ railties (4.0.3)
74
+ actionpack (= 4.0.3)
75
+ activesupport (= 4.0.3)
76
76
  rake (>= 0.8.7)
77
77
  thor (>= 0.18.1, < 2.0)
78
- rake (10.1.0)
78
+ rake (10.1.1)
79
79
  seed-fu (2.3.0)
80
80
  activerecord (>= 3.1, < 4.1)
81
81
  activesupport (>= 3.1, < 4.1)
82
82
  seed-fu-ndo (0.0.2)
83
83
  seed-fu (>= 2.2.0)
84
- sprockets (2.10.1)
84
+ sprockets (2.11.0)
85
85
  hike (~> 1.2)
86
86
  multi_json (~> 1.0)
87
87
  rack (~> 1.0)
@@ -90,10 +90,10 @@ GEM
90
90
  actionpack (>= 3.0)
91
91
  activesupport (>= 3.0)
92
92
  sprockets (~> 2.8)
93
- sqlite3 (1.3.8)
93
+ sqlite3 (1.3.7)
94
94
  thor (0.18.1)
95
- thread_safe (0.1.3)
96
- atomic
95
+ thread_safe (0.2.0)
96
+ atomic (>= 1.1.7, < 2)
97
97
  tilt (1.4.1)
98
98
  treetop (1.4.15)
99
99
  polyglot
Binary file
Binary file