cosme 0.4.0 → 0.4.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 922d8a8f714d52f5d8c888a06311b626cfb5e6ba
4
- data.tar.gz: 1290c06f5169a29d3d2a4b32b64c1cad65c00ef0
3
+ metadata.gz: ab7a610c759d9d797f0bb69bd8d6629183d08d66
4
+ data.tar.gz: 7f8268a39d7aac18ccbb8387664951038ecd90d7
5
5
  SHA512:
6
- metadata.gz: 2c044f43cc7ed402aa7f55f797d8e919a733bf86d331d8d076737fb8180fe87938441775487cd86e658f696e30c6d536b4f5a229cc18fd199df5c5d75bc37eeb
7
- data.tar.gz: 2a1c613511d5ef325e0281cd6de1c0a190ab3704295fe2e9ced8014b6a7f6cd282f893bc66cf1fcc615f0099e6f2f1bf50aa1bc0e87cbbac36b239018f2d6f4d
6
+ metadata.gz: 64acb2546062d004366560152851adb4cf402889c6e6a934e4af4abcc2452f8ac5b80c8af7227c17d9a30b45dbb4ef281a3ab1acb637816088085c97ccc9565e
7
+ data.tar.gz: d57e6b8566c2bcc4f37f28d7bd6adc4e499488d837224c9fc4a648ef006813307f4d8012823a70a71dc18b72829b4095a96c037a821654b49a16783db387c3e2
data/README.md CHANGED
@@ -33,7 +33,7 @@ Create a cosmetic file into `app/cosmetics`, and call `Cosme#define` method in t
33
33
 
34
34
  * `:controller` - Controller path. eg: 'admin/users' when called in Admin::UsersController. if you not set this option, apply a cosmetic in all controllers.
35
35
 
36
- * `:action` - Action name. eg: 'index' when called in Admin::UsersController#index. if you not set this option, apply a cosmetic in all actions.
36
+ * `:action` - Action name. eg: 'index' when called in \*Controller#index. if you not set this option, apply a cosmetic in all actions.
37
37
 
38
38
  * `:target` - String of [jQuery Selectors](https://api.jquery.com/category/selectors/).
39
39
 
@@ -11,11 +11,11 @@ class Cosme
11
11
 
12
12
  create: ($cosmetic) ->
13
13
  content = $cosmetic.data('content')
14
- return false if content.length <= 0
14
+ return @warning('"data-content" is empty.', $cosmetic) if content.length <= 0
15
15
 
16
16
  target = $cosmetic.data('target')
17
17
  $target = $(target)
18
- return false if $target.length <= 0
18
+ return @warning("Target \"#{target}\" is not found.", $cosmetic) if $target.length <= 0
19
19
 
20
20
  action = $cosmetic.data('action')
21
21
  switch action
@@ -26,4 +26,13 @@ class Cosme
26
26
  when 'replace'
27
27
  $target.replaceWith(content)
28
28
  else
29
- false
29
+ @warning("Undefined action \"#{action}\".", $cosmetic)
30
+
31
+ warning: (message, $element = null) ->
32
+ return unless window.console
33
+ return unless typeof window.console.warn is 'function'
34
+
35
+ messages = ["Cosme warning: #{message}"]
36
+ messages.push($element) if $element
37
+
38
+ console.warn.apply(console, messages)
data/lib/cosme/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Cosme
2
- VERSION = '0.4.0'
2
+ VERSION = '0.4.1'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cosme
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - YOSHIDA Hiroki
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-10-18 00:00:00.000000000 Z
11
+ date: 2015-11-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: actionpack