tartan-grid 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: f43ea9f36abe0805dde3f7fc743d6250c25cb6f2
4
+ data.tar.gz: e4a06647328e873b7ca52bb4dc2fb17acfbba9c5
5
+ SHA512:
6
+ metadata.gz: 1cacd49a3df8f4d012eeb99f04571bf1afd6519e48bed94ec371e583831c00309ed1365d757c876e0161b9a22be82bbe06a86af1cb38e009f0124edd7e6aa1e8
7
+ data.tar.gz: b50657061e5dd01654a572a386c28ce4bfb9da6538bed172ab938242a5ae191e88a107234f9f5aae122fa01c4f372976f3b6385605c5837e58edf8c898f8bc31
data/.gitignore ADDED
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in tartan.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 Jonathan Clem
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
+ # Tartan
2
+
3
+ TODO: Write a gem description
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'tartan'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install tartan
18
+
19
+ ## Usage
20
+
21
+ TODO: Write usage instructions here
22
+
23
+ ## Contributing
24
+
25
+ 1. Fork it
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"
@@ -0,0 +1,19 @@
1
+ @function columns-width($columns) {
2
+ @return ($columns * $tartan-column-width) + ($columns - 1) * $tartan-gutter-width;
3
+ }
4
+
5
+ @function columns($columns, $context: $tartan-column-count) {
6
+ @return relative-width(columns-width($columns), $context)
7
+ }
8
+
9
+ @function gutter($context: $tartan-column-count) {
10
+ @return relative-width($tartan-gutter-width, $context);
11
+ }
12
+
13
+ @function container-outer-width() {
14
+ @return columns-width($tartan-column-count);
15
+ }
16
+
17
+ @function relative-width($width, $context: $tartan-column-count) {
18
+ @return percentage($width / columns-width($context));
19
+ }
@@ -0,0 +1,88 @@
1
+ @import 'mixins';
2
+
3
+ @mixin container {
4
+ @include box-sizing(border-box);
5
+ @include clearfix;
6
+
7
+ margin: 0 auto;
8
+ max-width: container-outer-width();
9
+
10
+ @if $tartan-fluid == false {
11
+ min-width: container-outer-width();
12
+ padding: 0 $tartan-gutter-width;
13
+ } @else {
14
+ padding: 0 gutter();
15
+ }
16
+
17
+ @if $tartan-render-mode == inline-block {
18
+ letter-spacing: -($tartan-base-size / 64) * 1em;
19
+ }
20
+ }
21
+
22
+ @mixin sub-container {
23
+ @include container;
24
+ max-width: 100%;
25
+ padding: 0;
26
+ }
27
+
28
+ @mixin row {
29
+ @include clearfix;
30
+ }
31
+
32
+ @mixin span-columns($columns: $tartan-column-count, $context: $tartan-column-count, $tartan-render-mode: $tartan-render-mode) {
33
+ @include box-sizing(border-box);
34
+
35
+ @if $tartan-render-mode == inline-block {
36
+ display: inline-block;
37
+ } @else {
38
+ display: block;
39
+ float: left;
40
+ }
41
+
42
+ margin-right: gutter($context);
43
+ margin-bottom: gutter($context);
44
+ width: columns($columns, $context);
45
+ vertical-align: top;
46
+
47
+ @if $columns == $context {
48
+ @include omega;
49
+ }
50
+
51
+ @if $tartan-render-mode == inline-block {
52
+ letter-spacing: normal;
53
+ }
54
+
55
+ &:last-child {
56
+ margin-bottom: 0;
57
+ }
58
+ }
59
+
60
+ @mixin push-columns($columns: 1, $context: $tartan-column-count, $type: margin) {
61
+ #{$type}-left: columns($columns, $context) + gutter($context);
62
+
63
+ @if $type == padding {
64
+ @include box-sizing(content-box);
65
+ }
66
+ }
67
+
68
+ @mixin bumper($columns: 1, $context: $tartan-column-count, $type: margin) {
69
+ #{$type}-right: columns($columns, $context) + gutter($context);
70
+
71
+ @if $type == padding {
72
+ @include box-sizing(content-box);
73
+ }
74
+ }
75
+
76
+ @mixin no-push($type) {
77
+ #{$type}-left: 0;
78
+ }
79
+
80
+ @mixin omega {
81
+ float: right;
82
+ margin-right: 0;
83
+ }
84
+
85
+ @mixin no-omega($context: $tartan-column-count) {
86
+ float: left;
87
+ margin-right: gutter($context);
88
+ }
@@ -0,0 +1,13 @@
1
+ @mixin box-sizing($box) {
2
+ -webkit-box-sizing: border-box;
3
+ -moz-box-sizing: border-box;
4
+ box-sizing: border-box;
5
+ }
6
+
7
+ @mixin clearfix {
8
+ &:after {
9
+ content: "";
10
+ display: table;
11
+ clear: both;
12
+ }
13
+ }
@@ -0,0 +1,6 @@
1
+ $tartan-base-size: 16 !default;
2
+ $tartan-column-count: 12 !default;
3
+ $tartan-column-width: 4em !default;
4
+ $tartan-fluid: true !default;
5
+ $tartan-gutter-width: 1em !default;
6
+ $tartan-render-mode: inline-block !default;
@@ -0,0 +1,3 @@
1
+ @import 'settings';
2
+ @import 'functions';
3
+ @import 'grid';
data/bin/tartan ADDED
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require File.dirname(__FILE__) + '../lib/tartan.rb'
4
+
5
+ Tartan::Generator.start
data/lib/tartan.rb ADDED
@@ -0,0 +1,26 @@
1
+ dir = File.dirname(__FILE__)
2
+ $LOAD_PATH.unshift dir unless $LOAD_PATH.include?(dir)
3
+
4
+ require 'tartan/generator'
5
+
6
+ unless defined?(Sass)
7
+ require 'sass'
8
+ end
9
+
10
+ module Tartan
11
+ if defined?(Rails) && defined?(Rails::Engine)
12
+ class Engine < ::Rails::Engine
13
+ require 'tartan/engine'
14
+ end
15
+
16
+ module Rails
17
+ class Railtie < ::Rails::Railtie
18
+ rake_tasks do
19
+ load "tasks/install.rake"
20
+ end
21
+ end
22
+ end
23
+ else
24
+ Sass.load_paths << File.expand_path("../../app/assets/stylesheets", __FILE__)
25
+ end
26
+ end
@@ -0,0 +1,4 @@
1
+ module Tartan
2
+ class Engine < Rails::Engine
3
+ end
4
+ end
@@ -0,0 +1,75 @@
1
+ require 'tartan/version'
2
+ require 'fileutils'
3
+ require 'thor'
4
+
5
+ module Tartan
6
+ class Generator < Thor
7
+ map ['-v', '--version'] => :version
8
+
9
+ desc 'install', 'Install Tartan into your project'
10
+ method_options :path => :string, :force => :boolean
11
+ def install
12
+ if tartan_files_already_exist? && !options[:force]
13
+ puts 'Tartan files already installed, doing nothing.'
14
+ else
15
+ install_files
16
+ puts "Tartan files installed to #{install_path}/"
17
+ end
18
+ end
19
+
20
+ desc 'update', 'Update Tartan'
21
+ method_options :path => :string
22
+ def update
23
+ if tartan_files_already_exist?
24
+ remove_tartan_directory
25
+ install_files
26
+ puts 'Tartan files updated.'
27
+ else
28
+ puts 'No existing Tartan installation. Doing nothing.'
29
+ end
30
+ end
31
+
32
+ desc 'version', 'Show version'
33
+ def version
34
+ say "Tartan #{Tartan::VERSION}"
35
+ end
36
+
37
+ private
38
+
39
+ def tartan_files_already_exist?
40
+ install_path.exist?
41
+ end
42
+
43
+ def install_path
44
+ @install_path ||= if options[:path]
45
+ Pathname.new(File.join(options[:path], 'tartan'))
46
+ else
47
+ Pathname.new('tartan')
48
+ end
49
+ end
50
+
51
+ def remove_tartan_directory
52
+ FileUtils.rm_rf('tartan')
53
+ end
54
+
55
+ def make_install_directory
56
+ FileUtils.mkdir(install_path)
57
+ end
58
+
59
+ def copy_in_scss_files
60
+ FileUtils.cp_r(all_stylesheets, install_path)
61
+ end
62
+
63
+ def all_stylesheets
64
+ Dir["#{stylesheets_directory}/*"]
65
+ end
66
+
67
+ def stylesheets_directory
68
+ File.join(top_level_directory, "app", "assets", "stylesheets")
69
+ end
70
+
71
+ def top_level_directory
72
+ File.dirname(File.dirname(File.dirname(__FILE__)))
73
+ end
74
+ end
75
+ end
@@ -0,0 +1,3 @@
1
+ module Tartan
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,20 @@
1
+ # Needed for pre-3.1.
2
+
3
+ require "fileutils"
4
+ require "find"
5
+
6
+ namespace :tartan do
7
+ desc "Move files to the Rails assets directory."
8
+ task :install, [:sass_path] do |t, args|
9
+ args.with_defaults(:sass_path => 'public/stylesheets/sass')
10
+ source_root = File.expand_path(File.join(File.dirname(__FILE__), '..', '..'))
11
+ FileUtils.mkdir_p("#{Rails.root}/#{args.sass_path}/tartan")
12
+ FileUtils.cp_r("#{source_root}/app/assets/stylesheets/.", "#{Rails.root}/#{args.sass_path}/tartan", { :preserve => true })
13
+ Find.find("#{Rails.root}/#{args.sass_path}/tartan") do |path|
14
+ if path.end_with?(".css.scss")
15
+ path_without_css_extension = path.gsub(/\.css\.scss$/, ".scss")
16
+ FileUtils.mv(path, path_without_css_extension)
17
+ end
18
+ end
19
+ end
20
+ end
data/tartan.gemspec ADDED
@@ -0,0 +1,28 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'tartan/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "tartan-grid"
8
+ spec.version = Tartan::VERSION
9
+ spec.authors = ["Jonathan Clem"]
10
+ spec.email = ["jonathan@jclem.net"]
11
+ spec.description = <<-EOF
12
+ A simple grid for Heroku, with a Rails engine.
13
+ EOF
14
+ spec.summary = %q{A simple grid for Heroku}
15
+ spec.homepage = "https://github.com/jclem/tartan"
16
+ spec.license = "MIT"
17
+
18
+ spec.files = `git ls-files`.split($/)
19
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
20
+ # spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
21
+ spec.require_paths = ["lib"]
22
+
23
+ spec.add_dependency "sass", ">= 3.2.0"
24
+ spec.add_dependency "thor"
25
+
26
+ spec.add_development_dependency "bundler", "~> 1.3"
27
+ spec.add_development_dependency "rake"
28
+ end
metadata ADDED
@@ -0,0 +1,119 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: tartan-grid
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Jonathan Clem
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2013-07-30 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: sass
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - '>='
18
+ - !ruby/object:Gem::Version
19
+ version: 3.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: 3.2.0
27
+ - !ruby/object:Gem::Dependency
28
+ name: thor
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
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: bundler
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ~>
46
+ - !ruby/object:Gem::Version
47
+ version: '1.3'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ~>
53
+ - !ruby/object:Gem::Version
54
+ version: '1.3'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rake
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
+ description: |
70
+ A simple grid for Heroku, with a Rails engine.
71
+ email:
72
+ - jonathan@jclem.net
73
+ executables:
74
+ - tartan
75
+ extensions: []
76
+ extra_rdoc_files: []
77
+ files:
78
+ - .gitignore
79
+ - Gemfile
80
+ - LICENSE.txt
81
+ - README.md
82
+ - Rakefile
83
+ - app/assets/stylesheets/_functions.scss
84
+ - app/assets/stylesheets/_grid.scss
85
+ - app/assets/stylesheets/_mixins.scss
86
+ - app/assets/stylesheets/_settings.scss
87
+ - app/assets/stylesheets/_tartan.scss
88
+ - bin/tartan
89
+ - lib/tartan.rb
90
+ - lib/tartan/engine.rb
91
+ - lib/tartan/generator.rb
92
+ - lib/tartan/version.rb
93
+ - lib/tasks/install.rake
94
+ - tartan.gemspec
95
+ homepage: https://github.com/jclem/tartan
96
+ licenses:
97
+ - MIT
98
+ metadata: {}
99
+ post_install_message:
100
+ rdoc_options: []
101
+ require_paths:
102
+ - lib
103
+ required_ruby_version: !ruby/object:Gem::Requirement
104
+ requirements:
105
+ - - '>='
106
+ - !ruby/object:Gem::Version
107
+ version: '0'
108
+ required_rubygems_version: !ruby/object:Gem::Requirement
109
+ requirements:
110
+ - - '>='
111
+ - !ruby/object:Gem::Version
112
+ version: '0'
113
+ requirements: []
114
+ rubyforge_project:
115
+ rubygems_version: 2.0.2
116
+ signing_key:
117
+ specification_version: 4
118
+ summary: A simple grid for Heroku
119
+ test_files: []