snake 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/MIT-LICENSE +20 -0
- data/README.rdoc +19 -0
- data/Rakefile +34 -0
- data/lib/generators/snake/parse_generator.rb +13 -0
- data/lib/snake.rb +14 -0
- data/lib/snake/parser.rb +26 -0
- data/lib/snake/version.rb +3 -0
- data/lib/snake/writer.rb +22 -0
- data/lib/tasks/snake_tasks.rake +4 -0
- data/test/dummy/app/assets/javascripts/application.js +13 -0
- data/test/dummy/app/assets/stylesheets/_snake_vars.css.scss +2 -0
- data/test/dummy/app/assets/stylesheets/application.css +15 -0
- data/test/dummy/bin/bundle +3 -0
- data/test/dummy/bin/rails +4 -0
- data/test/dummy/bin/rake +4 -0
- data/test/dummy/bin/setup +29 -0
- data/test/dummy/config/application.rb +31 -0
- data/test/dummy/config/boot.rb +5 -0
- data/test/dummy/config/environment.rb +5 -0
- data/test/dummy/config/environments/development.rb +41 -0
- data/test/dummy/config/environments/production.rb +79 -0
- data/test/dummy/config/environments/test.rb +42 -0
- data/test/dummy/config/initializers/assets.rb +11 -0
- data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/test/dummy/config/initializers/cookies_serializer.rb +3 -0
- data/test/dummy/config/initializers/filter_parameter_logging.rb +4 -0
- data/test/dummy/config/initializers/inflections.rb +16 -0
- data/test/dummy/config/initializers/mime_types.rb +4 -0
- data/test/dummy/config/initializers/session_store.rb +3 -0
- data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/test/dummy/config/locales/en.yml +23 -0
- data/test/dummy/config/routes.rb +56 -0
- data/test/dummy/config/secrets.yml +22 -0
- data/test/test_helper.rb +18 -0
- data/test/test_json/test.json +378 -0
- data/test/test_parser.rb +44 -0
- data/test/test_writer.rb +20 -0
- metadata +138 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: be86d45ed07b35ab252ffb2646dc4e133f5b9868
|
4
|
+
data.tar.gz: 005b291409a14f3dbc8c64ea3c26433f45fc0695
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 56c7442c8759b065640f689da72585799e50a3736b69c405efd2d8f6e8f1adefaa3e22673b5d1921c9174e091f103d9498aeaf839057bf6ca7b615c535ccd4a2
|
7
|
+
data.tar.gz: 20c0c0844ead834cbd3cc7187618c79cc082f00a26f8d9aef1e3e5731a5402c32eefbf77782816ddbac823392e2e1449d2239c0b251ddab97cd291425f40a8f2
|
data/MIT-LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright 2015 caneroj1
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.rdoc
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
<h1>Snake</h1>
|
2
|
+
|
3
|
+
<p>Snake is a Rails plugin that parses custom downloads of Twitter Bootstrap v3. When you customize your own version of Twitter Bootstrap <a href="http://getbootstrap.com/customize/">here</a>, one of the files you receive is a config.json file that specifies all of the customization you just made.<p>
|
4
|
+
|
5
|
+
<p>If you are using `gem "bootstrap-sass"`, I've found it slightly difficult to load up all of this customization without having to write it yourself. Using Snake, you can just customize your download of Bootstrap and get it loaded in right away.</p>
|
6
|
+
|
7
|
+
<h2>Usage</h2>
|
8
|
+
<ul>
|
9
|
+
<li>Create a new directory under `app/assets/stylesheets` called json and put your config.json file there.</li>
|
10
|
+
<li>Add `gem "snake"` to your Gemfile</li>
|
11
|
+
<li>Update and run tests: `bundle update && rake`</li>
|
12
|
+
<li>Parse config.json by running `rails g snake:parse`.</li>
|
13
|
+
</ul>
|
14
|
+
|
15
|
+
<h2>Contributing</h2>
|
16
|
+
<p>If there are any bugs, make an issue.</p>
|
17
|
+
<p>If there are any desired features, either let me know or send me a pull request. Be sure to write tests and have them pass!</p>
|
18
|
+
<h2>Licensing</h2>
|
19
|
+
<p>This project uses MIT-LICENSE.</p>
|
data/Rakefile
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
begin
|
2
|
+
require 'bundler/setup'
|
3
|
+
rescue LoadError
|
4
|
+
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
5
|
+
end
|
6
|
+
|
7
|
+
require 'rdoc/task'
|
8
|
+
|
9
|
+
RDoc::Task.new(:rdoc) do |rdoc|
|
10
|
+
rdoc.rdoc_dir = 'rdoc'
|
11
|
+
rdoc.title = 'Snake'
|
12
|
+
rdoc.options << '--line-numbers'
|
13
|
+
rdoc.rdoc_files.include('README.rdoc')
|
14
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
15
|
+
end
|
16
|
+
|
17
|
+
|
18
|
+
|
19
|
+
|
20
|
+
|
21
|
+
|
22
|
+
Bundler::GemHelper.install_tasks
|
23
|
+
|
24
|
+
require 'rake/testtask'
|
25
|
+
|
26
|
+
Rake::TestTask.new(:test) do |t|
|
27
|
+
t.libs << 'lib'
|
28
|
+
t.libs << 'test'
|
29
|
+
t.pattern = 'test/**/test_*.rb'
|
30
|
+
t.verbose = false
|
31
|
+
end
|
32
|
+
|
33
|
+
|
34
|
+
task default: :test
|
@@ -0,0 +1,13 @@
|
|
1
|
+
class ParseGenerator < Rails::Generators::Base
|
2
|
+
require_relative '../../snake.rb'
|
3
|
+
|
4
|
+
def parse
|
5
|
+
vars = Snake::Parser.parse(File.join(Rails.root, JSON_PATH))
|
6
|
+
Snake::Writer.write(vars)
|
7
|
+
inject_into_file File.join(Rails.root, STYLES_PATH), after: '@import "bootstrap-sprockets";' do
|
8
|
+
<<-INSERT
|
9
|
+
@import "snake_vars";
|
10
|
+
INSERT
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
data/lib/snake.rb
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
module Snake
|
2
|
+
require "json"
|
3
|
+
require "thor"
|
4
|
+
|
5
|
+
include Thor::Actions
|
6
|
+
|
7
|
+
TEST_PATH = "test/dummy/app/assets/stylesheets/_snake_vars.css.scss"
|
8
|
+
APP_PATH = "app/assets/stylesheets/_snake_vars.css.scss"
|
9
|
+
JSON_PATH = "app/assets/json/config.json"
|
10
|
+
STYLES_PATH = "app/assets/stylesheets/application.css.scss"
|
11
|
+
|
12
|
+
require_relative './snake/parser'
|
13
|
+
require_relative './snake/writer'
|
14
|
+
end
|
data/lib/snake/parser.rb
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
module Snake
|
2
|
+
class Parser
|
3
|
+
|
4
|
+
class << self
|
5
|
+
def parse(file)
|
6
|
+
vars = compare(get_new_variables(file), get_default_variables)
|
7
|
+
end
|
8
|
+
|
9
|
+
private
|
10
|
+
def get_new_variables(file)
|
11
|
+
JSON.parse(File.read(file))["vars"]
|
12
|
+
end
|
13
|
+
|
14
|
+
def get_default_variables
|
15
|
+
JSON.parse(File.read(File.expand_path("json/defaults.json")))["vars"]
|
16
|
+
end
|
17
|
+
|
18
|
+
def compare(new_vars, default_vars)
|
19
|
+
default_vars.each_pair do |key, var|
|
20
|
+
new_vars.delete_if { |new_key, new_var| new_var.eql?(var) }
|
21
|
+
end
|
22
|
+
new_vars
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
data/lib/snake/writer.rb
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
module Snake
|
2
|
+
class Writer
|
3
|
+
|
4
|
+
class << self
|
5
|
+
def write(vars)
|
6
|
+
file = open_file
|
7
|
+
vars.each_pair { |key, val| file.puts "$#{key.gsub(/@/, "")} : #{val};" }
|
8
|
+
file.close
|
9
|
+
end
|
10
|
+
|
11
|
+
private
|
12
|
+
def open_file
|
13
|
+
file =
|
14
|
+
if Rails.env.eql?("test")
|
15
|
+
File.open(File.join(Rails.root, TEST_PATH), "w")
|
16
|
+
else
|
17
|
+
File.open(File.join(Rails.root, APP_PATH), "w")
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
// This is a manifest file that'll be compiled into application.js, which will include all the files
|
2
|
+
// listed below.
|
3
|
+
//
|
4
|
+
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
|
5
|
+
// or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path.
|
6
|
+
//
|
7
|
+
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
|
8
|
+
// compiled file.
|
9
|
+
//
|
10
|
+
// Read Sprockets README (https://github.com/sstephenson/sprockets#sprockets-directives) for details
|
11
|
+
// about supported directives.
|
12
|
+
//
|
13
|
+
//= require_tree .
|
@@ -0,0 +1,15 @@
|
|
1
|
+
/*
|
2
|
+
* This is a manifest file that'll be compiled into application.css, which will include all the files
|
3
|
+
* listed below.
|
4
|
+
*
|
5
|
+
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
|
6
|
+
* or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
|
7
|
+
*
|
8
|
+
* You're free to add application-wide styles to this file and they'll appear at the bottom of the
|
9
|
+
* compiled file so the styles you add here take precedence over styles defined in any styles
|
10
|
+
* defined in the other CSS/SCSS files in this directory. It is generally better to create a new
|
11
|
+
* file per style scope.
|
12
|
+
*
|
13
|
+
*= require_tree .
|
14
|
+
*= require_self
|
15
|
+
*/
|
data/test/dummy/bin/rake
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'pathname'
|
3
|
+
|
4
|
+
# path to your application root.
|
5
|
+
APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
|
6
|
+
|
7
|
+
Dir.chdir APP_ROOT do
|
8
|
+
# This script is a starting point to setup your application.
|
9
|
+
# Add necessary setup steps to this file:
|
10
|
+
|
11
|
+
puts "== Installing dependencies =="
|
12
|
+
system "gem install bundler --conservative"
|
13
|
+
system "bundle check || bundle install"
|
14
|
+
|
15
|
+
# puts "\n== Copying sample files =="
|
16
|
+
# unless File.exist?("config/database.yml")
|
17
|
+
# system "cp config/database.yml.sample config/database.yml"
|
18
|
+
# end
|
19
|
+
|
20
|
+
puts "\n== Preparing database =="
|
21
|
+
system "bin/rake db:setup"
|
22
|
+
|
23
|
+
puts "\n== Removing old logs and tempfiles =="
|
24
|
+
system "rm -f log/*"
|
25
|
+
system "rm -rf tmp/cache"
|
26
|
+
|
27
|
+
puts "\n== Restarting application server =="
|
28
|
+
system "touch tmp/restart.txt"
|
29
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
require File.expand_path('../boot', __FILE__)
|
2
|
+
|
3
|
+
# require 'rails/all'
|
4
|
+
require "action_controller/railtie"
|
5
|
+
require "active_support/railtie"
|
6
|
+
require "action_mailer/railtie"
|
7
|
+
require "action_view/railtie"
|
8
|
+
require "sprockets/railtie"
|
9
|
+
require "rails/test_unit/railtie"
|
10
|
+
|
11
|
+
Bundler.require(*Rails.groups)
|
12
|
+
require "snake"
|
13
|
+
|
14
|
+
module Dummy
|
15
|
+
class Application < Rails::Application
|
16
|
+
# Settings in config/environments/* take precedence over those specified here.
|
17
|
+
# Application configuration should go into files in config/initializers
|
18
|
+
# -- all .rb files in that directory are automatically loaded.
|
19
|
+
|
20
|
+
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
|
21
|
+
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
|
22
|
+
# config.time_zone = 'Central Time (US & Canada)'
|
23
|
+
|
24
|
+
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
|
25
|
+
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
|
26
|
+
# config.i18n.default_locale = :de
|
27
|
+
|
28
|
+
# Do not swallow errors in after_commit/after_rollback callbacks.
|
29
|
+
# config.active_record.raise_in_transactional_callbacks = true
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
Rails.application.configure do
|
2
|
+
# Settings specified here will take precedence over those in config/application.rb.
|
3
|
+
|
4
|
+
# In the development environment your application's code is reloaded on
|
5
|
+
# every request. This slows down response time but is perfect for development
|
6
|
+
# since you don't have to restart the web server when you make code changes.
|
7
|
+
config.cache_classes = false
|
8
|
+
|
9
|
+
# Do not eager load code on boot.
|
10
|
+
config.eager_load = false
|
11
|
+
|
12
|
+
# Show full error reports and disable caching.
|
13
|
+
config.consider_all_requests_local = true
|
14
|
+
config.action_controller.perform_caching = false
|
15
|
+
|
16
|
+
# Don't care if the mailer can't send.
|
17
|
+
config.action_mailer.raise_delivery_errors = false
|
18
|
+
|
19
|
+
# Print deprecation notices to the Rails logger.
|
20
|
+
config.active_support.deprecation = :log
|
21
|
+
|
22
|
+
# Raise an error on page load if there are pending migrations.
|
23
|
+
# config.active_record.migration_error = :page_load
|
24
|
+
|
25
|
+
# Debug mode disables concatenation and preprocessing of assets.
|
26
|
+
# This option may cause significant delays in view rendering with a large
|
27
|
+
# number of complex assets.
|
28
|
+
config.assets.debug = true
|
29
|
+
|
30
|
+
# Asset digests allow you to set far-future HTTP expiration dates on all assets,
|
31
|
+
# yet still be able to expire them through the digest params.
|
32
|
+
config.assets.digest = true
|
33
|
+
|
34
|
+
# Adds additional error checking when serving assets at runtime.
|
35
|
+
# Checks for improperly declared sprockets dependencies.
|
36
|
+
# Raises helpful error messages.
|
37
|
+
config.assets.raise_runtime_errors = true
|
38
|
+
|
39
|
+
# Raises error for missing translations
|
40
|
+
# config.action_view.raise_on_missing_translations = true
|
41
|
+
end
|
@@ -0,0 +1,79 @@
|
|
1
|
+
Rails.application.configure do
|
2
|
+
# Settings specified here will take precedence over those in config/application.rb.
|
3
|
+
|
4
|
+
# Code is not reloaded between requests.
|
5
|
+
config.cache_classes = true
|
6
|
+
|
7
|
+
# Eager load code on boot. This eager loads most of Rails and
|
8
|
+
# your application in memory, allowing both threaded web servers
|
9
|
+
# and those relying on copy on write to perform better.
|
10
|
+
# Rake tasks automatically ignore this option for performance.
|
11
|
+
config.eager_load = false
|
12
|
+
|
13
|
+
# Full error reports are disabled and caching is turned on.
|
14
|
+
config.consider_all_requests_local = false
|
15
|
+
config.action_controller.perform_caching = true
|
16
|
+
|
17
|
+
# Enable Rack::Cache to put a simple HTTP cache in front of your application
|
18
|
+
# Add `rack-cache` to your Gemfile before enabling this.
|
19
|
+
# For large-scale production use, consider using a caching reverse proxy like
|
20
|
+
# NGINX, varnish or squid.
|
21
|
+
# config.action_dispatch.rack_cache = true
|
22
|
+
|
23
|
+
# Disable serving static files from the `/public` folder by default since
|
24
|
+
# Apache or NGINX already handles this.
|
25
|
+
config.serve_static_files = ENV['RAILS_SERVE_STATIC_FILES'].present?
|
26
|
+
|
27
|
+
# Compress JavaScripts and CSS.
|
28
|
+
config.assets.js_compressor = :uglifier
|
29
|
+
# config.assets.css_compressor = :sass
|
30
|
+
|
31
|
+
# Do not fallback to assets pipeline if a precompiled asset is missed.
|
32
|
+
config.assets.compile = false
|
33
|
+
|
34
|
+
# Asset digests allow you to set far-future HTTP expiration dates on all assets,
|
35
|
+
# yet still be able to expire them through the digest params.
|
36
|
+
config.assets.digest = true
|
37
|
+
|
38
|
+
# `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb
|
39
|
+
|
40
|
+
# Specifies the header that your server uses for sending files.
|
41
|
+
# config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache
|
42
|
+
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX
|
43
|
+
|
44
|
+
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
|
45
|
+
# config.force_ssl = true
|
46
|
+
|
47
|
+
# Use the lowest log level to ensure availability of diagnostic information
|
48
|
+
# when problems arise.
|
49
|
+
config.log_level = :debug
|
50
|
+
|
51
|
+
# Prepend all log lines with the following tags.
|
52
|
+
# config.log_tags = [ :subdomain, :uuid ]
|
53
|
+
|
54
|
+
# Use a different logger for distributed setups.
|
55
|
+
# config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)
|
56
|
+
|
57
|
+
# Use a different cache store in production.
|
58
|
+
# config.cache_store = :mem_cache_store
|
59
|
+
|
60
|
+
# Enable serving of images, stylesheets, and JavaScripts from an asset server.
|
61
|
+
# config.action_controller.asset_host = 'http://assets.example.com'
|
62
|
+
|
63
|
+
# Ignore bad email addresses and do not raise email delivery errors.
|
64
|
+
# Set this to true and configure the email server for immediate delivery to raise delivery errors.
|
65
|
+
# config.action_mailer.raise_delivery_errors = false
|
66
|
+
|
67
|
+
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
|
68
|
+
# the I18n.default_locale when a translation cannot be found).
|
69
|
+
config.i18n.fallbacks = true
|
70
|
+
|
71
|
+
# Send deprecation notices to registered listeners.
|
72
|
+
config.active_support.deprecation = :notify
|
73
|
+
|
74
|
+
# Use default logging formatter so that PID and timestamp are not suppressed.
|
75
|
+
config.log_formatter = ::Logger::Formatter.new
|
76
|
+
|
77
|
+
# Do not dump schema after migrations.
|
78
|
+
config.active_record.dump_schema_after_migration = false
|
79
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
Rails.application.configure do
|
2
|
+
# Settings specified here will take precedence over those in config/application.rb.
|
3
|
+
|
4
|
+
# The test environment is used exclusively to run your application's
|
5
|
+
# test suite. You never need to work with it otherwise. Remember that
|
6
|
+
# your test database is "scratch space" for the test suite and is wiped
|
7
|
+
# and recreated between test runs. Don't rely on the data there!
|
8
|
+
config.cache_classes = true
|
9
|
+
|
10
|
+
# Do not eager load code on boot. This avoids loading your whole application
|
11
|
+
# just for the purpose of running a single test. If you are using a tool that
|
12
|
+
# preloads Rails for running tests, you may have to set it to true.
|
13
|
+
config.eager_load = false
|
14
|
+
|
15
|
+
# Configure static file server for tests with Cache-Control for performance.
|
16
|
+
config.serve_static_files = true
|
17
|
+
config.static_cache_control = 'public, max-age=3600'
|
18
|
+
|
19
|
+
# Show full error reports and disable caching.
|
20
|
+
config.consider_all_requests_local = true
|
21
|
+
config.action_controller.perform_caching = false
|
22
|
+
|
23
|
+
# Raise exceptions instead of rendering exception templates.
|
24
|
+
config.action_dispatch.show_exceptions = false
|
25
|
+
|
26
|
+
# Disable request forgery protection in test environment.
|
27
|
+
config.action_controller.allow_forgery_protection = false
|
28
|
+
|
29
|
+
# Tell Action Mailer not to deliver emails to the real world.
|
30
|
+
# The :test delivery method accumulates sent emails in the
|
31
|
+
# ActionMailer::Base.deliveries array.
|
32
|
+
config.action_mailer.delivery_method = :test
|
33
|
+
|
34
|
+
# Randomize the order test cases are executed.
|
35
|
+
config.active_support.test_order = :random
|
36
|
+
|
37
|
+
# Print deprecation notices to the stderr.
|
38
|
+
config.active_support.deprecation = :stderr
|
39
|
+
|
40
|
+
# Raises error for missing translations
|
41
|
+
# config.action_view.raise_on_missing_translations = true
|
42
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
|
3
|
+
# Version of your assets, change this if you want to expire all your assets.
|
4
|
+
Rails.application.config.assets.version = '1.0'
|
5
|
+
|
6
|
+
# Add additional assets to the asset load path
|
7
|
+
# Rails.application.config.assets.paths << Emoji.images_path
|
8
|
+
|
9
|
+
# Precompile additional assets.
|
10
|
+
# application.js, application.css, and all non-JS/CSS in app/assets folder are already added.
|
11
|
+
# Rails.application.config.assets.precompile += %w( search.js )
|
@@ -0,0 +1,7 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
|
3
|
+
# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
|
4
|
+
# Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
|
5
|
+
|
6
|
+
# You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
|
7
|
+
# Rails.backtrace_cleaner.remove_silencers!
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
|
3
|
+
# Add new inflection rules using the following format. Inflections
|
4
|
+
# are locale specific, and you may define rules for as many different
|
5
|
+
# locales as you wish. All of these examples are active by default:
|
6
|
+
# ActiveSupport::Inflector.inflections(:en) do |inflect|
|
7
|
+
# inflect.plural /^(ox)$/i, '\1en'
|
8
|
+
# inflect.singular /^(ox)en/i, '\1'
|
9
|
+
# inflect.irregular 'person', 'people'
|
10
|
+
# inflect.uncountable %w( fish sheep )
|
11
|
+
# end
|
12
|
+
|
13
|
+
# These inflection rules are supported but not enabled by default:
|
14
|
+
# ActiveSupport::Inflector.inflections(:en) do |inflect|
|
15
|
+
# inflect.acronym 'RESTful'
|
16
|
+
# end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
|
3
|
+
# This file contains settings for ActionController::ParamsWrapper which
|
4
|
+
# is enabled by default.
|
5
|
+
|
6
|
+
# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
|
7
|
+
ActiveSupport.on_load(:action_controller) do
|
8
|
+
wrap_parameters format: [:json] if respond_to?(:wrap_parameters)
|
9
|
+
end
|
10
|
+
|
11
|
+
# To enable root element in JSON for ActiveRecord objects.
|
12
|
+
# ActiveSupport.on_load(:active_record) do
|
13
|
+
# self.include_root_in_json = true
|
14
|
+
# end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# Files in the config/locales directory are used for internationalization
|
2
|
+
# and are automatically loaded by Rails. If you want to use locales other
|
3
|
+
# than English, add the necessary files in this directory.
|
4
|
+
#
|
5
|
+
# To use the locales, use `I18n.t`:
|
6
|
+
#
|
7
|
+
# I18n.t 'hello'
|
8
|
+
#
|
9
|
+
# In views, this is aliased to just `t`:
|
10
|
+
#
|
11
|
+
# <%= t('hello') %>
|
12
|
+
#
|
13
|
+
# To use a different locale, set it with `I18n.locale`:
|
14
|
+
#
|
15
|
+
# I18n.locale = :es
|
16
|
+
#
|
17
|
+
# This would use the information in config/locales/es.yml.
|
18
|
+
#
|
19
|
+
# To learn more, please read the Rails Internationalization guide
|
20
|
+
# available at http://guides.rubyonrails.org/i18n.html.
|
21
|
+
|
22
|
+
en:
|
23
|
+
hello: "Hello world"
|
@@ -0,0 +1,56 @@
|
|
1
|
+
Rails.application.routes.draw do
|
2
|
+
# The priority is based upon order of creation: first created -> highest priority.
|
3
|
+
# See how all your routes lay out with "rake routes".
|
4
|
+
|
5
|
+
# You can have the root of your site routed with "root"
|
6
|
+
# root 'welcome#index'
|
7
|
+
|
8
|
+
# Example of regular route:
|
9
|
+
# get 'products/:id' => 'catalog#view'
|
10
|
+
|
11
|
+
# Example of named route that can be invoked with purchase_url(id: product.id)
|
12
|
+
# get 'products/:id/purchase' => 'catalog#purchase', as: :purchase
|
13
|
+
|
14
|
+
# Example resource route (maps HTTP verbs to controller actions automatically):
|
15
|
+
# resources :products
|
16
|
+
|
17
|
+
# Example resource route with options:
|
18
|
+
# resources :products do
|
19
|
+
# member do
|
20
|
+
# get 'short'
|
21
|
+
# post 'toggle'
|
22
|
+
# end
|
23
|
+
#
|
24
|
+
# collection do
|
25
|
+
# get 'sold'
|
26
|
+
# end
|
27
|
+
# end
|
28
|
+
|
29
|
+
# Example resource route with sub-resources:
|
30
|
+
# resources :products do
|
31
|
+
# resources :comments, :sales
|
32
|
+
# resource :seller
|
33
|
+
# end
|
34
|
+
|
35
|
+
# Example resource route with more complex sub-resources:
|
36
|
+
# resources :products do
|
37
|
+
# resources :comments
|
38
|
+
# resources :sales do
|
39
|
+
# get 'recent', on: :collection
|
40
|
+
# end
|
41
|
+
# end
|
42
|
+
|
43
|
+
# Example resource route with concerns:
|
44
|
+
# concern :toggleable do
|
45
|
+
# post 'toggle'
|
46
|
+
# end
|
47
|
+
# resources :posts, concerns: :toggleable
|
48
|
+
# resources :photos, concerns: :toggleable
|
49
|
+
|
50
|
+
# Example resource route within a namespace:
|
51
|
+
# namespace :admin do
|
52
|
+
# # Directs /admin/products/* to Admin::ProductsController
|
53
|
+
# # (app/controllers/admin/products_controller.rb)
|
54
|
+
# resources :products
|
55
|
+
# end
|
56
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
|
3
|
+
# Your secret key is used for verifying the integrity of signed cookies.
|
4
|
+
# If you change this key, all old signed cookies will become invalid!
|
5
|
+
|
6
|
+
# Make sure the secret is at least 30 characters and all random,
|
7
|
+
# no regular words or you'll be exposed to dictionary attacks.
|
8
|
+
# You can use `rake secret` to generate a secure secret key.
|
9
|
+
|
10
|
+
# Make sure the secrets in this file are kept private
|
11
|
+
# if you're sharing your code publicly.
|
12
|
+
|
13
|
+
development:
|
14
|
+
secret_key_base: a56521d5a17f7a2991f7bba30cb3bc093167e7cec6a1b25e85f656c3717c5f2298649e212860693795809344de1ca61f56f1ddab61f96c7abe8b5acdc3fb969f
|
15
|
+
|
16
|
+
test:
|
17
|
+
secret_key_base: d46fc3da61dc52f7ce0167c00d4f51b0fb6fe3e6b29d9f84907db7303665d6f8f73d8418b8628dab731c05bacf2dfd790229d4bdb0b7440941c7ba99e901f8e3
|
18
|
+
|
19
|
+
# Do not keep production secrets in the repository,
|
20
|
+
# instead read values from the environment.
|
21
|
+
production:
|
22
|
+
secret_key_base: <%= ENV["SECRET_KEY_BASE"] %>
|
data/test/test_helper.rb
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
# Configure Rails Environment
|
2
|
+
ENV["RAILS_ENV"] = "test"
|
3
|
+
|
4
|
+
require File.expand_path("../../test/dummy/config/environment.rb", __FILE__)
|
5
|
+
# ActiveRecord::Migrator.migrations_paths = [File.expand_path("../../test/dummy/db/migrate", __FILE__)]
|
6
|
+
require "rails/test_help"
|
7
|
+
|
8
|
+
# Filter out Minitest backtrace while allowing backtrace from other libraries
|
9
|
+
# to be shown.
|
10
|
+
Minitest.backtrace_filter = Minitest::BacktraceFilter.new
|
11
|
+
|
12
|
+
# Load support files
|
13
|
+
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
|
14
|
+
|
15
|
+
# Load fixtures from the engine
|
16
|
+
# if ActiveSupport::TestCase.respond_to?(:fixture_path=)
|
17
|
+
# ActiveSupport::TestCase.fixture_path = File.expand_path("../fixtures", __FILE__)
|
18
|
+
# end
|
@@ -0,0 +1,378 @@
|
|
1
|
+
{
|
2
|
+
"vars": {
|
3
|
+
"@gray-base": "#000",
|
4
|
+
"@gray-darker": "lighten(@gray-base, 13.5%)",
|
5
|
+
"@gray-dark": "lighten(@gray-base, 20%)",
|
6
|
+
"@gray": "lighten(@gray-base, 33.5%)",
|
7
|
+
"@gray-light": "lighten(@gray-base, 46.7%)",
|
8
|
+
"@gray-lighter": "lighten(@gray-base, 93.5%)",
|
9
|
+
"@brand-primary": "darken(#428bca, 6.5%)",
|
10
|
+
"@brand-success": "#5cb85c",
|
11
|
+
"@brand-info": "#5bc0de",
|
12
|
+
"@brand-warning": "#f0ad4e",
|
13
|
+
"@brand-danger": "#d9534f",
|
14
|
+
"@body-bg": "#fff",
|
15
|
+
"@text-color": "@gray-dark",
|
16
|
+
"@link-color": "@brand-primary",
|
17
|
+
"@link-hover-color": "darken(@link-color, 15%)",
|
18
|
+
"@link-hover-decoration": "underline",
|
19
|
+
"@font-family-sans-serif": "\"Helvetica Neue\", Helvetica, Arial, sans-serif",
|
20
|
+
"@font-family-serif": "Georgia, \"Times New Roman\", Times, serif",
|
21
|
+
"@font-family-monospace": "Menlo, Monaco, Consolas, \"Courier New\", monospace",
|
22
|
+
"@font-family-base": "@font-family-sans-serif",
|
23
|
+
"@font-size-base": "14px",
|
24
|
+
"@font-size-large": "ceil((@font-size-base * 1.25))",
|
25
|
+
"@font-size-small": "ceil((@font-size-base * 0.85))",
|
26
|
+
"@font-size-h1": "floor((@font-size-base * 2.6))",
|
27
|
+
"@font-size-h2": "floor((@font-size-base * 2.15))",
|
28
|
+
"@font-size-h3": "ceil((@font-size-base * 1.7))",
|
29
|
+
"@font-size-h4": "ceil((@font-size-base * 1.25))",
|
30
|
+
"@font-size-h5": "@font-size-base",
|
31
|
+
"@font-size-h6": "ceil((@font-size-base * 0.85))",
|
32
|
+
"@line-height-base": "1.428571429",
|
33
|
+
"@line-height-computed": "floor((@font-size-base * @line-height-base))",
|
34
|
+
"@headings-font-family": "inherit",
|
35
|
+
"@headings-font-weight": "500",
|
36
|
+
"@headings-line-height": "1.1",
|
37
|
+
"@headings-color": "inherit",
|
38
|
+
"@icon-font-path": "\"../fonts/\"",
|
39
|
+
"@icon-font-name": "\"glyphicons-halflings-regular\"",
|
40
|
+
"@icon-font-svg-id": "\"glyphicons_halflingsregular\"",
|
41
|
+
"@padding-base-vertical": "6px",
|
42
|
+
"@padding-base-horizontal": "12px",
|
43
|
+
"@padding-large-vertical": "10px",
|
44
|
+
"@padding-large-horizontal": "16px",
|
45
|
+
"@padding-small-vertical": "5px",
|
46
|
+
"@padding-small-horizontal": "10px",
|
47
|
+
"@padding-xs-vertical": "1px",
|
48
|
+
"@padding-xs-horizontal": "5px",
|
49
|
+
"@line-height-large": "1.33",
|
50
|
+
"@line-height-small": "1.5",
|
51
|
+
"@border-radius-base": "4px",
|
52
|
+
"@border-radius-large": "6px",
|
53
|
+
"@border-radius-small": "3px",
|
54
|
+
"@component-active-color": "#fff",
|
55
|
+
"@component-active-bg": "@brand-primary",
|
56
|
+
"@caret-width-base": "4px",
|
57
|
+
"@caret-width-large": "5px",
|
58
|
+
"@table-cell-padding": "8px",
|
59
|
+
"@table-condensed-cell-padding": "5px",
|
60
|
+
"@table-bg": "transparent",
|
61
|
+
"@table-bg-accent": "#f9f9f9",
|
62
|
+
"@table-bg-hover": "#f5f5f5",
|
63
|
+
"@table-bg-active": "@table-bg-hover",
|
64
|
+
"@table-border-color": "#ddd",
|
65
|
+
"@btn-font-weight": "normal",
|
66
|
+
"@btn-default-color": "#333",
|
67
|
+
"@btn-default-bg": "#fff",
|
68
|
+
"@btn-default-border": "#ccc",
|
69
|
+
"@btn-primary-color": "#fff",
|
70
|
+
"@btn-primary-bg": "@brand-primary",
|
71
|
+
"@btn-primary-border": "darken(@btn-primary-bg, 5%)",
|
72
|
+
"@btn-success-color": "#fff",
|
73
|
+
"@btn-success-bg": "@brand-success",
|
74
|
+
"@btn-success-border": "darken(@btn-success-bg, 5%)",
|
75
|
+
"@btn-info-color": "#fff",
|
76
|
+
"@btn-info-bg": "@brand-info",
|
77
|
+
"@btn-info-border": "darken(@btn-info-bg, 5%)",
|
78
|
+
"@btn-warning-color": "#fff",
|
79
|
+
"@btn-warning-bg": "@brand-warning",
|
80
|
+
"@btn-warning-border": "darken(@btn-warning-bg, 5%)",
|
81
|
+
"@btn-danger-color": "#fff",
|
82
|
+
"@btn-danger-bg": "@brand-danger",
|
83
|
+
"@btn-danger-border": "darken(@btn-danger-bg, 5%)",
|
84
|
+
"@btn-link-disabled-color": "@gray-light",
|
85
|
+
"@input-bg": "#fff",
|
86
|
+
"@input-bg-disabled": "@gray-lighter",
|
87
|
+
"@input-color": "@gray",
|
88
|
+
"@input-border": "#ccc",
|
89
|
+
"@input-border-radius": "@border-radius-base",
|
90
|
+
"@input-border-radius-large": "@border-radius-large",
|
91
|
+
"@input-border-radius-small": "@border-radius-small",
|
92
|
+
"@input-border-focus": "#66afe9",
|
93
|
+
"@input-color-placeholder": "#999",
|
94
|
+
"@input-height-base": "(@line-height-computed + (@padding-base-vertical * 2) + 2)",
|
95
|
+
"@input-height-large": "(ceil(@font-size-large * @line-height-large) + (@padding-large-vertical * 2) + 2)",
|
96
|
+
"@input-height-small": "(floor(@font-size-small * @line-height-small) + (@padding-small-vertical * 2) + 2)",
|
97
|
+
"@legend-color": "@gray-dark",
|
98
|
+
"@legend-border-color": "#e5e5e5",
|
99
|
+
"@input-group-addon-bg": "@gray-lighter",
|
100
|
+
"@input-group-addon-border-color": "@input-border",
|
101
|
+
"@cursor-disabled": "not-allowed",
|
102
|
+
"@dropdown-bg": "#fff",
|
103
|
+
"@dropdown-border": "rgba(0,0,0,.15)",
|
104
|
+
"@dropdown-fallback-border": "#ccc",
|
105
|
+
"@dropdown-divider-bg": "#e5e5e5",
|
106
|
+
"@dropdown-link-color": "@gray-dark",
|
107
|
+
"@dropdown-link-hover-color": "darken(@gray-dark, 5%)",
|
108
|
+
"@dropdown-link-hover-bg": "#f5f5f5",
|
109
|
+
"@dropdown-link-active-color": "@component-active-color",
|
110
|
+
"@dropdown-link-active-bg": "@component-active-bg",
|
111
|
+
"@dropdown-link-disabled-color": "@gray-light",
|
112
|
+
"@dropdown-header-color": "@gray-light",
|
113
|
+
"@dropdown-caret-color": "#000",
|
114
|
+
"@screen-xs": "480px",
|
115
|
+
"@screen-xs-min": "@screen-xs",
|
116
|
+
"@screen-phone": "@screen-xs-min",
|
117
|
+
"@screen-sm": "768px",
|
118
|
+
"@screen-sm-min": "@screen-sm",
|
119
|
+
"@screen-tablet": "@screen-sm-min",
|
120
|
+
"@screen-md": "992px",
|
121
|
+
"@screen-md-min": "@screen-md",
|
122
|
+
"@screen-desktop": "@screen-md-min",
|
123
|
+
"@screen-lg": "1200px",
|
124
|
+
"@screen-lg-min": "@screen-lg",
|
125
|
+
"@screen-lg-desktop": "@screen-lg-min",
|
126
|
+
"@screen-xs-max": "(@screen-sm-min - 1)",
|
127
|
+
"@screen-sm-max": "(@screen-md-min - 1)",
|
128
|
+
"@screen-md-max": "(@screen-lg-min - 1)",
|
129
|
+
"@grid-columns": "12",
|
130
|
+
"@grid-gutter-width": "30px",
|
131
|
+
"@grid-float-breakpoint": "@screen-sm-min",
|
132
|
+
"@grid-float-breakpoint-max": "(@grid-float-breakpoint - 1)",
|
133
|
+
"@container-tablet": "(720px + @grid-gutter-width)",
|
134
|
+
"@container-sm": "@container-tablet",
|
135
|
+
"@container-desktop": "(940px + @grid-gutter-width)",
|
136
|
+
"@container-md": "@container-desktop",
|
137
|
+
"@container-large-desktop": "(1140px + @grid-gutter-width)",
|
138
|
+
"@container-lg": "@container-large-desktop",
|
139
|
+
"@navbar-height": "50px",
|
140
|
+
"@navbar-margin-bottom": "@line-height-computed",
|
141
|
+
"@navbar-border-radius": "@border-radius-base",
|
142
|
+
"@navbar-padding-horizontal": "floor((@grid-gutter-width / 2))",
|
143
|
+
"@navbar-padding-vertical": "((@navbar-height - @line-height-computed) / 2)",
|
144
|
+
"@navbar-collapse-max-height": "340px",
|
145
|
+
"@navbar-default-color": "#777",
|
146
|
+
"@navbar-default-bg": "#f8f8f8",
|
147
|
+
"@navbar-default-border": "darken(@navbar-default-bg, 6.5%)",
|
148
|
+
"@navbar-default-link-color": "#777",
|
149
|
+
"@navbar-default-link-hover-color": "#333",
|
150
|
+
"@navbar-default-link-hover-bg": "transparent",
|
151
|
+
"@navbar-default-link-active-color": "#555",
|
152
|
+
"@navbar-default-link-active-bg": "darken(@navbar-default-bg, 6.5%)",
|
153
|
+
"@navbar-default-link-disabled-color": "#ccc",
|
154
|
+
"@navbar-default-link-disabled-bg": "transparent",
|
155
|
+
"@navbar-default-brand-color": "@navbar-default-link-color",
|
156
|
+
"@navbar-default-brand-hover-color": "darken(@navbar-default-brand-color, 10%)",
|
157
|
+
"@navbar-default-brand-hover-bg": "transparent",
|
158
|
+
"@navbar-default-toggle-hover-bg": "#ddd",
|
159
|
+
"@navbar-default-toggle-icon-bar-bg": "#888",
|
160
|
+
"@navbar-default-toggle-border-color": "#ddd",
|
161
|
+
"@navbar-inverse-color": "lighten(@gray-light, 15%)",
|
162
|
+
"@navbar-inverse-bg": "#222",
|
163
|
+
"@navbar-inverse-border": "darken(@navbar-inverse-bg, 10%)",
|
164
|
+
"@navbar-inverse-link-color": "lighten(@gray-light, 15%)",
|
165
|
+
"@navbar-inverse-link-hover-color": "#fff",
|
166
|
+
"@navbar-inverse-link-hover-bg": "transparent",
|
167
|
+
"@navbar-inverse-link-active-color": "@navbar-inverse-link-hover-color",
|
168
|
+
"@navbar-inverse-link-active-bg": "darken(@navbar-inverse-bg, 10%)",
|
169
|
+
"@navbar-inverse-link-disabled-color": "#444",
|
170
|
+
"@navbar-inverse-link-disabled-bg": "transparent",
|
171
|
+
"@navbar-inverse-brand-color": "@navbar-inverse-link-color",
|
172
|
+
"@navbar-inverse-brand-hover-color": "#fff",
|
173
|
+
"@navbar-inverse-brand-hover-bg": "transparent",
|
174
|
+
"@navbar-inverse-toggle-hover-bg": "#333",
|
175
|
+
"@navbar-inverse-toggle-icon-bar-bg": "#fff",
|
176
|
+
"@navbar-inverse-toggle-border-color": "#333",
|
177
|
+
"@nav-link-padding": "10px 15px",
|
178
|
+
"@nav-link-hover-bg": "@gray-lighter",
|
179
|
+
"@nav-disabled-link-color": "@gray-light",
|
180
|
+
"@nav-disabled-link-hover-color": "@gray-light",
|
181
|
+
"@nav-tabs-border-color": "#ddd",
|
182
|
+
"@nav-tabs-link-hover-border-color": "@gray-lighter",
|
183
|
+
"@nav-tabs-active-link-hover-bg": "@body-bg",
|
184
|
+
"@nav-tabs-active-link-hover-color": "@gray",
|
185
|
+
"@nav-tabs-active-link-hover-border-color": "#ddd",
|
186
|
+
"@nav-tabs-justified-link-border-color": "#ddd",
|
187
|
+
"@nav-tabs-justified-active-link-border-color": "@body-bg",
|
188
|
+
"@nav-pills-border-radius": "@border-radius-base",
|
189
|
+
"@nav-pills-active-link-hover-bg": "@component-active-bg",
|
190
|
+
"@nav-pills-active-link-hover-color": "@component-active-color",
|
191
|
+
"@pagination-color": "@link-color",
|
192
|
+
"@pagination-bg": "#fff",
|
193
|
+
"@pagination-border": "#ddd",
|
194
|
+
"@pagination-hover-color": "@link-hover-color",
|
195
|
+
"@pagination-hover-bg": "@gray-lighter",
|
196
|
+
"@pagination-hover-border": "#ddd",
|
197
|
+
"@pagination-active-color": "#fff",
|
198
|
+
"@pagination-active-bg": "@brand-primary",
|
199
|
+
"@pagination-active-border": "@brand-primary",
|
200
|
+
"@pagination-disabled-color": "@gray-light",
|
201
|
+
"@pagination-disabled-bg": "#fff",
|
202
|
+
"@pagination-disabled-border": "#ddd",
|
203
|
+
"@pager-bg": "@pagination-bg",
|
204
|
+
"@pager-border": "@pagination-border",
|
205
|
+
"@pager-border-radius": "15px",
|
206
|
+
"@pager-hover-bg": "@pagination-hover-bg",
|
207
|
+
"@pager-active-bg": "@pagination-active-bg",
|
208
|
+
"@pager-active-color": "@pagination-active-color",
|
209
|
+
"@pager-disabled-color": "@pagination-disabled-color",
|
210
|
+
"@jumbotron-padding": "30px",
|
211
|
+
"@jumbotron-color": "inherit",
|
212
|
+
"@jumbotron-bg": "@gray-lighter",
|
213
|
+
"@jumbotron-heading-color": "inherit",
|
214
|
+
"@jumbotron-font-size": "ceil((@font-size-base * 1.5))",
|
215
|
+
"@state-success-text": "#3c763d",
|
216
|
+
"@state-success-bg": "#dff0d8",
|
217
|
+
"@state-success-border": "darken(spin(@state-success-bg, -10), 5%)",
|
218
|
+
"@state-info-text": "#31708f",
|
219
|
+
"@state-info-bg": "#d9edf7",
|
220
|
+
"@state-info-border": "darken(spin(@state-info-bg, -10), 7%)",
|
221
|
+
"@state-warning-text": "#8a6d3b",
|
222
|
+
"@state-warning-bg": "#fcf8e3",
|
223
|
+
"@state-warning-border": "darken(spin(@state-warning-bg, -10), 5%)",
|
224
|
+
"@state-danger-text": "#a94442",
|
225
|
+
"@state-danger-bg": "#f2dede",
|
226
|
+
"@state-danger-border": "darken(spin(@state-danger-bg, -10), 5%)",
|
227
|
+
"@tooltip-max-width": "200px",
|
228
|
+
"@tooltip-color": "#fff",
|
229
|
+
"@tooltip-bg": "#000",
|
230
|
+
"@tooltip-opacity": ".9",
|
231
|
+
"@tooltip-arrow-width": "5px",
|
232
|
+
"@tooltip-arrow-color": "@tooltip-bg",
|
233
|
+
"@popover-bg": "#fff",
|
234
|
+
"@popover-max-width": "276px",
|
235
|
+
"@popover-border-color": "rgba(0,0,0,.2)",
|
236
|
+
"@popover-fallback-border-color": "#ccc",
|
237
|
+
"@popover-title-bg": "darken(@popover-bg, 3%)",
|
238
|
+
"@popover-arrow-width": "10px",
|
239
|
+
"@popover-arrow-color": "@popover-bg",
|
240
|
+
"@popover-arrow-outer-width": "(@popover-arrow-width + 1)",
|
241
|
+
"@popover-arrow-outer-color": "fadein(@popover-border-color, 5%)",
|
242
|
+
"@popover-arrow-outer-fallback-color": "darken(@popover-fallback-border-color, 20%)",
|
243
|
+
"@label-default-bg": "@gray-light",
|
244
|
+
"@label-primary-bg": "@brand-primary",
|
245
|
+
"@label-success-bg": "@brand-success",
|
246
|
+
"@label-info-bg": "@brand-info",
|
247
|
+
"@label-warning-bg": "@brand-warning",
|
248
|
+
"@label-danger-bg": "@brand-danger",
|
249
|
+
"@label-color": "#fff",
|
250
|
+
"@label-link-hover-color": "#fff",
|
251
|
+
"@modal-inner-padding": "15px",
|
252
|
+
"@modal-title-padding": "15px",
|
253
|
+
"@modal-title-line-height": "@line-height-base",
|
254
|
+
"@modal-content-bg": "#fff",
|
255
|
+
"@modal-content-border-color": "rgba(0,0,0,.2)",
|
256
|
+
"@modal-content-fallback-border-color": "#999",
|
257
|
+
"@modal-backdrop-bg": "#000",
|
258
|
+
"@modal-backdrop-opacity": ".5",
|
259
|
+
"@modal-header-border-color": "#e5e5e5",
|
260
|
+
"@modal-footer-border-color": "@modal-header-border-color",
|
261
|
+
"@modal-lg": "900px",
|
262
|
+
"@modal-md": "600px",
|
263
|
+
"@modal-sm": "300px",
|
264
|
+
"@alert-padding": "15px",
|
265
|
+
"@alert-border-radius": "@border-radius-base",
|
266
|
+
"@alert-link-font-weight": "bold",
|
267
|
+
"@alert-success-bg": "@state-success-bg",
|
268
|
+
"@alert-success-text": "@state-success-text",
|
269
|
+
"@alert-success-border": "@state-success-border",
|
270
|
+
"@alert-info-bg": "@state-info-bg",
|
271
|
+
"@alert-info-text": "@state-info-text",
|
272
|
+
"@alert-info-border": "@state-info-border",
|
273
|
+
"@alert-warning-bg": "@state-warning-bg",
|
274
|
+
"@alert-warning-text": "@state-warning-text",
|
275
|
+
"@alert-warning-border": "@state-warning-border",
|
276
|
+
"@alert-danger-bg": "@state-danger-bg",
|
277
|
+
"@alert-danger-text": "@state-danger-text",
|
278
|
+
"@alert-danger-border": "@state-danger-border",
|
279
|
+
"@progress-bg": "#f5f5f5",
|
280
|
+
"@progress-bar-color": "#fff",
|
281
|
+
"@progress-border-radius": "@border-radius-base",
|
282
|
+
"@progress-bar-bg": "@brand-primary",
|
283
|
+
"@progress-bar-success-bg": "@brand-success",
|
284
|
+
"@progress-bar-warning-bg": "@brand-warning",
|
285
|
+
"@progress-bar-danger-bg": "@brand-danger",
|
286
|
+
"@progress-bar-info-bg": "@brand-info",
|
287
|
+
"@list-group-bg": "#fff",
|
288
|
+
"@list-group-border": "#ddd",
|
289
|
+
"@list-group-border-radius": "@border-radius-base",
|
290
|
+
"@list-group-hover-bg": "#f5f5f5",
|
291
|
+
"@list-group-active-color": "@component-active-color",
|
292
|
+
"@list-group-active-bg": "@component-active-bg",
|
293
|
+
"@list-group-active-border": "@list-group-active-bg",
|
294
|
+
"@list-group-active-text-color": "lighten(@list-group-active-bg, 40%)",
|
295
|
+
"@list-group-disabled-color": "@gray-light",
|
296
|
+
"@list-group-disabled-bg": "@gray-lighter",
|
297
|
+
"@list-group-disabled-text-color": "@list-group-disabled-color",
|
298
|
+
"@list-group-link-color": "#555",
|
299
|
+
"@list-group-link-hover-color": "@list-group-link-color",
|
300
|
+
"@list-group-link-heading-color": "#333",
|
301
|
+
"@panel-bg": "#fff",
|
302
|
+
"@panel-body-padding": "15px",
|
303
|
+
"@panel-heading-padding": "10px 15px",
|
304
|
+
"@panel-footer-padding": "@panel-heading-padding",
|
305
|
+
"@panel-border-radius": "@border-radius-base",
|
306
|
+
"@panel-inner-border": "#ddd",
|
307
|
+
"@panel-footer-bg": "#f5f5f5",
|
308
|
+
"@panel-default-text": "@gray-dark",
|
309
|
+
"@panel-default-border": "#ddd",
|
310
|
+
"@panel-default-heading-bg": "#f5f5f5",
|
311
|
+
"@panel-primary-text": "#fff",
|
312
|
+
"@panel-primary-border": "@brand-primary",
|
313
|
+
"@panel-primary-heading-bg": "@brand-primary",
|
314
|
+
"@panel-success-text": "@state-success-text",
|
315
|
+
"@panel-success-border": "@state-success-border",
|
316
|
+
"@panel-success-heading-bg": "@state-success-bg",
|
317
|
+
"@panel-info-text": "@state-info-text",
|
318
|
+
"@panel-info-border": "@state-info-border",
|
319
|
+
"@panel-info-heading-bg": "@state-info-bg",
|
320
|
+
"@panel-warning-text": "@state-warning-text",
|
321
|
+
"@panel-warning-border": "@state-warning-border",
|
322
|
+
"@panel-warning-heading-bg": "@state-warning-bg",
|
323
|
+
"@panel-danger-text": "@state-danger-text",
|
324
|
+
"@panel-danger-border": "@state-danger-border",
|
325
|
+
"@panel-danger-heading-bg": "@state-danger-bg",
|
326
|
+
"@thumbnail-padding": "4px",
|
327
|
+
"@thumbnail-bg": "@body-bg",
|
328
|
+
"@thumbnail-border": "#ddd",
|
329
|
+
"@thumbnail-border-radius": "@border-radius-base",
|
330
|
+
"@thumbnail-caption-color": "@text-color",
|
331
|
+
"@thumbnail-caption-padding": "9px",
|
332
|
+
"@well-bg": "#f5f5f5",
|
333
|
+
"@well-border": "darken(@well-bg, 7%)",
|
334
|
+
"@badge-color": "#fff",
|
335
|
+
"@badge-link-hover-color": "#fff",
|
336
|
+
"@badge-bg": "@gray-light",
|
337
|
+
"@badge-active-color": "@link-color",
|
338
|
+
"@badge-active-bg": "#fff",
|
339
|
+
"@badge-font-weight": "bold",
|
340
|
+
"@badge-line-height": "1",
|
341
|
+
"@badge-border-radius": "10px",
|
342
|
+
"@breadcrumb-padding-vertical": "8px",
|
343
|
+
"@breadcrumb-padding-horizontal": "15px",
|
344
|
+
"@breadcrumb-bg": "#f5f5f5",
|
345
|
+
"@breadcrumb-color": "#ccc",
|
346
|
+
"@breadcrumb-active-color": "@gray-light",
|
347
|
+
"@breadcrumb-separator": "\"/\"",
|
348
|
+
"@carousel-text-shadow": "0 1px 2px rgba(0,0,0,.6)",
|
349
|
+
"@carousel-control-color": "#fff",
|
350
|
+
"@carousel-control-width": "15%",
|
351
|
+
"@carousel-control-opacity": ".5",
|
352
|
+
"@carousel-control-font-size": "20px",
|
353
|
+
"@carousel-indicator-active-bg": "#fff",
|
354
|
+
"@carousel-indicator-border-color": "#fff",
|
355
|
+
"@carousel-caption-color": "#fff",
|
356
|
+
"@close-font-weight": "bold",
|
357
|
+
"@close-color": "#000",
|
358
|
+
"@close-text-shadow": "0 1px 0 #fff",
|
359
|
+
"@code-color": "#c7254e",
|
360
|
+
"@code-bg": "#f9f2f4",
|
361
|
+
"@kbd-color": "#fff",
|
362
|
+
"@kbd-bg": "#333",
|
363
|
+
"@pre-bg": "#f5f5f5",
|
364
|
+
"@pre-color": "@gray-dark",
|
365
|
+
"@pre-border-color": "#ccc",
|
366
|
+
"@pre-scrollable-max-height": "340px",
|
367
|
+
"@component-offset-horizontal": "180px",
|
368
|
+
"@text-muted": "@gray-light",
|
369
|
+
"@abbr-border-color": "@gray-light",
|
370
|
+
"@headings-small-color": "@gray-light",
|
371
|
+
"@blockquote-small-color": "@gray-light",
|
372
|
+
"@blockquote-font-size": "(@font-size-base * 1.25)",
|
373
|
+
"@blockquote-border-color": "@gray-lighter",
|
374
|
+
"@page-header-border-color": "@gray-lighter",
|
375
|
+
"@dl-horizontal-offset": "@component-offset-horizontal",
|
376
|
+
"@hr-border": "@gray-lighter"
|
377
|
+
}
|
378
|
+
}
|
data/test/test_parser.rb
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
require_relative '../lib/snake/parser'
|
3
|
+
|
4
|
+
class ParserTest < ActiveSupport::TestCase
|
5
|
+
def test_get_new_variables
|
6
|
+
assert_equal Snake::Parser.send(:get_new_variables, File.join(File.dirname(__FILE__), ("test_json/test.json"))).class, Hash
|
7
|
+
end
|
8
|
+
|
9
|
+
def test_get_default_variables
|
10
|
+
assert_equal Snake::Parser.send(:get_default_variables).class, Hash
|
11
|
+
end
|
12
|
+
|
13
|
+
def test_compare_with_same_hashes
|
14
|
+
hash_one = { "var1" => "val1" }
|
15
|
+
hash_two = { "var1" => "val1" }
|
16
|
+
|
17
|
+
assert_equal Snake::Parser.send(:compare, hash_one, hash_two), {}
|
18
|
+
end
|
19
|
+
|
20
|
+
def test_compare_with_totally_different_hashes
|
21
|
+
hash_one = { "var1" => "val1" }
|
22
|
+
hash_two = { "var2" => "val3" }
|
23
|
+
|
24
|
+
assert_equal Snake::Parser.send(:compare, hash_one, hash_two), hash_one
|
25
|
+
end
|
26
|
+
|
27
|
+
def test_compare_with_changed_hashes
|
28
|
+
hash_one = { "var1" => "val2" }
|
29
|
+
hash_two = { "var1" => "val1" }
|
30
|
+
|
31
|
+
assert_equal Snake::Parser.send(:compare, hash_one, hash_two), hash_one
|
32
|
+
end
|
33
|
+
|
34
|
+
def test_compare_with_realistic_hashes
|
35
|
+
hash_one = { "var1" => "val1", "var2" => "val2", "var3" => "val3" }
|
36
|
+
hash_two = { "var1" => "val1", "var2" => "val3", "var3" => "val3" }
|
37
|
+
|
38
|
+
assert_equal Snake::Parser.send(:compare, hash_one, hash_two), { "var2" => "val2" }
|
39
|
+
end
|
40
|
+
|
41
|
+
def test_parse
|
42
|
+
assert_equal Snake::Parser.parse(File.join(File.dirname(__FILE__), ("test_json/test.json"))).class, Hash
|
43
|
+
end
|
44
|
+
end
|
data/test/test_writer.rb
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
require_relative '../lib/snake/writer'
|
3
|
+
|
4
|
+
class WriterTest < ActiveSupport::TestCase
|
5
|
+
def test_write_file
|
6
|
+
Snake::Writer.write({"var1" => "val1", "var2" => "val2"})
|
7
|
+
assert_equal File.exists?(File.join(Rails.root, "test/dummy/app/assets/stylesheets/_snake_vars.css.scss")), true
|
8
|
+
end
|
9
|
+
|
10
|
+
def test_written_file_is_correct
|
11
|
+
values_hash = {"var1" => "val1", "var2" => "val2"}
|
12
|
+
values_arr = values_hash.to_a.map { |el| "$#{el[0]} : #{el[1]};\n"}
|
13
|
+
|
14
|
+
Snake::Writer.write(values_hash)
|
15
|
+
|
16
|
+
File.open(File.join(Rails.root, "test/dummy/app/assets/stylesheets/_snake_vars.css.scss")) do |f|
|
17
|
+
f.each_line.with_index { |line, index| assert_equal line, values_arr[index] }
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
metadata
ADDED
@@ -0,0 +1,138 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: snake
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- caneroj1
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-01-19 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rails
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 4.2.0
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 4.2.0
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: sqlite3
|
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
|
+
description: Parse config.json included with custom downloads of Twitter Bootstrap
|
42
|
+
and use it with your Rails app.
|
43
|
+
email:
|
44
|
+
- caneroj1@tcnj.edu
|
45
|
+
executables: []
|
46
|
+
extensions: []
|
47
|
+
extra_rdoc_files: []
|
48
|
+
files:
|
49
|
+
- MIT-LICENSE
|
50
|
+
- README.rdoc
|
51
|
+
- Rakefile
|
52
|
+
- lib/generators/snake/parse_generator.rb
|
53
|
+
- lib/snake.rb
|
54
|
+
- lib/snake/parser.rb
|
55
|
+
- lib/snake/version.rb
|
56
|
+
- lib/snake/writer.rb
|
57
|
+
- lib/tasks/snake_tasks.rake
|
58
|
+
- test/dummy/app/assets/javascripts/application.js
|
59
|
+
- test/dummy/app/assets/stylesheets/_snake_vars.css.scss
|
60
|
+
- test/dummy/app/assets/stylesheets/application.css
|
61
|
+
- test/dummy/bin/bundle
|
62
|
+
- test/dummy/bin/rails
|
63
|
+
- test/dummy/bin/rake
|
64
|
+
- test/dummy/bin/setup
|
65
|
+
- test/dummy/config/application.rb
|
66
|
+
- test/dummy/config/boot.rb
|
67
|
+
- test/dummy/config/environment.rb
|
68
|
+
- test/dummy/config/environments/development.rb
|
69
|
+
- test/dummy/config/environments/production.rb
|
70
|
+
- test/dummy/config/environments/test.rb
|
71
|
+
- test/dummy/config/initializers/assets.rb
|
72
|
+
- test/dummy/config/initializers/backtrace_silencers.rb
|
73
|
+
- test/dummy/config/initializers/cookies_serializer.rb
|
74
|
+
- test/dummy/config/initializers/filter_parameter_logging.rb
|
75
|
+
- test/dummy/config/initializers/inflections.rb
|
76
|
+
- test/dummy/config/initializers/mime_types.rb
|
77
|
+
- test/dummy/config/initializers/session_store.rb
|
78
|
+
- test/dummy/config/initializers/wrap_parameters.rb
|
79
|
+
- test/dummy/config/locales/en.yml
|
80
|
+
- test/dummy/config/routes.rb
|
81
|
+
- test/dummy/config/secrets.yml
|
82
|
+
- test/test_helper.rb
|
83
|
+
- test/test_json/test.json
|
84
|
+
- test/test_parser.rb
|
85
|
+
- test/test_writer.rb
|
86
|
+
homepage: https://github.com/caneroj1/snake
|
87
|
+
licenses:
|
88
|
+
- MIT
|
89
|
+
metadata: {}
|
90
|
+
post_install_message:
|
91
|
+
rdoc_options: []
|
92
|
+
require_paths:
|
93
|
+
- lib
|
94
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
95
|
+
requirements:
|
96
|
+
- - ">="
|
97
|
+
- !ruby/object:Gem::Version
|
98
|
+
version: '0'
|
99
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
requirements: []
|
105
|
+
rubyforge_project:
|
106
|
+
rubygems_version: 2.4.3
|
107
|
+
signing_key:
|
108
|
+
specification_version: 4
|
109
|
+
summary: Parse config.json included with custom downloads of Twitter Bootstrap.
|
110
|
+
test_files:
|
111
|
+
- test/dummy/app/assets/javascripts/application.js
|
112
|
+
- test/dummy/app/assets/stylesheets/_snake_vars.css.scss
|
113
|
+
- test/dummy/app/assets/stylesheets/application.css
|
114
|
+
- test/dummy/bin/bundle
|
115
|
+
- test/dummy/bin/rails
|
116
|
+
- test/dummy/bin/rake
|
117
|
+
- test/dummy/bin/setup
|
118
|
+
- test/dummy/config/application.rb
|
119
|
+
- test/dummy/config/boot.rb
|
120
|
+
- test/dummy/config/environment.rb
|
121
|
+
- test/dummy/config/environments/development.rb
|
122
|
+
- test/dummy/config/environments/production.rb
|
123
|
+
- test/dummy/config/environments/test.rb
|
124
|
+
- test/dummy/config/initializers/assets.rb
|
125
|
+
- test/dummy/config/initializers/backtrace_silencers.rb
|
126
|
+
- test/dummy/config/initializers/cookies_serializer.rb
|
127
|
+
- test/dummy/config/initializers/filter_parameter_logging.rb
|
128
|
+
- test/dummy/config/initializers/inflections.rb
|
129
|
+
- test/dummy/config/initializers/mime_types.rb
|
130
|
+
- test/dummy/config/initializers/session_store.rb
|
131
|
+
- test/dummy/config/initializers/wrap_parameters.rb
|
132
|
+
- test/dummy/config/locales/en.yml
|
133
|
+
- test/dummy/config/routes.rb
|
134
|
+
- test/dummy/config/secrets.yml
|
135
|
+
- test/test_helper.rb
|
136
|
+
- test/test_json/test.json
|
137
|
+
- test/test_parser.rb
|
138
|
+
- test/test_writer.rb
|