bem 1.0.0 → 1.1.0

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: 0d2af2c63a4e9b5cfaf19f80154ca2d68a166a69
4
- data.tar.gz: f1f114a392a7538fd561aaad7cb92972d3555b35
3
+ metadata.gz: 6b0671cfc07f6456f95f35f2915f870648e847bd
4
+ data.tar.gz: e1a6ad054d2531e76cb276b5fda058fbf293259b
5
5
  SHA512:
6
- metadata.gz: b99f58dcf4150b3e63bce1f150ad3f4d662c8c03e3f0e17f4f0a643e6e6eeac6f9f1ebce8b07d5c8540f1428a96538786c8663840be4197dbc0d0590939ca067
7
- data.tar.gz: f41c04967225654d1d90a235ccdcd80c8ba2df75479c3119f94538ce94e8937bbfc2ef52dd1b0efed4b45381dbc1c68d1c08ef439d025d764da1fb1ce95f4973
6
+ metadata.gz: 2ed7dedeb47e34a91efaedbd518d06e9f91697cc584c8aa06ef8f01dd927c7623f6b967d5b6d3a0bd879efb1fbf71336e84ac4bc323e6891b94ccb3926e31aff
7
+ data.tar.gz: 7925bb652a94a4469f44c31dfd026ab806e6e8e677a712b05a919332072db3b19e3fac85ad9047e566b61db84268eb043e5ee9c3620e4b380a549dc9c9258ccd
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Bem
2
2
 
3
- TODO: Write a gem description
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
- TODO: Write usage instructions here
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 = ' Ruby library for working with BEM in rails projects '
12
- spec.description = ' Ruby library for working with BEM in rails projects '
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
- manifest = File.join(Rails.root, 'app', 'assets', tech[:group], options[:manifest] + tech[:extension])
52
+ manifest_name = options[:manifest].present? ? options[:manifest] : 'application'
53
53
 
54
- level = level_path(options[:level], tech)
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, level.split("#{ tech[:group] }/").last.sub(tech[:extension], ''))
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)
@@ -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
@@ -1,3 +1,3 @@
1
1
  module Bem
2
- VERSION = '1.0.0'
2
+ VERSION = '1.1.0'
3
3
  end
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.0.0
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-04 00:00:00.000000000 Z
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: ' Ruby library for working with BEM in rails projects '
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: {}