modernizer 0.0.1

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
+ MDlmNWRiNjc1OGY4N2JiYzEwMWYxOTMwZjRlYThlODA1YWQ3YWQ4Ng==
5
+ data.tar.gz: !binary |-
6
+ NDM4MGNlOTU0ZGQ1MGJkYTMxMDBjYjI3NzQ0NjhiNjZmNzQ5ODg3Mw==
7
+ !binary "U0hBNTEy":
8
+ metadata.gz: !binary |-
9
+ NTk0MmU2MDMzMTFjZDc3NmFhMjA2YTc5OWRhNjZkZTQ3OGEyMzc3YWIxYjE3
10
+ Nzg4NDViMmUwYzMwZWZmYThmYTc5NDljOTAzODI3NTlhYTM3YTZiN2U1Y2Q0
11
+ NGJlZmUxOWI5ZjM3MjVmZDk1M2NkYzJiMWU5MmZiMWNkYzM0NWI=
12
+ data.tar.gz: !binary |-
13
+ MWMwMDc3MTI5YmIzNDc0NzE4MzA3MmIxNTcyZjIwMmFmNTYxMjUxZmFkNjY3
14
+ OWUzYzlmYTlmNjkzOTU5N2YyOWYzNDc4MzM4YTM3MWQ0MGUwZDg2MDE0ZDA1
15
+ OWFhM2ZiZjJkNDU3YjQzZDhmNTk4NmQwZmIxOTMyN2E4ODZmNTQ=
data/.gitignore ADDED
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in modernizer.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 Tucker Joseph
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,48 @@
1
+ # Modernizer
2
+
3
+ TODO: Write a gem description
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'modernizer'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install modernizer
18
+
19
+ ## Usage
20
+ ```ruby
21
+ Modernizer.new do
22
+ request_version { @env[...] }
23
+
24
+ first do
25
+ add('hello') { 'hardcoded' }
26
+ end
27
+
28
+ modernize '1.2.1' do
29
+ add('foo') { "#{@body['hello']}-bar" }
30
+ end
31
+
32
+ modernize '1.2.3' do
33
+ remove 'hello'
34
+ compute('foo') {|x| "baz-#{x}" }
35
+ end
36
+
37
+ last do
38
+ remove 'foo'
39
+ end
40
+ end
41
+ ```
42
+ ## Contributing
43
+
44
+ 1. Fork it
45
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
46
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
47
+ 4. Push to the branch (`git push origin my-new-feature`)
48
+ 5. Create new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ require 'bundler/gem_tasks'
2
+ require 'rake/testtask'
3
+
4
+ require File.expand_path('../spec/spec_tasks.rb', __FILE__)
5
+
6
+ task :default => [:test]
@@ -0,0 +1,35 @@
1
+ module Modernize
2
+ module MapMethods
3
+ class << self
4
+ # Adds a field based on the result of the block
5
+ # if the field doesn't already exist.
6
+ #
7
+ def add(struct, field, block)
8
+ h = struct.hash
9
+ h[field] = struct.instance_exec(&block) if h[field].nil?
10
+ end
11
+
12
+ # Removes a field.
13
+ #
14
+ def remove(struct, field, block)
15
+ struct.hash.delete(field)
16
+ end
17
+
18
+ # Maps an existing field passing the current value
19
+ # as a parameter to the block.
20
+ #
21
+ def map(struct, field, block)
22
+ h = struct.hash
23
+ h[field] = struct.instance_exec(h[field], &block) unless h[field].nil?
24
+ end
25
+
26
+ # Adds or updates a field passing the current value (if any)
27
+ # as a parameter to the block.
28
+ #
29
+ def compute(struct, field, block)
30
+ h = struct.hash
31
+ h[field] = struct.instance_exec(h[field], &block)
32
+ end
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,53 @@
1
+ module Modernize
2
+ module MetaMethods
3
+ class << self
4
+
5
+ # Defines a set of translations to run in order to modernizer
6
+ # a given version.
7
+ #
8
+ def modernize(parser, args, &block)
9
+ raise ArgumentError.new("wrong number of arguments (#{args.size} for 1)") if args.size != 1
10
+ raise StandardError.new('version is not valid') unless Gem::Version.correct?(args[0])
11
+ parser.translations[args[0]] = VersionParser.parse(&block)
12
+ end
13
+
14
+ # Stores the block for determining the version.
15
+ #
16
+ def version(parser, args, &block)
17
+ raise ArgumentError.new("wrong number of arguments (#{args.size} for 0)") if args.size != 0
18
+ parser.has_version = true
19
+ parser.initial_version = block
20
+ end
21
+
22
+ # Method for setting the translations which get run before any others,
23
+ #
24
+ def first(parser, args, &block)
25
+ raise ArgumentError.new("wrong number of arguments (#{args.size} for 0)") if args.size != 0
26
+ parser.translations[:first] = VersionParser.parse(&block)
27
+ end
28
+
29
+ # Method for setting the translations which get run after any others.
30
+ #
31
+ def last(parser, args, &block)
32
+ raise ArgumentError.new("wrong number of arguments (#{args.size} for 0)") if args.size != 0
33
+ parser.translations[:last] = VersionParser.parse(&block)
34
+ end
35
+
36
+ # Sets the order of translations to be ascending i.e.
37
+ # first do version 0.0.1 then version 0.0.2 etc.
38
+ #
39
+ def ascending(parser, args, &block)
40
+ raise ArgumentError.new("wrong number of arguments (#{args.size} for 0)") if args.size != 0
41
+ parser.order = :ascending
42
+ end
43
+
44
+ # Sets the order of translations to be descending i.e.
45
+ # first do version 0.0.9 then version 0.0.8 etc.
46
+ #
47
+ def descending(parser, args, &block)
48
+ raise ArgumentError.new("wrong number of arguments (#{args.size} for 0)") if args.size != 0
49
+ parser.order = :descending
50
+ end
51
+ end
52
+ end
53
+ end
@@ -0,0 +1,45 @@
1
+ module Modernize
2
+ class Parser
3
+ # Executes a block to figure out the sets of translations and version.
4
+ #
5
+ def self.parse(&block)
6
+ context = BlockParsingContext.new
7
+ context.instance_exec(&block)
8
+ context.migrations
9
+ end
10
+ end
11
+
12
+ # Struct for storing the translations and block for determining version
13
+ #
14
+ class CompiledMigrations < Struct.new(:translations, :version, :order); end
15
+
16
+ class VersionError < StandardError; end
17
+
18
+ # Class for the context in which the block will get run
19
+ #
20
+ class BlockParsingContext
21
+ attr_accessor :translations, :initial_version, :has_version, :order
22
+
23
+ def initialize
24
+ @translations = {}
25
+ @initial_version = nil
26
+ @has_version = false
27
+ @order = :ascending
28
+ end
29
+
30
+ # Determines what versions there are and before + after if any.
31
+ #
32
+ def method_missing(method, *args, &block)
33
+ raise NoMethodError.new("Undefined translation method #{method}") unless MetaMethods.respond_to?(method)
34
+ MetaMethods.send(method, self, args, &block)
35
+ end
36
+
37
+ # Returns the struct of version block and translation sets
38
+ # throws an error if no block is provided for determining version.
39
+ #
40
+ def migrations
41
+ raise VersionError.new('did not provide a way to determine version') unless @has_version
42
+ CompiledMigrations.new(@translations, @initial_version, @order)
43
+ end
44
+ end
45
+ end
@@ -0,0 +1,3 @@
1
+ module Modernizer
2
+ VERSION = '0.0.1'
3
+ end
@@ -0,0 +1,33 @@
1
+ module Modernize
2
+ class VersionParser
3
+ # Takes a block for a given version and generates the translations.
4
+ #
5
+ def self.parse(&block)
6
+ context = VersionParsingContext.new
7
+ context.instance_exec(&block)
8
+ context.migration
9
+ end
10
+ end
11
+
12
+ # Class for the context to executed the block in.
13
+ #
14
+ class VersionParsingContext
15
+ def initialize
16
+ @maps = []
17
+ end
18
+
19
+ # Figures out which translations are done for each version.
20
+ #
21
+ def method_missing(method, *args, &block)
22
+ raise ArgumentError.new("wrong number of arguments (#{args.size} for 1)") if args.size != 1
23
+ raise NoMethodError.new("Undefined translation method #{method}") unless MapMethods.respond_to?(method)
24
+ @maps << {name: method, field: args[0], block: block}
25
+ end
26
+
27
+ # Returns all the translations for a verion.
28
+ #
29
+ def migration
30
+ @maps
31
+ end
32
+ end
33
+ end
data/lib/modernizer.rb ADDED
@@ -0,0 +1,111 @@
1
+ require 'modernizer/version'
2
+ require 'modernizer/map_methods'
3
+ require 'modernizer/meta_methods'
4
+ require 'modernizer/version_parser'
5
+ require 'modernizer/parser'
6
+
7
+ module Modernize
8
+ class Modernizer
9
+
10
+ # Generates the set of migrations by parsing the passed in block
11
+ #
12
+ def initialize(&block)
13
+ @migrations = Parser.parse(&block)
14
+ end
15
+
16
+ # Translates a hash based on defined migrations
17
+ # with a given context and returns the hash.
18
+ # This will modify whatever gets passed in.
19
+ #
20
+ def translate(context, hash)
21
+ # makes sure that the context is a hash
22
+ raise ArgumentError.new('did not pass a hash for the context') unless context.is_a?(Hash)
23
+ raise ArgumentError.new('cannot provide include hash in context') if context[:hash]
24
+ # create the context instance for instance variables
25
+ struct = StructContext.new(context, hash)
26
+
27
+ # instantiate MapMethods to perform translations and define lambda
28
+ # for how to tranlate a field
29
+ #
30
+
31
+ translate = lambda { |t|
32
+ MapMethods.send(t[:name], struct, t[:field], t[:block])
33
+ }
34
+
35
+ # determine the version of the incoming hash
36
+ #
37
+ struct_version = struct.instance_exec(&@migrations.version)
38
+
39
+ raise StandardError.new('calculated version is not valid') unless Gem::Version.correct?(struct_version)
40
+
41
+ # get the first and last translations
42
+ #
43
+ firsts = @migrations.translations.delete(:first)
44
+ lasts = @migrations.translations.delete(:last)
45
+
46
+ # gets a list of the potential versions and then sorts them
47
+ #
48
+ migration_versions = @migrations.translations.keys.sort! do |x,y|
49
+ Gem::Version.new(x) <=> Gem::Version.new(y)
50
+ end
51
+
52
+ # reverse order if descending was specified
53
+ #
54
+ migration_versions = @migrations.order == :descending ? migration_versions.reverse : migration_versions
55
+ # run the first translations if they exist
56
+ #
57
+ firsts.each(&translate) if firsts
58
+
59
+ # determine the first version to run translations
60
+ #
61
+ first_index = @migrations.order == :ascending ? migration_versions.find_index(struct_version) : nil
62
+ last_index = @migrations.order == :descending ? migration_versions.find_index(struct_version) : nil
63
+
64
+ # run all subsequent version translations
65
+ #
66
+ migration_versions.each_with_index do |version, index|
67
+ next unless !first_index || index >= first_index
68
+ next unless !last_index || index <= last_index
69
+ @migrations.translations[version].each(&translate)
70
+ end
71
+
72
+ # run the first translations if they exist
73
+ #
74
+ lasts.each(&translate) if lasts
75
+
76
+ # return hash
77
+ #
78
+ struct.hash
79
+ end
80
+ end
81
+
82
+ private
83
+
84
+ # This class is used to make the context key/values available
85
+ # as instance variables to the map methods.
86
+ #
87
+ class StructContext
88
+ def initialize(context, hash)
89
+ create_getter(:hash, hash)
90
+ context.each do |key, value|
91
+ create_getter(key, value)
92
+ end
93
+ end
94
+
95
+ # Helper method which wraps define_method.
96
+ #
97
+ def create_method(name, &block)
98
+ self.class.send(:define_method, name, &block)
99
+ end
100
+
101
+ # Creates getters for each instance variable and sets
102
+ # the initial value.
103
+ #
104
+ def create_getter(name, value)
105
+ instance_variable_set(:"@#{name}", value)
106
+ create_method(name.to_sym) do
107
+ instance_variable_get(:"@#{name}")
108
+ end
109
+ end
110
+ end
111
+ end
@@ -0,0 +1,25 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'modernizer/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = 'modernizer'
8
+ spec.version = Modernizer::VERSION
9
+ spec.authors = ['Tucker Joseph']
10
+ spec.email = ['rtjoseph11@gmail.com']
11
+ spec.description = %q{convert hashes based on translations associated with versions}
12
+ spec.summary = %q{see description}
13
+ spec.homepage = ''
14
+ spec.license = 'MIT'
15
+
16
+ spec.files = `git ls-files`.split($/)
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ['lib']
20
+
21
+ spec.add_development_dependency 'bundler', '~> 1.3'
22
+ spec.add_development_dependency 'rake'
23
+ spec.add_development_dependency 'mocha'
24
+ spec.add_development_dependency 'minitest', '~> 4.7'
25
+ end
@@ -0,0 +1,257 @@
1
+ require File.expand_path('../../lib/modernizer.rb', __FILE__)
2
+ require 'minitest/autorun'
3
+ require 'mocha/setup'
4
+
5
+ describe 'Modernize' do
6
+ describe 'add a field' do
7
+ before do
8
+ @m = Modernize::Modernizer.new do
9
+ version { @env['version'] }
10
+
11
+ modernize '0.0.1' do
12
+ add('foo'){ 'bar' }
13
+ end
14
+ end
15
+ end
16
+
17
+ it 'should add foo to the body' do
18
+ result = @m.translate({:env => {'version' => '0.0.1'}}, {})
19
+ expected = {'foo' => 'bar'}
20
+ assert_equal expected, result
21
+ end
22
+ end
23
+
24
+ describe 'remove a field' do
25
+ before do
26
+ @m = Modernize::Modernizer.new do
27
+ version { @env['version'] }
28
+
29
+ modernize '0.0.1' do
30
+ remove 'foo'
31
+ end
32
+ end
33
+ end
34
+
35
+ it 'should remove foo from the body' do
36
+ result = @m.translate({:env => {'version' => '0.0.1'}}, {'foo' => 'bar', 'fizz' => 'buzz'})
37
+ expected = {'fizz' => 'buzz'}
38
+ assert_equal expected, result
39
+ end
40
+ end
41
+
42
+ describe 'compute a field' do
43
+ before do
44
+ @m = Modernize::Modernizer.new do
45
+ version { @env['version'] }
46
+
47
+ modernize '0.0.1' do
48
+ compute('retina') do |value|
49
+ if @hash['device-type'] == 'android'
50
+ false
51
+ else
52
+ case value
53
+ when 1 then true
54
+ when 0 then false
55
+ else false
56
+ end
57
+ end
58
+ end
59
+ end
60
+ end
61
+ end
62
+
63
+ it 'should set retina to false for android' do
64
+ result = @m.translate({:env => {'version' => '0.0.1'}}, {'foo' => 'bar', 'device-type' => 'android'})
65
+ expected = {'foo' => 'bar', 'device-type' => 'android', 'retina' => false}
66
+ assert_equal expected, result
67
+ end
68
+
69
+ it 'should convert numbers to booleans' do
70
+ result = @m.translate({:env => {'version' => '0.0.1'}}, {'foo' => 'bar', 'device-type' => 'iOS', 'retina' => 1})
71
+ expected = {'foo' => 'bar', 'device-type' => 'iOS', 'retina' => true}
72
+ assert_equal expected, result
73
+ end
74
+ end
75
+
76
+ describe 'first methods' do
77
+ before do
78
+ @m = Modernize::Modernizer.new do
79
+ version { @env['version'] }
80
+
81
+ first do
82
+ add('foo'){'bar'}
83
+
84
+ compute('fizz'){|value| "thing-#{value}"}
85
+ end
86
+
87
+ modernize '0.0.1' do
88
+ remove 'foo'
89
+ end
90
+ end
91
+ end
92
+
93
+ it 'should remove foo from the body' do
94
+ result = @m.translate({:env => {'version' => '0.0.1'}}, {'baz' => 'thing', 'fizz' => 'buzz'})
95
+ expected = {'baz' => 'thing', 'fizz' => 'thing-buzz'}
96
+ assert_equal expected, result
97
+ end
98
+ end
99
+
100
+ describe 'last methods' do
101
+ before do
102
+ @m = Modernize::Modernizer.new do
103
+ version { @env['version'] }
104
+
105
+ modernize '0.0.1' do
106
+ remove 'foo'
107
+ end
108
+
109
+ last do
110
+ add('foo'){'bar'}
111
+
112
+ compute('fizz'){|value| "thing-#{value}"}
113
+ end
114
+ end
115
+ end
116
+
117
+ it 'should remove foo from the body' do
118
+ result = @m.translate({:env => {'version' => '0.0.1'}}, {'foo' => 'thing', 'fizz' => 'buzz'})
119
+ expected = {'foo' => 'bar', 'fizz' => 'thing-buzz'}
120
+ assert_equal expected, result
121
+ end
122
+ end
123
+
124
+ describe 'version sorting' do
125
+ before do
126
+ @m = Modernize::Modernizer.new do
127
+ modernize '0.0.2' do
128
+ add('foo'){'bar'}
129
+
130
+ compute('fizz'){|value| "thing-#{value}"}
131
+ end
132
+
133
+ modernize '0.0.1' do
134
+ remove 'foo'
135
+ end
136
+
137
+ version { @env['version'] }
138
+ end
139
+ end
140
+
141
+ it 'should remove foo from the body' do
142
+ result = @m.translate({:env => {'version' => '0.0.1'}}, {'foo' => 'thing', 'fizz' => 'buzz'})
143
+ expected = {'foo' => 'bar', 'fizz' => 'thing-buzz'}
144
+ assert_equal expected, result
145
+ end
146
+ end
147
+
148
+ describe 'add/map do not overwrite/add keys/values' do
149
+ before do
150
+ @m = Modernize::Modernizer.new do
151
+ modernize '0.0.1' do
152
+ add('foo'){'bar'}
153
+
154
+ map('fizz'){|value| "thing-#{value}"}
155
+ end
156
+
157
+ version { @env['version'] }
158
+ end
159
+ end
160
+
161
+ it 'should not have fizz and not overwrite foo' do
162
+ result = @m.translate({:env => {'version' => '0.0.1'}}, {'foo' => 'thing'})
163
+ expected = {'foo' => 'thing'}
164
+ assert_equal expected, result
165
+ end
166
+ end
167
+
168
+ describe 'context variables are available' do
169
+ before do
170
+ @m = Modernize::Modernizer.new do
171
+ modernize '0.0.1' do
172
+ add('foo'){'bar'}
173
+ add('version'){@thing['version']}
174
+ map('fizz'){|value| "thing-#{value}-#{@hash['foo']}-#{@name['mark']}"}
175
+ end
176
+
177
+ version { @thing['version'] }
178
+ end
179
+ end
180
+
181
+ it 'should yield values as expected' do
182
+ result = @m.translate({:thing => {'version' => '0.0.1'}, :name => {'mark' => 'kinsella'}}, {'some' => 'thing', 'fizz' => 'buzz'})
183
+ expected = {'some' => 'thing', 'foo' => 'bar', 'version' => '0.0.1', 'fizz' => 'thing-buzz-bar-kinsella'}
184
+ assert_equal expected, result
185
+ end
186
+ end
187
+
188
+ describe 'throws an error if hash is provided in context' do
189
+ before do
190
+ @m = Modernize::Modernizer.new do
191
+ version { @env['version'] }
192
+
193
+ modernize '0.0.1' do
194
+ add('foo'){ 'bar' }
195
+ end
196
+ end
197
+ end
198
+
199
+ it 'should throw an argument error' do
200
+ assert_raises(ArgumentError) { @m.translate({:env => {'version' => '0.0.1'}, :hash => {'doesnt' => 'work'}}, {}) }
201
+ end
202
+ end
203
+
204
+ describe 'throws an error if calculated version is not valid' do
205
+ before do
206
+ @m = Modernize::Modernizer.new do
207
+ version { @env['version'] }
208
+
209
+ modernize '0.0.1' do
210
+ add('foo'){ 'bar' }
211
+ end
212
+ end
213
+ end
214
+
215
+ it 'should throw an standard error' do
216
+ assert_raises(StandardError) { @m.translate({:env => {'version' => 'XXX'}}, {}) }
217
+ end
218
+ end
219
+
220
+ describe 'throws an error if modernizer version is not valid' do
221
+ it 'should throw an standard error' do
222
+ assert_raises(StandardError) do
223
+ Modernize::Modernizer.new do
224
+ version { @env['version'] }
225
+
226
+ modernize 'XXX' do
227
+ add('foo'){ 'bar' }
228
+ end
229
+ end
230
+ end
231
+ end
232
+ end
233
+
234
+ describe 'will modernize in descending order' do
235
+ before do
236
+ @m = Modernize::Modernizer.new do
237
+ descending
238
+ modernize '0.0.3' do
239
+ remove 'foo'
240
+ compute('fizz'){|value| "thing-#{value}"}
241
+ end
242
+
243
+ modernize '0.0.2' do
244
+ add('foo'){'bar'}
245
+ end
246
+
247
+ version { @env['version'] }
248
+ end
249
+ end
250
+
251
+ it 'should remove foo from the body' do
252
+ result = @m.translate({:env => {'version' => '0.0.1'}}, {'foo' => 'thing', 'fizz' => 'buzz'})
253
+ expected = {'foo' => 'bar', 'fizz' => 'thing-buzz'}
254
+ assert_equal expected, result
255
+ end
256
+ end
257
+ end
@@ -0,0 +1,9 @@
1
+ require 'rake/testtask'
2
+
3
+ Rake::TestTask.new('test:modernizer') do |test|
4
+ test.pattern = 'spec/modernizer_spec.rb'
5
+ test.verbose = true
6
+ end
7
+
8
+ desc 'Run application test suite'
9
+ task 'test' => "test:modernizer"
metadata ADDED
@@ -0,0 +1,117 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: modernizer
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Tucker Joseph
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2013-09-04 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: '1.3'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: '1.3'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ! '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ! '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: mocha
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ! '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ! '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: minitest
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ~>
60
+ - !ruby/object:Gem::Version
61
+ version: '4.7'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ~>
67
+ - !ruby/object:Gem::Version
68
+ version: '4.7'
69
+ description: convert hashes based on translations associated with versions
70
+ email:
71
+ - rtjoseph11@gmail.com
72
+ executables: []
73
+ extensions: []
74
+ extra_rdoc_files: []
75
+ files:
76
+ - .gitignore
77
+ - Gemfile
78
+ - LICENSE.txt
79
+ - README.md
80
+ - Rakefile
81
+ - lib/modernizer.rb
82
+ - lib/modernizer/map_methods.rb
83
+ - lib/modernizer/meta_methods.rb
84
+ - lib/modernizer/parser.rb
85
+ - lib/modernizer/version.rb
86
+ - lib/modernizer/version_parser.rb
87
+ - modernizer.gemspec
88
+ - spec/modernizer_spec.rb
89
+ - spec/spec_tasks.rb
90
+ homepage: ''
91
+ licenses:
92
+ - MIT
93
+ metadata: {}
94
+ post_install_message:
95
+ rdoc_options: []
96
+ require_paths:
97
+ - lib
98
+ required_ruby_version: !ruby/object:Gem::Requirement
99
+ requirements:
100
+ - - ! '>='
101
+ - !ruby/object:Gem::Version
102
+ version: '0'
103
+ required_rubygems_version: !ruby/object:Gem::Requirement
104
+ requirements:
105
+ - - ! '>='
106
+ - !ruby/object:Gem::Version
107
+ version: '0'
108
+ requirements: []
109
+ rubyforge_project:
110
+ rubygems_version: 2.0.6
111
+ signing_key:
112
+ specification_version: 4
113
+ summary: see description
114
+ test_files:
115
+ - spec/modernizer_spec.rb
116
+ - spec/spec_tasks.rb
117
+ has_rdoc: