bem 1.0.0 → 1.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 +4 -4
- data/README.md +67 -2
- data/bem.gemspec +3 -3
- data/lib/bem/actions.rb +8 -5
- data/lib/bem/commands_tasks.rb +1 -0
- data/lib/bem/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6b0671cfc07f6456f95f35f2915f870648e847bd
|
4
|
+
data.tar.gz: e1a6ad054d2531e76cb276b5fda058fbf293259b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2ed7dedeb47e34a91efaedbd518d06e9f91697cc584c8aa06ef8f01dd927c7623f6b967d5b6d3a0bd879efb1fbf71336e84ac4bc323e6891b94ccb3926e31aff
|
7
|
+
data.tar.gz: 7925bb652a94a4469f44c31dfd026ab806e6e8e677a712b05a919332072db3b19e3fac85ad9047e566b61db84268eb043e5ee9c3620e4b380a549dc9c9258ccd
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# Bem
|
2
2
|
|
3
|
-
|
3
|
+
Ruby library for working with BEM(http://bem.info/) in rails projects.
|
4
4
|
|
5
5
|
## Installation
|
6
6
|
|
@@ -15,10 +15,75 @@ And then execute:
|
|
15
15
|
Or install it yourself as:
|
16
16
|
|
17
17
|
$ gem install bem
|
18
|
+
|
19
|
+
Then you must create config file:
|
20
|
+
|
21
|
+
$ rails g bem:install
|
22
|
+
|
23
|
+
And spring config file if you want to use bem command with `spring` as `spring bem create`
|
24
|
+
|
25
|
+
$ rails g bem:spring
|
26
|
+
|
27
|
+
After that stop `spring`
|
28
|
+
|
29
|
+
$ spring stop
|
30
|
+
|
31
|
+
And now you can use command `spring bem create` instead of just `bem create`. `spring` command significantly increase speed of blocks creation.
|
18
32
|
|
19
33
|
## Usage
|
20
34
|
|
21
|
-
|
35
|
+
You can create blocks, elements, modificators, levels and manifests with command `bem create`
|
36
|
+
|
37
|
+
This command create structure like that
|
38
|
+
|
39
|
+
levelname
|
40
|
+
block-name
|
41
|
+
__element-name
|
42
|
+
_mode-name.scss
|
43
|
+
block-name__element-name_mod-name_value.scss
|
44
|
+
block-name__element-name.scss
|
45
|
+
_mod-name
|
46
|
+
block-name_mod-name_value.scss
|
47
|
+
block_name.css.sass
|
48
|
+
|
49
|
+
Which is exactly the same as shown here http://bem.info/tools/bem/bem-tools/levels/
|
50
|
+
|
51
|
+
It accepts these options:
|
52
|
+
|
53
|
+
Options:
|
54
|
+
-b, [--block=BLOCK] # Create or use given block.
|
55
|
+
-e, [--element=ELEMENT] # Create or use given element.
|
56
|
+
-m, [--modificator=MODIFICATOR] # Create modificator.
|
57
|
+
-v, [--value=VALUE] # Value for modificator.
|
58
|
+
-l, [--level=LEVEL] # Create or use given level.
|
59
|
+
-a, [--manifest=MANIFEST] # Manifests to append level
|
60
|
+
-j, [--js], [--no-js] # Do create assets with javascripts
|
61
|
+
# Default: true
|
62
|
+
-s, [--css], [--no-css] # Do create assets with stylesheets
|
63
|
+
# Default: true
|
64
|
+
|
65
|
+
It will automatically include appropriate information in corresponding levels and manifests.
|
66
|
+
For adjust technologies and css directives use config/initializers/bem.rb
|
67
|
+
|
68
|
+
For detail information about this command:
|
69
|
+
|
70
|
+
$ bem help create
|
71
|
+
|
72
|
+
For destroy blocks, elements, modificators, levels and manifests use command `bem destroy`. It makes undo of `bem create` command. It accepts these options:
|
73
|
+
|
74
|
+
Options:
|
75
|
+
-b, [--block=BLOCK] # Destroy or use given block.
|
76
|
+
-e, [--element=ELEMENT] # Destroy or use give element.
|
77
|
+
-m, [--mod=MOD] # Destroy modificator.
|
78
|
+
-v, [--value=VALUE] # Value for modificator.
|
79
|
+
-l, [--level=LEVEL] # Destroy or use given level.
|
80
|
+
-a, [--manifest=MANIFEST] # Manifests to append level
|
81
|
+
|
82
|
+
For detail information about this command:
|
83
|
+
|
84
|
+
$ bem help destroy
|
85
|
+
|
86
|
+
This application https://github.com/gkopylov/bem_with_rails_and_less_example_app was created for demonstrate of using this gem.
|
22
87
|
|
23
88
|
## Contributing
|
24
89
|
|
data/bem.gemspec
CHANGED
@@ -8,9 +8,9 @@ Gem::Specification.new do |spec|
|
|
8
8
|
spec.version = Bem::VERSION
|
9
9
|
spec.authors = ['Kopylov German']
|
10
10
|
spec.email = ['roverrr@gmail.com']
|
11
|
-
spec.summary = '
|
12
|
-
spec.description = '
|
13
|
-
spec.homepage = ''
|
11
|
+
spec.summary = 'Ruby library for working with BEM in rails projects'
|
12
|
+
spec.description = 'Ruby library for working with BEM in rails projects'
|
13
|
+
spec.homepage = 'https://github.com/gkopylov/bem'
|
14
14
|
spec.license = 'MIT'
|
15
15
|
|
16
16
|
spec.files = `git ls-files -z`.split("\x0")
|
data/lib/bem/actions.rb
CHANGED
@@ -6,9 +6,9 @@ module BEM
|
|
6
6
|
|
7
7
|
handle_bem(options, tech) if options[:block].present?
|
8
8
|
|
9
|
-
handle_level(options, tech)
|
9
|
+
handle_level(options, tech) unless options[:include_to_manifest]
|
10
10
|
|
11
|
-
handle_manifest(options, tech) if options[:manifest].present?
|
11
|
+
handle_manifest(options, tech) if options[:manifest].present? || options[:include_to_manifest]
|
12
12
|
end
|
13
13
|
end
|
14
14
|
|
@@ -49,13 +49,16 @@ module BEM
|
|
49
49
|
end
|
50
50
|
|
51
51
|
def handle_manifest(options, tech)
|
52
|
-
|
52
|
+
manifest_name = options[:manifest].present? ? options[:manifest] : 'application'
|
53
53
|
|
54
|
-
|
54
|
+
manifest = File.join(Rails.root, 'app', 'assets', tech[:group], manifest_name + tech[:extension])
|
55
|
+
|
56
|
+
path = options[:include_to_manifest] ? build_path_for(tech[:extension], options, tech[:group]) :
|
57
|
+
level_path(options[:level], tech)
|
55
58
|
|
56
59
|
File.exist?(manifest) ? (puts("#{ manifest } already exists") if !options[:block].present?) : create_file(manifest)
|
57
60
|
|
58
|
-
append_file manifest, string_to_append(tech,
|
61
|
+
append_file manifest, string_to_append(tech, path.split("#{ tech[:group] }/").last.sub(tech[:extension], ''))
|
59
62
|
end
|
60
63
|
|
61
64
|
def build_path_for(extension, options, group)
|
data/lib/bem/commands_tasks.rb
CHANGED
@@ -15,6 +15,7 @@ class CommandsTasks < Thor
|
|
15
15
|
method_option :manifest, :type => :string, :aliases => '-a', :desc => 'Manifests to append level'
|
16
16
|
method_option :js, :default => true, :type => :boolean, :aliases => '-j', :desc => 'Do create assets with javascripts'
|
17
17
|
method_option :css, :default => true, :type => :boolean, :aliases => '-s', :desc => 'Do create assets with stylesheets'
|
18
|
+
method_option :include_to_manifest, :type => :boolean, :aliases => '-i', :desc => 'Include css asset to manifest'
|
18
19
|
def create
|
19
20
|
build_with options
|
20
21
|
end
|
data/lib/bem/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bem
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kopylov German
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-07-
|
11
|
+
date: 2014-07-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -122,7 +122,7 @@ dependencies:
|
|
122
122
|
- - '>='
|
123
123
|
- !ruby/object:Gem::Version
|
124
124
|
version: '0'
|
125
|
-
description:
|
125
|
+
description: Ruby library for working with BEM in rails projects
|
126
126
|
email:
|
127
127
|
- roverrr@gmail.com
|
128
128
|
executables:
|
@@ -152,7 +152,7 @@ files:
|
|
152
152
|
- lib/generators/bem/spring/templates/spring.rb
|
153
153
|
- spec/actions_spec.rb
|
154
154
|
- spec/spec_helper.rb
|
155
|
-
homepage:
|
155
|
+
homepage: https://github.com/gkopylov/bem
|
156
156
|
licenses:
|
157
157
|
- MIT
|
158
158
|
metadata: {}
|