tv_snow 0.0.1

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: 38d537156ec05b43fa2f6153959616c07e91461e
4
+ data.tar.gz: 31bb2088f3583fbb5b603c5d15f824d741fbf88b
5
+ SHA512:
6
+ metadata.gz: 7195c1431eab81e3678bdcf4d3c473c082650661a539c049a7db8a8eb8c5abc824e9fba5585734c155672ebfe2bd5052943b21db742711c6e4fd28f1d54766eb
7
+ data.tar.gz: 8776a76e9b9b8b6581117f57a544813996a731b82cc33ba3bb06b2ed4fe500c03b26bf137a5f7e7a03b20ab81990b6b5b5a32a5b55a1b5c30ecb0879b41f0e7a
@@ -0,0 +1,23 @@
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
18
+ *.bundle
19
+ *.so
20
+ *.o
21
+ *.a
22
+ mkmf.log
23
+ *.swp
data/Gemfile ADDED
@@ -0,0 +1,8 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in tv_snow.gemspec
4
+ gemspec
5
+
6
+ gem 'sass'
7
+ gem 'haml'
8
+ gem 'slim'
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 Jonathan Arnett
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.
@@ -0,0 +1,44 @@
1
+ # TV Snow
2
+
3
+ A Ruby gem for compiling static sites!
4
+
5
+ ## Installation
6
+
7
+ Someday, you will be able to run `$ gem install tv_snow` and have it work.
8
+ It doesn't yet.
9
+
10
+ Currently, you can install the gem by downloading it from this lovely Github
11
+ project page, entering the directory, and running
12
+
13
+ ```$ rake install```
14
+
15
+ ## Usage
16
+
17
+ Build your site with your favorite Ruby tools!
18
+
19
+ First, you should have the following directories in your project (but each is
20
+ optional):
21
+
22
+ * `css`, which should hold all your Sass and CSS files
23
+ * `js`, which should hold all your Coffeescript and JS files
24
+ * `img`, which should hold all your images
25
+
26
+ All of your Haml or Slim files should just be at the root of the project.
27
+ Someday, I should probably add support for directory structures. Maybe today.
28
+
29
+ Note: When you link to a stylesheet written in Sass, do not add the `scss`
30
+ ending to the file name. So linking to the styles contained in
31
+ `css/default.css.scss`, in Haml you would write:
32
+
33
+ ```%link{rel: 'stylesheet', href: 'css/default.css'}```
34
+
35
+ ## Contributing
36
+
37
+ 1. Fork it ( https://github.com/J3RN/tv_snow/fork )
38
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
39
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
40
+ 4. Push to the branch (`git push origin my-new-feature`)
41
+ 5. Create a new Pull Request
42
+
43
+ There is so much to do! I'm sorry for the very unfinished-ness of this app, and
44
+ would love your help!
@@ -0,0 +1,2 @@
1
+ require "bundler/gem_tasks"
2
+
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'tv_snow'
4
+
5
+ compiler = TvSnow::Compiler.new
6
+ compiler.compile
@@ -0,0 +1,64 @@
1
+ require "tv_snow/version"
2
+
3
+ module TvSnow
4
+ class Compiler
5
+ # Compile the site -- Heavily inspired by Jekyll and Octopress!
6
+ def compile
7
+ # Define directory names
8
+ deploy_dir = "_deploy/"
9
+ css_dir = "css"
10
+ js_dir = "js"
11
+ img_dir = "img"
12
+
13
+ # Make sure all of our destinations exist!
14
+ check_or_create(deploy_dir)
15
+ check_or_create(deploy_dir + css_dir)
16
+ check_or_create(deploy_dir + js_dir)
17
+ check_or_create(deploy_dir + img_dir)
18
+
19
+ # Copy all markup to be deployed, compile if necessary
20
+ compile_type("slimrb", "slim", ".", deploy_dir)
21
+ compile_type("haml", "haml", ".", deploy_dir)
22
+ copy_files("html", "", deploy_dir)
23
+
24
+ # Copy all stylesheets, compile if necessary
25
+ compile_type("sass", "scss", css_dir, deploy_dir + css_dir)
26
+ copy_files("css", css_dir, deploy_dir)
27
+
28
+ # Copy Javascript, compile if necessary
29
+ #compile("coffee -o ") TODO: Fix this
30
+ copy_files("js", js_dir, deploy_dir)
31
+
32
+ # Copy all images
33
+ copy_files("*", img_dir, deploy_dir)
34
+ end
35
+
36
+ # A fairly trivial method that creates a directory if it does not already exist
37
+ def check_or_create(dir)
38
+ if not File.directory?(dir)
39
+ puts "Creating #{ dir }..."
40
+ Dir.mkdir(dir)
41
+ end
42
+ end
43
+
44
+ # Runs a given command, compiling all of the given file types and outputting
45
+ # the result into a given destination
46
+ def compile_type(command, ext, source_dir, dest_dir)
47
+ Dir.glob("#{ source_dir }/*.#{ ext }") do |file|
48
+ new_file_name = File.basename(file)[0..-(ext.length + 2)]
49
+ puts "Compiling #{ file } to #{ new_file_name }..."
50
+ system "#{ command } #{ file } > #{ dest_dir }/#{ new_file_name }"
51
+ end
52
+ end
53
+
54
+ # Simply runs 'cp'. It operates file-by-file instead of recursively because I
55
+ # like printing individual files (it looks cool)
56
+ def copy_files(ext, source_dir, dest_dir)
57
+ Dir.glob("#{ source_dir }/*.#{ ext }") do |file|
58
+ puts "Copying #{ file }..."
59
+ command = "cp #{ file } #{ dest_dir }/#{ file }"
60
+ system command
61
+ end
62
+ end
63
+ end
64
+ end
@@ -0,0 +1,3 @@
1
+ module TvSnow
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,25 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'tv_snow/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "tv_snow"
8
+ spec.version = TvSnow::VERSION
9
+ spec.authors = ["Jonathan Arnett"]
10
+ spec.email = ["jonarnett90@gmail.com"]
11
+ spec.summary = "A static site compiler"
12
+ spec.description = "TV Snow will compile a static site from all of your
13
+ favorite Ruby templating tools, such as Sass, Slim,
14
+ Haml, and others."
15
+ spec.homepage = "https://github.com/J3RN/tv_snow"
16
+ spec.license = "MIT"
17
+
18
+ spec.files = `git ls-files -z`.split("\x0")
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_development_dependency "bundler", "~> 1.6"
24
+ spec.add_development_dependency "rake"
25
+ end
metadata ADDED
@@ -0,0 +1,86 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: tv_snow
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Jonathan Arnett
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-06-13 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.6'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.6'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ description: |-
42
+ TV Snow will compile a static site from all of your
43
+ favorite Ruby templating tools, such as Sass, Slim,
44
+ Haml, and others.
45
+ email:
46
+ - jonarnett90@gmail.com
47
+ executables:
48
+ - tv_snow
49
+ extensions: []
50
+ extra_rdoc_files: []
51
+ files:
52
+ - ".gitignore"
53
+ - Gemfile
54
+ - LICENSE.txt
55
+ - README.md
56
+ - Rakefile
57
+ - bin/tv_snow
58
+ - lib/tv_snow.rb
59
+ - lib/tv_snow/version.rb
60
+ - tv_snow.gemspec
61
+ homepage: https://github.com/J3RN/tv_snow
62
+ licenses:
63
+ - MIT
64
+ metadata: {}
65
+ post_install_message:
66
+ rdoc_options: []
67
+ require_paths:
68
+ - lib
69
+ required_ruby_version: !ruby/object:Gem::Requirement
70
+ requirements:
71
+ - - ">="
72
+ - !ruby/object:Gem::Version
73
+ version: '0'
74
+ required_rubygems_version: !ruby/object:Gem::Requirement
75
+ requirements:
76
+ - - ">="
77
+ - !ruby/object:Gem::Version
78
+ version: '0'
79
+ requirements: []
80
+ rubyforge_project:
81
+ rubygems_version: 2.3.0
82
+ signing_key:
83
+ specification_version: 4
84
+ summary: A static site compiler
85
+ test_files: []
86
+ has_rdoc: