bem-on-rails 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0f66d7fdd5df85cb015296b66ec95448402ff0f1
4
- data.tar.gz: 1f2395fd3b5d51a031e66a4c0c7c2cbaf7462b91
3
+ metadata.gz: 528efc9c4ee0620d95e5923c59b8ab349d27cf3f
4
+ data.tar.gz: 094484ca8182ccb9d9e519a65a6868a093e804cb
5
5
  SHA512:
6
- metadata.gz: 69bafa47042962c169f8f2ac8c53bb4652736ff6bb7c113a2921575931a37bad1dfc331a3129954f6f924194a42d42cc07ecee3fe3ee0c8c218d344002d80df0
7
- data.tar.gz: 08f97d4c7e17769d5a5423356b63c80ac6f8833c7f40f0c5c96bb0bef7885faf705bc62b7a373ea7abadef452622d87adafc897535a371b0680c8863ecaac022
6
+ metadata.gz: aefa6d3c4ce10fa5823245a77db22ca88d48d5a5bf2b91b105ad7c8bb575b569cd235c563e54f1266a71f9be63e0b4f7168d2a32560bb3050ea956efff92b2d9
7
+ data.tar.gz: 365656e97e01dd2654133f1fc68efde5a21e8fdf4328309a63605b3ed27277ed7595903b14f9e5fe050905288fe559390e68e329bd17ecf5121ba820a5df783c
data/CHANGELOG.md CHANGED
@@ -20,3 +20,8 @@
20
20
  * more refactoring
21
21
  * add mix functionality
22
22
  * walking to clean code
23
+
24
+ ## v0.0.5
25
+
26
+ * work with levels
27
+ * errors fixes
data/README.md CHANGED
@@ -26,6 +26,10 @@ Then you should run install generator:
26
26
  This generator creates Thor task with templates. You should run to watch your new instruments:
27
27
 
28
28
  $ thor -T
29
+
30
+ If you want use default level, you must be create folders tree for it:
31
+
32
+ $ thor bem:levels -a --default
29
33
 
30
34
  You should restart server after install.
31
35
  You can customize everythink in initializers/bem.rb!
@@ -35,36 +39,52 @@ You can customize everythink in initializers/bem.rb!
35
39
  You can create blocks, elements, modificators and groups for blocks. It's awesome! Also you can remove them and watch lists of blocks, block elements, blocks mods and etc. Try thor help for more info.
36
40
 
37
41
  Default blocks folder structure:
38
- - **blocks**
39
- - **block_name**
40
- - **elements**
41
- - **__element_name**
42
- - __element_name.html.haml
43
- - __element_name.css.sass
44
- - __element_name.coffee
45
- - __element_name.md
46
- - **mods**
47
- - **_mod_name**
48
- - **_mod_value**
49
- - _mod_name.css.sass
50
- - _mod_name.coffee
51
- - _mod_name.md
52
- - block_name.html.haml
53
- - block_name.css.sass
54
- - block_name.coffee
55
- - block_name.md
56
- - **group_name**
57
- - **block_name**
42
+
43
+ - **bem**
44
+ - **level_name**
45
+ - **block_name**
46
+ - **elements**
47
+ - **__element_name**
48
+ - __element_name.html.haml
49
+ - __element_name.css.sass
50
+ - __element_name.coffee
51
+ - __element_name.md
52
+ - **mods**
53
+ - **_mod_name**
54
+ - **_mod_value**
55
+ - _mod_name.css.sass
56
+ - _mod_name.coffee
57
+ - _mod_name.md
58
+ - block_name.html.haml
59
+ - block_name.css.sass
60
+ - block_name.coffee
61
+ - block_name.md
58
62
 
59
63
  You can specify all prefixes for blocks, elements and mods in bem.rb initializer.
60
64
 
65
+ **All blocks now creates on levels.**
66
+
67
+ ### Levels
68
+
69
+ Create new level:
70
+
71
+ $ thor bem:levels -a -n level_name
72
+
73
+ Get from git:
74
+
75
+ $ thor bem:levels -a -g git@github.com:verybigman/bem-controls.git
76
+
77
+ Copy from directory:
78
+
79
+ $ thor bem:levels -a -d ~/path/to/level_name
80
+
61
81
  ### Creating
62
82
 
63
83
  Easy block creating look like:
64
84
 
65
85
  $ thor bem:create -b test
66
86
 
67
- Block with modificator:
87
+ Block with mod:
68
88
 
69
89
  $ thor bem:create -b test -m large
70
90
 
@@ -87,14 +107,12 @@ Element with pretty mod:
87
107
  Block in special technolody:
88
108
  $ thor bem:create -b test -T sass
89
109
 
90
- Element in special tehcnology creates like block. List of know technologies you can see in bem.rb
91
- initializer. You can customize it. After block, element or mod creating generator
92
- adds to assets main file (application) require string. Ex:
110
+ Element in special tehcnology creates like block. List of know technologies you can see in bem.rb initializer. You can customize it. After block, element or mod creating generator adds to level assets (level_name/.bem/assets) main file (level) require string. Ex:
93
111
  ```sass
94
- //= require test/elements/__field/__field.css.sass
112
+ //= require ../../../../test/elements/__field/__field.css.sass
95
113
  ```
96
- You should remember! You are not in any case should not be writing styles and scripts in assets application files.
97
- Use them like configs, for require only. This involves using Sprockets.
114
+ You should remember! You are not in any case should not be writing styles and scripts in assets levels and application files.
115
+ Use them like configuration files, for require only. This involves using Sprockets.
98
116
 
99
117
  ### Rendering
100
118
 
@@ -136,12 +154,12 @@ Now templates exists for haml, sass, coffee and md technologies, but you will cr
136
154
  lib/tasks/templates. For example, you can watch haml template:
137
155
  ```haml
138
156
  - haml_tag this[:tag], this[:attrs]
139
- = content
157
+ = content
140
158
  ```
141
159
  Or Slim template:
142
160
  ```slim
143
161
  * this[:tag], this[:attrs]
144
- = content
162
+ = content
145
163
  ```
146
164
  This and content is BEM helpers for rendering. For access to default essence propeties use 'this' method.
147
165
  For access to custom essence properties use 'ctx' method.
@@ -158,11 +176,9 @@ If you want it, please watch [here](https://github.com/Vasfed/csso-rails).
158
176
  ## Tomorrow
159
177
 
160
178
  0. Incapsulate helpers methods and isolate them from project helpers.
161
- 1. Flag bem.
162
- 2. i-bem.js for html.
163
- 3. deps.js
164
- 4. Mods with restructure. Now you can't use mods with templates(haml, slim and etc.), but they generates.
165
- 5. Bem exutable. Work with Thor is not convenient.
179
+ 1. i-bem.js for html.
180
+ 2. deps.js
181
+ 3. Mods with restructure. Now you can't use mods with templates(haml, slim and etc.), but they generates.
166
182
 
167
183
  ## Contributing
168
184
 
data/ToDo.md ADDED
@@ -0,0 +1,7 @@
1
+ 1. Removing levels.
2
+ 2. Update removing assets lines with Thor:Actions (gsub).
3
+ 3. Creating essences on levels.
4
+ 4. Levels autoordering. Now we write it by hands in initializers/bem.rb.
5
+ 5. Manipulate with essence from parent level in template.
6
+ 6. Right work for Slim. Now it's trouble.
7
+ 7. See here [Stux](https://github.com/inossidabile/styx) for bridge js params from blocks to javascript code.
@@ -4,7 +4,7 @@ module Bemonrails
4
4
 
5
5
  def b(name, builder={})
6
6
  unless name.blank?
7
- path = File.join BEM[:blocks][:dir], build_path_for(:block, builder)
7
+ path = File.join build_path_for(:block, builder, false)
8
8
  target = File.join path, block(name), block(name)
9
9
  get_bemattributes_from builder
10
10
  set_names :block, name
@@ -15,7 +15,7 @@ module Bemonrails
15
15
 
16
16
  def e(name, builder={})
17
17
  unless name.blank?
18
- path = File.join build_path_for(:element, builder)
18
+ path = File.join build_path_for(:element, builder, false)
19
19
  target = File.join path, element(name), element(name)
20
20
  get_bemattributes_from builder
21
21
  set_names :element, name
@@ -33,9 +33,9 @@ module Bemonrails
33
33
  end
34
34
  end
35
35
  @this[:ctx] = builder
36
- # Set defult attrs, if user not set them.
37
- @this[:tag] ||= :div
36
+ @this[:bem] ||= true
38
37
  @this[:attrs] ||= {}
38
+ @this[:tag] ||= :div
39
39
  end
40
40
 
41
41
  def set_names(essence, name)
@@ -50,8 +50,12 @@ module Bemonrails
50
50
 
51
51
  def update_bemattributes
52
52
  classes_array = []
53
- generate_class(@this, classes_array)
54
- install_mix(@this[:mix], classes_array)
53
+ if @this[:bem] == true
54
+ generate_class(@this, classes_array)
55
+ install_mix(@this[:mix], classes_array)
56
+ else
57
+ classes_array.push(@this[:elem] ? @this[:elem] : @this[:block])
58
+ end
55
59
  @this[:attrs].merge!({class: [classes_array, @this[:cls]].join(" ").strip!})
56
60
  end
57
61
 
@@ -1,9 +1,9 @@
1
1
  module Bemonrails
2
2
  module BemNames
3
3
  # Directories paths.
4
- def build_path_for(essence, builder=options)
5
- # I think all block can be in groups
6
- path = [builder[:group]]
4
+ def build_path_for(essence, builder=options, include_level=true)
5
+ current_level = builder[:level] ? builder[:level] : BEM[:level]
6
+ path = include_level ? [current_level] : []
7
7
  case essence
8
8
  when :mod
9
9
  # This is for mods with value
@@ -29,8 +29,8 @@ module Bemonrails
29
29
  File.join(path.compact)
30
30
  end
31
31
 
32
- def path_to_block(path)
33
- BEM[:blocks][:path] + path
32
+ def path_to_block(path, level="")
33
+ File.join Rails.root.join(BEM[:root], level + path)
34
34
  end
35
35
 
36
36
  def generate_names(builder=options)
@@ -51,7 +51,7 @@ module Bemonrails
51
51
  end
52
52
  end
53
53
 
54
- # Generate names for elements, his mods and they values
54
+ # Generate names for elements, they mods and they values
55
55
  if builder[:element]
56
56
 
57
57
  names[:name] = element
@@ -86,7 +86,7 @@ module Bemonrails
86
86
  end
87
87
 
88
88
  def element_directory
89
- block_name = @this[:block] ? @this[:block] : options[:block]
89
+ block_name = @this ? @this[:block] : options[:block]
90
90
  File.join(block(block_name), BEM[:elements][:dir])
91
91
  end
92
92
 
@@ -0,0 +1,10 @@
1
+ module Bemonrails
2
+ module Levels
3
+ def parse_bem_levels
4
+ BEM[:levels].each do |level|
5
+ prepend_view_path File.join(BEM[:root] , level[:name])
6
+ end
7
+ prepend_view_path BEM[:root]
8
+ end
9
+ end
10
+ end
@@ -2,18 +2,17 @@
2
2
  # BEM[:techs][:my_tech] = ".ext"
3
3
 
4
4
  # List of default techs, generating if -T is empty.
5
- # BEM[:default] << :my_tech
5
+ # BEM[:default].push(:my_tech)
6
6
 
7
7
  # Usage files variants. File for Readme about essences.
8
- # BEM[:usage] << :my_tech
8
+ # BEM[:usage].push(:my_tech)
9
9
 
10
10
  # Default directories, try to customize.
11
11
  # Blocks directory in root of rails app.
12
12
  # BEM[:blocks] = {
13
- # dir: "blocks",
14
- # path: Rails.root.join("blocks"),
15
- # prefix: "",
16
- # postfix: ""
13
+ # dir: BEM[:root],
14
+ # prefix: "",
15
+ # postfix: ""
17
16
  # }
18
17
  # Elements and mods directory in every block. Configure it's like blocks.
19
18
  # Write 'dir: ""' for creating elements in root of block.
@@ -24,6 +23,17 @@
24
23
  # ...
25
24
  # }
26
25
 
26
+ # Work with levels
27
+ # Add new level with 'thor bem:levels'
28
+ # Require it:
29
+ # bem_controls = { name: "bem-controls",
30
+ # git: "git@github.com:verybigman/bem-controls.git" }
31
+ # Push to levels stack:
32
+ # BEM[:levels].push(bem_controls)
33
+ # Set it default if you want:
34
+ # BEM[:level] = bem_controls[:name]
35
+ # After install default level is your app name. Take it by BEM[:app].
36
+
27
37
  # [!] If you work with sass and you want to create blocks, elements and mods in sass,
28
38
  # you should convert 'application.css' to 'application.css.sass'. Because, when
29
39
  # blocks, elements or mods creates, technology files will be included to application
@@ -13,7 +13,7 @@ class Bem < Thor
13
13
  method_option :mod, type: :string, aliases: "-m", desc: "Create modificator for block or element."
14
14
  method_option :value, type: :string, aliases: "-v", desc: "Value for modificator."
15
15
  method_option :tech, type: :string, aliases: "-T", desc: "Create essence in spec tech."
16
- method_option :group, type: :string, aliases: "-l", desc: "Create essence in group. Work for blocks only!"
16
+ method_option :level, type: :string, aliases: "-l", desc: "Create essence in level. Work for blocks only!"
17
17
  method_option :force, type: :boolean, desc: "Force existing block, element or mod files."
18
18
  def create
19
19
  path = build_path_for(essence)
@@ -27,7 +27,7 @@ class Bem < Thor
27
27
  method_option :mod, type: :string, aliases: "-m", desc: "Remove modificator for block or element."
28
28
  method_option :value, type: :string, aliases: "-v", desc: "Value for modificator."
29
29
  method_option :tech, type: :string, aliases: "-T", desc: "Remove essence in spec tech."
30
- method_option :group, type: :string, aliases: "-l", desc: "Remove essence in group. Work for blocks only!"
30
+ method_option :level, type: :string, aliases: "-l", desc: "Remove essence in level. Work for blocks only!"
31
31
  def remove
32
32
  path = build_path_for(essence)
33
33
  manipulate_essence(:remove, essence, path)
@@ -39,18 +39,18 @@ class Bem < Thor
39
39
  method_option :element, type: :string, aliases: "-e", desc: "Element usage"
40
40
  method_option :mod, type: :string, aliases: "-m", desc: "Mod usage."
41
41
  method_option :value, type: :string, aliases: "-v", desc: "Mod value usage."
42
- method_option :group, type: :string, aliases: "-l", desc: "Search essence in group."
42
+ method_option :level, type: :string, aliases: "-l", desc: "Search essence in level."
43
43
  def usage
44
44
  path = build_path_for(essence)
45
45
  manipulate_essence(:usage, essence, path)
46
46
  end
47
47
 
48
48
 
49
- desc 'list', 'See list of group, block elements, mods and etc.'
49
+ desc 'list', 'See list of level, block elements, mods and etc.'
50
50
  method_option :block, type: :string, aliases: "-b", desc: "All block elements, mods and mods values"
51
51
  method_option :element, type: :string, aliases: "-e", desc: "All element mods and mods values"
52
52
  method_option :mod, type: :string, aliases: "-m", desc: "All mod values."
53
- method_option :group, type: :string, aliases: "-l", desc: "All blocks in group."
53
+ method_option :level, type: :string, aliases: "-l", desc: "All blocks in level."
54
54
  def list
55
55
  path = essence ? build_path_for(essence) : build_path_for(:block)
56
56
  case essence
@@ -66,10 +66,85 @@ class Bem < Thor
66
66
  end
67
67
  end
68
68
 
69
+ desc 'levels', 'Manipulating with levels'
70
+ method_option :add, type: :boolean, aliases: "-a", desc: "Add new level"
71
+ method_option :git, type: :string, aliases: "-g", desc: "From git repository"
72
+ method_option :dir, type: :string, aliases: "-d", desc: "From local directory"
73
+ method_option :new, type: :string, aliases: "-n", desc: "Create new level"
74
+ method_option :default, type: :string, desc: "Create default level tree"
75
+ def levels
76
+ if options[:add]
77
+ level_name = ""
78
+ level = ""
79
+ if options[:git]
80
+ level_name = options[:git].split("/").last.gsub(".git", "")
81
+ level = Rails.root.join BEM[:root], level_name
82
+ print_message("Cloning blocks into new level: #{ level_name }...", "green")
83
+ `git clone #{ options[:git] } #{ level }`
84
+ test_level(level) ? level_added : level_error
85
+ level_has_assets?(level) ? update_assets_with_level(level_name) : make_level_assets_path(level)
86
+ elsif options[:dir]
87
+ level_name = options[:git].split("/").last
88
+ level = Rails.root.join BEM[:root], level_name
89
+ print_message("Copying blocks into new level: #{ level_name }...", "green")
90
+ `cp -R #{ options[:dir] } #{ level }`
91
+ test_level(level) ? level_added : level_error
92
+ level_has_assets?(level) ? update_assets_with_level(level_name) : make_level_assets_path(level)
93
+ elsif options[:new]
94
+ level_name = options[:new]
95
+ level = Rails.root.join BEM[:root], level_name
96
+ make_level_assets_path level
97
+ update_assets_with_level level_name
98
+ test_level(level) ? level_added : level_error
99
+ elsif options[:default]
100
+ level_name = BEM[:app]
101
+ level = Rails.root.join BEM[:root], level_name
102
+ make_level_assets_path level
103
+ update_assets_with_level level_name
104
+ test_level(level) ? level_added : level_error
105
+ end
106
+ end
107
+ end
108
+
69
109
  protected
70
110
 
111
+ def test_level(level)
112
+ File.directory? level
113
+ end
114
+
115
+ def level_added
116
+ print_message("New level added successfully! Change BEM[:levels] in bem.rb for available levels.", "green")
117
+ end
118
+
119
+ def level_error
120
+ print_message("Error! We have a trouble with connection to repository. Please, try again.", "red")
121
+ end
122
+
123
+ def level_assets_path
124
+ File.join(".bem", "assets")
125
+ end
126
+
127
+ def level_has_assets?(level)
128
+ File.directory? File.join level, level_assets_path
129
+ end
130
+
131
+ def update_assets_with_level(level)
132
+ BEM[:assets].each do |type, tech|
133
+ asset = File.join(Rails.root, "app", "assets", type.to_s, "application" + tech[:ext])
134
+ destination = [level, level_assets_path, type.to_s, "level" + tech[:ext]]
135
+ create_file asset unless File.exist?(asset)
136
+ append_file asset, "\n#{ tech[:import] } #{ File.join(destination) }#{ tech[:postfix] }"
137
+ end
138
+ end
139
+
140
+ def make_level_assets_path(level)
141
+ BEM[:assets].each do |type, tech|
142
+ create_file File.join level, level_assets_path, type.to_s, "level" + tech[:ext]
143
+ end
144
+ end
145
+
71
146
  def essence_exist?(essence_dir)
72
- File.directory?(File.join(BEM[:blocks][:path], essence_dir))
147
+ File.directory? File.join BEM[:blocks][:path], essence_dir
73
148
  end
74
149
 
75
150
  def create_essence(essence_options, path)
@@ -79,7 +154,7 @@ class Bem < Thor
79
154
  # directory. Watch existing templates for example.
80
155
  # What is .tt? It is custom extension for finding templates in other files.
81
156
  if options[:tech] # Maybe recive from command line
82
- template "#{options[:tech]}.tt", File.join(essence_options[:path], path, names[:name], names[:name] + BEM[:techs][options[:tech].to_sym])
157
+ template "#{ options[:tech] }.tt", File.join(essence_options[:dir], path, names[:name], names[:name] + BEM[:techs][options[:tech].to_sym])
83
158
  else
84
159
  create_defaults(essence_options, path, names)
85
160
  end
@@ -87,33 +162,37 @@ class Bem < Thor
87
162
 
88
163
  def create_defaults(essence_options, path, names)
89
164
  BEM[:default].each do |tech|
90
- template "#{tech}.tt", File.join(essence_options[:path], path, names[:name], names[:name] + BEM[:techs][tech])
165
+ template "#{ tech }.tt", File.join(essence_options[:dir], path, names[:name], names[:name] + BEM[:techs][tech])
91
166
  end
92
167
  end
93
168
 
94
169
  def remove_essence(essence_options, path)
95
170
  names = generate_names
96
- destination = File.join(essence_options[:path], path, names[:name])
171
+ destination = File.join(essence_options[:dir], path, names[:name])
97
172
  destination = File.join(destination, names[:name] + BEM[:techs][options[:tech].to_sym]) if options[:tech]
98
- FileUtils.rm_rf(destination)
99
-
100
- puts "\e[0;31m remove\e[0m " + destination.to_s.gsub(Rails.root.to_s + "/", "")
173
+ remove_dir destination
101
174
  end
102
175
 
103
176
  def update_assets(name, path)
177
+ level = BEM[:level]
178
+ level ||= options[:level]
104
179
  BEM[:assets].each do |type, tech|
105
- asset = File.join(Rails.root, "app", "assets", type.to_s, "application" + tech[:ext])
106
- destination = [path, name, name + tech[:ext]].reject(&:empty?)
107
- line = "#{tech[:import]} #{File.join(destination)}#{tech[:postfix]}"
108
- File.open(asset, "a") { |f| f.write("\n" + line) }
180
+ asset = File.join(Rails.root, BEM[:root], level, level_assets_path, type.to_s, "level" + tech[:ext])
181
+ # BEM[:root] > level > .bem > assets
182
+ # 4 ../
183
+ destination = ["../../../../", path, name, name + tech[:ext]].reject(&:empty?)
184
+ create_file asset unless File.exist?(asset)
185
+ append_file asset, "\n#{ tech[:import] } #{ File.join(destination) }#{ tech[:postfix] }"
109
186
  end
110
187
  end
111
188
 
112
189
  def cut_assets(name, path)
190
+ level = BEM[:level]
191
+ level ||= options[:level]
113
192
  BEM[:assets].each do |type, tech|
114
- asset = File.join(Rails.root, "app", "assets", type.to_s, "application" + tech[:ext])
115
- destination = [path, name, name + tech[:ext]].reject(&:empty?)
116
- line = "#{tech[:import]} #{File.join(destination)}#{tech[:postfix]}"
193
+ asset = File.join(Rails.root, BEM[:root], level, level_assets_path, type.to_s, "level" + tech[:ext])
194
+ destination = ["../../../../", path, name, name + tech[:ext]].reject(&:empty?)
195
+ line = "#{ tech[:import] } #{ File.join(destination) }#{ tech[:postfix] }"
117
196
 
118
197
  tmp = Tempfile.new("temp")
119
198
  open(asset, 'r').each do |l|
@@ -180,8 +259,7 @@ class Bem < Thor
180
259
  cut_assets(ess_name, path)
181
260
  when :usage
182
261
  search_usage_information(ess_name, path) if essence_exist?(destination)
183
- else raise print_message("You should set params. Try 'thor help bem:#{action}' for more information", 'red')
262
+ else raise print_message("You should set params. Try 'thor help bem:#{ action }' for more information", 'red')
184
263
  end
185
264
  end
186
-
187
265
  end
@@ -1,6 +1,12 @@
1
1
  BEM = {}
2
2
 
3
- BEM[:attrs] = [:block, :elem, :mods, :elemMods, :bem, :js, :jsAttr, :cls, :tag, :mix, :content]
3
+ BEM[:root] = "bem"
4
+ BEM[:attrs] = [:block, :elem, :mods, :elemMods, :bem, :js, :jsAttr, :cls, :tag, :mix, :content, :attrs]
5
+ BEM[:levels] = []
6
+
7
+ BEM[:app] = Rails.application.class.to_s.split("::").first.underscore.split('_').map(&:downcase).join('-')
8
+ BEM[:levels].push({ name: BEM[:app] }) # levels stack
9
+ BEM[:level] = BEM[:app] # default level
4
10
 
5
11
  # List of known techs.
6
12
  BEM[:techs] = {
@@ -25,8 +31,7 @@ BEM[:usage] = [:md, :wiki]
25
31
  # Default directories, try to customize.
26
32
  # Blocks directory in root of rails app.
27
33
  BEM[:blocks] = {
28
- dir: "blocks",
29
- path: Rails.root.join("blocks"),
34
+ dir: BEM[:root],
30
35
  prefix: "",
31
36
  postfix: ""
32
37
  }
@@ -34,7 +39,6 @@ BEM[:blocks] = {
34
39
  # Write 'dir: ""' for creating elements in root of block.
35
40
  BEM[:elements] = {
36
41
  dir: "elements",
37
- path: BEM[:blocks][:path], # This is individualy for every block
38
42
  prefix: "__",
39
43
  postfix: ""
40
44
  }
@@ -42,7 +46,6 @@ BEM[:elements] = {
42
46
  # Write 'dir: ""' for creating mods in root of block.
43
47
  BEM[:mods] = {
44
48
  dir: "mods",
45
- path: BEM[:blocks][:path], # This is individualy for every block or element
46
49
  prefix: "_",
47
50
  postfix: ""
48
51
  }
@@ -76,4 +79,4 @@ BEM[:assets] = {
76
79
  # You must use application files in
77
80
  # assets as a configs, don't write code in them.
78
81
  # This is need to sprokets includes.
79
- Rails.application.config.assets.paths << BEM[:blocks][:dir]
82
+ Rails.application.config.assets.paths << BEM[:root]
@@ -9,7 +9,8 @@ module Bemonrails
9
9
  end
10
10
 
11
11
  ActiveSupport.on_load :action_controller do
12
- before_filter { prepend_view_path(BEM[:blocks][:dir]) }
12
+ include Bemonrails::Levels
13
+ before_filter :parse_bem_levels
13
14
  end
14
15
  end
15
16
 
@@ -1,3 +1,3 @@
1
1
  module Bemonrails
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
data/lib/bem-on-rails.rb CHANGED
@@ -2,6 +2,7 @@ require "bem-on-rails/version"
2
2
  require "bem-on-rails/engine"
3
3
  require "bem-on-rails/build/bem_names"
4
4
  require "bem-on-rails/build/console_messages"
5
+ require "bem-on-rails/build/levels"
5
6
  require "bem-on-rails/generators/install_generator"
6
7
  require 'bem-on-rails/railtie' if defined?(Rails)
7
8
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bem-on-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Anton Winogradov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-09-22 00:00:00.000000000 Z
11
+ date: 2013-11-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -80,12 +80,14 @@ files:
80
80
  - LICENSE
81
81
  - README.md
82
82
  - Rakefile
83
+ - ToDo.md
83
84
  - app/helpers/bemonrails/bem_render_helper.rb
84
85
  - app/views/bemonrails/essences/_content.html.haml
85
86
  - bem-on-rails.gemspec
86
87
  - lib/bem-on-rails.rb
87
88
  - lib/bem-on-rails/build/bem_names.rb
88
89
  - lib/bem-on-rails/build/console_messages.rb
90
+ - lib/bem-on-rails/build/levels.rb
89
91
  - lib/bem-on-rails/engine.rb
90
92
  - lib/bem-on-rails/generators/install_generator.rb
91
93
  - lib/bem-on-rails/generators/templates/config/initializer.tt.rb