r_kit 0.3.1 → 0.3.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,7 @@
1
1
  ---
2
- !binary "U0hBMQ==":
3
- metadata.gz: !binary |-
4
- NDU1OThjNDNlODZiZGVjYjY1NTRlNTk1NzRiNTA3YWUwYzBmNTY2YQ==
5
- data.tar.gz: !binary |-
6
- NjYwMzQ1ZDNmMWZlYzVhMTlmMGE1ZDlmZjUxNjk0YTk2ZGQwMWUzMg==
2
+ SHA1:
3
+ metadata.gz: 37ae0ce25844d771e435d1448bb7b18733cbec45
4
+ data.tar.gz: 900e39cc2b92494cedbbdce9f58556622df4da8b
7
5
  SHA512:
8
- metadata.gz: !binary |-
9
- NzQwMDhmMDdkZjI4MDE3ZGRlOWE5YjYwZjVjODE3NDI1ZWM1ODkxMWRjYmZj
10
- MDI3M2EyMTAxMDljMTZjNzM5Nzg1ODVmNjcyMmZmMjNkNmVhOWQwOTkzYzUx
11
- ZGVjYjE2ZmE0MDM4ZDYwNGEzOTZlMjA4OGExMmMyMDA0YjMxZTY=
12
- data.tar.gz: !binary |-
13
- YTQwYTJiNmYxMjRjMTEwNDUzZTdhYjlkNTBiMWIyNTY2MTEyNmYwNTQxZWE2
14
- MzhmY2VmOWUwM2QyZjg2OTFlNGRiMTUzOTlhYzRlYmZmYjg1MmFjZjEzM2Ni
15
- Mjg5NzEyYmNiYzU1Y2JlYzdiYWE0ZGQ0OTllYTgxMmM1MGRmYTU=
6
+ metadata.gz: 1d7db4ae33a413c6c2b5582b041f16fd151c32d3219da1ea70a802f6a2c9abe34a9c216b4aa690731d97d99d9f00ac2e3deb21fd531abf0768cc9d2371115275
7
+ data.tar.gz: 7fee02dc77b0845b938d2dabb911752cbd51a950dfe2767bbbf562369c804e912da7189dc32c7518646e83df863899a6662f59620d872fde24fa5653b12b3a4a
@@ -1,8 +1,24 @@
1
- require 'continuation'
2
-
3
1
  module Kernel
4
2
 
5
- def backtrace &block
3
+ def _backtrace_from_ruby_vm &block
4
+ stack_level = 0
5
+ block ||= ->(obj){ obj != self }
6
+
7
+ RubyVM::DebugInspector.open do |inspector|
8
+ loop do
9
+ stack_binding = begin
10
+ inspector.frame_binding(stack_level += 1)
11
+ rescue ArgumentError
12
+ nil
13
+ end
14
+
15
+ obj = stack_binding.try :eval, 'self'
16
+ return obj if obj != self && block.call(obj)
17
+ end
18
+ end
19
+ end
20
+
21
+ def _backtrace_from_continuation &block
6
22
  cc = nil
7
23
  block ||= ->(obj){ obj != self }
8
24
 
@@ -17,4 +33,11 @@ module Kernel
17
33
  backtrace unless backtrace.is_a? Continuation
18
34
  end
19
35
 
36
+
37
+ if RubyVM.const_defined? "DebugInspector"
38
+ alias :backtrace :_backtrace_from_ruby_vm
39
+ else
40
+ require 'continuation'
41
+ alias :backtrace :_backtrace_from_continuation
42
+ end
20
43
  end
@@ -1,21 +1,21 @@
1
1
  .text-left,
2
2
  .text-left p:not([class*=text-]),
3
3
  [class*=text-] .text-left,
