globalize-versioning 0.1.0.alpha.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.
checksums.yaml ADDED
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ NDBlYTJhMmJkZDIxNmJmNjUyODI5MTIxMzNlMjRkZmVlOTVhN2FmMw==
5
+ data.tar.gz: !binary |-
6
+ Nzk4MWM2MmNiNjk1MGM0YTc0MmVjYTRlZjVkMGUxZmJmMTBmNmJkYw==
7
+ !binary "U0hBNTEy":
8
+ metadata.gz: !binary |-
9
+ N2VkZjliYWFiZDZlNGQ5ZjgwNzYzY2NjNWRiZmU0MTM1MjQwMGJhN2JiYjdh
10
+ NWFmOGJiOGRiNjliMjdjMjE5MzczODhmNDI1YTEyOGVmNTg3MzFlMjc0YTVh
11
+ ZDBmYjJhZmNkMzdmNDNjMjhiNDM4YzMxMmM2ZWJmNjk1OTM0NmI=
12
+ data.tar.gz: !binary |-
13
+ NDg3ZDlmM2Y4NGE2Y2IzZWU3MGM5ZTg3ZDc4ZmJmZDIwM2UxYzlmZjE5NmVh
14
+ MTY1YTYyZjljM2Q5YzE5NWE0MTkwMTk3YjJlMDkyOTEwMzUzY2NiZTRiZmY1
15
+ MDQzN2JkMTZjY2RlZmRkOGZhNGZkMzZkZmQ5NmM3YzdmM2QxNmI=
data/Gemfile ADDED
@@ -0,0 +1,16 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # once these versions of globalized are released, we can remove this
4
+ if ENV['RAILS_3']
5
+ gem 'globalize', github: 'globalize/globalize', branch: 'gut_versioning_3-0'
6
+ end
7
+
8
+ gemspec
9
+
10
+ # Per https://github.com/bmabey/database_cleaner/issues/224
11
+ gem 'database_cleaner', github: 'bmabey/database_cleaner', branch: 'master'
12
+
13
+ group :test do
14
+ gem 'pry'
15
+ gem 'pry-nav'
16
+ end
data/Gemfile.lock ADDED
@@ -0,0 +1,84 @@
1
+ GIT
2
+ remote: git://github.com/bmabey/database_cleaner.git
3
+ revision: 072492166e82969136d1abaeccbcadaae4fe6539
4
+ branch: master
5
+ specs:
6
+ database_cleaner (1.2.0)
7
+
8
+ GIT
9
+ remote: git://github.com/globalize/globalize.git
10
+ revision: b1622d455313e1df3b10397986df795b293c814c
11
+ branch: gut_versioning_4-0
12
+ specs:
13
+ globalize (4.0.0.alpha.5)
14
+ activemodel (>= 4.0.0)
15
+ activerecord (>= 4.0.0)
16
+
17
+ PATH
18
+ remote: .
19
+ specs:
20
+ globalize-versioning (0.1.0.alpha.1)
21
+ globalize (~> 4.0.0.alpha.5)
22
+ paper_trail (~> 3.0.0)
23
+
24
+ GEM
25
+ remote: https://rubygems.org/
26
+ specs:
27
+ activemodel (4.0.2)
28
+ activesupport (= 4.0.2)
29
+ builder (~> 3.1.0)
30
+ activerecord (4.0.2)
31
+ activemodel (= 4.0.2)
32
+ activerecord-deprecated_finders (~> 1.0.2)
33
+ activesupport (= 4.0.2)
34
+ arel (~> 4.0.0)
35
+ activerecord-deprecated_finders (1.0.3)
36
+ activesupport (4.0.2)
37
+ i18n (~> 0.6, >= 0.6.4)
38
+ minitest (~> 4.2)
39
+ multi_json (~> 1.3)
40
+ thread_safe (~> 0.1)
41
+ tzinfo (~> 0.3.37)
42
+ arel (4.0.1)
43
+ atomic (1.1.14)
44
+ builder (3.1.4)
45
+ coderay (1.1.0)
46
+ i18n (0.6.9)
47
+ json (1.8.1)
48
+ method_source (0.8.2)
49
+ minitest (4.7.5)
50
+ minitest-colorize (0.0.5)
51
+ minitest (>= 2.0)
52
+ multi_json (1.8.2)
53
+ paper_trail (3.0.0)
54
+ activerecord (>= 3.0, < 5.0)
55
+ activesupport (>= 3.0, < 5.0)
56
+ pry (0.9.12.4)
57
+ coderay (~> 1.0)
58
+ method_source (~> 0.8)
59
+ slop (~> 3.4)
60
+ pry-nav (0.2.3)
61
+ pry (~> 0.9.10)
62
+ rake (10.1.1)
63
+ rdoc (4.1.0)
64
+ json (~> 1.4)
65
+ slop (3.4.7)
66
+ sqlite3 (1.3.8)
67
+ thread_safe (0.1.3)
68
+ atomic
69
+ tzinfo (0.3.38)
70
+
71
+ PLATFORMS
72
+ ruby
73
+
74
+ DEPENDENCIES
75
+ database_cleaner!
76
+ globalize!
77
+ globalize-versioning!
78
+ minitest (~> 4)
79
+ minitest-colorize
80
+ pry
81
+ pry-nav
82
+ rake
83
+ rdoc
84
+ sqlite3
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License
2
+
3
+ Copyright (c) 2013 Philip Arndt, Chris Salzberg
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/Rakefile ADDED
@@ -0,0 +1,22 @@
1
+ require 'rake'
2
+ require 'rake/testtask'
3
+ require 'rdoc/task'
4
+
5
+ desc 'Default: run unit tests.'
6
+ task :default => :test
7
+
8
+ desc 'Run all tests.'
9
+ Rake::TestTask.new(:test) do |t|
10
+ t.libs << 'lib'
11
+ t.pattern = 'test/**/*_test.rb'
12
+ t.verbose = true
13
+ end
14
+
15
+ desc 'Generate documentation.'
16
+ Rake::RDocTask.new(:rdoc) do |rdoc|
17
+ rdoc.rdoc_dir = 'rdoc'
18
+ rdoc.title = 'Globalize Versioning'
19
+ rdoc.options << '--line-numbers' << '--inline-source'
20
+ rdoc.rdoc_files.include('README')
21
+ rdoc.rdoc_files.include('lib/**/*.rb')
22
+ end
@@ -0,0 +1,2 @@
1
+ require_relative 'globalize/versioning'
2
+
@@ -0,0 +1,27 @@
1
+ require 'globalize'
2
+
3
+ module Globalize::Versioning
4
+ autoload :PaperTrail, 'globalize/versioning/paper_trail'
5
+ end
6
+
7
+ Globalize::ActiveRecord::ActMacro.module_eval do
8
+ def setup_translates_with_versioning!(options)
9
+ setup_translates_without_versioning!(options)
10
+
11
+ if options[:versioning]
12
+
13
+ # hard-coded for now
14
+ class_attribute :versioning_gem, :instance_accessor => false
15
+ self.versioning_gem = :paper_trail
16
+
17
+ ::ActiveRecord::Base.extend(Globalize::Versioning::PaperTrail)
18
+ if options[:versioning].is_a?(Hash)
19
+ translation_class.has_paper_trail(options[:versioning][:options])
20
+ else
21
+ translation_class.has_paper_trail
22
+ end
23
+ end
24
+ end
25
+
26
+ alias_method_chain :setup_translates!, :versioning
27
+ end
@@ -0,0 +1,42 @@
1
+ require 'paper_trail'
2
+
3
+ module Globalize
4
+ module Versioning
5
+ module PaperTrail
6
+ # At present this isn't used but we may use something similar in paper trail
7
+ # shortly, so leaving it around to reference easily.
8
+ #def versioned_columns
9
+ #super + self.class.translated_attribute_names
10
+ #end
11
+ end
12
+ end
13
+ end
14
+
15
+ ActiveRecord::Base.class_eval do
16
+ class << self
17
+ def has_paper_trail_with_globalize(*args)
18
+ has_paper_trail_without_globalize(*args)
19
+ include Globalize::Versioning::PaperTrail
20
+ end
21
+ alias_method_chain :has_paper_trail, :globalize
22
+ end
23
+ end
24
+
25
+ # to handle different versions of paper_trail
26
+ version_class = Module.const_defined?(:Version) ? Version : PaperTrail::Version
27
+
28
+ version_class.class_eval do
29
+
30
+ before_save do |version|
31
+ version.locale = Globalize.locale.to_s
32
+ end
33
+
34
+ def self.for_this_locale
35
+ where :locale => Globalize.locale.to_s
36
+ end
37
+
38
+ def sibling_versions_with_locales
39
+ sibling_versions_without_locales.for_this_locale
40
+ end
41
+ alias_method_chain :sibling_versions, :locales
42
+ end
@@ -0,0 +1,5 @@
1
+ module Globalize
2
+ module Versioning
3
+ VERSION = '0.1.0.alpha.1'
4
+ end
5
+ end
metadata ADDED
@@ -0,0 +1,170 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: globalize-versioning
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0.alpha.1
5
+ platform: ruby
6
+ authors:
7
+ - Philip Arndt
8
+ - Chris Salzberg
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2014-01-04 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: globalize
16
+ requirement: !ruby/object:Gem::Requirement
17
+ requirements:
18
+ - - ! '>='
19
+ - !ruby/object:Gem::Version
20
+ version: '3'
21
+ - - <
22
+ - !ruby/object:Gem::Version
23
+ version: '5'
24
+ type: :runtime
25
+ prerelease: false
26
+ version_requirements: !ruby/object:Gem::Requirement
27
+ requirements:
28
+ - - ! '>='
29
+ - !ruby/object:Gem::Version
30
+ version: '3'
31
+ - - <
32
+ - !ruby/object:Gem::Version
33
+ version: '5'
34
+ - !ruby/object:Gem::Dependency
35
+ name: paper_trail
36
+ requirement: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ~>
39
+ - !ruby/object:Gem::Version
40
+ version: 3.0.0
41
+ type: :runtime
42
+ prerelease: false
43
+ version_requirements: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ~>
46
+ - !ruby/object:Gem::Version
47
+ version: 3.0.0
48
+ - !ruby/object:Gem::Dependency
49
+ name: database_cleaner
50
+ requirement: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ! '>='
53
+ - !ruby/object:Gem::Version
54
+ version: 1.2.0
55
+ type: :development
56
+ prerelease: false
57
+ version_requirements: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: 1.2.0
62
+ - !ruby/object:Gem::Dependency
63
+ name: minitest
64
+ requirement: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ~>
67
+ - !ruby/object:Gem::Version
68
+ version: '4'
69
+ type: :development
70
+ prerelease: false
71
+ version_requirements: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ~>
74
+ - !ruby/object:Gem::Version
75
+ version: '4'
76
+ - !ruby/object:Gem::Dependency
77
+ name: minitest-colorize
78
+ requirement: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ! '>='
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ type: :development
84
+ prerelease: false
85
+ version_requirements: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ! '>='
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ - !ruby/object:Gem::Dependency
91
+ name: sqlite3
92
+ requirement: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ! '>='
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ type: :development
98
+ prerelease: false
99
+ version_requirements: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ! '>='
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ - !ruby/object:Gem::Dependency
105
+ name: rdoc
106
+ requirement: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ! '>='
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ type: :development
112
+ prerelease: false
113
+ version_requirements: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ! '>='
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ - !ruby/object:Gem::Dependency
119
+ name: rake
120
+ requirement: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ! '>='
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
125
+ type: :development
126
+ prerelease: false
127
+ version_requirements: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ! '>='
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
132
+ description: Provides support for using versioning gems such as PaperTrail with Globalize.
133
+ email: nobody@globalize-rails.org
134
+ executables: []
135
+ extensions: []
136
+ extra_rdoc_files: []
137
+ files:
138
+ - lib/globalize/versioning.rb
139
+ - lib/globalize/versioning/paper_trail.rb
140
+ - lib/globalize/versioning/version.rb
141
+ - lib/globalize-versioning.rb
142
+ - Gemfile.lock
143
+ - LICENSE
144
+ - Rakefile
145
+ - Gemfile
146
+ homepage: http://github.com/globalize/globalize-versioning
147
+ licenses:
148
+ - MIT
149
+ metadata: {}
150
+ post_install_message:
151
+ rdoc_options: []
152
+ require_paths:
153
+ - lib
154
+ required_ruby_version: !ruby/object:Gem::Requirement
155
+ requirements:
156
+ - - ! '>='
157
+ - !ruby/object:Gem::Version
158
+ version: '0'
159
+ required_rubygems_version: !ruby/object:Gem::Requirement
160
+ requirements:
161
+ - - ! '>'
162
+ - !ruby/object:Gem::Version
163
+ version: 1.3.1
164
+ requirements: []
165
+ rubyforge_project: globalize-versioning
166
+ rubygems_version: 2.0.5
167
+ signing_key:
168
+ specification_version: 4
169
+ summary: Adapter for using versioning gems with Globalize
170
+ test_files: []