bem 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +18 -0
- data/.rspec +3 -0
- data/.rubocop.yml +13 -0
- data/Gemfile +3 -0
- data/LICENSE.txt +22 -0
- data/README.md +29 -0
- data/Rakefile +1 -0
- data/bem.gemspec +29 -0
- data/bin/bem +11 -0
- data/lib/bem/actions.rb +101 -0
- data/lib/bem/commands_tasks.rb +32 -0
- data/lib/bem/configuration.rb +25 -0
- data/lib/bem/version.rb +3 -0
- data/lib/bem.rb +8 -0
- data/lib/generators/bem/install/install_generator.rb +20 -0
- data/lib/generators/bem/install/templates/bem.rb +7 -0
- data/lib/generators/bem/install/templates/technologies/js.tt +11 -0
- data/lib/generators/bem/install/templates/technologies/scss.tt +3 -0
- data/lib/generators/bem/spring/spring_generator.rb +13 -0
- data/lib/generators/bem/spring/templates/spring.rb +15 -0
- data/spec/actions_spec.rb +123 -0
- data/spec/spec_helper.rb +92 -0
- metadata +181 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 0d2af2c63a4e9b5cfaf19f80154ca2d68a166a69
|
4
|
+
data.tar.gz: f1f114a392a7538fd561aaad7cb92972d3555b35
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: b99f58dcf4150b3e63bce1f150ad3f4d662c8c03e3f0e17f4f0a643e6e6eeac6f9f1ebce8b07d5c8540f1428a96538786c8663840be4197dbc0d0590939ca067
|
7
|
+
data.tar.gz: f41c04967225654d1d90a235ccdcd80c8ba2df75479c3119f94538ce94e8937bbfc2ef52dd1b0efed4b45381dbc1c68d1c08ef439d025d764da1fb1ce95f4973
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.rubocop.yml
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2014 Kopylov German
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
# Bem
|
2
|
+
|
3
|
+
TODO: Write a gem description
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
gem 'bem'
|
10
|
+
|
11
|
+
And then execute:
|
12
|
+
|
13
|
+
$ bundle
|
14
|
+
|
15
|
+
Or install it yourself as:
|
16
|
+
|
17
|
+
$ gem install bem
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
|
21
|
+
TODO: Write usage instructions here
|
22
|
+
|
23
|
+
## Contributing
|
24
|
+
|
25
|
+
1. Fork it ( http://github.com/<my-github-username>/bem/fork )
|
26
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
27
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
28
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
29
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
data/bem.gemspec
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'bem/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = 'bem'
|
8
|
+
spec.version = Bem::VERSION
|
9
|
+
spec.authors = ['Kopylov German']
|
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 = ''
|
14
|
+
spec.license = 'MIT'
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0")
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ['lib']
|
20
|
+
|
21
|
+
spec.add_development_dependency 'bundler'
|
22
|
+
spec.add_development_dependency 'rake'
|
23
|
+
spec.add_development_dependency 'rspec'
|
24
|
+
spec.add_development_dependency 'rubocop'
|
25
|
+
spec.add_development_dependency 'simplecov'
|
26
|
+
spec.add_development_dependency 'thor'
|
27
|
+
spec.add_development_dependency 'pry'
|
28
|
+
spec.add_development_dependency 'rails'
|
29
|
+
end
|
data/bin/bem
ADDED
data/lib/bem/actions.rb
ADDED
@@ -0,0 +1,101 @@
|
|
1
|
+
module BEM
|
2
|
+
module Actions
|
3
|
+
def build_with(options = {})
|
4
|
+
BEM.configuration.technologies.each do |tech|
|
5
|
+
next puts("#{ tech[:group] } are omitted") unless build?(tech[:group], options)
|
6
|
+
|
7
|
+
handle_bem(options, tech) if options[:block].present?
|
8
|
+
|
9
|
+
handle_level(options, tech)
|
10
|
+
|
11
|
+
handle_manifest(options, tech) if options[:manifest].present?
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
def destroy_with(options = {})
|
16
|
+
BEM.configuration.technologies.each do |tech|
|
17
|
+
path = build_path_for(tech[:extension], options, tech[:group])
|
18
|
+
|
19
|
+
remove_file File.expand_path('..', path)
|
20
|
+
|
21
|
+
level = level_path(options[:level], tech)
|
22
|
+
|
23
|
+
path_without_extension = path.split("#{ tech[:group] }/").last.sub(tech[:extension], '')
|
24
|
+
|
25
|
+
gsub_file(level, string_to_append(tech, path_without_extension), '') if File.exist? level
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
private
|
30
|
+
|
31
|
+
def handle_bem(options, tech)
|
32
|
+
path = build_path_for(tech[:extension], options, tech[:group])
|
33
|
+
|
34
|
+
@css_class = File.basename(path, tech[:extension]) if tech[:group] == 'stylesheets'
|
35
|
+
|
36
|
+
template("#{ tech[:name] }.tt", path)
|
37
|
+
end
|
38
|
+
|
39
|
+
def handle_level(options, tech)
|
40
|
+
path = build_path_for(tech[:extension], options, tech[:group])
|
41
|
+
|
42
|
+
level = level_path(options[:level], tech)
|
43
|
+
|
44
|
+
File.exist?(level) ? (puts("#{ level } already exists") unless options[:block].present?) : create_file(level)
|
45
|
+
|
46
|
+
path_without_extension = path.split("#{ tech[:group] }/").last.sub(tech[:extension], '')
|
47
|
+
|
48
|
+
append_file(level, string_to_append(tech, path_without_extension)) if options[:block].present?
|
49
|
+
end
|
50
|
+
|
51
|
+
def handle_manifest(options, tech)
|
52
|
+
manifest = File.join(Rails.root, 'app', 'assets', tech[:group], options[:manifest] + tech[:extension])
|
53
|
+
|
54
|
+
level = level_path(options[:level], tech)
|
55
|
+
|
56
|
+
File.exist?(manifest) ? (puts("#{ manifest } already exists") if !options[:block].present?) : create_file(manifest)
|
57
|
+
|
58
|
+
append_file manifest, string_to_append(tech, level.split("#{ tech[:group] }/").last.sub(tech[:extension], ''))
|
59
|
+
end
|
60
|
+
|
61
|
+
def build_path_for(extension, options, group)
|
62
|
+
b, e, m, v, t = options[:block], options[:element], options[:modificator], options[:value], extension
|
63
|
+
|
64
|
+
level = options[:level].present? ? options[:level] : Rails.application.class.parent_name.to_s.parameterize
|
65
|
+
|
66
|
+
path = [Rails.root.to_s, 'app', 'assets', group, level]
|
67
|
+
|
68
|
+
if b.present? && e.present? && m.present?
|
69
|
+
path += [b, "__#{ e }", "_#{ m }", "#{ b }__#{ e }_#{ m }#{ "_#{ v }" if v.present? }#{ t }"]
|
70
|
+
elsif b.present? && e.present?
|
71
|
+
path += [b, "__#{ e }", "#{ b }__#{ e + t }"]
|
72
|
+
elsif b.present? && m.present?
|
73
|
+
path += [b, "_#{ m }", "#{ b }_#{ m }#{ "_#{ v }" if v.present? }#{ t }"]
|
74
|
+
elsif b.present?
|
75
|
+
path += [b, "#{ b + t }"]
|
76
|
+
else
|
77
|
+
path += [level + t]
|
78
|
+
end
|
79
|
+
|
80
|
+
File.join(path.compact)
|
81
|
+
end
|
82
|
+
|
83
|
+
def build?(technology_group, options)
|
84
|
+
(options[:css] && technology_group == 'stylesheets') || (options[:js] && technology_group == 'javascripts')
|
85
|
+
end
|
86
|
+
|
87
|
+
def level_path(level_name, technology)
|
88
|
+
level = level_name.present? ? level_name : Rails.application.class.parent_name.to_s.parameterize
|
89
|
+
|
90
|
+
File.join(Rails.root.to_s, 'app', 'assets', technology[:group], level, "#{ level + technology[:extension] }")
|
91
|
+
end
|
92
|
+
|
93
|
+
def string_to_append(technology, path)
|
94
|
+
if technology[:group] == 'stylesheets'
|
95
|
+
"\n#{ technology[:css_directive] } #{ technology[:css_prefix] + path + technology[:css_postfix] }"
|
96
|
+
elsif technology[:group] == 'javascripts'
|
97
|
+
"\n//= require #{ path }"
|
98
|
+
end
|
99
|
+
end
|
100
|
+
end
|
101
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
class CommandsTasks < Thor
|
2
|
+
include BEM::Actions
|
3
|
+
include Thor::Actions
|
4
|
+
|
5
|
+
def self.source_root
|
6
|
+
File.join(Rails.root.to_s, 'lib', 'bem', 'templates')
|
7
|
+
end
|
8
|
+
|
9
|
+
desc 'create', 'Create level, block, element or modificator'
|
10
|
+
method_option :block, :type => :string, :aliases => '-b', :desc => 'Create or use given block.'
|
11
|
+
method_option :element, :type => :string, :aliases => '-e', :desc => 'Create or use given element.'
|
12
|
+
method_option :modificator, :type => :string, :aliases => '-m', :desc => 'Create modificator.'
|
13
|
+
method_option :value, :type => :string, :aliases => '-v', :desc => 'Value for modificator.'
|
14
|
+
method_option :level, :type => :string, :aliases => '-l', :desc => 'Create or use given level.'
|
15
|
+
method_option :manifest, :type => :string, :aliases => '-a', :desc => 'Manifests to append level'
|
16
|
+
method_option :js, :default => true, :type => :boolean, :aliases => '-j', :desc => 'Do create assets with javascripts'
|
17
|
+
method_option :css, :default => true, :type => :boolean, :aliases => '-s', :desc => 'Do create assets with stylesheets'
|
18
|
+
def create
|
19
|
+
build_with options
|
20
|
+
end
|
21
|
+
|
22
|
+
desc 'destroy', 'Destroy level, block, element or modificator'
|
23
|
+
method_option :block, :type => :string, :aliases => '-b', :desc => 'Destroy or use given block.'
|
24
|
+
method_option :element, :type => :string, :aliases => '-e', :desc => 'Destroy or use give element.'
|
25
|
+
method_option :mod, :type => :string, :aliases => '-m', :desc => 'Destroy modificator.'
|
26
|
+
method_option :value, :type => :string, :aliases => '-v', :desc => 'Value for modificator.'
|
27
|
+
method_option :level, :type => :string, :aliases => '-l', :desc => 'Destroy or use given level.'
|
28
|
+
method_option :manifest, :type => :string, :aliases => '-a', :desc => 'Manifests to append level'
|
29
|
+
def destroy
|
30
|
+
destroy_with options
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module BEM
|
2
|
+
class Configuration
|
3
|
+
attr_accessor :technologies, :css_directive
|
4
|
+
|
5
|
+
def initialize
|
6
|
+
@technologies = [
|
7
|
+
{ :group => 'stylesheets', :extension => '.scss', :name => 'scss',
|
8
|
+
:css_directive => '@import', :css_prefix => "'", :css_postfix => "';" },
|
9
|
+
{ :group => 'javascripts', :extension => '.js', :name => 'js' }
|
10
|
+
]
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
class << self
|
15
|
+
def configuration
|
16
|
+
@configuration ||= Configuration.new
|
17
|
+
end
|
18
|
+
|
19
|
+
attr_writer :configuration
|
20
|
+
|
21
|
+
def configure
|
22
|
+
yield configuration
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
data/lib/bem/version.rb
ADDED
data/lib/bem.rb
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
require 'rails/generators/base'
|
2
|
+
|
3
|
+
module Bem
|
4
|
+
module Generators
|
5
|
+
class InstallGenerator < Rails::Generators::Base
|
6
|
+
source_root File.expand_path('../templates', __FILE__)
|
7
|
+
|
8
|
+
def copy_initializer
|
9
|
+
template 'bem.rb', File.join(Rails.root, 'config', 'initializers', 'bem.rb')
|
10
|
+
end
|
11
|
+
|
12
|
+
def copy_technologies_templates
|
13
|
+
BEM.configuration.technologies.each do |tech|
|
14
|
+
copy_file "technologies/#{ tech[:name] }.tt",
|
15
|
+
File.join(Rails.root, 'lib', 'bem', 'templates', "#{ tech[:name] }.tt")
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,7 @@
|
|
1
|
+
BEM.configure do |config|
|
2
|
+
config.technologies = [
|
3
|
+
{ :group => 'stylesheets', :extension => '.scss', :name => 'scss',
|
4
|
+
:css_directive => '@import', :css_prefix => "'", :css_postfix => "';" },
|
5
|
+
{ :group => 'javascripts', :extension => '.js', :name => 'js' }
|
6
|
+
]
|
7
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
require 'rails/generators/base'
|
2
|
+
|
3
|
+
module Bem
|
4
|
+
module Generators
|
5
|
+
class SpringGenerator < Rails::Generators::Base
|
6
|
+
source_root File.expand_path('../templates', __FILE__)
|
7
|
+
|
8
|
+
def copy_spring_config
|
9
|
+
template 'spring.rb', File.join(Rails.root, 'config', 'spring.rb')
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,123 @@
|
|
1
|
+
describe BEM::Actions do
|
2
|
+
describe '#build_with' do
|
3
|
+
before do
|
4
|
+
class DummyClass < Thor
|
5
|
+
include BEM::Actions
|
6
|
+
include Thor::Actions
|
7
|
+
|
8
|
+
def self.source_root
|
9
|
+
File.join(File.dirname(__FILE__), 'sandbox')
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
@dummy_object = DummyClass.new
|
14
|
+
|
15
|
+
@dummy_object.create_file 'spec/sandbox/scss.tt'
|
16
|
+
|
17
|
+
Rails.stub(:root).and_return(sandbox_root)
|
18
|
+
|
19
|
+
Rails.application.class.stub(:parent_name).and_return('fakeapp')
|
20
|
+
end
|
21
|
+
|
22
|
+
subject { @dummy_object.build_with(options) }
|
23
|
+
|
24
|
+
describe 'when empty default options' do
|
25
|
+
before do
|
26
|
+
@dummy_object.remove_file "#{ sandbox_root }/app/assets/javascripts/fakeapp/fakeapp.js"
|
27
|
+
|
28
|
+
@dummy_object.remove_file "#{ sandbox_root }/app/assets/stylesheets/fakeapp/fakeapp.scss"
|
29
|
+
end
|
30
|
+
|
31
|
+
def options
|
32
|
+
{ :js => true, :css => true }
|
33
|
+
end
|
34
|
+
|
35
|
+
it { expect(capture(:stdout) { subject }).to match " create spec/sandbox/app/assets/stylesheets/fakeapp/fakeapp.scss\n create spec/sandbox/app/assets/javascripts/fakeapp/fakeapp.js\n"
|
36
|
+
}
|
37
|
+
end
|
38
|
+
|
39
|
+
describe 'when create only stylesheets' do
|
40
|
+
before do
|
41
|
+
@dummy_object.remove_file "#{ sandbox_root }/app/assets/stylesheets/fakeapp/fakeapp.scss"
|
42
|
+
end
|
43
|
+
|
44
|
+
def options
|
45
|
+
{ :css => true }
|
46
|
+
end
|
47
|
+
|
48
|
+
it { expect(capture(:stdout) { subject }).to match " create spec/sandbox/app/assets/stylesheets/fakeapp/fakeapp.scss\n"
|
49
|
+
}
|
50
|
+
end
|
51
|
+
|
52
|
+
describe 'when create only specific level' do
|
53
|
+
before do
|
54
|
+
@dummy_object.remove_file "#{ sandbox_root }/app/assets/stylesheets/somelevel/somelevel.scss"
|
55
|
+
end
|
56
|
+
|
57
|
+
def options
|
58
|
+
{ :css => true, :level => 'somelevel' }
|
59
|
+
end
|
60
|
+
|
61
|
+
it { expect(capture(:stdout) { subject }).to match " create spec/sandbox/app/assets/stylesheets/somelevel/somelevel.scss\njavascripts are omitted\n"
|
62
|
+
}
|
63
|
+
end
|
64
|
+
|
65
|
+
describe 'when create a block' do
|
66
|
+
before do
|
67
|
+
@dummy_object.remove_file "#{ sandbox_root }/app/assets/stylesheets/fakeapp/someblock/someblock.scss"
|
68
|
+
end
|
69
|
+
|
70
|
+
def options
|
71
|
+
{ :css => true, :block => 'someblock' }
|
72
|
+
end
|
73
|
+
|
74
|
+
it { expect(capture(:stdout) { subject }).to match " create spec/sandbox/app/assets/stylesheets/fakeapp/someblock/someblock.scss\n append spec/sandbox/app/assets/stylesheets/fakeapp/fakeapp.scss\njavascripts are omitted\n"
|
75
|
+
}
|
76
|
+
end
|
77
|
+
|
78
|
+
describe 'when create an element within a block' do
|
79
|
+
before do
|
80
|
+
@dummy_object.remove_file "#{ sandbox_root }/app/assets/stylesheets/fakeapp/someblock/someblock.scss"
|
81
|
+
|
82
|
+
@dummy_object.remove_file "#{ sandbox_root }/app/assets/stylesheets/fakeapp/someblock/__someelement/someblock__someelement.scss"
|
83
|
+
end
|
84
|
+
|
85
|
+
def options
|
86
|
+
{ :css => true, :block => 'someblock', :element => 'someelement' }
|
87
|
+
end
|
88
|
+
|
89
|
+
it { expect(capture(:stdout) { subject }).to match " create spec/sandbox/app/assets/stylesheets/fakeapp/someblock/__someelement/someblock__someelement.scss\n append spec/sandbox/app/assets/stylesheets/fakeapp/fakeapp.scss\njavascripts are omitted\n"
|
90
|
+
}
|
91
|
+
end
|
92
|
+
|
93
|
+
describe 'when create a block modificator' do
|
94
|
+
before do
|
95
|
+
@dummy_object.remove_file "#{ sandbox_root }/app/assets/stylesheets/fakeapp/someblock/someblock.scss"
|
96
|
+
|
97
|
+
@dummy_object.remove_file "#{ sandbox_root }/app/assets/stylesheets/fakeapp/someblock/_somemod/someblock_somemod.scss"
|
98
|
+
end
|
99
|
+
|
100
|
+
def options
|
101
|
+
{ :css => true, :block => 'someblock', :modificator => 'somemod' }
|
102
|
+
end
|
103
|
+
|
104
|
+
it { expect(capture(:stdout) { subject }).to match " create spec/sandbox/app/assets/stylesheets/fakeapp/someblock/_somemod/someblock_somemod.scss\n append spec/sandbox/app/assets/stylesheets/fakeapp/fakeapp.scss\njavascripts are omitted\n"
|
105
|
+
}
|
106
|
+
end
|
107
|
+
|
108
|
+
describe 'when create an element modificator within a block' do
|
109
|
+
before do
|
110
|
+
@dummy_object.remove_file "#{ sandbox_root }/app/assets/stylesheets/fakeapp/someblock/someblock.scss"
|
111
|
+
|
112
|
+
@dummy_object.remove_file "#{ sandbox_root }/app/assets/stylesheets/fakeapp/someblock/__someelement/_somemod/someblock__someelement_somemod.scss"
|
113
|
+
end
|
114
|
+
|
115
|
+
def options
|
116
|
+
{ :css => true, :block => 'someblock', :modificator => 'somemod', :element => 'someelement' }
|
117
|
+
end
|
118
|
+
|
119
|
+
it { expect(capture(:stdout) { subject }).to match " create spec/sandbox/app/assets/stylesheets/fakeapp/someblock/__someelement/_somemod/someblock__someelement_somemod.scss\n append spec/sandbox/app/assets/stylesheets/fakeapp/fakeapp.scss\njavascripts are omitted\n"
|
120
|
+
}
|
121
|
+
end
|
122
|
+
end
|
123
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,92 @@
|
|
1
|
+
require 'simplecov'
|
2
|
+
|
3
|
+
SimpleCov.start do
|
4
|
+
add_filter '/spec/'
|
5
|
+
end
|
6
|
+
|
7
|
+
require 'rails'
|
8
|
+
require 'pry'
|
9
|
+
require 'bem'
|
10
|
+
|
11
|
+
# This file was generated by the `rspec --init` command. Conventionally, all
|
12
|
+
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
|
13
|
+
# The generated `.rspec` file contains `--require spec_helper` which will cause this
|
14
|
+
# file to always be loaded, without a need to explicitly require it in any files.
|
15
|
+
#
|
16
|
+
# Given that it is always loaded, you are encouraged to keep this file as
|
17
|
+
# light-weight as possible. Requiring heavyweight dependencies from this file
|
18
|
+
# will add to the boot time of your test suite on EVERY test run, even for an
|
19
|
+
# individual file that may not need all of that loaded. Instead, make a
|
20
|
+
# separate helper file that requires this one and then use it only in the specs
|
21
|
+
# that actually need it.
|
22
|
+
#
|
23
|
+
# The `.rspec` file also contains a few flags that are not defaults but that
|
24
|
+
# users commonly want.
|
25
|
+
#
|
26
|
+
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
|
27
|
+
RSpec.configure do |config|
|
28
|
+
def sandbox_root
|
29
|
+
File.join(File.dirname(__FILE__), "sandbox")
|
30
|
+
end
|
31
|
+
|
32
|
+
# The settings below are suggested to provide a good initial experience
|
33
|
+
# with RSpec, but feel free to customize to your heart's content.
|
34
|
+
=begin
|
35
|
+
# These two settings work together to allow you to limit a spec run
|
36
|
+
# to individual examples or groups you care about by tagging them with
|
37
|
+
# `:focus` metadata. When nothing is tagged with `:focus`, all examples
|
38
|
+
# get run.
|
39
|
+
config.filter_run :focus
|
40
|
+
config.run_all_when_everything_filtered = true
|
41
|
+
|
42
|
+
# Many RSpec users commonly either run the entire suite or an individual
|
43
|
+
# file, and it's useful to allow more verbose output when running an
|
44
|
+
# individual spec file.
|
45
|
+
if config.files_to_run.one?
|
46
|
+
# Use the documentation formatter for detailed output,
|
47
|
+
# unless a formatter has already been configured
|
48
|
+
# (e.g. via a command-line flag).
|
49
|
+
config.default_formatter = 'doc'
|
50
|
+
end
|
51
|
+
|
52
|
+
# Print the 10 slowest examples and example groups at the
|
53
|
+
# end of the spec run, to help surface which specs are running
|
54
|
+
# particularly slow.
|
55
|
+
config.profile_examples = 10
|
56
|
+
|
57
|
+
# Run specs in random order to surface order dependencies. If you find an
|
58
|
+
# order dependency and want to debug it, you can fix the order by providing
|
59
|
+
# the seed, which is printed after each run.
|
60
|
+
# --seed 1234
|
61
|
+
config.order = :random
|
62
|
+
|
63
|
+
# Seed global randomization in this process using the `--seed` CLI option.
|
64
|
+
# Setting this allows you to use `--seed` to deterministically reproduce
|
65
|
+
# test failures related to randomization by passing the same `--seed` value
|
66
|
+
# as the one that triggered the failure.
|
67
|
+
Kernel.srand config.seed
|
68
|
+
|
69
|
+
# rspec-expectations config goes here. You can use an alternate
|
70
|
+
# assertion/expectation library such as wrong or the stdlib/minitest
|
71
|
+
# assertions if you prefer.
|
72
|
+
config.expect_with :rspec do |expectations|
|
73
|
+
# Enable only the newer, non-monkey-patching expect syntax.
|
74
|
+
# For more details, see:
|
75
|
+
# - http://myronmars.to/n/dev-blog/2012/06/rspecs-new-expectation-syntax
|
76
|
+
expectations.syntax = :expect
|
77
|
+
end
|
78
|
+
|
79
|
+
# rspec-mocks config goes here. You can use an alternate test double
|
80
|
+
# library (such as bogus or mocha) by changing the `mock_with` option here.
|
81
|
+
config.mock_with :rspec do |mocks|
|
82
|
+
# Enable only the newer, non-monkey-patching expect syntax.
|
83
|
+
# For more details, see:
|
84
|
+
# - http://teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
|
85
|
+
mocks.syntax = :expect
|
86
|
+
|
87
|
+
# Prevents you from mocking or stubbing a method that does not exist on
|
88
|
+
# a real object. This is generally recommended.
|
89
|
+
mocks.verify_partial_doubles = true
|
90
|
+
end
|
91
|
+
=end
|
92
|
+
end
|
metadata
ADDED
@@ -0,0 +1,181 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: bem
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Kopylov German
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-07-04 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - '>='
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - '>='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - '>='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rubocop
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - '>='
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: simplecov
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - '>='
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - '>='
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: thor
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - '>='
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - '>='
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: pry
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - '>='
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - '>='
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: rails
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - '>='
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - '>='
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
125
|
+
description: ' Ruby library for working with BEM in rails projects '
|
126
|
+
email:
|
127
|
+
- roverrr@gmail.com
|
128
|
+
executables:
|
129
|
+
- bem
|
130
|
+
extensions: []
|
131
|
+
extra_rdoc_files: []
|
132
|
+
files:
|
133
|
+
- .gitignore
|
134
|
+
- .rspec
|
135
|
+
- .rubocop.yml
|
136
|
+
- Gemfile
|
137
|
+
- LICENSE.txt
|
138
|
+
- README.md
|
139
|
+
- Rakefile
|
140
|
+
- bem.gemspec
|
141
|
+
- bin/bem
|
142
|
+
- lib/bem.rb
|
143
|
+
- lib/bem/actions.rb
|
144
|
+
- lib/bem/commands_tasks.rb
|
145
|
+
- lib/bem/configuration.rb
|
146
|
+
- lib/bem/version.rb
|
147
|
+
- lib/generators/bem/install/install_generator.rb
|
148
|
+
- lib/generators/bem/install/templates/bem.rb
|
149
|
+
- lib/generators/bem/install/templates/technologies/js.tt
|
150
|
+
- lib/generators/bem/install/templates/technologies/scss.tt
|
151
|
+
- lib/generators/bem/spring/spring_generator.rb
|
152
|
+
- lib/generators/bem/spring/templates/spring.rb
|
153
|
+
- spec/actions_spec.rb
|
154
|
+
- spec/spec_helper.rb
|
155
|
+
homepage: ''
|
156
|
+
licenses:
|
157
|
+
- MIT
|
158
|
+
metadata: {}
|
159
|
+
post_install_message:
|
160
|
+
rdoc_options: []
|
161
|
+
require_paths:
|
162
|
+
- lib
|
163
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
164
|
+
requirements:
|
165
|
+
- - '>='
|
166
|
+
- !ruby/object:Gem::Version
|
167
|
+
version: '0'
|
168
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
169
|
+
requirements:
|
170
|
+
- - '>='
|
171
|
+
- !ruby/object:Gem::Version
|
172
|
+
version: '0'
|
173
|
+
requirements: []
|
174
|
+
rubyforge_project:
|
175
|
+
rubygems_version: 2.1.11
|
176
|
+
signing_key:
|
177
|
+
specification_version: 4
|
178
|
+
summary: Ruby library for working with BEM in rails projects
|
179
|
+
test_files:
|
180
|
+
- spec/actions_spec.rb
|
181
|
+
- spec/spec_helper.rb
|