4
- [class*=text-] .text-left p:not([class*=text-]) {
5
- text-align: left;
4
+ [class*=text-] .text-left p:not([class*=text-]) {
5
+ text-align: left;
6
6
  }
7
7
 
8
8
  .text-center,
9
9
  .text-center p:not([class*=text-]),
10
10
  [class*=text-] .text-center,
11
- [class*=text-] .text-center p:not([class*=text-]) {
12
- text-align: center;
11
+ [class*=text-] .text-center p:not([class*=text-]) {
12
+ text-align: center;
13
13
  }
14
14
 
15
15
 
16
16
  .text-right,
17
17
  .text-right p:not([class*=text-]),
18
18
  [class*=text-] .text-right,
19
- [class*=text-] .text-right p:not([class*=text-]) {
20
- text-align: right;
19
+ [class*=text-] .text-right p:not([class*=text-]) {
20
+ text-align: right;
21
21
  }
@@ -5,8 +5,8 @@ html{
5
5
  }
6
6
 
7
7
  body{
8
- background-color: $background-color;
9
- color: $text-color;
8
+ background-color: background-color();
9
+ color: text-color();
10
10
 
11
11
  margin: 0 0 1em;
12
12
  }
@@ -1,5 +1,5 @@
1
1
  a{
2
- color: $link-color;
2
+ color: link-color();
3
3
  text-decoration: none;
4
4
 
5
5
  &:hover{
@@ -1,9 +1,9 @@
1
1
  ul{
2
2
  font-weight: 200;
3
3
  line-height: 1.4em;
4
-
4
+
5
5
  margin: 1.75em 0;
6
6
  padding: 0;
7
-
7
+
8
8
  list-style-type: none;
9
- }
9
+ }
@@ -2,6 +2,6 @@ p{
2
2
  font-weight: 200;
3
3
  line-height: 1.4em;
4
4
  text-align: justify;
5
-
5
+
6
6
  margin: 1.75em 0;
7
7
  }
@@ -3,7 +3,7 @@ h2,
3
3
  h3{
4
4
  font-weight: 200;
5
5
  margin: 1em 0;
6
-
6
+
7
7
  @include link-styled-title;
8
8
  }
9
9
 
@@ -4,6 +4,6 @@
4
4
 
5
5
  padding: .625em;
6
6
 
7
- background-color: $primary-color;
8
- color: $background-color;
7
+ background-color: btn-background-color();
8
+ color: btn-color();
9
9
  }
@@ -12,7 +12,7 @@
12
12
 
13
13
  @mixin top-curved-shadow() {
14
14
  position: relative;
15
-
15
+
16
16
  &:before {
17
17
  @include base-horizontal-curved-shadow;
18
18
  top: 0%;
@@ -21,7 +21,7 @@
21
21
 
22
22
  @mixin bottom-curved-shadow() {
23
23
  position: relative;
24
-
24
+
25
25
  &:after {
26
26
  @include base-horizontal-curved-shadow;
27
27
  bottom: 0%;
@@ -1,6 +1,6 @@
1
1
  @mixin keyframes($name) {
2
2
  @-webkit-keyframes #{$name} {
3
- @content;
3
+ @content;
4
4
  }
5
5
  @-moz-keyframes #{$name} {
6
6
  @content;
@@ -10,5 +10,5 @@
10
10
  }
11
11
  @keyframes #{$name} {
12
12
  @content;
13
- }
14
- }
13
+ }
14
+ }
@@ -1,7 +1,7 @@
1
1
  @mixin link-styled-title() {
2
2
  a{
3
3
  @include unstyled-link();
4
-
4
+
5
5
  &:hover{
6
6
  opacity: .75;
7
7
  text-decoration: none;
@@ -15,4 +15,4 @@
15
15
  opacity: 1;
16
16
  }
17
17
  }
18
- }
18
+ }
@@ -1,3 +1,8 @@
1
+ // $black
2
+ $white: white() !default;
3
+
4
+
5
+
1
6
  $primary-color: primary-color() !default;
2
7
  // $secondary-color: secondary-color() !default;
3
8
 
@@ -1,8 +1,10 @@
1
1
  module Sass::Script::Functions
2
2
 
3
3
  RKit::Css.config.colors.each do |name, value|
4
+ color = Sass::Script.parse value, 0, 0
5
+
4
6
  define_method name do
5
- Sass::Script::String.new value
7
+ color
6
8
  end
7
9
  end
8
10
  end
data/lib/r_kit/css.rb CHANGED
@@ -3,13 +3,17 @@ class RKit::Css < RKit::Core
3
3
  with_engine __FILE__
4
4
  with_sprockets __FILE__
5
5
 
6
+ config :colors, :white, '#fbfbfb'
7
+
6
8
  config :colors, :primary_color, '#b62b2b'
7
9
  config :colors, :text_color, '#888'
8
10
  config :colors, :background_color, '#111'
9
11
 
10
12
 
11
- alias_config :colors, :link_color, :background_color
12
- alias_config :colors, :link_background_color, :primary_color
13
+ alias_config :colors, :btn_color, :background_color
14
+ alias_config :colors, :btn_background_color, :primary_color
15
+
16
+ alias_config :colors, :link_color, :primary_color
13
17
 
14
18
  # unused colors
15
19
  # config :colors, :secondary_color, 'cornflowerblue'
@@ -0,0 +1,26 @@
1
+ module RKit::Decorator::ActionViewBaseExtend
2
+
3
+ def assign new_assigns
4
+ _decorate_assigns new_assigns if RKit::Decorator.config.auto_decoration
5
+
6
+ super
7
+ end
8
+
9
+
10
+ def _decorate_assigns assigns
11
+ assigns.dup.each do |key, value|
12
+ assigns[key] = _decorate value
13
+ end
14
+ end
15
+
16
+ def _decorate assign
17
+ if assign.respond_to? :decorate
18
+ assign.decorate view_context: self
19
+ else
20
+ assign
21
+ end
22
+ end
23
+
24
+
25
+ ActionView::Base.prepend self
26
+ end
@@ -43,14 +43,14 @@ module RKit::Decorator::ActiveRecordExtend
43
43
  end
44
44
 
45
45
 
46
- def decorate_all
47
- all.map(&:decorate)
46
+ def decorate view_context: nil
47
+ all.map{ |record| record.decorate view_context: view_context }
48
48
  end
49
49
 
50
50
 
51
51
  def define_instance_methods
52
- define_method "decorate" do
53
- self.class.decorator_klass.new self
52
+ define_method "decorate" do |view_context: nil|
53
+ self.class.decorator_klass.new self, view_context: view_context
54
54
  end
55
55
  end
56
56
 
@@ -3,15 +3,21 @@ require 'delegate'
3
3
  class RKit::Decorator::Base < SimpleDelegator
4
4
  alias :_obj :__getobj__
5
5
 
6
- def view_context
7
- backtrace{ |obj| obj.is_a? ActionView::Base } || backtrace{ |obj| obj.respond_to? :view_context }.view_context
6
+ def initialize obj, view_context: nil
7
+ @_view_context = view_context
8
+ super obj
8
9
  end
9
10
 
10
11
 
11
- def _h
12
- @view_context ||= view_context
12
+ def _view_context
13
+ backtrace{ |obj| obj.is_a? ActionView::Base } || backtrace{ |obj| obj.respond_to? :view_context }.view_context
13
14
  end
14
15
 
16
+ def view
17
+ @_view_context ||= _view_context
18
+ end
19
+
20
+
15
21
  def === object
16
22
  self == object || __getobj__ == object
17
23
  end
@@ -5,6 +5,9 @@ class RKit::Decorator < RKit::Core
5
5
 
6
6
  load_path __FILE__, 'base.rb'
7
7
 
8
+ load_path __FILE__, 'action_view_base_extend.rb'
8
9
  load_path __FILE__, 'active_record_extend.rb'
9
-
10
+
11
+
12
+ config :auto_decoration, true
10
13
  end
data/lib/r_kit/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module RKit
2
- VERSION = "0.3.1"
2
+ VERSION = "0.3.2"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: r_kit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thomas Petrachi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-06-16 00:00:00.000000000 Z
11
+ date: 2014-07-03 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Rails tools box
14
14
  email:
@@ -17,7 +17,7 @@ executables: []
17
17
  extensions: []
18
18
  extra_rdoc_files: []
19
19
  files:
20
- - .gitignore
20
+ - ".gitignore"
21
21
  - Gemfile
22
22
  - LICENSE.txt
23
23
  - README.md
@@ -30,7 +30,7 @@ files:
30
30
  - lib/r_kit/core/engineer.rb
31
31
  - lib/r_kit/core/loader.rb
32
32
  - lib/r_kit/css.rb
33
- - lib/r_kit/css/lib/assets/stylesheets/r_kit.scss.erb
33
+ - lib/r_kit/css/lib/assets/stylesheets/r_kit.scss
34
34
  - lib/r_kit/css/lib/assets/stylesheets/r_kit/base.scss
35
35
  - lib/r_kit/css/lib/assets/stylesheets/r_kit/base/alignments.scss
36
36
  - lib/r_kit/css/lib/assets/stylesheets/r_kit/base/displays.scss
@@ -54,6 +54,7 @@ files:
54
54
  - lib/r_kit/css/lib/assets/stylesheets/r_kit/variables/colors.scss
55
55
  - lib/r_kit/css/sass_extend.rb
56
56
  - lib/r_kit/decorator.rb
57
+ - lib/r_kit/decorator/action_view_base_extend.rb
57
58
  - lib/r_kit/decorator/active_record_extend.rb
58
59
  - lib/r_kit/decorator/base.rb
59
60
  - lib/r_kit/grid.rb
@@ -81,20 +82,20 @@ require_paths:
81
82
  - lib
82
83
  required_ruby_version: !ruby/object:Gem::Requirement
83
84
  requirements:
84
- - - ! '>='
85
+ - - ">="
85
86
  - !ruby/object:Gem::Version
86
87
  version: '0'
87
88
  required_rubygems_version: !ruby/object:Gem::Requirement
88
89
  requirements:
89
- - - ! '>='
90
+ - - ">="
90
91
  - !ruby/object:Gem::Version
91
92
  version: '0'
92
93
  requirements: []
93
94
  rubyforge_project:
94
- rubygems_version: 2.1.11
95
+ rubygems_version: 2.3.0
95
96
  signing_key:
96
97
  specification_version: 4
97
- summary: ! 'Rails tools box : Core extentions, Pagination, Decorator, CSS, Javascript,
98
+ summary: 'Rails tools box : Core extentions, Pagination, Decorator, CSS, Javascript,
98
99
  and others comming. A flexible gem that hold a number of basics services for rails
99
100
  applications.'
100
101
  test_files: []