ruby_storm 0.0.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
+ NTRkYTYzOGJkNjc1NmI5NjEwNzZjMjU5M2YwYzQwOTZjZDMyOTI1Zg==
5
+ data.tar.gz: !binary |-
6
+ MmE5YjkwMzkzYmMzMmZiYWFjNTZkNmRlMmM5NDM0OGY2NjU1ODIwZg==
7
+ SHA512:
8
+ metadata.gz: !binary |-
9
+ ODEzZjZjZDJhZmM4MzgxYTQ3Y2E4NDhhZjNlZTUyYmQ2ODY1ODE3Y2IwOTQ0
10
+ ZWQ0ZWJiNGM4ZjhhZDc4NzBjNjZlNTI3NmMzYzExMmQ5ZDJmMGM2MGNmODk0
11
+ YjQxNzBlNTI1Y2RiZjVhYTc1N2JhNjAwOWFjMjQ2MWNkMzEwNDY=
12
+ data.tar.gz: !binary |-
13
+ OTA3YWZlZDZiZWJmOWM3Yjg4N2RmYTM4NTIwOTVjNzE1MTAxOWI1N2IwOTFl
14
+ MDc1OTEzNDk1ZjJjODYwYmNhZDQ3ZGYyZTZmN2QzNzA0ZDhjYTFkMThkMzhj
15
+ NGVkYWNiNjMzN2NlNWQyODkwNGNjNDk4NDM5ZWY4MDcxY2JlNDI=
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 1.9.3-p448
data/Gemfile ADDED
@@ -0,0 +1,7 @@
1
+ source 'https://rubygems.org'
2
+ gem 'pry'
3
+ gem 'jazz_hands'
4
+ gem 'awesome_print'
5
+ gem 'activerecord'
6
+ gem 'sqlite3'
7
+ gem 'thread_safe'
data/Gemfile.lock ADDED
@@ -0,0 +1,117 @@
1
+ GEM
2
+ remote: https://rubygems.org/
3
+ specs:
4
+ actionpack (4.1.7)
5
+ actionview (= 4.1.7)
6
+ activesupport (= 4.1.7)
7
+ rack (~> 1.5.2)
8
+ rack-test (~> 0.6.2)
9
+ actionview (4.1.7)
10
+ activesupport (= 4.1.7)
11
+ builder (~> 3.1)
12
+ erubis (~> 2.7.0)
13
+ activemodel (4.1.7)
14
+ activesupport (= 4.1.7)
15
+ builder (~> 3.1)
16
+ activerecord (4.1.7)
17
+ activemodel (= 4.1.7)
18
+ activesupport (= 4.1.7)
19
+ arel (~> 5.0.0)
20
+ activesupport (4.1.7)
21
+ i18n (~> 0.6, >= 0.6.9)
22
+ json (~> 1.7, >= 1.7.7)
23
+ minitest (~> 5.1)
24
+ thread_safe (~> 0.1)
25
+ tzinfo (~> 1.1)
26
+ arel (5.0.1.20140414130214)
27
+ awesome_print (1.2.0)
28
+ binding_of_caller (0.7.2)
29
+ debug_inspector (>= 0.0.1)
30
+ builder (3.2.2)
31
+ coderay (1.1.0)
32
+ columnize (0.8.9)
33
+ coolline (0.5.0)
34
+ unicode_utils (~> 1.4)
35
+ debug_inspector (0.0.2)
36
+ debugger (1.6.8)
37
+ columnize (>= 0.3.1)
38
+ debugger-linecache (~> 1.2.0)
39
+ debugger-ruby_core_source (~> 1.3.5)
40
+ debugger-linecache (1.2.0)
41
+ debugger-ruby_core_source (1.3.5)
42
+ diff-lcs (1.2.5)
43
+ diffy (3.0.7)
44
+ erubis (2.7.0)
45
+ grit (2.5.0)
46
+ diff-lcs (~> 1.1)
47
+ mime-types (~> 1.15)
48
+ posix-spawn (~> 0.3.6)
49
+ hirb (0.7.2)
50
+ i18n (0.6.11)
51
+ jazz_hands (0.5.2)
52
+ awesome_print (~> 1.2)
53
+ coolline (>= 0.4.2)
54
+ hirb (~> 0.7.1)
55
+ pry (~> 0.9.12)
56
+ pry-debugger (~> 0.2.2)
57
+ pry-doc (~> 0.4.6)
58
+ pry-git (~> 0.2.3)
59
+ pry-rails (~> 0.3.2)
60
+ pry-remote (>= 0.1.7)
61
+ pry-stack_explorer (~> 0.4.9)
62
+ railties (>= 3.0, < 5.0)
63
+ json (1.8.1)
64
+ method_source (0.8.2)
65
+ mime-types (1.25.1)
66
+ minitest (5.4.2)
67
+ posix-spawn (0.3.9)
68
+ pry (0.9.12.6)
69
+ coderay (~> 1.0)
70
+ method_source (~> 0.8)
71
+ slop (~> 3.4)
72
+ pry-debugger (0.2.3)
73
+ debugger (~> 1.3)
74
+ pry (>= 0.9.10, < 0.11.0)
75
+ pry-doc (0.4.6)
76
+ pry (>= 0.9)
77
+ yard (>= 0.8)
78
+ pry-git (0.2.3)
79
+ diffy
80
+ grit
81
+ pry (>= 0.9.8)
82
+ pry-rails (0.3.2)
83
+ pry (>= 0.9.10)
84
+ pry-remote (0.1.8)
85
+ pry (~> 0.9)
86
+ slop (~> 3.0)
87
+ pry-stack_explorer (0.4.9.1)
88
+ binding_of_caller (>= 0.7)
89
+ pry (>= 0.9.11)
90
+ rack (1.5.2)
91
+ rack-test (0.6.2)
92
+ rack (>= 1.0)
93
+ railties (4.1.7)
94
+ actionpack (= 4.1.7)
95
+ activesupport (= 4.1.7)
96
+ rake (>= 0.8.7)
97
+ thor (>= 0.18.1, < 2.0)
98
+ rake (10.3.2)
99
+ slop (3.6.0)
100
+ sqlite3 (1.3.10)
101
+ thor (0.19.1)
102
+ thread_safe (0.3.4)
103
+ tzinfo (1.2.2)
104
+ thread_safe (~> 0.1)
105
+ unicode_utils (1.4.0)
106
+ yard (0.8.7.6)
107
+
108
+ PLATFORMS
109
+ ruby
110
+
111
+ DEPENDENCIES
112
+ activerecord
113
+ awesome_print
114
+ jazz_hands
115
+ pry
116
+ sqlite3
117
+ thread_safe
@@ -0,0 +1,12 @@
1
+ # encoding: utf-8
2
+ require 'fileutils'
3
+
4
+ module Storm
5
+ STORM_DIR = "#{File.dirname(__FILE__)}/../"
6
+ STORM_ENV = ENV['DATABASE_ENV'] || 'development'
7
+ VERSION = ENV['VERSION'] || nil
8
+ DATABASE_DIR = ENV['DATABASE_DIR'] || './db'
9
+ MIGRATIONS_DIR = "#{DATABASE_DIR}/migrate"
10
+ APP_DIR = File.expand_path("./")
11
+ APP_NAME = ENV['APP_NAME'] || Inflector::classify(File.basename(FileUtils.pwd))
12
+ end
@@ -0,0 +1,609 @@
1
+ ##
2
+ # This Inflector code is an extract from Rails :: ActiveSupport
3
+ # https://github.com/rails/rails/tree/master/activesupport
4
+ #
5
+ ##
6
+ module Inflector
7
+
8
+ def self.inflections(locale = :en)
9
+ if block_given?
10
+ yield Inflections.instance(locale)
11
+ else
12
+ Inflections.instance(locale)
13
+ end
14
+ end
15
+ # Returns the plural form of the word in the string.
16
+ #
17
+ # If passed an optional +locale+ parameter, the word will be
18
+ # pluralized using rules defined for that language. By default,
19
+ # this parameter is set to <tt>:en</tt>.
20
+ #
21
+ # 'post'.pluralize # => "posts"
22
+ # 'octopus'.pluralize # => "octopi"
23
+ # 'sheep'.pluralize # => "sheep"
24
+ # 'words'.pluralize # => "words"
25
+ # 'CamelOctopus'.pluralize # => "CamelOctopi"
26
+ # 'ley'.pluralize(:es) # => "leyes"
27
+ def self.pluralize(word, locale = :en)
28
+ apply_inflections(word, inflections(locale).plurals)
29
+ end
30
+
31
+ # The reverse of +pluralize+, returns the singular form of a word in a
32
+ # string.
33
+ #
34
+ # If passed an optional +locale+ parameter, the word will be
35
+ # singularized using rules defined for that language. By default,
36
+ # this parameter is set to <tt>:en</tt>.
37
+ #
38
+ # 'posts'.singularize # => "post"
39
+ # 'octopi'.singularize # => "octopus"
40
+ # 'sheep'.singularize # => "sheep"
41
+ # 'word'.singularize # => "word"
42
+ # 'CamelOctopi'.singularize # => "CamelOctopus"
43
+ # 'leyes'.singularize(:es) # => "ley"
44
+ def self.singularize(word, locale = :en)
45
+ apply_inflections(word, inflections(locale).singulars)
46
+ end
47
+
48
+ # By default, +camelize+ converts strings to UpperCamelCase. If the argument
49
+ # to +camelize+ is set to <tt>:lower</tt> then +camelize+ produces
50
+ # lowerCamelCase.
51
+ #
52
+ # +camelize+ will also convert '/' to '::' which is useful for converting
53
+ # paths to namespaces.
54
+ #
55
+ # 'active_model'.camelize # => "ActiveModel"
56
+ # 'active_model'.camelize(:lower) # => "activeModel"
57
+ # 'active_model/errors'.camelize # => "ActiveModel::Errors"
58
+ # 'active_model/errors'.camelize(:lower) # => "activeModel::Errors"
59
+ #
60
+ # As a rule of thumb you can think of +camelize+ as the inverse of
61
+ # +underscore+, though there are cases where that does not hold:
62
+ #
63
+ # 'SSLError'.underscore.camelize # => "SslError"
64
+ def self.camelize(term, uppercase_first_letter = true)
65
+ string = term.to_s
66
+ if uppercase_first_letter
67
+ string = string.sub(/^[a-z\d]*/) { inflections.acronyms[$&] || $&.capitalize }
68
+ else
69
+ string = string.sub(/^(?:#{inflections.acronym_regex}(?=\b|[A-Z_])|\w)/) { $&.downcase }
70
+ end
71
+ string.gsub!(/(?:_|(\/))([a-z\d]*)/i) { "#{$1}#{inflections.acronyms[$2] || $2.capitalize}" }
72
+ string.gsub!(/\//, '::')
73
+ string
74
+ end
75
+
76
+ # Makes an underscored, lowercase form from the expression in the string.
77
+ #
78
+ # Changes '::' to '/' to convert namespaces to paths.
79
+ #
80
+ # 'ActiveModel'.underscore # => "active_model"
81
+ # 'ActiveModel::Errors'.underscore # => "active_model/errors"
82
+ #
83
+ # As a rule of thumb you can think of +underscore+ as the inverse of
84
+ # +camelize+, though there are cases where that does not hold:
85
+ #
86
+ # 'SSLError'.underscore.camelize # => "SslError"
87
+ def self.underscore(camel_cased_word)
88
+ return camel_cased_word unless camel_cased_word =~ /[A-Z-]|::/
89
+ word = camel_cased_word.to_s.gsub(/::/, '/')
90
+ word.gsub!(/(?:(?<=([A-Za-z\d]))|\b)(#{inflections.acronym_regex})(?=\b|[^a-z])/) { "#{$1 && '_'}#{$2.downcase}" }
91
+ word.gsub!(/([A-Z\d]+)([A-Z][a-z])/,'\1_\2')
92
+ word.gsub!(/([a-z\d])([A-Z])/,'\1_\2')
93
+ word.tr!("-", "_")
94
+ word.downcase!
95
+ word
96
+ end
97
+
98
+ # Tweaks an attribute name for display to end users.
99
+ #
100
+ # Specifically, +humanize+ performs these transformations:
101
+ #
102
+ # * Applies human inflection rules to the argument.
103
+ # * Deletes leading underscores, if any.
104
+ # * Removes a "_id" suffix if present.
105
+ # * Replaces underscores with spaces, if any.
106
+ # * Downcases all words except acronyms.
107
+ # * Capitalizes the first word.
108
+ #
109
+ # The capitalization of the first word can be turned off by setting the
110
+ # +:capitalize+ option to false (default is true).
111
+ #
112
+ # humanize('employee_salary') # => "Employee salary"
113
+ # humanize('author_id') # => "Author"
114
+ # humanize('author_id', capitalize: false) # => "author"
115
+ # humanize('_id') # => "Id"
116
+ #
117
+ # If "SSL" was defined to be an acronym:
118
+ #
119
+ # humanize('ssl_error') # => "SSL error"
120
+ #
121
+ def self.humanize(lower_case_and_underscored_word, options = {})
122
+ result = lower_case_and_underscored_word.to_s.dup
123
+
124
+ inflections.humans.each { |(rule, replacement)| break if result.sub!(rule, replacement) }
125
+
126
+ result.sub!(/\A_+/, '')
127
+ result.sub!(/_id\z/, '')
128
+ result.tr!('_', ' ')
129
+
130
+ result.gsub!(/([a-z\d]*)/i) do |match|
131
+ "#{inflections.acronyms[match] || match.downcase}"
132
+ end
133
+
134
+ if options.fetch(:capitalize, true)
135
+ result.sub!(/\A\w/) { |match| match.upcase }
136
+ end
137
+
138
+ result
139
+ end
140
+
141
+ # Capitalizes all the words and replaces some characters in the string to
142
+ # create a nicer looking title. +titleize+ is meant for creating pretty
143
+ # output. It is not used in the Rails internals.
144
+ #
145
+ # +titleize+ is also aliased as +titlecase+.
146
+ #
147
+ # 'man from the boondocks'.titleize # => "Man From The Boondocks"
148
+ # 'x-men: the last stand'.titleize # => "X Men: The Last Stand"
149
+ # 'TheManWithoutAPast'.titleize # => "The Man Without A Past"
150
+ # 'raiders_of_the_lost_ark'.titleize # => "Raiders Of The Lost Ark"
151
+ def self.titleize(word)
152
+ humanize(underscore(word)).gsub(/\b(?<!['`])[a-z]/) { $&.capitalize }
153
+ end
154
+
155
+ # Create the name of a table like Rails does for models to table names. This
156
+ # method uses the +pluralize+ method on the last word in the string.
157
+ #
158
+ # 'RawScaledScorer'.tableize # => "raw_scaled_scorers"
159
+ # 'egg_and_ham'.tableize # => "egg_and_hams"
160
+ # 'fancyCategory'.tableize # => "fancy_categories"
161
+ def self.tableize(class_name)
162
+ pluralize(underscore(class_name))
163
+ end
164
+
165
+ # Create a class name from a plural table name like Rails does for table
166
+ # names to models. Note that this returns a string and not a Class (To
167
+ # convert to an actual class follow +classify+ with +constantize+).
168
+ #
169
+ # 'egg_and_hams'.classify # => "EggAndHam"
170
+ # 'posts'.classify # => "Post"
171
+ #
172
+ # Singular names are not handled correctly:
173
+ #
174
+ # 'calculus'.classify # => "Calculu"
175
+ def self.classify(table_name)
176
+ # strip out any leading schema name
177
+ camelize(singularize(table_name.to_s.sub(/.*\./, '')))
178
+ end
179
+
180
+ # Replaces underscores with dashes in the string.
181
+ #
182
+ # 'puni_puni'.dasherize # => "puni-puni"
183
+ def self.dasherize(underscored_word)
184
+ underscored_word.tr('_', '-')
185
+ end
186
+
187
+ # Removes the module part from the expression in the string.
188
+ #
189
+ # 'ActiveRecord::CoreExtensions::String::Inflections'.demodulize # => "Inflections"
190
+ # 'Inflections'.demodulize # => "Inflections"
191
+ # '::Inflections'.demodulize # => "Inflections"
192
+ # ''.demodulize # => ""
193
+ #
194
+ # See also +deconstantize+.
195
+ def self.demodulize(path)
196
+ path = path.to_s
197
+ if i = path.rindex('::')
198
+ path[(i+2)..-1]
199
+ else
200
+ path
201
+ end
202
+ end
203
+
204
+ # Removes the rightmost segment from the constant expression in the string.
205
+ #
206
+ # 'Net::HTTP'.deconstantize # => "Net"
207
+ # '::Net::HTTP'.deconstantize # => "::Net"
208
+ # 'String'.deconstantize # => ""
209
+ # '::String'.deconstantize # => ""
210
+ # ''.deconstantize # => ""
211
+ #
212
+ # See also +demodulize+.
213
+ def self.deconstantize(path)
214
+ path.to_s[0, path.rindex('::') || 0] # implementation based on the one in facets' Module#spacename
215
+ end
216
+
217
+ # Creates a foreign key name from a class name.
218
+ # +separate_class_name_and_id_with_underscore+ sets whether
219
+ # the method should put '_' between the name and 'id'.
220
+ #
221
+ # 'Message'.foreign_key # => "message_id"
222
+ # 'Message'.foreign_key(false) # => "messageid"
223
+ # 'Admin::Post'.foreign_key # => "post_id"
224
+ def self.foreign_key(class_name, separate_class_name_and_id_with_underscore = true)
225
+ underscore(demodulize(class_name)) + (separate_class_name_and_id_with_underscore ? "_id" : "id")
226
+ end
227
+
228
+ # Tries to find a constant with the name specified in the argument string.
229
+ #
230
+ # 'Module'.constantize # => Module
231
+ # 'Test::Unit'.constantize # => Test::Unit
232
+ #
233
+ # The name is assumed to be the one of a top-level constant, no matter
234
+ # whether it starts with "::" or not. No lexical context is taken into
235
+ # account:
236
+ #
237
+ # C = 'outside'
238
+ # module M
239
+ # C = 'inside'
240
+ # C # => 'inside'
241
+ # 'C'.constantize # => 'outside', same as ::C
242
+ # end
243
+ #
244
+ # NameError is raised when the name is not in CamelCase or the constant is
245
+ # unknown.
246
+ def self.constantize(camel_cased_word)
247
+ names = camel_cased_word.split('::')
248
+
249
+ # Trigger a built-in NameError exception including the ill-formed constant in the message.
250
+ Object.const_get(camel_cased_word) if names.empty?
251
+
252
+ # Remove the first blank element in case of '::ClassName' notation.
253
+ names.shift if names.size > 1 && names.first.empty?
254
+
255
+ names.inject(Object) do |constant, name|
256
+ if constant == Object
257
+ constant.const_get(name)
258
+ else
259
+ candidate = constant.const_get(name)
260
+ next candidate if constant.const_defined?(name, false)
261
+ next candidate unless Object.const_defined?(name)
262
+
263
+ # Go down the ancestors to check if it is owned directly. The check
264
+ # stops when we reach Object or the end of ancestors tree.
265
+ constant = constant.ancestors.inject do |const, ancestor|
266
+ break const if ancestor == Object
267
+ break ancestor if ancestor.const_defined?(name, false)
268
+ const
269
+ end
270
+
271
+ # owner is in Object, so raise
272
+ constant.const_get(name, false)
273
+ end
274
+ end
275
+ end
276
+
277
+ # Tries to find a constant with the name specified in the argument string.
278
+ #
279
+ # 'Module'.safe_constantize # => Module
280
+ # 'Test::Unit'.safe_constantize # => Test::Unit
281
+ #
282
+ # The name is assumed to be the one of a top-level constant, no matter
283
+ # whether it starts with "::" or not. No lexical context is taken into
284
+ # account:
285
+ #
286
+ # C = 'outside'
287
+ # module M
288
+ # C = 'inside'
289
+ # C # => 'inside'
290
+ # 'C'.safe_constantize # => 'outside', same as ::C
291
+ # end
292
+ #
293
+ # +nil+ is returned when the name is not in CamelCase or the constant (or
294
+ # part of it) is unknown.
295
+ #
296
+ # 'blargle'.safe_constantize # => nil
297
+ # 'UnknownModule'.safe_constantize # => nil
298
+ # 'UnknownModule::Foo::Bar'.safe_constantize # => nil
299
+ def self.safe_constantize(camel_cased_word)
300
+ constantize(camel_cased_word)
301
+ rescue NameError => e
302
+ raise if e.name && !(camel_cased_word.to_s.split("::").include?(e.name.to_s) ||
303
+ e.name.to_s == camel_cased_word.to_s)
304
+ rescue ArgumentError => e
305
+ raise unless e.message =~ /not missing constant #{const_regexp(camel_cased_word)}\!$/
306
+ end
307
+
308
+ # Returns the suffix that should be added to a number to denote the position
309
+ # in an ordered sequence such as 1st, 2nd, 3rd, 4th.
310
+ #
311
+ # ordinal(1) # => "st"
312
+ # ordinal(2) # => "nd"
313
+ # ordinal(1002) # => "nd"
314
+ # ordinal(1003) # => "rd"
315
+ # ordinal(-11) # => "th"
316
+ # ordinal(-1021) # => "st"
317
+ def self.ordinal(number)
318
+ abs_number = number.to_i.abs
319
+
320
+ if (11..13).include?(abs_number % 100)
321
+ "th"
322
+ else
323
+ case abs_number % 10
324
+ when 1; "st"
325
+ when 2; "nd"
326
+ when 3; "rd"
327
+ else "th"
328
+ end
329
+ end
330
+ end
331
+
332
+ # Turns a number into an ordinal string used to denote the position in an
333
+ # ordered sequence such as 1st, 2nd, 3rd, 4th.
334
+ #
335
+ # ordinalize(1) # => "1st"
336
+ # ordinalize(2) # => "2nd"
337
+ # ordinalize(1002) # => "1002nd"
338
+ # ordinalize(1003) # => "1003rd"
339
+ # ordinalize(-11) # => "-11th"
340
+ # ordinalize(-1021) # => "-1021st"
341
+ def self.ordinalize(number)
342
+ "#{number}#{ordinal(number)}"
343
+ end
344
+
345
+ private
346
+
347
+ # Mounts a regular expression, returned as a string to ease interpolation,
348
+ # that will match part by part the given constant.
349
+ #
350
+ # const_regexp("Foo::Bar::Baz") # => "Foo(::Bar(::Baz)?)?"
351
+ # const_regexp("::") # => "::"
352
+ def self.const_regexp(camel_cased_word) #:nodoc:
353
+ parts = camel_cased_word.split("::")
354
+
355
+ return Regexp.escape(camel_cased_word) if parts.blank?
356
+
357
+ last = parts.pop
358
+
359
+ parts.reverse.inject(last) do |acc, part|
360
+ part.empty? ? acc : "#{part}(::#{acc})?"
361
+ end
362
+ end
363
+
364
+ # Applies inflection rules for +singularize+ and +pluralize+.
365
+ #
366
+ # apply_inflections('post', inflections.plurals) # => "posts"
367
+ # apply_inflections('posts', inflections.singulars) # => "post"
368
+ def self.apply_inflections(word, rules)
369
+ result = word.to_s.dup
370
+
371
+ if word.empty? || inflections.uncountables.include?(result.downcase[/\b\w+\Z/])
372
+ result
373
+ else
374
+ rules.each { |(rule, replacement)| break if result.sub!(rule, replacement) }
375
+ result
376
+ end
377
+ end
378
+ end
379
+
380
+ class Inflections
381
+ @__instance__ = ThreadSafe::Cache.new
382
+
383
+ def self.instance(locale = :en)
384
+ @__instance__[locale] ||= new
385
+ end
386
+
387
+ attr_reader :plurals, :singulars, :uncountables, :humans, :acronyms, :acronym_regex
388
+
389
+ def initialize
390
+ @plurals, @singulars, @uncountables, @humans, @acronyms, @acronym_regex = [], [], [], [], {}, /(?=a)b/
391
+ end
392
+
393
+ # Private, for the test suite.
394
+ def initialize_dup(orig) # :nodoc:
395
+ %w(plurals singulars uncountables humans acronyms acronym_regex).each do |scope|
396
+ instance_variable_set("@#{scope}", orig.send(scope).dup)
397
+ end
398
+ end
399
+
400
+ # Specifies a new acronym. An acronym must be specified as it will appear
401
+ # in a camelized string. An underscore string that contains the acronym
402
+ # will retain the acronym when passed to +camelize+, +humanize+, or
403
+ # +titleize+. A camelized string that contains the acronym will maintain
404
+ # the acronym when titleized or humanized, and will convert the acronym
405
+ # into a non-delimited single lowercase word when passed to +underscore+.
406
+ #
407
+ # acronym 'HTML'
408
+ # titleize 'html' # => 'HTML'
409
+ # camelize 'html' # => 'HTML'
410
+ # underscore 'MyHTML' # => 'my_html'
411
+ #
412
+ # The acronym, however, must occur as a delimited unit and not be part of
413
+ # another word for conversions to recognize it:
414
+ #
415
+ # acronym 'HTTP'
416
+ # camelize 'my_http_delimited' # => 'MyHTTPDelimited'
417
+ # camelize 'https' # => 'Https', not 'HTTPs'
418
+ # underscore 'HTTPS' # => 'http_s', not 'https'
419
+ #
420
+ # acronym 'HTTPS'
421
+ # camelize 'https' # => 'HTTPS'
422
+ # underscore 'HTTPS' # => 'https'
423
+ #
424
+ # Note: Acronyms that are passed to +pluralize+ will no longer be
425
+ # recognized, since the acronym will not occur as a delimited unit in the
426
+ # pluralized result. To work around this, you must specify the pluralized
427
+ # form as an acronym as well:
428
+ #
429
+ # acronym 'API'
430
+ # camelize(pluralize('api')) # => 'Apis'
431
+ #
432
+ # acronym 'APIs'
433
+ # camelize(pluralize('api')) # => 'APIs'
434
+ #
435
+ # +acronym+ may be used to specify any word that contains an acronym or
436
+ # otherwise needs to maintain a non-standard capitalization. The only
437
+ # restriction is that the word must begin with a capital letter.
438
+ #
439
+ # acronym 'RESTful'
440
+ # underscore 'RESTful' # => 'restful'
441
+ # underscore 'RESTfulController' # => 'restful_controller'
442
+ # titleize 'RESTfulController' # => 'RESTful Controller'
443
+ # camelize 'restful' # => 'RESTful'
444
+ # camelize 'restful_controller' # => 'RESTfulController'
445
+ #
446
+ # acronym 'McDonald'
447
+ # underscore 'McDonald' # => 'mcdonald'
448
+ # camelize 'mcdonald' # => 'McDonald'
449
+ def acronym(word)
450
+ @acronyms[word.downcase] = word
451
+ @acronym_regex = /#{@acronyms.values.join("|")}/
452
+ end
453
+
454
+ # Specifies a new pluralization rule and its replacement. The rule can
455
+ # either be a string or a regular expression. The replacement should
456
+ # always be a string that may include references to the matched data from
457
+ # the rule.
458
+ def plural(rule, replacement)
459
+ @uncountables.delete(rule) if rule.is_a?(String)
460
+ @uncountables.delete(replacement)
461
+ @plurals.unshift([rule, replacement])
462
+ end
463
+
464
+ # Specifies a new singularization rule and its replacement. The rule can
465
+ # either be a string or a regular expression. The replacement should
466
+ # always be a string that may include references to the matched data from
467
+ # the rule.
468
+ def singular(rule, replacement)
469
+ @uncountables.delete(rule) if rule.is_a?(String)
470
+ @uncountables.delete(replacement)
471
+ @singulars.unshift([rule, replacement])
472
+ end
473
+
474
+ # Specifies a new irregular that applies to both pluralization and
475
+ # singularization at the same time. This can only be used for strings, not
476
+ # regular expressions. You simply pass the irregular in singular and
477
+ # plural form.
478
+ #
479
+ # irregular 'octopus', 'octopi'
480
+ # irregular 'person', 'people'
481
+ def irregular(singular, plural)
482
+ @uncountables.delete(singular)
483
+ @uncountables.delete(plural)
484
+
485
+ s0 = singular[0]
486
+ srest = singular[1..-1]
487
+
488
+ p0 = plural[0]
489
+ prest = plural[1..-1]
490
+
491
+ if s0.upcase == p0.upcase
492
+ plural(/(#{s0})#{srest}$/i, '\1' + prest)
493
+ plural(/(#{p0})#{prest}$/i, '\1' + prest)
494
+
495
+ singular(/(#{s0})#{srest}$/i, '\1' + srest)
496
+ singular(/(#{p0})#{prest}$/i, '\1' + srest)
497
+ else
498
+ plural(/#{s0.upcase}(?i)#{srest}$/, p0.upcase + prest)
499
+ plural(/#{s0.downcase}(?i)#{srest}$/, p0.downcase + prest)
500
+ plural(/#{p0.upcase}(?i)#{prest}$/, p0.upcase + prest)
501
+ plural(/#{p0.downcase}(?i)#{prest}$/, p0.downcase + prest)
502
+
503
+ singular(/#{s0.upcase}(?i)#{srest}$/, s0.upcase + srest)
504
+ singular(/#{s0.downcase}(?i)#{srest}$/, s0.downcase + srest)
505
+ singular(/#{p0.upcase}(?i)#{prest}$/, s0.upcase + srest)
506
+ singular(/#{p0.downcase}(?i)#{prest}$/, s0.downcase + srest)
507
+ end
508
+ end
509
+
510
+ # Specifies words that are uncountable and should not be inflected.
511
+ #
512
+ # uncountable 'money'
513
+ # uncountable 'money', 'information'
514
+ # uncountable %w( money information rice )
515
+ def uncountable(*words)
516
+ @uncountables += words.flatten.map(&:downcase)
517
+ end
518
+
519
+ # Specifies a humanized form of a string by a regular expression rule or
520
+ # by a string mapping. When using a regular expression based replacement,
521
+ # the normal humanize formatting is called after the replacement. When a
522
+ # string is used, the human form should be specified as desired (example:
523
+ # 'The name', not 'the_name').
524
+ #
525
+ # human /_cnt$/i, '\1_count'
526
+ # human 'legacy_col_person_name', 'Name'
527
+ def human(rule, replacement)
528
+ @humans.prepend([rule, replacement])
529
+ end
530
+
531
+ # Clears the loaded inflections within a given scope (default is
532
+ # <tt>:all</tt>). Give the scope as a symbol of the inflection type, the
533
+ # options are: <tt>:plurals</tt>, <tt>:singulars</tt>, <tt>:uncountables</tt>,
534
+ # <tt>:humans</tt>.
535
+ #
536
+ # clear :all
537
+ # clear :plurals
538
+ def clear(scope = :all)
539
+ case scope
540
+ when :all
541
+ @plurals, @singulars, @uncountables, @humans = [], [], [], []
542
+ else
543
+ instance_variable_set "@#{scope}", []
544
+ end
545
+ end
546
+ end
547
+
548
+
549
+
550
+ Inflector.inflections(:en) do |inflect|
551
+ inflect.plural(/$/, 's')
552
+ inflect.plural(/s$/i, 's')
553
+ inflect.plural(/^(ax|test)is$/i, '\1es')
554
+ inflect.plural(/(octop|vir)us$/i, '\1i')
555
+ inflect.plural(/(octop|vir)i$/i, '\1i')
556
+ inflect.plural(/(alias|status)$/i, '\1es')
557
+ inflect.plural(/(bu)s$/i, '\1ses')
558
+ inflect.plural(/(buffal|tomat)o$/i, '\1oes')
559
+ inflect.plural(/([ti])um$/i, '\1a')
560
+ inflect.plural(/([ti])a$/i, '\1a')
561
+ inflect.plural(/sis$/i, 'ses')
562
+ inflect.plural(/(?:([^f])fe|([lr])f)$/i, '\1\2ves')
563
+ inflect.plural(/(hive)$/i, '\1s')
564
+ inflect.plural(/([^aeiouy]|qu)y$/i, '\1ies')
565
+ inflect.plural(/(x|ch|ss|sh)$/i, '\1es')
566
+ inflect.plural(/(matr|vert|ind)(?:ix|ex)$/i, '\1ices')
567
+ inflect.plural(/^(m|l)ouse$/i, '\1ice')
568
+ inflect.plural(/^(m|l)ice$/i, '\1ice')
569
+ inflect.plural(/^(ox)$/i, '\1en')
570
+ inflect.plural(/^(oxen)$/i, '\1')
571
+ inflect.plural(/(quiz)$/i, '\1zes')
572
+
573
+ inflect.singular(/s$/i, '')
574
+ inflect.singular(/(ss)$/i, '\1')
575
+ inflect.singular(/(n)ews$/i, '\1ews')
576
+ inflect.singular(/([ti])a$/i, '\1um')
577
+ inflect.singular(/((a)naly|(b)a|(d)iagno|(p)arenthe|(p)rogno|(s)ynop|(t)he)(sis|ses)$/i, '\1sis')
578
+ inflect.singular(/(^analy)(sis|ses)$/i, '\1sis')
579
+ inflect.singular(/([^f])ves$/i, '\1fe')
580
+ inflect.singular(/(hive)s$/i, '\1')
581
+ inflect.singular(/(tive)s$/i, '\1')
582
+ inflect.singular(/([lr])ves$/i, '\1f')
583
+ inflect.singular(/([^aeiouy]|qu)ies$/i, '\1y')
584
+ inflect.singular(/(s)eries$/i, '\1eries')
585
+ inflect.singular(/(m)ovies$/i, '\1ovie')
586
+ inflect.singular(/(x|ch|ss|sh)es$/i, '\1')
587
+ inflect.singular(/^(m|l)ice$/i, '\1ouse')
588
+ inflect.singular(/(bus)(es)?$/i, '\1')
589
+ inflect.singular(/(o)es$/i, '\1')
590
+ inflect.singular(/(shoe)s$/i, '\1')
591
+ inflect.singular(/(cris|test)(is|es)$/i, '\1is')
592
+ inflect.singular(/^(a)x[ie]s$/i, '\1xis')
593
+ inflect.singular(/(octop|vir)(us|i)$/i, '\1us')
594
+ inflect.singular(/(alias|status)(es)?$/i, '\1')
595
+ inflect.singular(/^(ox)en/i, '\1')
596
+ inflect.singular(/(vert|ind)ices$/i, '\1ex')
597
+ inflect.singular(/(matr)ices$/i, '\1ix')
598
+ inflect.singular(/(quiz)zes$/i, '\1')
599
+ inflect.singular(/(database)s$/i, '\1')
600
+
601
+ inflect.irregular('person', 'people')
602
+ inflect.irregular('man', 'men')
603
+ inflect.irregular('child', 'children')
604
+ inflect.irregular('sex', 'sexes')
605
+ inflect.irregular('move', 'moves')
606
+ inflect.irregular('zombie', 'zombies')
607
+
608
+ inflect.uncountable(%w(equipment information rice money species series fish sheep jeans police))
609
+ end
@@ -0,0 +1,58 @@
1
+ ##
2
+ # Jazz Hands for console and debugging
3
+ ##
4
+ require 'jazz_hands'
5
+ require 'awesome_print'
6
+
7
+ JazzHands.colored_prompt = true
8
+ JazzHands.enable_syntax_highlighting_as_you_type!
9
+
10
+ Pry.config.print = ->(output, value) do
11
+ return if JazzHands._hirb_output && Hirb::View.view_or_page_output(value)
12
+ pretty = value.ai(indent: 2)
13
+ Pry::Helpers::BaseHelpers.stagger_output("=> #{pretty}", output)
14
+ end
15
+
16
+ # Friendlier prompt - line number, app name, nesting levels look like
17
+ # directory paths.
18
+ #
19
+ # Heavy use of lazy lambdas so configuration (like Pry.color) can be
20
+ # changed later or even during console usage.
21
+ #
22
+ # Custom color helpers using hints \001 and \002 so that good readline
23
+ # libraries (GNU, rb-readline) correctly ignore color codes when
24
+ # calculating line length.
25
+
26
+ name = Storm::APP_NAME
27
+
28
+ color = -> { Pry.color && JazzHands.colored_prompt }
29
+ red = ->(text) { color[] ? "\001\e[0;31m\002#{text}\001\e[0m\002" : text.to_s }
30
+ blue = ->(text) { color[] ? "\001\e[0;34m\002#{text}\001\e[0m\002" : text.to_s }
31
+ bold = ->(text) { color[] ? "\001\e[1m\002#{text}\001\e[0m\002" : text.to_s }
32
+
33
+ separator = -> { red.(JazzHands.prompt_separator) }
34
+ colored_name = -> { blue.(name) }
35
+
36
+ line = ->(pry) { "[#{bold.(pry.input_array.size)}] " }
37
+ target_string = ->(object, level) do
38
+ level = 0 if level < 0
39
+ unless (string = Pry.view_clip(object)) == 'main'
40
+ "(#{'../' * level}#{string})"
41
+ else
42
+ ''
43
+ end
44
+ end
45
+
46
+ Pry.config.prompt = [
47
+ ->(object, level, pry) do # Main prompt
48
+ "#{line.(pry)}#{colored_name.()}#{target_string.(object, level)} #{separator.()} "
49
+ end,
50
+ ->(object, level, pry) do # Wait prompt in multiline input
51
+ spaces = ' ' * (
52
+ "[#{pry.input_array.size}] ".size + # Uncolored `line.(pry)`
53
+ name.size +
54
+ target_string.(object, level).size
55
+ )
56
+ "#{spaces} #{separator.()} "
57
+ end
58
+ ]
data/bin/storm ADDED
@@ -0,0 +1,40 @@
1
+ #!/usr/bin/env ruby
2
+ require 'thread_safe'
3
+
4
+ module Storm
5
+ require File.expand_path("./../../application/inflector", __FILE__)
6
+ require File.expand_path("./../../application/application", __FILE__)
7
+
8
+ def self.perform!(namespace, args=ARGV)
9
+ begin
10
+ names = namespace.to_s.split(':')
11
+ generator(names)
12
+ if klass = generator(names)
13
+ puts "#{klass} #{args.length > 1 ? args[1..-1] : ''}"
14
+ Dir["./*/*.rb"].each{|file| require file } if klass.name != "Storm::Init"
15
+ klass.start(args[1..-1])
16
+ else
17
+ puts "Could not find generator '#{names}'. "
18
+ end
19
+ rescue Exception => e
20
+ puts e.message
21
+ return 1
22
+ end
23
+ return 0
24
+ end
25
+
26
+ def self.generator(names)
27
+ generators_and_paths = names.map{|name|
28
+ [name.capitalize,name.downcase]
29
+ }
30
+ klass = "::Storm::"+generators_and_paths.map(&:first).join("::")
31
+ path = File.expand_path("./../../generators/#{generators_and_paths.map(&:last).join("/")}.rb", __FILE__)
32
+
33
+ if File.exists?(path)
34
+ require path
35
+ return eval(klass)
36
+ end
37
+ end
38
+ end
39
+
40
+ exit Storm::perform!(ARGV[0])
data/bin/storm_console ADDED
@@ -0,0 +1,19 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ Dir["./*/*.rb"].each{|file| require file }
4
+
5
+ Bundler.require(:default)
6
+ require 'thread_safe'
7
+ require 'pry'
8
+ require 'active_record'
9
+
10
+ require File.expand_path("./../../application/inflector", __FILE__)
11
+ require File.expand_path("./../../application/application", __FILE__)
12
+ require File.expand_path("./../../application/jazz_hands", __FILE__)
13
+
14
+ ActiveRecord::Base.establish_connection YAML.load_file('./db/databases.yml')[Storm::STORM_ENV] rescue nil
15
+
16
+ load Gem.bin_path('pry', 'pry', ">= 0.9")
17
+
18
+
19
+
data/bin/stormc ADDED
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+ Kernel::exec "bundle exec #{File.expand_path("./../storm_console", __FILE__)}"
3
+
4
+
@@ -0,0 +1,42 @@
1
+ require "#{Storm::STORM_DIR}/generators/db/db_command"
2
+
3
+ module Storm::Db
4
+ class Create < Storm::DBCommand
5
+ def self.start(args)
6
+ options = {:charset => 'utf8', :collation => 'utf8_unicode_ci'}
7
+
8
+ create_db = lambda do |config|
9
+ # drops and create need to be performed with a connection to the 'postgres' (system) database
10
+ if config["adapter"] == 'postgres'
11
+ ::ActiveRecord::Base.establish_connection(config.merge('database' => 'postgres', 'schema_search_path' => 'public'))
12
+ end
13
+ # drop the old database (if it exists)
14
+ ::ActiveRecord::Base.connection.drop_database config["database"] rescue nil
15
+ # create new
16
+ ::ActiveRecord::Base.connection.create_database(config["database"]) rescue nil
17
+ ::ActiveRecord::Base.establish_connection(config)
18
+ end
19
+
20
+ begin
21
+ create_db.call self.config
22
+ rescue Exception => sqlerr
23
+ if sqlerr.errno == 1405
24
+ print "#{sqlerr.error}. \nPlease provide the root password for your mysql installation\n>"
25
+ root_password = $stdin.gets.strip
26
+
27
+ grant_statement = <<-SQL
28
+ GRANT ALL PRIVILEGES ON #{config['database']}.*
29
+ TO '#{config['username']}'@'localhost'
30
+ IDENTIFIED BY '#{config['password']}' WITH GRANT OPTION;
31
+ SQL
32
+
33
+ create_db.call config.merge('database' => nil, 'username' => 'root', 'password' => root_password)
34
+ else
35
+ $stderr.puts sqlerr.error
36
+ $stderr.puts "Couldn't create database for #{config.inspect}, charset: utf8, collation: utf8_unicode_ci"
37
+ $stderr.puts "(if you set the charset manually, make sure you have a matching collation)" if config['charset']
38
+ end
39
+ end
40
+ end
41
+ end
42
+ end
@@ -0,0 +1,13 @@
1
+ class Storm::DBCommand
2
+ require 'active_record'
3
+ require 'yaml'
4
+ def self.config
5
+ @config ||= ::YAML.load_file('./db/databases.yml')[Storm::STORM_ENV]
6
+ end
7
+
8
+ def self.connect
9
+ self.config
10
+ ::ActiveRecord::Base.establish_connection self.config
11
+ ::ActiveRecord::Base.logger = Logger.new STDOUT if @config['logger']
12
+ end
13
+ end
@@ -0,0 +1,13 @@
1
+ require "#{Storm::STORM_DIR}/generators/db/db_command"
2
+
3
+ module Storm::Db
4
+ class Drop < Storm::DBCommand
5
+ def self.start(args)
6
+ ::ActiveRecord::Base.connection.drop_database self.connect['database'] rescue
7
+ if self.config['adapter'] == 'sqlite3'
8
+ db_file = File.expand_path("./"+self.config['database'])
9
+ File.delete(db_file)
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,36 @@
1
+ require 'fileutils'
2
+ require "#{Storm::STORM_DIR}/generators/db/migration_generator"
3
+
4
+ module Storm::Db
5
+ class Generate < Storm::MigrationGenerator
6
+ def self.start(args)
7
+ filename = next_migration_file_name(args)
8
+ model_name, *columns = args
9
+ model_source = Inflector::singularize(Inflector::tableize(model_name))
10
+ create_table = \
11
+ ["class Generate#{::Inflector::pluralize(::Inflector::classify(model_name))} < ActiveRecord::Migration",
12
+ " def change",
13
+ " create_table :#{::Inflector::tableize(model_name)} do |t|",
14
+ columns.map do |col|
15
+ col_name, col_type = col.split(":")
16
+ col_type ||= "string"
17
+ " t.#{col_type} :#{::Inflector::singularize(::Inflector::tableize(col_name))}"
18
+ end,
19
+ " t.timestamps",
20
+ " end",
21
+ " end",
22
+ "end"].flatten
23
+
24
+ FileUtils.mkdir_p("./models/")
25
+ File.open("./models/#{model_source}.rb", "w+") do |f|
26
+ f.puts "\
27
+ class #{::Inflector::classify(model_name)} < ActiveRecord::Base
28
+ end
29
+ "
30
+ end
31
+ File.open("./db/migrate/#{filename}", "w+") do |f|
32
+ f.puts create_table.join("\n")
33
+ end
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,11 @@
1
+ require "#{Storm::STORM_DIR}/generators/db/db_command"
2
+
3
+ module Storm::Db
4
+ class Migrate < Storm::DBCommand
5
+ def self.start *_
6
+ self.connect
7
+ ::ActiveRecord::Migration.verbose = true
8
+ ::ActiveRecord::Migrator.migrate File.expand_path(Storm::MIGRATIONS_DIR), Storm::VERSION && Storm::VERSION.to_i
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,10 @@
1
+ module Storm::Db
2
+ class Storm::MigrationGenerator
3
+ def self.next_migration_file_name(args)
4
+ ::Inflector::tableize("#{Time.now.strftime("%Y%m%d%H%M%S")}_#{self.name.split("::").last}_#{args[0]}")+".rb"
5
+ end
6
+
7
+ def self.last_migration_timestamp
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,20 @@
1
+ require "#{Storm::STORM_DIR}/generators/db/migration_generator"
2
+
3
+ module Storm::Db
4
+ class Modify < Storm::MigrationGenerator
5
+ def self.start(args)
6
+ filename = next_migration_file_name(args)
7
+ model_name, *_ = args
8
+
9
+ create_table = \
10
+ ["class Modify#{::Inflector::classify(model_name)} < ActiveRecord::Migration",
11
+ " def change",
12
+ " end",
13
+ "end"].flatten
14
+
15
+ File.open("./db/migrate/#{filename}", "w+") do |f|
16
+ f.puts create_table.join("\n")
17
+ end
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,11 @@
1
+ require "#{Storm::STORM_DIR}/generators/db/db_command"
2
+
3
+ module Storm::Db
4
+ class Rollback < Storm::DBCommand
5
+ def self.start (*args)
6
+ self.connect
7
+ step = ENV['STEP'] ? ENV['STEP'].to_i : 1
8
+ ::ActiveRecord::Migrator.rollback ::Storm::MIGRATIONS_DIR, step
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,10 @@
1
+ require "#{Storm::STORM_DIR}/generators/db/db_command"
2
+
3
+ module Storm::Db
4
+ class Version < Storm::DBCommand
5
+ def self.start(*args)
6
+ self.connect
7
+ puts "Current version: #{::ActiveRecord::Migrator.current_version}"
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,62 @@
1
+ require 'fileutils'
2
+
3
+ module Storm
4
+ class Init
5
+ def self.start(args)
6
+ app_name = args[0]
7
+ class_name = Inflector::classify(app_name)
8
+ file_name = "#{Inflector::underscore(app_name)}.rb"
9
+ dir_name = "#{Inflector::underscore(app_name)}"
10
+ FileUtils.mkdir_p(dir_name)
11
+ FileUtils.mkdir_p("./#{dir_name}/#{MIGRATIONS_DIR}") rescue nil
12
+ gemfile(dir_name)
13
+ appfile(dir_name, file_name, class_name)
14
+ dbfile(dir_name)
15
+ end
16
+
17
+ #
18
+ # Write project Gemfile
19
+ #
20
+ def self.gemfile(dir_name)
21
+ File.open("./#{dir_name}/Gemfile", "w+") do |f|
22
+ f.puts "\
23
+ source 'https://rubygems.org'
24
+ gem 'ruby_storm'
25
+ "
26
+ end
27
+ end
28
+
29
+ #
30
+ # Write app entry point
31
+ #
32
+ def self.appfile(dir_name, file_name, class_name)
33
+ File.open("./#{dir_name}/#{file_name}", "w+") do |f|
34
+ f.puts "\
35
+ class #{class_name}
36
+ def self.main(env)
37
+ end
38
+ end
39
+ "
40
+ end
41
+ end
42
+
43
+ #
44
+ # Write databases.yml
45
+ #
46
+ def self.dbfile(dir_name)
47
+ File.open("./#{dir_name}/db/databases.yml", "w+") do |f|
48
+ f.puts "\
49
+ default: &default
50
+ adapter: sqlite3
51
+ pool: 5
52
+ timeout: 5000
53
+
54
+ development:
55
+ <<: *default
56
+ database: db/development.sqlite3
57
+ "
58
+ end
59
+ end
60
+ end
61
+ end
62
+
@@ -0,0 +1,8 @@
1
+ module Storm
2
+ class Version
3
+ def self.to_s(*args)
4
+ "0.0.2"
5
+ end
6
+ alias_method :start, :to_s
7
+ end
8
+ end
@@ -0,0 +1,26 @@
1
+ require './generators/version'
2
+
3
+ Gem::Specification.new do |s|
4
+ s.name = 'ruby_storm'
5
+ s.version = Storm::Version.to_s
6
+ s.date = '2014-11-02'
7
+ s.summary = "Ruby storm is a stand alone Object Relational Mapper"
8
+ s.description = "Ruby storm is a stand alone Object Relational Mapper that wraps ActiveRecord."
9
+ s.authors = ["Wouter Coppieters"]
10
+ s.email = 'wouter.coppieters@youdo.co.nz'
11
+
12
+ s.files = `git ls-files`.split("\n")
13
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
14
+ s.executables = ['stormc', 'storm']
15
+
16
+ s.add_runtime_dependency 'pry', '~> 0.9'
17
+ s.add_runtime_dependency 'jazz_hands', '~> 0.5'
18
+ s.add_runtime_dependency 'awesome_print', '~> 1.0'
19
+ s.add_runtime_dependency 'activerecord', '~> 4.1'
20
+ s.add_runtime_dependency 'sqlite3', '~> 1.3'
21
+ s.add_runtime_dependency 'thread_safe', '~> 0.3'
22
+ s.add_runtime_dependency 'bundler', '~> 1.5'
23
+
24
+ s.homepage = 'http://rubygems.org/gems/ruby_storm'
25
+ s.license = 'MIT'
26
+ end
data/rubystorm.todo ADDED
@@ -0,0 +1,11 @@
1
+ ☐ Require packages for app and daemon. 'storm/app', 'storm/daemon'. Main class inherits from Storm::App or Storm::Daemon
2
+ ☐ generate either daemon or app. (Both have gemfile and bin-dir)
3
+ ☐ Allow ENV VARS for migration dir, model dir
4
+ ☐ Create deploy procedure
5
+ ☐ Release!
6
+
7
+ ___________________
8
+ Archive:
9
+ ✔ generate and include gemfile in project dir @done (14-11-06 15:22)
10
+ ✔ Different Bundle.requires for storm and stormc. @done (14-11-06 15:22)
11
+ ✔ ALlow splitting of dependencies into groups. @done (14-11-06 15:22)
metadata ADDED
@@ -0,0 +1,166 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: ruby_storm
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.2
5
+ platform: ruby
6
+ authors:
7
+ - Wouter Coppieters
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-11-02 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: pry
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: '0.9'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: '0.9'
27
+ - !ruby/object:Gem::Dependency
28
+ name: jazz_hands
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ~>
32
+ - !ruby/object:Gem::Version
33
+ version: '0.5'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ~>
39
+ - !ruby/object:Gem::Version
40
+ version: '0.5'
41
+ - !ruby/object:Gem::Dependency
42
+ name: awesome_print
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ~>
46
+ - !ruby/object:Gem::Version
47
+ version: '1.0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ~>
53
+ - !ruby/object:Gem::Version
54
+ version: '1.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: activerecord
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ~>
60
+ - !ruby/object:Gem::Version
61
+ version: '4.1'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ~>
67
+ - !ruby/object:Gem::Version
68
+ version: '4.1'
69
+ - !ruby/object:Gem::Dependency
70
+ name: sqlite3
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ~>
74
+ - !ruby/object:Gem::Version
75
+ version: '1.3'
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ~>
81
+ - !ruby/object:Gem::Version
82
+ version: '1.3'
83
+ - !ruby/object:Gem::Dependency
84
+ name: thread_safe
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ~>
88
+ - !ruby/object:Gem::Version
89
+ version: '0.3'
90
+ type: :runtime
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ~>
95
+ - !ruby/object:Gem::Version
96
+ version: '0.3'
97
+ - !ruby/object:Gem::Dependency
98
+ name: bundler
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ~>
102
+ - !ruby/object:Gem::Version
103
+ version: '1.5'
104
+ type: :runtime
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ~>
109
+ - !ruby/object:Gem::Version
110
+ version: '1.5'
111
+ description: Ruby storm is a stand alone Object Relational Mapper that wraps ActiveRecord.
112
+ email: wouter.coppieters@youdo.co.nz
113
+ executables:
114
+ - stormc
115
+ - storm
116
+ extensions: []
117
+ extra_rdoc_files: []
118
+ files:
119
+ - .ruby-version
120
+ - Gemfile
121
+ - Gemfile.lock
122
+ - application/application.rb
123
+ - application/inflector.rb
124
+ - application/jazz_hands.rb
125
+ - bin/storm
126
+ - bin/storm_console
127
+ - bin/stormc
128
+ - generators/db/create.rb
129
+ - generators/db/db_command.rb
130
+ - generators/db/drop.rb
131
+ - generators/db/generate.rb
132
+ - generators/db/migrate.rb
133
+ - generators/db/migration_generator.rb
134
+ - generators/db/modify.rb
135
+ - generators/db/rollback.rb
136
+ - generators/db/version.rb
137
+ - generators/init.rb
138
+ - generators/version.rb
139
+ - ruby_storm.gemspec
140
+ - rubystorm.todo
141
+ homepage: http://rubygems.org/gems/ruby_storm
142
+ licenses:
143
+ - MIT
144
+ metadata: {}
145
+ post_install_message:
146
+ rdoc_options: []
147
+ require_paths:
148
+ - lib
149
+ required_ruby_version: !ruby/object:Gem::Requirement
150
+ requirements:
151
+ - - ! '>='
152
+ - !ruby/object:Gem::Version
153
+ version: '0'
154
+ required_rubygems_version: !ruby/object:Gem::Requirement
155
+ requirements:
156
+ - - ! '>='
157
+ - !ruby/object:Gem::Version
158
+ version: '0'
159
+ requirements: []
160
+ rubyforge_project:
161
+ rubygems_version: 2.3.0
162
+ signing_key:
163
+ specification_version: 4
164
+ summary: Ruby storm is a stand alone Object Relational Mapper
165
+ test_files: []
166
+ has_rdoc: