rails_stuff 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +9 -0
- data/.rspec +2 -0
- data/.rubocop.yml +24 -0
- data/.travis.yml +8 -0
- data/Gemfile +21 -0
- data/LICENSE.txt +21 -0
- data/README.md +350 -0
- data/Rakefile +22 -0
- data/bin/console +7 -0
- data/bin/git-hooks/pre-commit +14 -0
- data/bin/install_git_hooks +8 -0
- data/bin/setup +8 -0
- data/lib/net/http/debug.rb +26 -0
- data/lib/rails_stuff/helpers/all.rb +12 -0
- data/lib/rails_stuff/helpers/bootstrap.rb +34 -0
- data/lib/rails_stuff/helpers/forms.rb +21 -0
- data/lib/rails_stuff/helpers/links.rb +38 -0
- data/lib/rails_stuff/helpers/resource_form.rb +49 -0
- data/lib/rails_stuff/helpers/text.rb +28 -0
- data/lib/rails_stuff/helpers/translation.rb +29 -0
- data/lib/rails_stuff/helpers.rb +14 -0
- data/lib/rails_stuff/nullify_blank_attrs.rb +23 -0
- data/lib/rails_stuff/params_parser.rb +121 -0
- data/lib/rails_stuff/railtie.rb +54 -0
- data/lib/rails_stuff/random_uniq_attr.rb +48 -0
- data/lib/rails_stuff/redis_storage.rb +119 -0
- data/lib/rails_stuff/resources_controller/actions.rb +31 -0
- data/lib/rails_stuff/resources_controller/basic_helpers.rb +161 -0
- data/lib/rails_stuff/resources_controller/resource_helper.rb +31 -0
- data/lib/rails_stuff/resources_controller/responder.rb +21 -0
- data/lib/rails_stuff/resources_controller/sti_helpers.rb +62 -0
- data/lib/rails_stuff/resources_controller.rb +42 -0
- data/lib/rails_stuff/sort_scope.rb +71 -0
- data/lib/rails_stuff/statusable.rb +130 -0
- data/lib/rails_stuff/test_helpers/rails.rb +6 -0
- data/lib/rails_stuff/test_helpers/response.rb +34 -0
- data/lib/rails_stuff/types_tracker.rb +50 -0
- data/lib/rails_stuff/version.rb +14 -0
- data/lib/rails_stuff.rb +19 -0
- data/rails_stuff.gemspec +25 -0
- metadata +126 -0
@@ -0,0 +1,31 @@
|
|
1
|
+
module RailsStuff
|
2
|
+
module ResourcesController
|
3
|
+
# Defines resource helper and finder method.
|
4
|
+
module ResourceHelper
|
5
|
+
# Defines protected helper method. Ex. for `:user`
|
6
|
+
#
|
7
|
+
# helper_method :user
|
8
|
+
#
|
9
|
+
# def user
|
10
|
+
# @user ||= User.find params[:user_id]
|
11
|
+
# end
|
12
|
+
#
|
13
|
+
# #### Options
|
14
|
+
#
|
15
|
+
# - `class` - class name, default to `resource_name.classify`
|
16
|
+
# - `param` - param name, default to `resource_name.foreign_key`
|
17
|
+
def resource_helper(resource_name, **options)
|
18
|
+
helper_method resource_name
|
19
|
+
resource_name = resource_name.to_s
|
20
|
+
|
21
|
+
class_eval <<-RUBY, __FILE__, __LINE__ + 1
|
22
|
+
def #{resource_name}
|
23
|
+
@#{resource_name} ||= #{options[:class] || resource_name.classify}.
|
24
|
+
find params[:#{options[:param] || resource_name.foreign_key}]
|
25
|
+
end
|
26
|
+
protected :#{resource_name}
|
27
|
+
RUBY
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module RailsStuff
|
2
|
+
module ResourcesController
|
3
|
+
# Default responder class.
|
4
|
+
class Responder < ActionController::Responder
|
5
|
+
include Responders::FlashResponder
|
6
|
+
include Responders::HttpCacheResponder
|
7
|
+
|
8
|
+
# Similar to `.to_html`. Redirect is performed via turbolinks.
|
9
|
+
def to_js
|
10
|
+
default_render
|
11
|
+
rescue ActionView::MissingTemplate
|
12
|
+
raise if get?
|
13
|
+
if has_errors?
|
14
|
+
render resource.persisted? ? :edit : :new
|
15
|
+
else
|
16
|
+
redirect_via_turbolinks_to controller.url_for(resource_location)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,62 @@
|
|
1
|
+
require 'active_record/errors'
|
2
|
+
|
3
|
+
module RailsStuff
|
4
|
+
module ResourcesController
|
5
|
+
# Helper methods for controllers which works with STI models.
|
6
|
+
module StiHelpers
|
7
|
+
extend ActiveSupport::Concern
|
8
|
+
|
9
|
+
module ClassMethods
|
10
|
+
# Returns hash which is used to get subclass for requested type.
|
11
|
+
#
|
12
|
+
# By default it uses `.types_list` or `.descendants` to get list of
|
13
|
+
# classes and indexes them by class names.
|
14
|
+
def resource_class_by_type
|
15
|
+
@resource_class_by_type ||= begin
|
16
|
+
if resource_class.respond_to?(:types_list)
|
17
|
+
resource_class.types_list
|
18
|
+
else
|
19
|
+
resource_class.descendants
|
20
|
+
end.index_by(&:name)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
# Class-level accessor to permitted attributes for specisic class.
|
25
|
+
def permitted_attrs_for
|
26
|
+
@permitted_attrs_for ||= Hash.new { |h, k| h[k] = [] }
|
27
|
+
end
|
28
|
+
|
29
|
+
# Permits attrs only for specific class.
|
30
|
+
def permit_attrs_for(klass, *attrs)
|
31
|
+
permitted_attrs_for[klass].concat attrs
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
protected
|
36
|
+
|
37
|
+
# Returns model class depending on `type` attr in params.
|
38
|
+
# If resource is requested by id, it returns its class.
|
39
|
+
def class_from_request
|
40
|
+
@class_from_request ||=
|
41
|
+
if params.key?(:id)
|
42
|
+
resource.class
|
43
|
+
else
|
44
|
+
name = params.require(self.class.resource_param_name).
|
45
|
+
permit(:type)[:type]
|
46
|
+
self.class.resource_class_by_type[name] ||
|
47
|
+
raise(ActiveRecord::RecordNotFound)
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
# Instantiates object using class_from_request.
|
52
|
+
def build_resource
|
53
|
+
@_resource = super.becomes!(class_from_request)
|
54
|
+
end
|
55
|
+
|
56
|
+
# Merges default attrs with attrs for specific class.
|
57
|
+
def permitted_attrs
|
58
|
+
super + self.class.permitted_attrs_for[class_from_request]
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
require 'responders'
|
2
|
+
|
3
|
+
module RailsStuff
|
4
|
+
# InheritedResources on diet.
|
5
|
+
# Tiny and simple implementation. Feel free to change/extend it right in you
|
6
|
+
# application. Or just use separate modules.
|
7
|
+
module ResourcesController
|
8
|
+
extend ActiveSupport::Autoload
|
9
|
+
|
10
|
+
class << self
|
11
|
+
delegate :kaminari!, to: 'RailsStuff::ResourcesController::BasicHelpers'
|
12
|
+
end
|
13
|
+
|
14
|
+
autoload :Actions
|
15
|
+
autoload :BasicHelpers
|
16
|
+
autoload :Responder
|
17
|
+
autoload :StiHelpers
|
18
|
+
autoload :ResourceHelper
|
19
|
+
|
20
|
+
# Setups basic actions and helpers in resources controller.
|
21
|
+
#
|
22
|
+
# #### Options
|
23
|
+
#
|
24
|
+
# - `sti` - include STI helpers
|
25
|
+
# - `after_save_action` - action to use for `after_save_url`
|
26
|
+
# - `source_relation` - override `source_relation`
|
27
|
+
def resources_controller(**options)
|
28
|
+
include BasicHelpers
|
29
|
+
include StiHelpers if options[:sti]
|
30
|
+
include Actions
|
31
|
+
extend ResourceHelper
|
32
|
+
|
33
|
+
respond_to :html
|
34
|
+
self.responder = Responder
|
35
|
+
self.after_save_action = options[:after_save_action] || after_save_action
|
36
|
+
|
37
|
+
if options[:source_relation] # rubocop:disable GuardClause
|
38
|
+
protected define_method(:source_relation, &options[:source_relation])
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,71 @@
|
|
1
|
+
require 'has_scope'
|
2
|
+
|
3
|
+
module RailsStuff
|
4
|
+
# Provides safe and flexible way to sort collections by user's input.
|
5
|
+
# Uses `has_scope` gem.
|
6
|
+
#
|
7
|
+
# Supports different input format, and limits requested fields
|
8
|
+
# to allowed subset.
|
9
|
+
module SortScope
|
10
|
+
# Register type for has_scop that accepts stings, hashes & arrays.
|
11
|
+
HasScope::ALLOWED_TYPES[:any] = [[String, Hash, Array, Symbol]]
|
12
|
+
|
13
|
+
# Setups has_scope to order collection by allowed columns.
|
14
|
+
# Sort column is filtered by SortScope.filter_param method.
|
15
|
+
# Accepts params:
|
16
|
+
#
|
17
|
+
# - `sort=name`
|
18
|
+
# - `sort=name&sort_desc=true`
|
19
|
+
# - `sort[name]&sort[order]`
|
20
|
+
# - `sort[name]&sort[order]=desc
|
21
|
+
#
|
22
|
+
# #### Options
|
23
|
+
#
|
24
|
+
# - `by` - array of available fields to sort by,
|
25
|
+
# - `default` - default sort expression,
|
26
|
+
# - `only` - bypassed to `has_scope` to limit actions (default to `:index`).
|
27
|
+
#
|
28
|
+
# rubocop:disable ClassVars
|
29
|
+
def has_sort_scope(config = {})
|
30
|
+
@@_sort_scope_id ||= 0
|
31
|
+
default = config[:default] || :id
|
32
|
+
allowed = Array.wrap(config[:by]).map(&:to_s)
|
33
|
+
only_actions = config.fetch(:only, :index)
|
34
|
+
# Counter added into scope name to allow to define multiple scopes in same controller.
|
35
|
+
has_scope("sort_#{@@_sort_scope_id += 1}",
|
36
|
+
as: :sort,
|
37
|
+
default: nil,
|
38
|
+
allow_blank: true,
|
39
|
+
only: only_actions,
|
40
|
+
type: :any,
|
41
|
+
) do |c, scope, val|
|
42
|
+
scope.order(SortScope.filter_param(val, c.params, allowed, default))
|
43
|
+
end
|
44
|
+
end
|
45
|
+
# rubocop:enable ClassVars
|
46
|
+
|
47
|
+
class << self
|
48
|
+
# Filters value with whitelist of allowed fields to sort by.
|
49
|
+
#
|
50
|
+
# rubocop:disable CyclomaticComplexity, PerceivedComplexity, BlockNesting
|
51
|
+
def filter_param(val, params, allowed, default = nil)
|
52
|
+
val ||= default
|
53
|
+
unless val == default
|
54
|
+
val =
|
55
|
+
if val.is_a?(Hash)
|
56
|
+
val.each_with_object({}) do |(key, dir), h|
|
57
|
+
h[key] = (dir == 'desc' ? :desc : :asc) if allowed.include?(key)
|
58
|
+
end
|
59
|
+
else
|
60
|
+
allowed.include?(val) ? val : default
|
61
|
+
end
|
62
|
+
end
|
63
|
+
if val && !val.is_a?(Hash)
|
64
|
+
val = {val => ParamsParser.parse_boolean(params[:sort_desc]) ? :desc : :asc}
|
65
|
+
end
|
66
|
+
val
|
67
|
+
end
|
68
|
+
# rubocop:enable CyclomaticComplexity, PerceivedComplexity, BlockNesting
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
@@ -0,0 +1,130 @@
|
|
1
|
+
module RailsStuff
|
2
|
+
# Basic helpers to work with `status`-like field.
|
3
|
+
#
|
4
|
+
# For every status value it provides:
|
5
|
+
#
|
6
|
+
# - scopes with status name (eg. `.rejected`, '.not_rejected')
|
7
|
+
# - inquiry method to check status (eg. `#rejected?`)
|
8
|
+
# - bang method to update status (eg. `#rejected!`)
|
9
|
+
#
|
10
|
+
# It also provides:
|
11
|
+
#
|
12
|
+
# - translation helpers (`acttivemodel_translation` gem required)
|
13
|
+
# - inclusion validator
|
14
|
+
# - string/symbol agnostic `#status=`
|
15
|
+
# - `#status_sym`
|
16
|
+
# - `status_select_options` helper.
|
17
|
+
#
|
18
|
+
module Statusable
|
19
|
+
# Defines all helpers working with `field` (default to `status`).
|
20
|
+
# List of values can be given as second argument, otherwise it'll
|
21
|
+
# be read from const with pluralized name of `field` (eg. default to STATUSES).
|
22
|
+
#
|
23
|
+
# #### Options
|
24
|
+
#
|
25
|
+
# - `prefix` - used to prefix value-named helpers.
|
26
|
+
#
|
27
|
+
# # this defines #shipped?, #shipped! methods
|
28
|
+
# has_status_field :delivery_status, %i(shipped delivered)
|
29
|
+
#
|
30
|
+
# # this defines #delivery_shipped?, #delivery_shipped! methods
|
31
|
+
# has_status_field :delivery_status, %i(shipped delivered), prefix: :delivery
|
32
|
+
#
|
33
|
+
# - `validate` - additional options for validatior. `false` to disable it.
|
34
|
+
def has_status_field(field = :status, statuses = nil, **options) # rubocop:disable AbcSize
|
35
|
+
statuses ||= const_get(field.to_s.pluralize.upcase)
|
36
|
+
prefix = options[:prefix]
|
37
|
+
|
38
|
+
if options[:validate] != false
|
39
|
+
validates_inclusion_of field,
|
40
|
+
{in: statuses.map(&:to_s)}.merge!(options.fetch(:validate, {}))
|
41
|
+
end
|
42
|
+
|
43
|
+
statusable_methods.generate_field_methods field, statuses
|
44
|
+
|
45
|
+
# Scope with given status. Useful for has_scope.
|
46
|
+
scope "with_#{field}", ->(status) { where(field => status) }
|
47
|
+
|
48
|
+
statuses.map(&:to_s).each do |status_name|
|
49
|
+
# Scopes for every status.
|
50
|
+
scope "#{prefix}#{status_name}", -> { where(field => status_name) }
|
51
|
+
scope "not_#{prefix}#{status_name}", -> { where.not(field => status_name) }
|
52
|
+
statusable_methods.status_accessor field, status_name, prefix
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
# Module to hold generated methods.
|
57
|
+
def statusable_methods
|
58
|
+
# Include generated methods with a module, not right in class.
|
59
|
+
@statusable_methods ||= Module.new.tap do |m|
|
60
|
+
m.const_set :ClassMethods, Module.new
|
61
|
+
m.extend MethodsGenerator
|
62
|
+
include m
|
63
|
+
extend m::ClassMethods
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
# Generates methods.
|
68
|
+
module MethodsGenerator
|
69
|
+
# Generates all methods for the `field`.
|
70
|
+
def generate_field_methods(field, statuses)
|
71
|
+
field_accessor field
|
72
|
+
translation_helpers field
|
73
|
+
select_options_helper field, statuses
|
74
|
+
end
|
75
|
+
|
76
|
+
# Generates methods for specific value.
|
77
|
+
def status_accessor(field, status_name, prefix = nil)
|
78
|
+
# Shortcut to check status.
|
79
|
+
define_method "#{prefix}#{status_name}?" do
|
80
|
+
self[field] == status_name
|
81
|
+
end
|
82
|
+
|
83
|
+
# Shortcut to update status.
|
84
|
+
define_method "#{prefix}#{status_name}!" do
|
85
|
+
update_attributes!(field => status_name)
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
89
|
+
def field_accessor(field)
|
90
|
+
# Make field accept sympbols.
|
91
|
+
define_method "#{field}=" do |val|
|
92
|
+
val = val.to_s if val.is_a?(Symbol)
|
93
|
+
super(val)
|
94
|
+
end
|
95
|
+
|
96
|
+
# Status as symbol.
|
97
|
+
define_method "#{field}_sym" do
|
98
|
+
val = self[field]
|
99
|
+
val && val.to_sym
|
100
|
+
end
|
101
|
+
end
|
102
|
+
|
103
|
+
def translation_helpers(field)
|
104
|
+
# Class-level translation helper.
|
105
|
+
generate_class_method "#{field}_name" do |status|
|
106
|
+
t(".#{field}_name.#{status}") if status
|
107
|
+
end
|
108
|
+
|
109
|
+
# Translation helper.
|
110
|
+
define_method "#{field}_name" do
|
111
|
+
val = send field
|
112
|
+
self.class.t(".#{field}_name.#{val}") if val
|
113
|
+
end
|
114
|
+
end
|
115
|
+
|
116
|
+
def select_options_helper(field, statuses)
|
117
|
+
translation_method = :"#{field}_name"
|
118
|
+
# Returns array compatible with select_options helper.
|
119
|
+
generate_class_method "#{field}_select_options" do |args = {}|
|
120
|
+
filtered_statuses = statuses - Array.wrap(args[:except])
|
121
|
+
filtered_statuses.map { |x| [send(translation_method, x), x] }
|
122
|
+
end
|
123
|
+
end
|
124
|
+
|
125
|
+
def generate_class_method(method, &block)
|
126
|
+
const_get(:ClassMethods).send(:define_method, method, &block)
|
127
|
+
end
|
128
|
+
end
|
129
|
+
end
|
130
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
require 'hashie'
|
2
|
+
|
3
|
+
module RailsStuff
|
4
|
+
module TestHelpers
|
5
|
+
module Response
|
6
|
+
class << self
|
7
|
+
# Return `Hashie::Mash` for a given object. When `Array` is given
|
8
|
+
# it is mapped to mash recursievly.
|
9
|
+
def prepare_json_object(object)
|
10
|
+
case object
|
11
|
+
when Hash then Hashie::Mash.new(object)
|
12
|
+
when Array then object.map(&method(__callee__))
|
13
|
+
else object
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
# Easy access to json bodies. It parses and return `Hashie::Mash`'es, so
|
19
|
+
# properties can be accessed via method calls:
|
20
|
+
#
|
21
|
+
# response.json_body.order.items.id
|
22
|
+
# # note that hash methods are still present:
|
23
|
+
# response.json_body.order[:key] # instead of order.key
|
24
|
+
def json_body
|
25
|
+
@json_body ||= Response.prepare_json_object(JSON.parse(body))
|
26
|
+
end
|
27
|
+
|
28
|
+
# Makes it easier to debug failed specs.
|
29
|
+
def inspect
|
30
|
+
"<Response(#{status})>"
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
require 'active_support/core_ext/class/attribute'
|
2
|
+
|
3
|
+
module RailsStuff
|
4
|
+
# Adds `types_list` method which tracks all descendants.
|
5
|
+
# Also allows to remove any of descendants from this list.
|
6
|
+
# Useful for STI models to track all available types.
|
7
|
+
#
|
8
|
+
# Railtie adds `to_prepare` callback, which will automatically load types.
|
9
|
+
module TypesTracker
|
10
|
+
class << self
|
11
|
+
def extended(base)
|
12
|
+
base.class_attribute :types_list, instance_accessor: false
|
13
|
+
base.types_list = types_list_class.new
|
14
|
+
end
|
15
|
+
|
16
|
+
# Class for `types_list`. Default to `Array`. You can override it
|
17
|
+
# for all models, or assign new value to specific model
|
18
|
+
# via `lypes_list=` right after extending.
|
19
|
+
attr_accessor :types_list_class
|
20
|
+
end
|
21
|
+
|
22
|
+
self.types_list_class = Array
|
23
|
+
|
24
|
+
# Add `self` to `types_list`.
|
25
|
+
def register_type(*args)
|
26
|
+
if types_list.respond_to?(:add)
|
27
|
+
types_list.add self, *args
|
28
|
+
else
|
29
|
+
types_list << self
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
# Remove `self` from `types_list`.
|
34
|
+
def unregister_type
|
35
|
+
types_list.delete self
|
36
|
+
end
|
37
|
+
|
38
|
+
# Shortcut to eager load all descendants.
|
39
|
+
def eager_load_types!(dir = nil)
|
40
|
+
dir ||= "#{Rails.root}/app/models/#{to_s.underscore}"
|
41
|
+
Dir["#{dir}/*.rb"].each { |file| require_dependency file }
|
42
|
+
end
|
43
|
+
|
44
|
+
# Tracks all descendants automatically.
|
45
|
+
def inherited(base)
|
46
|
+
super
|
47
|
+
base.register_type
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
data/lib/rails_stuff.rb
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
require 'rails_stuff/version'
|
2
|
+
require 'active_support/dependencies/autoload'
|
3
|
+
|
4
|
+
# Useful stuff for Rails.
|
5
|
+
module RailsStuff
|
6
|
+
extend ActiveSupport::Autoload
|
7
|
+
|
8
|
+
autoload :Helpers
|
9
|
+
autoload :NullifyBlankAttrs
|
10
|
+
autoload :ParamsParser
|
11
|
+
autoload :RandomUniqAttr
|
12
|
+
autoload :RedisStorage
|
13
|
+
autoload :ResourcesController
|
14
|
+
autoload :Statusable
|
15
|
+
autoload :SortScope
|
16
|
+
autoload :TypesTracker
|
17
|
+
end
|
18
|
+
|
19
|
+
require 'rails_stuff/railtie' if defined?(Rails::Railtie)
|
data/rails_stuff.gemspec
ADDED
@@ -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 'rails_stuff/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = 'rails_stuff'
|
8
|
+
spec.version = RailsStuff::VERSION::STRING
|
9
|
+
spec.authors = ['Max Melentiev']
|
10
|
+
spec.email = ['m.melentiev@corp.mail.ru']
|
11
|
+
|
12
|
+
spec.summary = 'Collection of useful modules for Rails'
|
13
|
+
spec.homepage = 'https://github.com/printercu/rails_stuff'
|
14
|
+
spec.license = 'MIT'
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(spec)/}) }
|
17
|
+
spec.bindir = 'exe'
|
18
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
19
|
+
spec.require_paths = ['lib']
|
20
|
+
|
21
|
+
spec.add_dependency 'rails', '~> 4.0'
|
22
|
+
|
23
|
+
spec.add_development_dependency 'bundler', '~> 1.8'
|
24
|
+
spec.add_development_dependency 'rake', '~> 10.0'
|
25
|
+
end
|
metadata
ADDED
@@ -0,0 +1,126 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: rails_stuff
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Max Melentiev
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-09-11 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rails
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '4.0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '4.0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: bundler
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.8'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.8'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rake
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '10.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '10.0'
|
55
|
+
description:
|
56
|
+
email:
|
57
|
+
- m.melentiev@corp.mail.ru
|
58
|
+
executables: []
|
59
|
+
extensions: []
|
60
|
+
extra_rdoc_files: []
|
61
|
+
files:
|
62
|
+
- ".gitignore"
|
63
|
+
- ".rspec"
|
64
|
+
- ".rubocop.yml"
|
65
|
+
- ".travis.yml"
|
66
|
+
- Gemfile
|
67
|
+
- LICENSE.txt
|
68
|
+
- README.md
|
69
|
+
- Rakefile
|
70
|
+
- bin/console
|
71
|
+
- bin/git-hooks/pre-commit
|
72
|
+
- bin/install_git_hooks
|
73
|
+
- bin/setup
|
74
|
+
- lib/net/http/debug.rb
|
75
|
+
- lib/rails_stuff.rb
|
76
|
+
- lib/rails_stuff/helpers.rb
|
77
|
+
- lib/rails_stuff/helpers/all.rb
|
78
|
+
- lib/rails_stuff/helpers/bootstrap.rb
|
79
|
+
- lib/rails_stuff/helpers/forms.rb
|
80
|
+
- lib/rails_stuff/helpers/links.rb
|
81
|
+
- lib/rails_stuff/helpers/resource_form.rb
|
82
|
+
- lib/rails_stuff/helpers/text.rb
|
83
|
+
- lib/rails_stuff/helpers/translation.rb
|
84
|
+
- lib/rails_stuff/nullify_blank_attrs.rb
|
85
|
+
- lib/rails_stuff/params_parser.rb
|
86
|
+
- lib/rails_stuff/railtie.rb
|
87
|
+
- lib/rails_stuff/random_uniq_attr.rb
|
88
|
+
- lib/rails_stuff/redis_storage.rb
|
89
|
+
- lib/rails_stuff/resources_controller.rb
|
90
|
+
- lib/rails_stuff/resources_controller/actions.rb
|
91
|
+
- lib/rails_stuff/resources_controller/basic_helpers.rb
|
92
|
+
- lib/rails_stuff/resources_controller/resource_helper.rb
|
93
|
+
- lib/rails_stuff/resources_controller/responder.rb
|
94
|
+
- lib/rails_stuff/resources_controller/sti_helpers.rb
|
95
|
+
- lib/rails_stuff/sort_scope.rb
|
96
|
+
- lib/rails_stuff/statusable.rb
|
97
|
+
- lib/rails_stuff/test_helpers/rails.rb
|
98
|
+
- lib/rails_stuff/test_helpers/response.rb
|
99
|
+
- lib/rails_stuff/types_tracker.rb
|
100
|
+
- lib/rails_stuff/version.rb
|
101
|
+
- rails_stuff.gemspec
|
102
|
+
homepage: https://github.com/printercu/rails_stuff
|
103
|
+
licenses:
|
104
|
+
- MIT
|
105
|
+
metadata: {}
|
106
|
+
post_install_message:
|
107
|
+
rdoc_options: []
|
108
|
+
require_paths:
|
109
|
+
- lib
|
110
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
111
|
+
requirements:
|
112
|
+
- - ">="
|
113
|
+
- !ruby/object:Gem::Version
|
114
|
+
version: '0'
|
115
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
116
|
+
requirements:
|
117
|
+
- - ">="
|
118
|
+
- !ruby/object:Gem::Version
|
119
|
+
version: '0'
|
120
|
+
requirements: []
|
121
|
+
rubyforge_project:
|
122
|
+
rubygems_version: 2.4.6
|
123
|
+
signing_key:
|
124
|
+
specification_version: 4
|
125
|
+
summary: Collection of useful modules for Rails
|
126
|
+
test_files: []
|