evil-front-rails 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: bf64230064531dcb5038ce2444a24379ba0b579e
4
+ data.tar.gz: 3231bfb01f2ffc4aea64137663a8859700d0a59d
5
+ SHA512:
6
+ metadata.gz: 6e517154aa698c723f1aa230399c2309719e68f3d84865080572923b3ce9da746a57ede0464d10cd43e0e5ae5f038fee0c736675992ca151daa7155576d11582
7
+ data.tar.gz: 6566af73cac039d06025bdf81eadb8f6c3a6f9ad2445a027fe57f1795c92409fbdfd0b0b7b38aed5b707ab2458b43a34680f01505131c5fd65083c22f459d441
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ --format documentation --colour
@@ -0,0 +1,3 @@
1
+ ## 0.1 “Hellespontus Montes”
2
+
3
+ * Initial release.
data/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright 2013 Andrey Sitnik <andrey@sitnik.ru>
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
6
+ this software and associated documentation files (the "Software"), to deal in
7
+ the Software without restriction, including without limitation the rights to
8
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9
+ the Software, and to permit persons to whom the Software is furnished to do so,
10
+ subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17
+ FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18
+ COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19
+ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20
+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,13 @@
1
+ require 'rubygems'
2
+
3
+ require 'bundler/setup'
4
+ Bundler::GemHelper.install_tasks
5
+
6
+ require 'rspec/core/rake_task'
7
+ RSpec::Core::RakeTask.new
8
+ task default: :spec
9
+
10
+ task :clobber_package do
11
+ rm_r 'pkg' rescue nil
12
+ end
13
+ task clobber: [:clobber_package]
@@ -0,0 +1,26 @@
1
+ require File.expand_path('../lib/evil-front/rails/version', __FILE__)
2
+
3
+ Gem::Specification.new do |s|
4
+ s.platform = Gem::Platform::RUBY
5
+ s.name = 'evil-front-rails'
6
+ s.version = EvilFront::Rails::VERSION
7
+ s.date = Time.now.strftime('%Y-%m-%d')
8
+ s.summary = 'Helpers, Sass mixins, JS shortcuts, workflow and ' +
9
+ 'Rails settings from Evil Martians'
10
+
11
+ s.author = 'Andrey Sitnik'
12
+ s.email = 'andrey@sitnik.ru'
13
+ s.homepage = 'https://github.com/ai/evil-front'
14
+ s.license = 'MIT'
15
+
16
+ s.files = `git ls-files`.split("\n")
17
+ s.extra_rdoc_files = ['LICENSE']
18
+ s.require_path = 'lib'
19
+
20
+ s.add_dependency 'evil-front-all', EvilFront::VERSION.dup
21
+
22
+ s.add_dependency 'rails', '>= 3'
23
+ s.add_dependency 'sass-rails', '>= 3.2.6'
24
+ s.add_dependency 'slim-rails', '>= 1.1.0'
25
+ s.add_dependency 'coffee-rails', '>= 3.2.2'
26
+ end
@@ -0,0 +1,33 @@
1
+ require 'evil-front-all'
2
+
3
+ require 'sass-rails'
4
+ require 'slim-rails'
5
+
6
+ module EvilFront
7
+ class Railtie < ::Rails::Railtie
8
+ initializer 'evil_front.config' do |app|
9
+ # Disable assets and helper per controller
10
+ app.config.generators.stylesheets = false
11
+ app.config.generators.javascripts = false
12
+ app.config.generators.helper = false
13
+
14
+ # Precompile all JS/CSS in root of app assets dirs.
15
+ app.config.assets.precompile +=
16
+ Dir[::Rails.root.join('app/assets/*/*.{js,css,coffee,sass,scss}*')].
17
+ map { |i| File.basename(i).sub(/(\.js)?\.coffee$/, '.js') }.
18
+ map { |i| File.basename(i).sub(/(\.css)?\.(sass|scss)$/, '.css') }.
19
+ reject { |i| i =~ /^application\.(js|css)$/ }
20
+
21
+ # Sass debug in Chrome
22
+ if ::Rails.env.development?
23
+ app.config.sass.debug_info = true
24
+ end
25
+ end
26
+
27
+ initializer 'evil_front.action_view' do
28
+ ActiveSupport.on_load(:action_view) { include Helpers }
29
+ end
30
+ end
31
+ end
32
+
33
+ require_relative 'evil-front/rails/version'
@@ -0,0 +1,5 @@
1
+ module EvilFront
2
+ module Rails
3
+ VERSION = '0.1.0' unless defined? EvilFront::Rails::VERSION
4
+ end
5
+ end
@@ -0,0 +1,2 @@
1
+ /log
2
+ /tmp
@@ -0,0 +1,2 @@
1
+ class ApplicationController < ActionController::Base
2
+ end
@@ -0,0 +1,7 @@
1
+ class HelpersController < ApplicationController
2
+
3
+ def head
4
+ render layout: 'head'
5
+ end
6
+
7
+ end
@@ -0,0 +1,2 @@
1
+ = flying_quotes do
2
+ b text
@@ -0,0 +1,2 @@
1
+ - head_content do
2
+ style a {}
@@ -0,0 +1,2 @@
1
+ - content_for(:evil_libraries) { '<link src="a" />'.html_safe }
2
+ = standard_assets
@@ -0,0 +1,2 @@
1
+ = russian_typograph do
2
+ b= '"<ф>"'
@@ -0,0 +1 @@
1
+ = standard_assets
@@ -0,0 +1 @@
1
+ = tel('+5 55', class: 'phone', data: { role: 'call' })
@@ -0,0 +1,2 @@
1
+ = head_tag(statistics: false) do
2
+ title 2
@@ -0,0 +1,4 @@
1
+ = head_tag do
2
+ title 1
3
+
4
+ = yield
@@ -0,0 +1,2 @@
1
+ require ::File.expand_path('../config/environment', __FILE__)
2
+ run Rails.application
@@ -0,0 +1,14 @@
1
+ require File.expand_path('../boot', __FILE__)
2
+
3
+ require "action_controller/railtie"
4
+ require "sprockets/railtie"
5
+
6
+ if defined?(Bundler)
7
+ Bundler.require(*Rails.groups(assets: %w(development test)))
8
+ end
9
+
10
+ module App
11
+ class Application < Rails::Application
12
+ config.encoding = "utf-8"
13
+ end
14
+ end
@@ -0,0 +1,2 @@
1
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
2
+ require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE'])
@@ -0,0 +1,2 @@
1
+ require File.expand_path('../application', __FILE__)
2
+ App::Application.initialize!
@@ -0,0 +1,11 @@
1
+ App::Application.configure do
2
+ config.cache_classes = true
3
+ config.serve_static_assets = true
4
+ config.static_cache_control = "public, max-age=3600"
5
+ config.eager_load = false
6
+ config.consider_all_requests_local = true
7
+ config.action_controller.perform_caching = false
8
+ config.action_dispatch.show_exceptions = false
9
+ config.action_controller.allow_forgery_protection = false
10
+ config.active_support.deprecation = :stderr
11
+ end
@@ -0,0 +1 @@
1
+ App::Application.config.secret_key_base = 'test'
@@ -0,0 +1,3 @@
1
+ App::Application.routes.draw do
2
+ get ':controller/:action'
3
+ end
@@ -0,0 +1,116 @@
1
+ # encoding: utf-8
2
+
3
+ require_relative 'spec_helper'
4
+
5
+ describe HelpersController, type: :controller do
6
+ render_views
7
+
8
+ describe 'flying_quotes' do
9
+
10
+ it 'accepts blocks' do
11
+ get :flying_quotes
12
+ response.should be_success
13
+ response.body.should == '<span class="space-before-quote"> </span>' +
14
+ '<span class="quotes">«<b>text</b>»</span>'
15
+ end
16
+
17
+ end
18
+
19
+ describe 'russian_typograph' do
20
+
21
+ it 'accepts blocks' do
22
+ get :russian_typograph
23
+ response.should be_success
24
+ response.body.should == '<b><span class="quotes">«&lt;ф&gt;»</span></b>'
25
+ end
26
+
27
+ end
28
+
29
+ describe 'head_tag' do
30
+ before do
31
+ @env = Rails.env
32
+ end
33
+
34
+ after do
35
+ Rails.env = @env
36
+ end
37
+
38
+ it 'generates head tag content' do
39
+ get :head
40
+ response.should be_success
41
+ response.body.should == '<head><meta charset="UTF-8" />' +
42
+ '<title>1</title><style>a {}</style></head>'
43
+ end
44
+
45
+ it 'adds statistics in production' do
46
+ Rails.env = ActiveSupport::StringInquirer.new('production')
47
+ get :head
48
+ response.should be_success
49
+ response.body.should == '<head><meta charset="UTF-8" />' +
50
+ "<title>1</title><style>a {}</style>stat\n</head>"
51
+ end
52
+
53
+ it 'ignores statistics on demand' do
54
+ Rails.env = ActiveSupport::StringInquirer.new('production')
55
+ get :unstat
56
+ response.should be_success
57
+ response.body.should == '<head><meta charset="UTF-8" />' +
58
+ '<title>2</title></head>'
59
+ end
60
+
61
+ end
62
+
63
+ describe 'standard_assets' do
64
+
65
+ it 'includes links' do
66
+ Rails.env = ActiveSupport::StringInquirer.new('development')
67
+ get :standard_assets
68
+ response.should be_success
69
+ response.body.should ==
70
+ '<link href="/stylesheets/application.css" ' +
71
+ 'media="all" rel="stylesheet" />' +
72
+ '<script src="/assets/jquery.js"></script>' +
73
+ '<script src="/javascripts/application.js"></script>'
74
+ end
75
+
76
+ it 'includes CDN jQuery' do
77
+ Rails.env = ActiveSupport::StringInquirer.new('production')
78
+ get :standard_assets
79
+ response.should be_success
80
+ response.body.should ==
81
+ '<link href="/stylesheets/application.css" ' +
82
+ 'media="all" rel="stylesheet" />' +
83
+ '<script src="//ajax.googleapis.com/ajax/libs/' +
84
+ 'jquery/2.0.3/jquery.min.js"></script>' +
85
+ "<script>window.jQuery || " +
86
+ "document.write(unescape('%3Cscript " +
87
+ "src=\"/assets/jquery.js\">%3C/script>'))</script>" +
88
+ '<script src="/javascripts/application.js"></script>'
89
+ end
90
+
91
+ it 'includes additional libraries' do
92
+ Rails.env = ActiveSupport::StringInquirer.new('development')
93
+ get :library
94
+ response.should be_success
95
+ response.body.should ==
96
+ '<link href="/stylesheets/application.css" ' +
97
+ 'media="all" rel="stylesheet" />' +
98
+ '<script src="/assets/jquery.js"></script>' +
99
+ '<link src="a" />' +
100
+ '<script src="/javascripts/application.js"></script>'
101
+ end
102
+
103
+ end
104
+
105
+ describe 'tel' do
106
+
107
+ it 'renders telephone link' do
108
+ get :tel
109
+ response.should be_success
110
+ response.body.should == '<a class="tel phone" data-role="call" ' +
111
+ 'href="tel:+555">+5 55</a>'
112
+ end
113
+
114
+ end
115
+
116
+ end
@@ -0,0 +1,6 @@
1
+ ENV['RAILS_ENV'] ||= 'test'
2
+
3
+ require_relative 'app/config/environment'
4
+ require_relative '../lib/evil-front-rails'
5
+
6
+ require 'rspec/rails'
metadata ADDED
@@ -0,0 +1,143 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: evil-front-rails
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Andrey Sitnik
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-01-09 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: evil-front-all
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - '='
18
+ - !ruby/object:Gem::Version
19
+ version: 0.1.0
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - '='
25
+ - !ruby/object:Gem::Version
26
+ version: 0.1.0
27
+ - !ruby/object:Gem::Dependency
28
+ name: rails
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '3'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '3'
41
+ - !ruby/object:Gem::Dependency
42
+ name: sass-rails
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: 3.2.6
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: 3.2.6
55
+ - !ruby/object:Gem::Dependency
56
+ name: slim-rails
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: 1.1.0
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: 1.1.0
69
+ - !ruby/object:Gem::Dependency
70
+ name: coffee-rails
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: 3.2.2
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: 3.2.2
83
+ description:
84
+ email: andrey@sitnik.ru
85
+ executables: []
86
+ extensions: []
87
+ extra_rdoc_files:
88
+ - LICENSE
89
+ files:
90
+ - ".rspec"
91
+ - ChangeLog.md
92
+ - LICENSE
93
+ - Rakefile
94
+ - evil-front-rails.gemspec
95
+ - lib/evil-front-rails.rb
96
+ - lib/evil-front/rails/version.rb
97
+ - spec/app/.gitignore
98
+ - spec/app/app/controllers/application_controller.rb
99
+ - spec/app/app/controllers/helpers_controller.rb
100
+ - spec/app/app/views/helpers/flying_quotes.slim
101
+ - spec/app/app/views/helpers/head.slim
102
+ - spec/app/app/views/helpers/library.slim
103
+ - spec/app/app/views/helpers/russian_typograph.slim
104
+ - spec/app/app/views/helpers/standard_assets.slim
105
+ - spec/app/app/views/helpers/tel.slim
106
+ - spec/app/app/views/helpers/unstat.slim
107
+ - spec/app/app/views/layouts/_statistics.erb
108
+ - spec/app/app/views/layouts/head.slim
109
+ - spec/app/config.ru
110
+ - spec/app/config/application.rb
111
+ - spec/app/config/boot.rb
112
+ - spec/app/config/environment.rb
113
+ - spec/app/config/environments/test.rb
114
+ - spec/app/config/initializers/secret_token.rb
115
+ - spec/app/config/routes.rb
116
+ - spec/helpers_spec.rb
117
+ - spec/spec_helper.rb
118
+ homepage: https://github.com/ai/evil-front
119
+ licenses:
120
+ - MIT
121
+ metadata: {}
122
+ post_install_message:
123
+ rdoc_options: []
124
+ require_paths:
125
+ - lib
126
+ required_ruby_version: !ruby/object:Gem::Requirement
127
+ requirements:
128
+ - - ">="
129
+ - !ruby/object:Gem::Version
130
+ version: '0'
131
+ required_rubygems_version: !ruby/object:Gem::Requirement
132
+ requirements:
133
+ - - ">="
134
+ - !ruby/object:Gem::Version
135
+ version: '0'
136
+ requirements: []
137
+ rubyforge_project:
138
+ rubygems_version: 2.2.0
139
+ signing_key:
140
+ specification_version: 4
141
+ summary: Helpers, Sass mixins, JS shortcuts, workflow and Rails settings from Evil
142
+ Martians
143
+ test_files: []