dm-is-localizable 0.10.1 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +3 -2
- data/Gemfile +146 -0
- data/Rakefile +6 -60
- data/VERSION +1 -1
- data/dm-is-localizable.gemspec +27 -16
- data/lib/dm-is-localizable/is/localizable.rb +10 -5
- data/lib/dm-is-localizable/storage/language.rb +1 -1
- data/spec/rcov.opts +6 -0
- data/spec/spec_helper.rb +9 -57
- data/tasks/{changelog.rb → changelog.rake} +0 -0
- data/tasks/ci.rake +1 -0
- data/tasks/{install.rb → install.rake} +0 -0
- data/tasks/local_gemfile.rake +18 -0
- data/tasks/metrics.rake +36 -0
- data/tasks/spec.rake +22 -0
- data/tasks/{whitespace.rb → whitespace.rake} +0 -0
- data/tasks/yard.rake +9 -0
- data/tasks/yardstick.rake +19 -0
- metadata +88 -30
data/.gitignore
CHANGED
data/Gemfile
ADDED
@@ -0,0 +1,146 @@
|
|
1
|
+
# If you're working on more than one datamapper gem at a time, then it's
|
2
|
+
# recommended to create a local Gemfile and use this instead of the git
|
3
|
+
# sources. This will make sure that you are developing against your
|
4
|
+
# other local datamapper sources that you currently work on. Gemfile.local
|
5
|
+
# will behave identically to the standard Gemfile apart from the fact that
|
6
|
+
# it fetches the datamapper gems from local paths. This means that you can use
|
7
|
+
# the same environment variables, like ADAPTER(S) or PLUGIN(S) when running
|
8
|
+
# bundle commands. Gemfile.local is added to .gitignore, so you don't need to
|
9
|
+
# worry about accidentally checking local development paths into git.
|
10
|
+
# In order to create a local Gemfile, all you need to do is run:
|
11
|
+
#
|
12
|
+
# bundle exec rake local_gemfile
|
13
|
+
#
|
14
|
+
# This will give you a Gemfile.local file that points to your local clones of
|
15
|
+
# the various datamapper gems. It's assumed that all datamapper repo clones
|
16
|
+
# reside in the same directory. You can use the Gemfile.local like so for
|
17
|
+
# running any bundle command:
|
18
|
+
#
|
19
|
+
# BUNDLE_GEMFILE=Gemfile.local bundle foo
|
20
|
+
#
|
21
|
+
# You can also specify which adapter(s) should be part of the bundle by setting
|
22
|
+
# an environment variable. This of course also works when using the Gemfile.local
|
23
|
+
#
|
24
|
+
# bundle foo # dm-sqlite-adapter
|
25
|
+
# ADAPTER=mysql bundle foo # dm-mysql-adapter
|
26
|
+
# ADAPTERS=sqlite,mysql bundle foo # dm-sqlite-adapter and dm-mysql-adapter
|
27
|
+
#
|
28
|
+
# Of course you can also use the ADAPTER(S) variable when using the Gemfile.local
|
29
|
+
# and running specs against selected adapters.
|
30
|
+
#
|
31
|
+
# For easily working with adapters supported on your machine, it's recommended
|
32
|
+
# that you first install all adapters that you are planning to use or work on
|
33
|
+
# by doing something like
|
34
|
+
#
|
35
|
+
# ADAPTERS=sqlite,mysql,postgres bundle install
|
36
|
+
#
|
37
|
+
# This will clone the various repositories and make them available to bundler.
|
38
|
+
# Once you have them installed you can easily switch between adapters for the
|
39
|
+
# various development tasks. Running something like
|
40
|
+
#
|
41
|
+
# ADAPTER=mysql bundle exec rake spec
|
42
|
+
#
|
43
|
+
# will make sure that the dm-mysql-adapter is part of the bundle, and will be used
|
44
|
+
# when running the specs.
|
45
|
+
#
|
46
|
+
# You can also specify which plugin(s) should be part of the bundle by setting
|
47
|
+
# an environment variable. This also works when using the Gemfile.local
|
48
|
+
#
|
49
|
+
# bundle foo # dm-migrations
|
50
|
+
# PLUGINS=dm-validations bundle foo # dm-migrations and dm-validations
|
51
|
+
# PLUGINS=dm-validations,dm-types bundle foo # dm-migrations, dm-validations and dm-types
|
52
|
+
#
|
53
|
+
# Of course you can combine the PLUGIN(S) and ADAPTER(S) env vars to run specs
|
54
|
+
# for certain adapter/plugin combinations.
|
55
|
+
#
|
56
|
+
# Finally, to speed up running specs and other tasks, it's recommended to run
|
57
|
+
#
|
58
|
+
# bundle lock
|
59
|
+
#
|
60
|
+
# after running 'bundle install' for the first time. This will make 'bundle exec' run
|
61
|
+
# a lot faster compared to the unlocked version. With an unlocked bundle you would
|
62
|
+
# typically just run 'bundle install' from time to time to fetch the latest sources from
|
63
|
+
# upstream. When you locked your bundle, you need to run
|
64
|
+
#
|
65
|
+
# bundle install --relock
|
66
|
+
#
|
67
|
+
# to make sure to fetch the latest updates and then lock the bundle again. Gemfile.lock
|
68
|
+
# is added to the .gitignore file, so you don't need to worry about accidentally checking
|
69
|
+
# it into version control.
|
70
|
+
|
71
|
+
source 'http://rubygems.org'
|
72
|
+
|
73
|
+
DATAMAPPER = 'git://github.com/datamapper'
|
74
|
+
DM_VERSION = '~> 1.0.0'
|
75
|
+
|
76
|
+
|
77
|
+
group :runtime do # Runtime dependencies (as in the gemspec)
|
78
|
+
|
79
|
+
if ENV['EXTLIB']
|
80
|
+
gem 'extlib', '~> 0.9.15', :git => "#{DATAMAPPER}/extlib.git"
|
81
|
+
else
|
82
|
+
gem 'activesupport', '~> 3.0.0.beta3', :git => 'git://github.com/rails/rails.git', :require => nil
|
83
|
+
end
|
84
|
+
|
85
|
+
gem 'dm-core', DM_VERSION, :git => "#{DATAMAPPER}/dm-core.git"
|
86
|
+
gem 'dm-validations', DM_VERSION, :git => "#{DATAMAPPER}/dm-validations.git"
|
87
|
+
gem 'dm-is-remixable', DM_VERSION, :git => "#{DATAMAPPER}/dm-is-remixable.git"
|
88
|
+
|
89
|
+
gem 'dm-accepts_nested_attributes', DM_VERSION, :git => 'git://github.com/snusnu/dm-accepts_nested_attributes.git'
|
90
|
+
|
91
|
+
end
|
92
|
+
|
93
|
+
group(:development) do # Development dependencies (as in the gemspec)
|
94
|
+
|
95
|
+
gem 'rake', '~> 0.8.7'
|
96
|
+
gem 'rspec', '~> 1.3'
|
97
|
+
gem 'yard', '~> 0.5'
|
98
|
+
gem 'rcov', '~> 0.9.7'
|
99
|
+
gem 'jeweler', '~> 1.4'
|
100
|
+
|
101
|
+
end
|
102
|
+
|
103
|
+
group :quality do # These gems contain rake tasks that check the quality of the source code
|
104
|
+
|
105
|
+
gem 'yardstick', '~> 0.1'
|
106
|
+
gem 'metric_fu', '~> 1.3'
|
107
|
+
gem 'reek', '~> 1.2.7'
|
108
|
+
gem 'roodi', '~> 2.1'
|
109
|
+
|
110
|
+
end
|
111
|
+
|
112
|
+
group :datamapper do # We need this because we want to pin these dependencies to their git master sources
|
113
|
+
|
114
|
+
adapters = ENV['ADAPTER'] || ENV['ADAPTERS']
|
115
|
+
adapters = adapters.to_s.gsub(',',' ').split(' ') - ['in_memory']
|
116
|
+
|
117
|
+
unless adapters.empty?
|
118
|
+
|
119
|
+
DO_VERSION = '~> 0.10.3'
|
120
|
+
DM_DO_ADAPTERS = %w[sqlite postgres mysql oracle sqlserver]
|
121
|
+
|
122
|
+
gem 'data_objects', DO_VERSION, :git => "#{DATAMAPPER}/do.git"
|
123
|
+
|
124
|
+
adapters.each do |adapter|
|
125
|
+
if DM_DO_ADAPTERS.any? { |dm_do_adapter| dm_do_adapter =~ /#{adapter}/ }
|
126
|
+
adapter = 'sqlite3' if adapter == 'sqlite'
|
127
|
+
gem "do_#{adapter}", DO_VERSION, :git => "#{DATAMAPPER}/do.git"
|
128
|
+
end
|
129
|
+
end
|
130
|
+
|
131
|
+
gem 'dm-do-adapter', DM_VERSION, :git => "#{DATAMAPPER}/dm-do-adapter.git"
|
132
|
+
|
133
|
+
adapters.each do |adapter|
|
134
|
+
gem "dm-#{adapter}-adapter", DM_VERSION, :git => "#{DATAMAPPER}/dm-#{adapter}-adapter.git"
|
135
|
+
end
|
136
|
+
|
137
|
+
end
|
138
|
+
|
139
|
+
plugins = ENV['PLUGINS'] || ENV['PLUGIN']
|
140
|
+
plugins = (plugins.to_s.gsub(',',' ').split(' ') + ['dm-migrations']).uniq
|
141
|
+
|
142
|
+
plugins.each do |plugin|
|
143
|
+
gem plugin, DM_VERSION, :git => "#{DATAMAPPER}/#{plugin}.git"
|
144
|
+
end
|
145
|
+
|
146
|
+
end
|
data/Rakefile
CHANGED
@@ -1,8 +1,6 @@
|
|
1
1
|
require 'pathname'
|
2
2
|
require 'rake'
|
3
3
|
|
4
|
-
ROOT = Pathname(__FILE__).dirname.expand_path
|
5
|
-
JRUBY = RUBY_PLATFORM =~ /java/
|
6
4
|
|
7
5
|
begin
|
8
6
|
|
@@ -16,71 +14,19 @@ begin
|
|
16
14
|
gem.homepage = "http://github.com/snusnu/dm-is-localizable"
|
17
15
|
gem.authors = ["Martin Gamsjaeger (snusnu)"]
|
18
16
|
|
19
|
-
gem.add_dependency
|
20
|
-
gem.add_dependency
|
21
|
-
gem.add_dependency
|
17
|
+
gem.add_dependency 'dm-core', '~> 1.0.0'
|
18
|
+
gem.add_dependency 'dm-is-remixable', '~> 1.0.0'
|
19
|
+
gem.add_dependency 'dm-validations', '~> 1.0.0'
|
22
20
|
|
23
21
|
gem.add_development_dependency 'rspec', '~> 1.3'
|
22
|
+
gem.add_development_dependency 'yard', '~> 0.5'
|
24
23
|
|
25
24
|
Jeweler::GemcutterTasks.new
|
26
25
|
|
27
|
-
|
28
|
-
|
29
|
-
rescue LoadError
|
30
|
-
puts "Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler"
|
31
|
-
end
|
26
|
+
FileList['tasks/**/*.rake'].each { |task| import task }
|
32
27
|
|
33
|
-
begin
|
34
|
-
require 'spec/rake/spectask'
|
35
|
-
|
36
|
-
task :default => [ :spec ]
|
37
|
-
|
38
|
-
desc 'Run specifications'
|
39
|
-
Spec::Rake::SpecTask.new(:spec) do |t|
|
40
|
-
t.spec_opts << '--options' << 'spec/spec.opts' if File.exists?('spec/spec.opts')
|
41
|
-
t.libs << 'lib' << 'spec' # needed for CI rake spec task, duplicated in spec_helper
|
42
|
-
|
43
|
-
begin
|
44
|
-
require 'rcov'
|
45
|
-
t.rcov = JRUBY ? false : (ENV.has_key?('NO_RCOV') ? ENV['NO_RCOV'] != 'true' : true)
|
46
|
-
t.rcov_opts << '--exclude' << 'spec'
|
47
|
-
t.rcov_opts << '--text-summary'
|
48
|
-
t.rcov_opts << '--sort' << 'coverage' << '--sort-reverse'
|
49
|
-
rescue LoadError
|
50
|
-
# rcov not installed
|
51
|
-
rescue SyntaxError
|
52
|
-
# rcov syntax invalid
|
53
|
-
end
|
54
28
|
end
|
55
|
-
rescue LoadError
|
56
|
-
# rspec not installed
|
57
|
-
end
|
58
29
|
|
59
|
-
begin
|
60
|
-
require 'cucumber/rake/task'
|
61
|
-
Cucumber::Rake::Task.new(:features)
|
62
30
|
rescue LoadError
|
63
|
-
|
64
|
-
abort "Cucumber is not available. In order to run features, you must: sudo gem install cucumber"
|
65
|
-
end
|
66
|
-
end
|
67
|
-
|
68
|
-
task :default => :spec
|
69
|
-
|
70
|
-
require 'rake/rdoctask'
|
71
|
-
Rake::RDocTask.new do |rdoc|
|
72
|
-
if File.exist?('VERSION.yml')
|
73
|
-
config = YAML.load(File.read('VERSION.yml'))
|
74
|
-
version = "#{config[:major]}.#{config[:minor]}.#{config[:patch]}"
|
75
|
-
else
|
76
|
-
version = ""
|
77
|
-
end
|
78
|
-
|
79
|
-
rdoc.rdoc_dir = 'rdoc'
|
80
|
-
rdoc.title = "dm-is-localizable #{version}"
|
81
|
-
rdoc.rdoc_files.include('README*')
|
82
|
-
rdoc.rdoc_files.include('lib/**/*.rb')
|
31
|
+
puts "Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler"
|
83
32
|
end
|
84
|
-
|
85
|
-
# require all tasks below tasks
|
86
|
-
Pathname.glob(ROOT.join('tasks/**/*.rb').to_s).each { |f| require f }
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
1.0.0
|
data/dm-is-localizable.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{dm-is-localizable}
|
8
|
-
s.version = "0.
|
8
|
+
s.version = "1.0.0"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Martin Gamsjaeger (snusnu)"]
|
12
|
-
s.date = %q{2010-
|
12
|
+
s.date = %q{2010-06-08}
|
13
13
|
s.email = %q{gamsnjaga@gmail.com}
|
14
14
|
s.extra_rdoc_files = [
|
15
15
|
"LICENSE",
|
@@ -20,6 +20,7 @@ Gem::Specification.new do |s|
|
|
20
20
|
".document",
|
21
21
|
".gitignore",
|
22
22
|
"CHANGELOG",
|
23
|
+
"Gemfile",
|
23
24
|
"LICENSE",
|
24
25
|
"README.textile",
|
25
26
|
"Rakefile",
|
@@ -32,6 +33,7 @@ Gem::Specification.new do |s|
|
|
32
33
|
"lib/dm-is-localizable/storage/translation.rb",
|
33
34
|
"spec/fixtures/item.rb",
|
34
35
|
"spec/lib/rspec_tmbundle_support.rb",
|
36
|
+
"spec/rcov.opts",
|
35
37
|
"spec/shared/shared_examples_spec.rb",
|
36
38
|
"spec/spec.opts",
|
37
39
|
"spec/spec_helper.rb",
|
@@ -41,14 +43,20 @@ Gem::Specification.new do |s|
|
|
41
43
|
"spec/unit/is_localizable_spec.rb",
|
42
44
|
"spec/unit/language_spec.rb",
|
43
45
|
"spec/unit/translation_spec.rb",
|
44
|
-
"tasks/changelog.
|
45
|
-
"tasks/
|
46
|
-
"tasks/
|
46
|
+
"tasks/changelog.rake",
|
47
|
+
"tasks/ci.rake",
|
48
|
+
"tasks/install.rake",
|
49
|
+
"tasks/local_gemfile.rake",
|
50
|
+
"tasks/metrics.rake",
|
51
|
+
"tasks/spec.rake",
|
52
|
+
"tasks/whitespace.rake",
|
53
|
+
"tasks/yard.rake",
|
54
|
+
"tasks/yardstick.rake"
|
47
55
|
]
|
48
56
|
s.homepage = %q{http://github.com/snusnu/dm-is-localizable}
|
49
57
|
s.rdoc_options = ["--charset=UTF-8"]
|
50
58
|
s.require_paths = ["lib"]
|
51
|
-
s.rubygems_version = %q{1.3.
|
59
|
+
s.rubygems_version = %q{1.3.7}
|
52
60
|
s.summary = %q{Datamapper support for localization of content in multilanguage applications}
|
53
61
|
s.test_files = [
|
54
62
|
"spec/fixtures/item.rb",
|
@@ -67,22 +75,25 @@ Gem::Specification.new do |s|
|
|
67
75
|
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
68
76
|
s.specification_version = 3
|
69
77
|
|
70
|
-
if Gem::Version.new(Gem::
|
71
|
-
s.add_runtime_dependency(%q<dm-core>, ["
|
72
|
-
s.add_runtime_dependency(%q<dm-is-remixable>, ["
|
73
|
-
s.add_runtime_dependency(%q<dm-validations>, ["
|
78
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
79
|
+
s.add_runtime_dependency(%q<dm-core>, ["~> 1.0.0"])
|
80
|
+
s.add_runtime_dependency(%q<dm-is-remixable>, ["~> 1.0.0"])
|
81
|
+
s.add_runtime_dependency(%q<dm-validations>, ["~> 1.0.0"])
|
74
82
|
s.add_development_dependency(%q<rspec>, ["~> 1.3"])
|
83
|
+
s.add_development_dependency(%q<yard>, ["~> 0.5"])
|
75
84
|
else
|
76
|
-
s.add_dependency(%q<dm-core>, ["
|
77
|
-
s.add_dependency(%q<dm-is-remixable>, ["
|
78
|
-
s.add_dependency(%q<dm-validations>, ["
|
85
|
+
s.add_dependency(%q<dm-core>, ["~> 1.0.0"])
|
86
|
+
s.add_dependency(%q<dm-is-remixable>, ["~> 1.0.0"])
|
87
|
+
s.add_dependency(%q<dm-validations>, ["~> 1.0.0"])
|
79
88
|
s.add_dependency(%q<rspec>, ["~> 1.3"])
|
89
|
+
s.add_dependency(%q<yard>, ["~> 0.5"])
|
80
90
|
end
|
81
91
|
else
|
82
|
-
s.add_dependency(%q<dm-core>, ["
|
83
|
-
s.add_dependency(%q<dm-is-remixable>, ["
|
84
|
-
s.add_dependency(%q<dm-validations>, ["
|
92
|
+
s.add_dependency(%q<dm-core>, ["~> 1.0.0"])
|
93
|
+
s.add_dependency(%q<dm-is-remixable>, ["~> 1.0.0"])
|
94
|
+
s.add_dependency(%q<dm-validations>, ["~> 1.0.0"])
|
85
95
|
s.add_dependency(%q<rspec>, ["~> 1.3"])
|
96
|
+
s.add_dependency(%q<yard>, ["~> 0.5"])
|
86
97
|
end
|
87
98
|
end
|
88
99
|
|
@@ -1,3 +1,8 @@
|
|
1
|
+
require 'dm-core'
|
2
|
+
require 'dm-validations'
|
3
|
+
require 'dm-is-remixable'
|
4
|
+
require 'dm-accepts_nested_attributes'
|
5
|
+
|
1
6
|
module DataMapper
|
2
7
|
module Is
|
3
8
|
|
@@ -15,13 +20,13 @@ module DataMapper
|
|
15
20
|
:accept_nested_attributes => true
|
16
21
|
}.merge(options)
|
17
22
|
|
18
|
-
remixer_fk =
|
23
|
+
remixer_fk = ActiveSupport::Inflector.foreign_key(self.name).to_sym
|
19
24
|
remixer = remixer_fk.to_s.gsub('_id', '').to_sym
|
20
|
-
remixee =
|
25
|
+
remixee = ActiveSupport::Inflector.tableize(options[:model]).to_sym
|
21
26
|
|
22
27
|
remix n, Translation, :as => options[:as], :model => options[:model]
|
23
28
|
|
24
|
-
@translation_model =
|
29
|
+
@translation_model = ActiveSupport::Inflector.constantize(options[:model])
|
25
30
|
|
26
31
|
enhance :translation, @translation_model do
|
27
32
|
|
@@ -33,7 +38,7 @@ module DataMapper
|
|
33
38
|
|
34
39
|
class_eval &block
|
35
40
|
|
36
|
-
|
41
|
+
validates_uniqueness_of :language_id, :scope => remixer_fk
|
37
42
|
|
38
43
|
end
|
39
44
|
|
@@ -93,7 +98,7 @@ module DataMapper
|
|
93
98
|
def localizable_properties
|
94
99
|
translation_model.properties.map { |p| p.name }.select do |p|
|
95
100
|
# exclude properties that are'nt localizable
|
96
|
-
p != :id && p != :language_id && p !=
|
101
|
+
p != :id && p != :language_id && p != ActiveSupport::Inflector.foreign_key(self.name).to_sym
|
97
102
|
end
|
98
103
|
end
|
99
104
|
|
data/spec/rcov.opts
ADDED
data/spec/spec_helper.rb
CHANGED
@@ -1,62 +1,8 @@
|
|
1
|
-
require 'rubygems'
|
2
|
-
|
3
|
-
require 'dm-core'
|
4
|
-
require 'dm-is-remixable'
|
5
|
-
require 'dm-validations'
|
6
|
-
require 'dm-accepts_nested_attributes'
|
7
|
-
|
8
|
-
# Support running specs with 'rake spec' and 'spec'
|
9
|
-
$LOAD_PATH.unshift('lib') unless $LOAD_PATH.include?('lib')
|
10
|
-
|
11
1
|
require 'dm-is-localizable'
|
2
|
+
require 'dm-core/spec/setup'
|
3
|
+
require 'fixtures/item'
|
12
4
|
|
13
|
-
|
14
|
-
ENV["MYSQL_SPEC_URI"] ||= 'mysql://localhost/dm-is_localizable_test'
|
15
|
-
ENV["POSTGRES_SPEC_URI"] ||= 'postgres://postgres@localhost/dm-is_localizable_test'
|
16
|
-
|
17
|
-
|
18
|
-
def setup_adapter(name, default_uri = nil)
|
19
|
-
begin
|
20
|
-
DataMapper.setup(name, ENV["#{ENV['ADAPTER'].to_s.upcase}_SPEC_URI"] || default_uri)
|
21
|
-
Object.const_set('ADAPTER', ENV['ADAPTER'].to_sym) if name.to_s == ENV['ADAPTER']
|
22
|
-
true
|
23
|
-
rescue Exception => e
|
24
|
-
if name.to_s == ENV['ADAPTER']
|
25
|
-
Object.const_set('ADAPTER', nil)
|
26
|
-
warn "Could not load do_#{name}: #{e}"
|
27
|
-
end
|
28
|
-
false
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
# have the loggers handy
|
33
|
-
# DataObjects::Logger.new(STDOUT, :debug)
|
34
|
-
# DataObjects::Sqlite3.logger = DataObjects::Logger.new(STDOUT, :debug)
|
35
|
-
|
36
|
-
# -----------------------------------------------
|
37
|
-
# support for nice html output in rspec tmbundle
|
38
|
-
# -----------------------------------------------
|
39
|
-
|
40
|
-
USE_TEXTMATE_RSPEC_BUNDLE = true # set to false if not using textmate
|
41
|
-
|
42
|
-
if USE_TEXTMATE_RSPEC_BUNDLE
|
43
|
-
|
44
|
-
require Pathname(__FILE__).dirname.expand_path + 'lib/rspec_tmbundle_support'
|
45
|
-
|
46
|
-
# use the tmbundle logger
|
47
|
-
#RSpecTmBundleHelpers::TextmateRspecLogger.new(STDOUT, :off)
|
48
|
-
|
49
|
-
|
50
|
-
class Object
|
51
|
-
include RSpecTmBundleHelpers
|
52
|
-
end
|
53
|
-
|
54
|
-
end
|
55
|
-
|
56
|
-
ENV['ADAPTER'] ||= 'sqlite3'
|
57
|
-
setup_adapter(:default)
|
58
|
-
Dir[Pathname(__FILE__).dirname.to_s + "/fixtures/**/*.rb"].each { |rb| require(rb) }
|
59
|
-
|
5
|
+
DataMapper::Spec.setup
|
60
6
|
|
61
7
|
Spec::Runner.configure do |config|
|
62
8
|
|
@@ -64,4 +10,10 @@ Spec::Runner.configure do |config|
|
|
64
10
|
DataMapper.auto_migrate!
|
65
11
|
end
|
66
12
|
|
13
|
+
config.after(:suite) do
|
14
|
+
if DataMapper.respond_to?(:auto_migrate_down!, true)
|
15
|
+
DataMapper.send(:auto_migrate_down!, DataMapper::Spec.adapter.name)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
67
19
|
end
|
File without changes
|
data/tasks/ci.rake
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
task :ci => [ :verify_measurements, 'metrics:all' ]
|
File without changes
|
@@ -0,0 +1,18 @@
|
|
1
|
+
desc "Support bundling from local source code (allows BUNDLE_GEMFILE=Gemfile.local bundle foo)"
|
2
|
+
task :local_gemfile do |t|
|
3
|
+
|
4
|
+
root = Pathname(__FILE__).dirname.parent
|
5
|
+
datamapper = root.parent
|
6
|
+
|
7
|
+
source_regex = /DATAMAPPER = 'git:\/\/github.com\/datamapper'/
|
8
|
+
gem_source_regex = /:git => \"#\{DATAMAPPER\}\/(.+?)(?:\.git)?\"/
|
9
|
+
|
10
|
+
root.join('Gemfile.local').open('w') do |f|
|
11
|
+
root.join('Gemfile').open.each do |line|
|
12
|
+
line.sub!(source_regex, "DATAMAPPER = '#{datamapper}'")
|
13
|
+
line.sub!(gem_source_regex, ':path => "#{DATAMAPPER}/\1"')
|
14
|
+
f.puts line
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
data/tasks/metrics.rake
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
begin
|
2
|
+
require 'metric_fu'
|
3
|
+
rescue LoadError
|
4
|
+
namespace :metrics do
|
5
|
+
task :all do
|
6
|
+
abort 'metric_fu is not available. In order to run metrics:all, you must: gem install metric_fu'
|
7
|
+
end
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
begin
|
12
|
+
require 'reek/adapters/rake_task'
|
13
|
+
|
14
|
+
Reek::RakeTask.new do |t|
|
15
|
+
t.fail_on_error = true
|
16
|
+
t.verbose = false
|
17
|
+
t.source_files = 'lib/**/*.rb'
|
18
|
+
end
|
19
|
+
rescue LoadError
|
20
|
+
task :reek do
|
21
|
+
abort 'Reek is not available. In order to run reek, you must: gem install reek'
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
begin
|
26
|
+
require 'roodi'
|
27
|
+
require 'roodi_task'
|
28
|
+
|
29
|
+
RoodiTask.new do |t|
|
30
|
+
t.verbose = false
|
31
|
+
end
|
32
|
+
rescue LoadError
|
33
|
+
task :roodi do
|
34
|
+
abort 'Roodi is not available. In order to run roodi, you must: gem install roodi'
|
35
|
+
end
|
36
|
+
end
|
data/tasks/spec.rake
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'spec/rake/spectask'
|
2
|
+
require 'spec/rake/verify_rcov'
|
3
|
+
|
4
|
+
spec_defaults = lambda do |spec|
|
5
|
+
spec.pattern = 'spec/**/*_spec.rb'
|
6
|
+
spec.libs << 'lib' << 'spec'
|
7
|
+
spec.spec_opts << '--options' << 'spec/spec.opts'
|
8
|
+
end
|
9
|
+
|
10
|
+
Spec::Rake::SpecTask.new(:spec, &spec_defaults)
|
11
|
+
|
12
|
+
Spec::Rake::SpecTask.new(:rcov) do |rcov|
|
13
|
+
spec_defaults.call(rcov)
|
14
|
+
rcov.rcov = true
|
15
|
+
rcov.rcov_opts = File.read('spec/rcov.opts').split(/\s+/)
|
16
|
+
end
|
17
|
+
|
18
|
+
RCov::VerifyTask.new(:verify_rcov => :rcov) do |rcov|
|
19
|
+
rcov.threshold = 100
|
20
|
+
end
|
21
|
+
|
22
|
+
task :default => :spec
|
File without changes
|
data/tasks/yard.rake
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
begin
|
2
|
+
require 'pathname'
|
3
|
+
require 'yardstick/rake/measurement'
|
4
|
+
require 'yardstick/rake/verify'
|
5
|
+
|
6
|
+
# yardstick_measure task
|
7
|
+
Yardstick::Rake::Measurement.new
|
8
|
+
|
9
|
+
# verify_measurements task
|
10
|
+
Yardstick::Rake::Verify.new do |verify|
|
11
|
+
verify.threshold = 100
|
12
|
+
end
|
13
|
+
rescue LoadError
|
14
|
+
%w[ yardstick_measure verify_measurements ].each do |name|
|
15
|
+
task name.to_s do
|
16
|
+
abort "Yardstick is not available. In order to run #{name}, you must: gem install yardstick"
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dm-is-localizable
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
4
|
+
hash: 23
|
5
|
+
prerelease: false
|
6
|
+
segments:
|
7
|
+
- 1
|
8
|
+
- 0
|
9
|
+
- 0
|
10
|
+
version: 1.0.0
|
5
11
|
platform: ruby
|
6
12
|
authors:
|
7
13
|
- Martin Gamsjaeger (snusnu)
|
@@ -9,49 +15,87 @@ autorequire:
|
|
9
15
|
bindir: bin
|
10
16
|
cert_chain: []
|
11
17
|
|
12
|
-
date: 2010-
|
18
|
+
date: 2010-06-08 00:00:00 +02:00
|
13
19
|
default_executable:
|
14
20
|
dependencies:
|
15
21
|
- !ruby/object:Gem::Dependency
|
16
22
|
name: dm-core
|
17
|
-
|
18
|
-
|
19
|
-
|
23
|
+
prerelease: false
|
24
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
20
26
|
requirements:
|
21
|
-
- -
|
27
|
+
- - ~>
|
22
28
|
- !ruby/object:Gem::Version
|
23
|
-
|
24
|
-
|
29
|
+
hash: 23
|
30
|
+
segments:
|
31
|
+
- 1
|
32
|
+
- 0
|
33
|
+
- 0
|
34
|
+
version: 1.0.0
|
35
|
+
type: :runtime
|
36
|
+
version_requirements: *id001
|
25
37
|
- !ruby/object:Gem::Dependency
|
26
38
|
name: dm-is-remixable
|
27
|
-
|
28
|
-
|
29
|
-
|
39
|
+
prerelease: false
|
40
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
30
42
|
requirements:
|
31
|
-
- -
|
43
|
+
- - ~>
|
32
44
|
- !ruby/object:Gem::Version
|
33
|
-
|
34
|
-
|
45
|
+
hash: 23
|
46
|
+
segments:
|
47
|
+
- 1
|
48
|
+
- 0
|
49
|
+
- 0
|
50
|
+
version: 1.0.0
|
51
|
+
type: :runtime
|
52
|
+
version_requirements: *id002
|
35
53
|
- !ruby/object:Gem::Dependency
|
36
54
|
name: dm-validations
|
37
|
-
|
38
|
-
|
39
|
-
|
55
|
+
prerelease: false
|
56
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
40
58
|
requirements:
|
41
|
-
- -
|
59
|
+
- - ~>
|
42
60
|
- !ruby/object:Gem::Version
|
43
|
-
|
44
|
-
|
61
|
+
hash: 23
|
62
|
+
segments:
|
63
|
+
- 1
|
64
|
+
- 0
|
65
|
+
- 0
|
66
|
+
version: 1.0.0
|
67
|
+
type: :runtime
|
68
|
+
version_requirements: *id003
|
45
69
|
- !ruby/object:Gem::Dependency
|
46
70
|
name: rspec
|
47
|
-
|
48
|
-
|
49
|
-
|
71
|
+
prerelease: false
|
72
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
50
74
|
requirements:
|
51
75
|
- - ~>
|
52
76
|
- !ruby/object:Gem::Version
|
77
|
+
hash: 9
|
78
|
+
segments:
|
79
|
+
- 1
|
80
|
+
- 3
|
53
81
|
version: "1.3"
|
54
|
-
|
82
|
+
type: :development
|
83
|
+
version_requirements: *id004
|
84
|
+
- !ruby/object:Gem::Dependency
|
85
|
+
name: yard
|
86
|
+
prerelease: false
|
87
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
88
|
+
none: false
|
89
|
+
requirements:
|
90
|
+
- - ~>
|
91
|
+
- !ruby/object:Gem::Version
|
92
|
+
hash: 1
|
93
|
+
segments:
|
94
|
+
- 0
|
95
|
+
- 5
|
96
|
+
version: "0.5"
|
97
|
+
type: :development
|
98
|
+
version_requirements: *id005
|
55
99
|
description:
|
56
100
|
email: gamsnjaga@gmail.com
|
57
101
|
executables: []
|
@@ -66,6 +110,7 @@ files:
|
|
66
110
|
- .document
|
67
111
|
- .gitignore
|
68
112
|
- CHANGELOG
|
113
|
+
- Gemfile
|
69
114
|
- LICENSE
|
70
115
|
- README.textile
|
71
116
|
- Rakefile
|
@@ -78,6 +123,7 @@ files:
|
|
78
123
|
- lib/dm-is-localizable/storage/translation.rb
|
79
124
|
- spec/fixtures/item.rb
|
80
125
|
- spec/lib/rspec_tmbundle_support.rb
|
126
|
+
- spec/rcov.opts
|
81
127
|
- spec/shared/shared_examples_spec.rb
|
82
128
|
- spec/spec.opts
|
83
129
|
- spec/spec_helper.rb
|
@@ -87,9 +133,15 @@ files:
|
|
87
133
|
- spec/unit/is_localizable_spec.rb
|
88
134
|
- spec/unit/language_spec.rb
|
89
135
|
- spec/unit/translation_spec.rb
|
90
|
-
- tasks/changelog.
|
91
|
-
- tasks/
|
92
|
-
- tasks/
|
136
|
+
- tasks/changelog.rake
|
137
|
+
- tasks/ci.rake
|
138
|
+
- tasks/install.rake
|
139
|
+
- tasks/local_gemfile.rake
|
140
|
+
- tasks/metrics.rake
|
141
|
+
- tasks/spec.rake
|
142
|
+
- tasks/whitespace.rake
|
143
|
+
- tasks/yard.rake
|
144
|
+
- tasks/yardstick.rake
|
93
145
|
has_rdoc: true
|
94
146
|
homepage: http://github.com/snusnu/dm-is-localizable
|
95
147
|
licenses: []
|
@@ -100,21 +152,27 @@ rdoc_options:
|
|
100
152
|
require_paths:
|
101
153
|
- lib
|
102
154
|
required_ruby_version: !ruby/object:Gem::Requirement
|
155
|
+
none: false
|
103
156
|
requirements:
|
104
157
|
- - ">="
|
105
158
|
- !ruby/object:Gem::Version
|
159
|
+
hash: 3
|
160
|
+
segments:
|
161
|
+
- 0
|
106
162
|
version: "0"
|
107
|
-
version:
|
108
163
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
164
|
+
none: false
|
109
165
|
requirements:
|
110
166
|
- - ">="
|
111
167
|
- !ruby/object:Gem::Version
|
168
|
+
hash: 3
|
169
|
+
segments:
|
170
|
+
- 0
|
112
171
|
version: "0"
|
113
|
-
version:
|
114
172
|
requirements: []
|
115
173
|
|
116
174
|
rubyforge_project:
|
117
|
-
rubygems_version: 1.3.
|
175
|
+
rubygems_version: 1.3.7
|
118
176
|
signing_key:
|
119
177
|
specification_version: 3
|
120
178
|
summary: Datamapper support for localization of content in multilanguage applications
|