kentucky 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/lib/kentucky.rb ADDED
@@ -0,0 +1,27 @@
1
+ # CodeKit needs relative paths
2
+ dir = File.dirname(__FILE__)
3
+ $LOAD_PATH.unshift dir unless $LOAD_PATH.include?(dir)
4
+
5
+ require "kentucky/generator"
6
+
7
+ unless defined?(Sass)
8
+ require 'sass'
9
+ end
10
+
11
+ module Kentucky
12
+ if defined?(Rails) && defined?(Rails::Engine)
13
+ class Engine < ::Rails::Engine
14
+ require 'kentucky/engine'
15
+ end
16
+
17
+ module Rails
18
+ class Railtie < ::Rails::Railtie
19
+ rake_tasks do
20
+ load "tasks/install.rake"
21
+ end
22
+ end
23
+ end
24
+ else
25
+ Sass.load_paths << File.expand_path("../../app/assets/stylesheets", __FILE__)
26
+ end
27
+ end
@@ -0,0 +1,5 @@
1
+ module Kentucky
2
+ class Engine < Rails::Engine
3
+ # auto wire
4
+ end
5
+ end
@@ -0,0 +1,132 @@
1
+ require 'kentucky/version'
2
+ require "fileutils"
3
+ require 'thor'
4
+
5
+ module Kentucky
6
+ class Generator < Thor
7
+ map ['-v', '--version'] => :version
8
+
9
+ desc 'install', 'Install Kentucky into your project'
10
+ method_options :path => :string, :force => :boolean, :dir => :boolean
11
+ def install
12
+ if kentucky_files_already_exist? && !options[:force]
13
+ puts "Kentucky files already installed, doing nothing."
14
+ else
15
+ create_site_structure if !options[:force]
16
+ install_deps
17
+ install_files
18
+ puts "Kentucky files installed to #{install_path_kentucky}/"
19
+ end
20
+ end
21
+
22
+ desc 'update', 'Update Kentucky'
23
+ method_options :path => :string
24
+ def update
25
+ if kentucky_files_already_exist?
26
+ remove_kentucky_directory
27
+ create_kentucky_directory
28
+ install_files
29
+ puts "Kentucky files updated."
30
+ else
31
+ puts "No existing Kentucky installation. Doing nothing."
32
+ end
33
+ end
34
+
35
+ desc 'version', 'Show Kentucky version'
36
+ def version
37
+ say "Kentucky #{Kentucky::VERSION}"
38
+ end
39
+
40
+ private
41
+
42
+ def kentucky_files_already_exist?
43
+ install_path_kentucky.exist?
44
+ end
45
+
46
+ def create_site_structure
47
+ make_install_directory
48
+ if options[:dir]
49
+ dirs = %w(fonts images scripts scss style)
50
+ dirs.each do |dir|
51
+ FileUtils.mkdir(install_path + Pathname.new(dir))
52
+ end
53
+ end
54
+ create_kentucky_directory
55
+ end
56
+
57
+ def make_install_directory
58
+ FileUtils.mkdir_p(install_path)
59
+ end
60
+
61
+ def create_kentucky_directory
62
+ FileUtils.mkdir(install_path_kentucky)
63
+ end
64
+
65
+ def remove_kentucky_directory
66
+ FileUtils.rm_rf(install_path_kentucky)
67
+ end
68
+
69
+ def install_path
70
+ if options[:path]
71
+ path = Pathname.new(options[:path])
72
+ else
73
+ path = Pathname.new('.')
74
+ end
75
+
76
+ @install_path = path
77
+ return path
78
+ end
79
+
80
+ def install_files
81
+ copy_in_scss_files
82
+ end
83
+
84
+ def install_deps
85
+ Dir.chdir install_path_scss do
86
+ `bourbon install`
87
+ `neat install`
88
+ end
89
+ end
90
+
91
+ def copy_in_scss_files
92
+ FileUtils.cp_r(kentucky_stylesheets, install_path_kentucky)
93
+ FileUtils.cp(master_stylesheet, install_path_scss)
94
+ end
95
+
96
+ def install_path_scss
97
+ if options[:dir]
98
+ return install_path + Pathname.new("scss")
99
+ else
100
+ return install_path
101
+ end
102
+ end
103
+
104
+ def install_path_kentucky
105
+ return install_path_scss + Pathname.new("kentucky")
106
+ end
107
+
108
+ def master_stylesheet
109
+ Dir["#{stylesheets_directory}/style.scss"]
110
+ end
111
+
112
+ def kentucky_stylesheets
113
+ Dir["#{kentucky_directory}/*"]
114
+ end
115
+
116
+ def all_stylesheets
117
+ Dir["#{stylesheets_directory}/*"]
118
+ end
119
+
120
+ def kentucky_directory
121
+ File.join(stylesheets_directory, "kentucky")
122
+ end
123
+
124
+ def stylesheets_directory
125
+ File.join(top_level_directory, "app", "assets", "stylesheets")
126
+ end
127
+
128
+ def top_level_directory
129
+ File.dirname(File.dirname(File.dirname(__FILE__)))
130
+ end
131
+ end
132
+ end
@@ -0,0 +1,3 @@
1
+ module Kentucky
2
+ VERSION = "0.1.0"
3
+ end
@@ -0,0 +1,20 @@
1
+ # Needed for pre-3.1.
2
+
3
+ require "fileutils"
4
+ require "find"
5
+
6
+ namespace :kentucky 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}/kentucky")
12
+ FileUtils.cp_r("#{source_root}/app/assets/stylesheets/.", "#{Rails.root}/#{args.sass_path}/kentucky", { :preserve => true })
13
+ Find.find("#{Rails.root}/#{args.sass_path}/kentucky") 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/readme.md ADDED
@@ -0,0 +1,62 @@
1
+ # Kentucky
2
+ ###### Straight from the source.
3
+
4
+ ***
5
+
6
+ ## What is Kentucky?
7
+ Kentucky is LookThink's contribution to further enhance an already stellar SCSS library put together by the people at [ThoughtBot](http://www.thoughtbot.com/). Their mixin library, [Bourbon](http://bourbon.io/), and grid system, [Neat](http://neat.bourbon.io/), now serve as the base to all LookThink projects.
8
+
9
+ Kentucky also includes a variety of mixins from various projects that we find useful and weren't included in Bourbon. Additionally, it includes a handy-dandy file (_defaults.scss) for handling all of your variables, keeping them centralized and easy to maintain.
10
+
11
+ ***
12
+
13
+ ## What's changed?
14
+ LookThink now uses SCSS exclusively as it's CSS preprocessor language of choice. The previous framework was written in LESS and we've taken steps to continually evolve how we code projects.
15
+
16
+ We've also lessened the maintenance burden by relying on libraries that already exist and do the exact same things our previous framework did. The new method for acquiring the framework also means you'll always have the most up to date version of the components.
17
+
18
+ Lastly, we've opened a Trello board for all feedback, issue / bug reporting, and additions to the framework. You can track it's growth as well as alert us to potential or existing problems in Kentucky.
19
+
20
+ ***
21
+
22
+ ## How do I get Kentucky?
23
+ There are a few steps needed to build the new framework. Luckily for you we've automated as much as we can and all you have to do is copy-paste (or type if you're so inclined) a few lines into your terminal and you're set!
24
+
25
+ If you need to navigate to your project folder in the Terminal, use the `cd` command to get to your project folder: `$ cd projects-base/project/build`.
26
+
27
+ The simplest way to get Kentucky is to navigate to your project's SCSS folder, open Terminal and type:
28
+
29
+ $ kentucky install
30
+
31
+ This will install Bourbon, Neat, and Kentucky in nice little folders ready for you to use. All you need to do is add a folder for your partials, pages, or whatever you need and get to coding!
32
+
33
+ Kentucky also comes with a few options to make your life easier in particular situations.
34
+
35
+ If you need a full project structure (fonts, images, etc.), navigate to your project folder, open Terminal:
36
+
37
+ $ kentucky install --dir
38
+
39
+ This will create **fonts**, **images**, **SCSS**, **style**, and **scripts** folders in your project folder. It then installs Kentucky inside of the created SCSS folder! Super easy, right?!
40
+
41
+ The last option is for you Terminal pro's. Kentucky includes the capability to create your project folder, tell Kentucky where it is, and install it there, *without* needing to `cd` there. To do this open Terminal:
42
+
43
+ $ mkdir -p projects-base/project/build
44
+ $ kentucky install --path=projects-base/project/build --dir
45
+
46
+ This creates your project folder, creates all required folders inside of that folder, and installs Kentucky! Boom! This is also runnable without the `--dir` option if all you need is to point Kentucky to the project from anywhere but the project folder, `$ kentucky install --patch=projects-base/project/build/scss`.
47
+
48
+ Once Kentucky is installed, navigate to the project folder, open Terminal and run:
49
+
50
+ $ sass --watch scss/style.scss:style/style.css
51
+
52
+ Leave Terminal open and whenever you make a change to your SCSS files, it will compile a new style.css for you.
53
+
54
+ ***
55
+
56
+ ## Need help?
57
+ Fear not! Bourbon and Neat are fully documented and easy to follow. Need more general help? The SCSS documentation isn't grand, but it's better than not having any. See the list below for help with coding out your projects!
58
+
59
+ + [Official SCSS Reference](http://sass-lang.com/docs/yardoc/file.SASS_REFERENCE.html#)
60
+ + [Bourbon Documentation](http://bourbon.io/docs/)
61
+ + [Neat Documentation](http://neat.bourbon.io/docs/)
62
+ + *Updated code manual coming soon!*
metadata ADDED
@@ -0,0 +1,164 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: kentucky
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Aaron Clemmer
8
+ - Greg Bruening
9
+ - Chris Brinson
10
+ autorequire:
11
+ bindir: bin
12
+ cert_chain: []
13
+ date: 2013-05-30 00:00:00.000000000 Z
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: sass
17
+ requirement: !ruby/object:Gem::Requirement
18
+ requirements:
19
+ - - '>='
20
+ - !ruby/object:Gem::Version
21
+ version: 3.2.0
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ requirements:
26
+ - - '>='
27
+ - !ruby/object:Gem::Version
28
+ version: 3.2.0
29
+ - !ruby/object:Gem::Dependency
30
+ name: bourbon
31
+ requirement: !ruby/object:Gem::Requirement
32
+ requirements:
33
+ - - ~>
34
+ - !ruby/object:Gem::Version
35
+ version: '3.1'
36
+ type: :runtime
37
+ prerelease: false
38
+ version_requirements: !ruby/object:Gem::Requirement
39
+ requirements:
40
+ - - ~>
41
+ - !ruby/object:Gem::Version
42
+ version: '3.1'
43
+ - !ruby/object:Gem::Dependency
44
+ name: neat
45
+ requirement: !ruby/object:Gem::Requirement
46
+ requirements:
47
+ - - ~>
48
+ - !ruby/object:Gem::Version
49
+ version: '1.2'
50
+ type: :runtime
51
+ prerelease: false
52
+ version_requirements: !ruby/object:Gem::Requirement
53
+ requirements:
54
+ - - ~>
55
+ - !ruby/object:Gem::Version
56
+ version: '1.2'
57
+ - !ruby/object:Gem::Dependency
58
+ name: thor
59
+ requirement: !ruby/object:Gem::Requirement
60
+ requirements:
61
+ - - '>='
62
+ - !ruby/object:Gem::Version
63
+ version: '0'
64
+ type: :runtime
65
+ prerelease: false
66
+ version_requirements: !ruby/object:Gem::Requirement
67
+ requirements:
68
+ - - '>='
69
+ - !ruby/object:Gem::Version
70
+ version: '0'
71
+ - !ruby/object:Gem::Dependency
72
+ name: aruba
73
+ requirement: !ruby/object:Gem::Requirement
74
+ requirements:
75
+ - - '='
76
+ - !ruby/object:Gem::Version
77
+ version: 0.4.11
78
+ type: :development
79
+ prerelease: false
80
+ version_requirements: !ruby/object:Gem::Requirement
81
+ requirements:
82
+ - - '='
83
+ - !ruby/object:Gem::Version
84
+ version: 0.4.11
85
+ - !ruby/object:Gem::Dependency
86
+ name: rake
87
+ requirement: !ruby/object:Gem::Requirement
88
+ requirements:
89
+ - - '>='
90
+ - !ruby/object:Gem::Version
91
+ version: '0'
92
+ type: :development
93
+ prerelease: false
94
+ version_requirements: !ruby/object:Gem::Requirement
95
+ requirements:
96
+ - - '>='
97
+ - !ruby/object:Gem::Version
98
+ version: '0'
99
+ description: |
100
+ Kentucky is LookThink's contribution to further enhance an already stellar SCSS library put together by the people at ThoughtBot. Their mixin library (Bourbon) and grid system (Neat) now serve as the base to all LookThink projects. Kentucky also includes a variety of mixins from various projects that we find useful and weren't included in Bourbon. Additionally, it includes a handy-dandy file (_defaults.scss) for handling all of your variables, keeping them centralized and easy to maintain.
101
+ email:
102
+ - greg@lookthink.com
103
+ executables:
104
+ - kentucky
105
+ extensions: []
106
+ extra_rdoc_files: []
107
+ files:
108
+ - .gitignore
109
+ - Gemfile
110
+ - Gemfile.lock
111
+ - LICENSE
112
+ - Rakefile
113
+ - app/assets/stylesheets/kentucky/_debug.scss
114
+ - app/assets/stylesheets/kentucky/_defaults.scss
115
+ - app/assets/stylesheets/kentucky/_helpers.scss
116
+ - app/assets/stylesheets/kentucky/_kentucky.scss
117
+ - app/assets/stylesheets/kentucky/_normalize.scss
118
+ - app/assets/stylesheets/kentucky/_shame.scss
119
+ - app/assets/stylesheets/style.scss
120
+ - bin/kentucky
121
+ - features/install.feature
122
+ - features/step_definitions/kentucky_steps.rb
123
+ - features/support/env.rb
124
+ - features/support/kentucky_support.rb
125
+ - features/update.feature
126
+ - features/version.feature
127
+ - kentucky.gemspec
128
+ - lib/kentucky.rb
129
+ - lib/kentucky/engine.rb
130
+ - lib/kentucky/generator.rb
131
+ - lib/kentucky/version.rb
132
+ - lib/tasks/install.rake
133
+ - readme.md
134
+ homepage: https://bitbucket.org/lookthink/kentucky
135
+ licenses:
136
+ - MIT
137
+ metadata: {}
138
+ post_install_message:
139
+ rdoc_options: []
140
+ require_paths:
141
+ - lib
142
+ required_ruby_version: !ruby/object:Gem::Requirement
143
+ requirements:
144
+ - - '>='
145
+ - !ruby/object:Gem::Version
146
+ version: '0'
147
+ required_rubygems_version: !ruby/object:Gem::Requirement
148
+ requirements:
149
+ - - '>='
150
+ - !ruby/object:Gem::Version
151
+ version: '0'
152
+ requirements: []
153
+ rubyforge_project:
154
+ rubygems_version: 2.0.3
155
+ signing_key:
156
+ specification_version: 4
157
+ summary: Kentucky Bourbon, Neat SCSS Mixins and Grid System
158
+ test_files:
159
+ - features/install.feature
160
+ - features/step_definitions/kentucky_steps.rb
161
+ - features/support/env.rb
162
+ - features/support/kentucky_support.rb
163
+ - features/update.feature
164
+ - features/version.feature