active_tools 0.0.2 → 0.0.3

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.
Files changed (35) hide show
  1. data/.gitignore +0 -0
  2. data/Gemfile +0 -0
  3. data/LICENSE.txt +0 -0
  4. data/README.md +0 -0
  5. data/Rakefile +0 -0
  6. data/active_tools.gemspec +2 -2
  7. data/lib/active_tools/action_pack/action_controller/path_helper.rb +47 -0
  8. data/lib/active_tools/action_pack/action_controller.rb +8 -0
  9. data/lib/active_tools/action_pack/action_dispatch/flash_stack.rb +61 -0
  10. data/lib/active_tools/action_pack/action_dispatch.rb +8 -0
  11. data/lib/active_tools/action_pack/action_view/tag_attributes.rb +53 -0
  12. data/lib/active_tools/{actionpack → action_pack}/action_view.rb +1 -1
  13. data/lib/active_tools/actionpack.rb +3 -1
  14. data/lib/active_tools/active_model/delegate_attributes.rb +61 -0
  15. data/lib/active_tools/activemodel.rb +7 -0
  16. data/lib/active_tools/activesupport.rb +0 -0
  17. data/lib/active_tools/bundle.rb +19 -6
  18. data/lib/active_tools/core_extension/deep_copy.rb +7 -3
  19. data/lib/active_tools/core_extension/deep_merge.rb +3 -1
  20. data/lib/active_tools/core_extension/hashup.rb +2 -1
  21. data/lib/active_tools/core_extension/kabuki/crypt.rb +43 -0
  22. data/lib/active_tools/core_extension/kabuki/dump.rb +31 -0
  23. data/lib/active_tools/core_extension/kabuki/zip.rb +39 -0
  24. data/lib/active_tools/core_extension/kabuki.rb +25 -0
  25. data/lib/active_tools/core_extension/merge_hashup.rb +2 -1
  26. data/lib/active_tools/core_extension.rb +1 -20
  27. data/lib/active_tools/engine.rb +0 -0
  28. data/lib/active_tools/misc/input_source.rb +105 -0
  29. data/lib/active_tools/misc/script_flow.rb +82 -0
  30. data/lib/active_tools/misc.rb +9 -0
  31. data/lib/active_tools/railtie.rb +3 -0
  32. data/lib/active_tools/version.rb +1 -1
  33. data/lib/active_tools.rb +0 -0
  34. metadata +20 -6
  35. data/lib/active_tools/actionpack/action_view/alt_rendering.rb +0 -10
data/.gitignore CHANGED
File without changes
data/Gemfile CHANGED
File without changes
data/LICENSE.txt CHANGED
File without changes
data/README.md CHANGED
File without changes
data/Rakefile CHANGED
File without changes
data/active_tools.gemspec CHANGED
@@ -9,8 +9,8 @@ Gem::Specification.new do |gem|
9
9
  gem.authors = ["Valery Kvon"]
10
10
  gem.email = ["addagger@gmail.com"]
11
11
  gem.homepage = %q{http://vkvon.ru/projects/active_tools}
12
- gem.description = %q{Missing tools for Rails developers [under development]}
13
- gem.summary = %q{ActionDispatch, ActiveRecord, ActiveSupport and ActionView extendings}
12
+ gem.description = %q{Missing tools for Rails developers}
13
+ gem.summary = %q{ActionDispatch, ActionController, ActiveModel, ActiveRecord, ActiveSupport, ActionView and core extensions}
14
14
 
15
15
  gem.rubyforge_project = "active_tools"
16
16
 
@@ -0,0 +1,47 @@
1
+ module ActiveTools
2
+ module ActionPack
3
+ module ActionController
4
+ module PathHelper
5
+ extend ::ActiveSupport::Concern
6
+
7
+ included do
8
+ helper_method :path?, :action?, :controller?, :current_action, :current_controller
9
+ end
10
+
11
+ def path?(controller, action = nil)
12
+ controller?(controller) && action?(action)
13
+ end
14
+
15
+ def action?(action)
16
+ actions = case action
17
+ when Array then action.collect {|c| c.to_s}
18
+ when String, Symbol then Array.wrap(action.to_s)
19
+ else nil
20
+ end
21
+ actions.blank? ? true : current_action.in?(actions)
22
+ end
23
+
24
+ def controller?(controller)
25
+ controllers = case controller
26
+ when Array then controller.collect {|c| c.to_s}
27
+ when String, Symbol then Array.wrap(controller.to_s)
28
+ else nil
29
+ end
30
+ controllers.blank? ? true : current_controller.in?(controllers)
31
+ end
32
+
33
+ def current_action
34
+ request.path_parameters[:action]
35
+ end
36
+
37
+ def current_controller
38
+ request.path_parameters[:controller]
39
+ end
40
+ end
41
+ end
42
+ end
43
+
44
+ module OnLoadActionController
45
+ include ActionPack::ActionController::PathHelper
46
+ end
47
+ end
@@ -0,0 +1,8 @@
1
+ require 'active_tools/action_pack/action_controller/path_helper'
2
+
3
+ module ActiveTools
4
+ module ActionPack
5
+ module ActionController
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,61 @@
1
+ module ActiveTools
2
+ module ActionPack
3
+ module ActionDispatch
4
+ module FlashStack
5
+ extend ActiveSupport::Concern
6
+
7
+ included do
8
+ class_eval do
9
+ def empty?
10
+ @flashes.empty? && (@stack.nil? ? true : @stack.empty?)
11
+ end
12
+ end
13
+
14
+ class Stack
15
+ def initialize(flash)
16
+ @flash = flash
17
+ @stack = {}
18
+ end
19
+
20
+ def []=(k,v)
21
+ @stack[k] = Array(v)
22
+ end
23
+
24
+ def [](k)
25
+ @stack[k] ||= []
26
+ end
27
+
28
+ def method_missing(*args, &block)
29
+ @stack.send(*args, &block)
30
+ end
31
+
32
+ def use
33
+ @stack.dup.tap do
34
+ @stack.clear
35
+ end
36
+ end
37
+ end
38
+ end
39
+
40
+ def <<(*hashes)
41
+ hashes.each do |hash|
42
+ hash.each do |k,v|
43
+ Array(v).each do |value|
44
+ stack[k] << value
45
+ end
46
+ end
47
+ end
48
+ end
49
+
50
+ def stack
51
+ @stack ||= Stack.new(self)
52
+ end
53
+ end
54
+ end
55
+ end
56
+
57
+ module OnLoadActiveRecord
58
+ ::ActionDispatch::Flash::FlashHash.send(:include, ActionPack::ActionDispatch::FlashStack)
59
+ end
60
+
61
+ end
@@ -0,0 +1,8 @@
1
+ require 'active_tools/action_pack/action_dispatch/flash_stack'
2
+
3
+ module ActiveTools
4
+ module ActionPack
5
+ module ActionDispatch
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,53 @@
1
+ module ActiveTools
2
+ module ActionPack
3
+ module ActionView
4
+ module TagAttributes
5
+ class Collect
6
+ attr_reader :hash
7
+ def initialize(hash = nil)
8
+ @hash = HashWithIndifferentAccess.new {|h,k| h[k] = Array.new}
9
+ merge(hash) if hash
10
+ end
11
+
12
+ def merge(hash = {})
13
+ type_valid(hash).each {|key, value| self[key] = value}
14
+ self
15
+ end
16
+
17
+ def to_s
18
+ stringify_values.map {|k,v| "#{k}=\"#{v}\"" unless v.blank?}.compact.join(" ").html_safe
19
+ end
20
+
21
+ def [](key)
22
+ @hash[key]
23
+ end
24
+
25
+ def []=(key, value)
26
+ @hash[key] += Array[value]
27
+ end
28
+
29
+ def stringify_values
30
+ Hash[@hash.map {|k,v| [k, v.join(" ")]}]
31
+ end
32
+
33
+ private
34
+
35
+ def type_valid(object = nil)
36
+ raise(TypeError, "Hash or nil expected, #{object.class.name} passed.") unless object.is_a?(Hash) || object.nil?
37
+ object||{}
38
+ end
39
+
40
+ end
41
+ end
42
+ end
43
+ end
44
+
45
+ module OnLoadActionView
46
+
47
+ def tag_attributes(hash = {})
48
+ ActionPack::ActionView::TagAttributes::Collect.new(hash)
49
+ end
50
+
51
+ end
52
+
53
+ end
@@ -1,4 +1,4 @@
1
- require 'active_tools/actionpack/action_view/alt_rendering'
1
+ require 'active_tools/action_pack/action_view/tag_attributes'
2
2
 
3
3
  module ActiveTools
4
4
  module ActionPack
@@ -1,4 +1,6 @@
1
- require 'active_tools/actionpack/action_view'
1
+ require 'active_tools/action_pack/action_controller'
2
+ require 'active_tools/action_pack/action_dispatch'
3
+ require 'active_tools/action_pack/action_view'
2
4
 
3
5
  module ActiveTools
4
6
  module ActionPack
@@ -0,0 +1,61 @@
1
+ module ActiveTools
2
+ module ActiveModel
3
+ module DelegateAttributes
4
+ extend ::ActiveSupport::Concern
5
+
6
+ included do
7
+ class FakeErrors < ::ActiveModel::Errors
8
+ private
9
+ def normalize_message(attribute, message, options)
10
+ message ||= :invalid
11
+ end
12
+ end
13
+
14
+ end
15
+
16
+ module ClassMethods
17
+ def delegate_attributes(*args)
18
+ options = args.extract_options!
19
+ errors_option = options.delete(:errors)
20
+ writer_option = options.delete(:writer)
21
+
22
+ writer_regexp = /=\z/
23
+ readers = args.select {|a| a.to_s !=~ writer_regexp}
24
+ writers = args.select {|a| a.to_s =~ writer_regexp}
25
+ if writer_option == true
26
+ writers += readers.map {|a| "#{a}="}
27
+ end
28
+
29
+ class_eval do
30
+ delegate *(readers + writers), options.dup
31
+ end
32
+
33
+ unless errors_option == false
34
+ class_eval <<-EOV
35
+ validate do
36
+ object = #{options[:to]}
37
+ #{"object.instance_variable_set(:@errors, FakeErrors.new(object))" if errors_option.to_s == "fit"}
38
+ if !object.valid?
39
+ object.errors.messages.each do |attribute, suberrors|
40
+ if attribute.to_s.in? %w{#{readers.join(" ")}}
41
+ suberrors.each do |suberror|
42
+ errors.add(attribute, suberror)
43
+ end
44
+ end
45
+ end
46
+ end
47
+ end
48
+ EOV
49
+ end
50
+ end
51
+ end
52
+
53
+
54
+ end
55
+ end
56
+
57
+ module OnLoadActiveRecord
58
+ ::ActiveModel::Validations.send(:include, ActiveModel::DelegateAttributes)
59
+ end
60
+
61
+ end
@@ -0,0 +1,7 @@
1
+ require 'active_tools/active_model/delegate_attributes'
2
+
3
+ module ActiveTools
4
+ module ActiveModel
5
+
6
+ end
7
+ end
File without changes
@@ -1,8 +1,21 @@
1
- require 'active_tools/core_extension'
2
- require 'active_tools/actionpack'
3
- require 'active_tools/activesupport'
4
-
5
1
  module ActiveTools
6
-
7
-
2
+ module OnLoadActiveRecord
3
+ extend ::ActiveSupport::Concern
4
+ end
5
+
6
+ module OnLoadActionController
7
+ extend ::ActiveSupport::Concern
8
+ end
9
+
10
+ module OnLoadActionView
11
+ extend ::ActiveSupport::Concern
12
+ end
13
+
14
+ module Bundle
15
+ require 'active_tools/core_extension'
16
+ require 'active_tools/actionpack'
17
+ require 'active_tools/activesupport'
18
+ require 'active_tools/activemodel'
19
+ require 'active_tools/misc'
20
+ end
8
21
  end
@@ -4,7 +4,7 @@ module ActiveTools
4
4
  module DeepCopy
5
5
  # Return the 'deep' brand new copy of Hash, Array or Set. All nested hashes/arrays/sets rebuilded at the same way.
6
6
 
7
- module Hash
7
+ module HashExtension
8
8
  def deep_copy(&block)
9
9
  self.class.new.tap do |new_hash|
10
10
  each do |k, v|
@@ -18,7 +18,7 @@ module ActiveTools
18
18
  end
19
19
  end
20
20
 
21
- module Array
21
+ module ArrayExtension
22
22
  def deep_copy(&block)
23
23
  self.class.new.tap do |new_array|
24
24
  each do |v|
@@ -32,7 +32,7 @@ module ActiveTools
32
32
  end
33
33
  end
34
34
 
35
- module Set
35
+ module SetExtension
36
36
  def deep_copy(&block)
37
37
  self.class.new.tap do |new_set|
38
38
  each do |v|
@@ -46,6 +46,10 @@ module ActiveTools
46
46
  end
47
47
  end
48
48
 
49
+ ::Hash.send(:include, HashExtension)
50
+ ::Array.send(:include, ArrayExtension)
51
+ ::Set.send(:include, SetExtension)
52
+
49
53
  end
50
54
  end
51
55
  end
@@ -3,7 +3,7 @@ module ActiveTools
3
3
 
4
4
  module DeepMerge
5
5
 
6
- module Hash
6
+ module HashExtension
7
7
  # Return the merged Hash with another +hash+, where the possible child hashes are also merged.
8
8
  #
9
9
  # === Example:
@@ -30,6 +30,8 @@ module ActiveTools
30
30
  end
31
31
  end
32
32
 
33
+ ::Hash.send(:include, HashExtension)
34
+
33
35
  end
34
36
  end
35
37
  end
@@ -2,7 +2,7 @@ module ActiveTools
2
2
  module CoreExtension
3
3
 
4
4
  module Hashup
5
- module Array
5
+ module ArrayExtension
6
6
  # Return a nested Hash object from Array's elements sequence, where elements used as names of +hash+ keys.
7
7
  # The last element of array would be the last nested value.
8
8
  #
@@ -23,6 +23,7 @@ module ActiveTools
23
23
  end
24
24
  end
25
25
  end
26
+ ::Array.send(:include, ArrayExtension)
26
27
  end
27
28
  end
28
29
  end
@@ -0,0 +1,43 @@
1
+ module ActiveTools
2
+ module CoreExtension
3
+
4
+ module Kabuki
5
+ class Crypt
6
+ def initialize(string, key = nil)
7
+ @key = key||Digest::SHA1.hexdigest("yourpass")
8
+ @string = string
9
+ end
10
+
11
+ def encode
12
+ c = OpenSSL::Cipher::Cipher.new("aes-256-cbc")
13
+ c.encrypt
14
+ c.key = @key
15
+ e = c.update(@string)
16
+ e << c.final
17
+ e
18
+ end
19
+
20
+ def decode
21
+ c = OpenSSL::Cipher::Cipher.new("aes-256-cbc")
22
+ c.decrypt
23
+ c.key = @key
24
+ d = c.update(@string)
25
+ d << c.final
26
+ d
27
+ end
28
+ end
29
+
30
+ module StringExtension
31
+ def kabuki_encrypt
32
+ Kabuki::Crypt.new(self).encode
33
+ end
34
+
35
+ def kabuki_decrypt
36
+ Kabuki::Crypt.new(self).decode
37
+ end
38
+ end
39
+
40
+ ::String.send(:include, StringExtension)
41
+ end
42
+ end
43
+ end
@@ -0,0 +1,31 @@
1
+ module ActiveTools
2
+ module CoreExtension
3
+
4
+ module Kabuki
5
+ class Dump
6
+ def self.encode(object)
7
+ Marshal.dump(object)
8
+ end
9
+
10
+ def self.decode(string)
11
+ Marshal.load(string)
12
+ end
13
+ end
14
+
15
+ module ObjectExtension
16
+ def kabuki_dump
17
+ Kabuki::Dump.encode(self)
18
+ end
19
+ end
20
+
21
+ module StringExtension
22
+ def kabuki_load
23
+ Kabuki::Dump.decode(self)
24
+ end
25
+ end
26
+
27
+ ::Object.send(:include, ObjectExtension)
28
+ ::String.send(:include, StringExtension)
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,39 @@
1
+ module ActiveTools
2
+ module CoreExtension
3
+
4
+ module Kabuki
5
+ class Zip
6
+ def initialize(string)
7
+ @string = string
8
+ end
9
+
10
+ def compress(level=3)
11
+ z = Zlib::Deflate.new(level)
12
+ dst = z.deflate(@string, Zlib::FINISH)
13
+ z.close
14
+ dst
15
+ end
16
+
17
+ def decompress
18
+ zstream = Zlib::Inflate.new
19
+ buf = zstream.inflate(@string)
20
+ zstream.finish
21
+ zstream.close
22
+ buf
23
+ end
24
+ end
25
+
26
+ module StringExtension
27
+ def kabuki_zip
28
+ Kabuki::Zip.new(self).compress
29
+ end
30
+
31
+ def kabuki_unzip
32
+ Kabuki::Zip.new(self).decompress
33
+ end
34
+ end
35
+
36
+ ::String.send(:include, StringExtension)
37
+ end
38
+ end
39
+ end
@@ -0,0 +1,25 @@
1
+ require 'active_tools/core_extension/kabuki/crypt'
2
+ require 'active_tools/core_extension/kabuki/dump'
3
+ require 'active_tools/core_extension/kabuki/zip'
4
+
5
+ module ActiveTools
6
+ module CoreExtension
7
+
8
+ module Kabuki
9
+ module ObjectExtension
10
+ def kabuki!
11
+ Base64.strict_encode64(self.kabuki_dump.kabuki_zip.kabuki_encrypt)
12
+ end
13
+ end
14
+
15
+ module StringExtension
16
+ def kabuki
17
+ Base64.strict_decode64(self).kabuki_decrypt.kabuki_unzip.kabuki_load
18
+ end
19
+ end
20
+
21
+ ::Object.send(:include, ObjectExtension)
22
+ ::String.send(:include, StringExtension)
23
+ end
24
+ end
25
+ end
@@ -4,7 +4,7 @@ module ActiveTools
4
4
  module CoreExtension
5
5
 
6
6
  module MergeHashup
7
- module Hash
7
+ module HashExtension
8
8
  # Merge hashup sequence.
9
9
  #
10
10
  # === Example:
@@ -23,6 +23,7 @@ module ActiveTools
23
23
  end
24
24
 
25
25
  end
26
+ ::Hash.send(:include, HashExtension)
26
27
  end
27
28
  end
28
29
  end
@@ -2,29 +2,10 @@ require 'active_tools/core_extension/deep_copy'
2
2
  require 'active_tools/core_extension/deep_merge'
3
3
  require 'active_tools/core_extension/hashup'
4
4
  require 'active_tools/core_extension/merge_hashup'
5
+ require 'active_tools/core_extension/kabuki'
5
6
 
6
7
  module ActiveTools
7
8
  module CoreExtension
8
9
 
9
- module HashExtension
10
- include DeepCopy::Hash
11
- include DeepMerge::Hash
12
- include MergeHashup::Hash
13
- end
14
-
15
- module ArrayExtension
16
- include DeepCopy::Array
17
- include Hashup::Array
18
- end
19
-
20
- module SetExtension
21
- include DeepCopy::Set
22
- end
23
-
24
- ::Hash.send(:include, HashExtension)
25
- ::Array.send(:include, ArrayExtension)
26
- ::Set.send(:include, SetExtension)
27
-
28
10
  end
29
-
30
11
  end
File without changes
@@ -0,0 +1,105 @@
1
+ module ActiveTools
2
+ module Misc
3
+ module InputSource
4
+ module ErrorsExtension
5
+ extend ::ActiveSupport::Concern
6
+
7
+ included do
8
+ delegate :field_of, :to => :@base
9
+ end
10
+
11
+ def fields
12
+ keys.map {|attribute| field_of(attribute)}.compact.tap do |names|
13
+ names.instance_eval do
14
+ def ids
15
+ self.map(&:to_id)
16
+ end
17
+ end
18
+ end
19
+ end
20
+ end
21
+
22
+ module ConverseParameters
23
+ def converse_parameters(value, prefix = nil, parent = nil)
24
+ case value
25
+ when Hash
26
+ value.each do |k, v|
27
+ new_prefix = prefix ? "#{prefix}[#{k}]" : k
28
+ converse_parameters(v, new_prefix, value)
29
+ end
30
+ when Array
31
+ value.each do |e|
32
+ new_prefix = "#{prefix}[]"
33
+ converse_parameters(e, new_prefix, value)
34
+ end
35
+ else
36
+ value
37
+ end
38
+ value.tap do |v|
39
+ v.singleton_class.send(:undef_method, :belongs_to) if v.respond_to?(:belongs_to)
40
+ v.define_singleton_method :belongs_to do
41
+ parent
42
+ end
43
+ v.singleton_class.send(:undef_method, :input_source) if v.respond_to?(:input_source)
44
+ v.define_singleton_method :input_source do
45
+ prefix.to_s
46
+ end
47
+ end
48
+ end
49
+ end
50
+
51
+ module RequestExtension
52
+ include ConverseParameters
53
+
54
+ private
55
+ def normalize_parameters(value)
56
+ converse_parameters(super)
57
+ end
58
+ end
59
+
60
+ module AttributesAssignment
61
+ def assign_attributes(*args)
62
+ new_attributes = args.first
63
+ if new_attributes.respond_to?(:input_source)
64
+ @input_source = new_attributes.input_source
65
+ end
66
+ super(*args)
67
+ end
68
+
69
+ def field_of(attribute)
70
+ if @input_source && has_attribute?(attribute)
71
+ "#{@input_source}[#{attribute}]".tap do |input_source|
72
+ input_source.instance_eval do
73
+ def to_id
74
+ self.gsub(/\]\[|[^-a-zA-Z0-9:.]/, "_").sub(/_$/, "")
75
+ end
76
+ end
77
+ end
78
+ end
79
+ end
80
+ end
81
+
82
+ end
83
+ end
84
+
85
+ module OnLoadActionController
86
+ ::ActionDispatch::Request.send(:include, Misc::InputSource::RequestExtension)
87
+
88
+ def converse(hash, key)
89
+ converse_parameters(hash[key], key)
90
+ end
91
+
92
+ private
93
+ include Misc::InputSource::ConverseParameters
94
+ end
95
+
96
+ module OnLoadActiveRecord
97
+ ::ActiveModel::Errors.send(:include, Misc::InputSource::ErrorsExtension)
98
+
99
+ if Rails.version >= "3.2.9"
100
+ ::ActiveRecord::AttributeAssignment.send(:include, Misc::InputSource::AttributesAssignment)
101
+ else
102
+ include Misc::InputSource::AttributesAssignment
103
+ end
104
+ end
105
+ end
@@ -0,0 +1,82 @@
1
+ module ActiveTools
2
+ module Misc
3
+ module ScriptFlow
4
+ class Map
5
+ attr_reader :content
6
+
7
+ delegate :any?, :empty?, :to => :content
8
+
9
+ def initialize
10
+ @content = ::ActiveSupport::OrderedHash.new { |h,k| h[k] = ::ActiveSupport::SafeBuffer.new }
11
+ end
12
+
13
+ # Called by _layout_for to read stored values.
14
+ def get(key)
15
+ @content[key]
16
+ end
17
+
18
+ # Called by each renderer object to set the layout contents.
19
+ def set(key, value)
20
+ @content[key] = value
21
+ end
22
+
23
+ # Called by content_for
24
+ def append(key, value)
25
+ @content[key] << value
26
+ end
27
+ alias_method :append!, :append
28
+
29
+ def add_script(script)
30
+ set(script.hash, script)
31
+ end
32
+
33
+ def render
34
+ @content.values.join("\n").html_safe
35
+ end
36
+
37
+ end
38
+ end
39
+ end
40
+
41
+ module OnLoadActionController
42
+ included do
43
+ helper_method :script_flow
44
+ end
45
+
46
+ def script_flow
47
+ @script_flow ||= Misc::ScriptFlow::Map.new
48
+ end
49
+
50
+ def _render_template(options)
51
+ if lookup_context.rendered_format == :js
52
+ super + script_flow.render
53
+ else
54
+ super
55
+ end
56
+ end
57
+ end
58
+
59
+ module OnLoadActionView
60
+ def script(content = nil, &block)
61
+ if content || block_given?
62
+ if block_given?
63
+ content = capture(&block)
64
+ end
65
+ if content
66
+ case request.format
67
+ when Mime::JS then
68
+ script_flow.add_script(content)
69
+ nil
70
+ when Mime::HTML then
71
+ javascript_tag(content)
72
+ end
73
+ end
74
+ end
75
+ end
76
+
77
+ def script_for(identifier, content = nil, &block)
78
+ content_for(identifier, script(content, &block))
79
+ end
80
+ end
81
+
82
+ end
@@ -0,0 +1,9 @@
1
+ require 'active_tools/misc/script_flow'
2
+ require 'active_tools/misc/input_source'
3
+
4
+ module ActiveTools
5
+ module Misc
6
+
7
+
8
+ end
9
+ end
@@ -5,10 +5,13 @@ module ActiveTools
5
5
  class Railtie < ::Rails::Railtie
6
6
  config.before_initialize do
7
7
  ::ActiveSupport.on_load :active_record do
8
+ include OnLoadActiveRecord
8
9
  end
9
10
  ::ActiveSupport.on_load :action_controller do
11
+ include OnLoadActionController
10
12
  end
11
13
  ::ActiveSupport.on_load :action_view do
14
+ include OnLoadActionView
12
15
  end
13
16
  end
14
17
 
@@ -1,3 +1,3 @@
1
1
  module ActiveTools
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
data/lib/active_tools.rb CHANGED
File without changes
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_tools
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-01-19 00:00:00.000000000 Z
12
+ date: 2013-01-24 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -27,7 +27,7 @@ dependencies:
27
27
  - - ! '>='
28
28
  - !ruby/object:Gem::Version
29
29
  version: '0'
30
- description: Missing tools for Rails developers [under development]
30
+ description: Missing tools for Rails developers
31
31
  email:
32
32
  - addagger@gmail.com
33
33
  executables: []
@@ -41,17 +41,30 @@ files:
41
41
  - Rakefile
42
42
  - active_tools.gemspec
43
43
  - lib/active_tools.rb
44
+ - lib/active_tools/action_pack/action_controller.rb
45
+ - lib/active_tools/action_pack/action_controller/path_helper.rb
46
+ - lib/active_tools/action_pack/action_dispatch.rb
47
+ - lib/active_tools/action_pack/action_dispatch/flash_stack.rb
48
+ - lib/active_tools/action_pack/action_view.rb
49
+ - lib/active_tools/action_pack/action_view/tag_attributes.rb
44
50
  - lib/active_tools/actionpack.rb
45
- - lib/active_tools/actionpack/action_view.rb
46
- - lib/active_tools/actionpack/action_view/alt_rendering.rb
51
+ - lib/active_tools/active_model/delegate_attributes.rb
52
+ - lib/active_tools/activemodel.rb
47
53
  - lib/active_tools/activesupport.rb
48
54
  - lib/active_tools/bundle.rb
49
55
  - lib/active_tools/core_extension.rb
50
56
  - lib/active_tools/core_extension/deep_copy.rb
51
57
  - lib/active_tools/core_extension/deep_merge.rb
52
58
  - lib/active_tools/core_extension/hashup.rb
59
+ - lib/active_tools/core_extension/kabuki.rb
60
+ - lib/active_tools/core_extension/kabuki/crypt.rb
61
+ - lib/active_tools/core_extension/kabuki/dump.rb
62
+ - lib/active_tools/core_extension/kabuki/zip.rb
53
63
  - lib/active_tools/core_extension/merge_hashup.rb
54
64
  - lib/active_tools/engine.rb
65
+ - lib/active_tools/misc.rb
66
+ - lib/active_tools/misc/input_source.rb
67
+ - lib/active_tools/misc/script_flow.rb
55
68
  - lib/active_tools/railtie.rb
56
69
  - lib/active_tools/version.rb
57
70
  homepage: http://vkvon.ru/projects/active_tools
@@ -77,5 +90,6 @@ rubyforge_project: active_tools
77
90
  rubygems_version: 1.8.24
78
91
  signing_key:
79
92
  specification_version: 3
80
- summary: ActionDispatch, ActiveRecord, ActiveSupport and ActionView extendings
93
+ summary: ActionDispatch, ActionController, ActiveModel, ActiveRecord, ActiveSupport,
94
+ ActionView and core extensions
81
95
  test_files: []
@@ -1,10 +0,0 @@
1
- module ActiveTools
2
- module ActionPack
3
- module ActionView
4
- module AltRendering
5
-
6
-
7
- end
8
- end
9
- end
10
- end