midwife 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gitignore +3 -0
- data/Gemfile +2 -0
- data/Gemfile.lock +24 -0
- data/README.md +0 -0
- data/Rakefile +2 -0
- data/lib/midwife/tasks.rb +54 -0
- data/lib/midwife/version.rb +3 -0
- data/lib/midwife.rb +8 -0
- data/lib/tasks/care.rake +51 -0
- data/midwife.gemspec +23 -0
- metadata +141 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
PATH
|
|
2
|
+
remote: .
|
|
3
|
+
specs:
|
|
4
|
+
midwife (0.0.1)
|
|
5
|
+
haml (= 3.1.7)
|
|
6
|
+
listen (= 0.5.3)
|
|
7
|
+
rake (= 0.9.2.2)
|
|
8
|
+
rb-fsevent (~> 0.9.1)
|
|
9
|
+
sass (= 3.2.1)
|
|
10
|
+
|
|
11
|
+
GEM
|
|
12
|
+
remote: https://rubygems.org/
|
|
13
|
+
specs:
|
|
14
|
+
haml (3.1.7)
|
|
15
|
+
listen (0.5.3)
|
|
16
|
+
rake (0.9.2.2)
|
|
17
|
+
rb-fsevent (0.9.2)
|
|
18
|
+
sass (3.2.1)
|
|
19
|
+
|
|
20
|
+
PLATFORMS
|
|
21
|
+
ruby
|
|
22
|
+
|
|
23
|
+
DEPENDENCIES
|
|
24
|
+
midwife!
|
data/README.md
ADDED
|
File without changes
|
data/Rakefile
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
require 'listen'
|
|
2
|
+
|
|
3
|
+
module Midwife
|
|
4
|
+
class Tasks
|
|
5
|
+
HAML = FileList['**/*.haml']
|
|
6
|
+
HTML = HAML.ext('html')
|
|
7
|
+
SCSS = FileList['**/*.scss']
|
|
8
|
+
CSS = SCSS.ext('css')
|
|
9
|
+
|
|
10
|
+
ASSETS = 'assets'
|
|
11
|
+
PUBLIC = 'public'
|
|
12
|
+
|
|
13
|
+
CLEAN.include HTML + CSS
|
|
14
|
+
|
|
15
|
+
def self.build
|
|
16
|
+
desc 'Care for your haml/scss'
|
|
17
|
+
task :care => HTML + CSS
|
|
18
|
+
|
|
19
|
+
desc 'Listen to your haml/scss'
|
|
20
|
+
task :listen do |t|
|
|
21
|
+
Listen.to(ASSETS) do |modified, added, removed|
|
|
22
|
+
(modified + added).each do |source|
|
|
23
|
+
extension = File.extname(source)
|
|
24
|
+
if extension == '.haml'
|
|
25
|
+
target = source.ext('html')
|
|
26
|
+
compile('haml', source, target)
|
|
27
|
+
elsif extension == '.scss'
|
|
28
|
+
target = source.ext('css')
|
|
29
|
+
compile('sass', source, target)
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
removed.each do |source|
|
|
33
|
+
destination = source.gsub(ASSETS, PUBLIC).ext('html')
|
|
34
|
+
File.delete(destination)
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
rule '.html' => '.haml' do |t|
|
|
40
|
+
compile("haml", t.source, t.name)
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
rule '.css' => '.scss' do |t|
|
|
44
|
+
compile("sass", t.source, t.name)
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
def self.compile(command, source, target)
|
|
49
|
+
destination = target.gsub(ASSETS, PUBLIC)
|
|
50
|
+
FileUtils.mkdir_p(File.dirname(destination))
|
|
51
|
+
sh "#{command} #{source} #{destination}"
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
end
|
data/lib/midwife.rb
ADDED
data/lib/tasks/care.rake
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
include Rake::DSL
|
|
2
|
+
require 'rake/clean'
|
|
3
|
+
require 'listen'
|
|
4
|
+
|
|
5
|
+
HAML = FileList['**/*.haml']
|
|
6
|
+
HTML = HAML.ext('html')
|
|
7
|
+
SCSS = FileList['**/*.scss']
|
|
8
|
+
CSS = SCSS.ext('css')
|
|
9
|
+
|
|
10
|
+
ASSETS = 'assets'
|
|
11
|
+
PUBLIC = 'public'
|
|
12
|
+
|
|
13
|
+
CLEAN.include HTML + CSS
|
|
14
|
+
|
|
15
|
+
desc 'Care for your haml/scss'
|
|
16
|
+
task :care => HTML + CSS
|
|
17
|
+
task :default => :care
|
|
18
|
+
|
|
19
|
+
desc 'Listen to your haml/scss'
|
|
20
|
+
task :listen do |t|
|
|
21
|
+
Listen.to(ASSETS) do |modified, added, removed|
|
|
22
|
+
(modified + added).each do |source|
|
|
23
|
+
extension = File.extname(source)
|
|
24
|
+
if extension == '.haml'
|
|
25
|
+
target = source.ext('html')
|
|
26
|
+
compile('haml', source, target)
|
|
27
|
+
elsif extension == '.scss'
|
|
28
|
+
target = source.ext('css')
|
|
29
|
+
compile('sass', source, target)
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
removed.each do |source|
|
|
33
|
+
destination = source.gsub(ASSETS, PUBLIC).ext('html')
|
|
34
|
+
File.delete(destination)
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
rule '.html' => '.haml' do |t|
|
|
40
|
+
compile("haml", t.source, t.name)
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
rule '.css' => '.scss' do |t|
|
|
44
|
+
compile("sass", t.source, t.name)
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
def compile(command, source, target)
|
|
48
|
+
destination = target.gsub(ASSETS, PUBLIC)
|
|
49
|
+
FileUtils.mkdir_p(File.dirname(destination))
|
|
50
|
+
sh "#{command} #{source} #{destination}"
|
|
51
|
+
end
|
data/midwife.gemspec
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
|
3
|
+
require "midwife/version"
|
|
4
|
+
|
|
5
|
+
Gem::Specification.new do |s|
|
|
6
|
+
s.name = "midwife"
|
|
7
|
+
s.version = Midwife::VERSION
|
|
8
|
+
s.platform = Gem::Platform::RUBY
|
|
9
|
+
s.authors = ["Li-Hsuan Lung"]
|
|
10
|
+
s.email = ["lihsuan@8thlight.com"]
|
|
11
|
+
s.homepage = "http://github.com/naush/midwife"
|
|
12
|
+
s.summary = %q{A collection of preprocessors for frontend development}
|
|
13
|
+
s.description = %q{}
|
|
14
|
+
|
|
15
|
+
s.add_dependency "rake", "0.9.2.2"
|
|
16
|
+
s.add_dependency "listen", "0.5.3"
|
|
17
|
+
s.add_dependency "rb-fsevent", "~> 0.9.1"
|
|
18
|
+
s.add_dependency "haml", "3.1.7"
|
|
19
|
+
s.add_dependency "sass", "3.2.1"
|
|
20
|
+
|
|
21
|
+
s.files = `git ls-files`.split("\n")
|
|
22
|
+
s.require_paths = ["lib"]
|
|
23
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: midwife
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.0.1
|
|
5
|
+
prerelease:
|
|
6
|
+
platform: ruby
|
|
7
|
+
authors:
|
|
8
|
+
- Li-Hsuan Lung
|
|
9
|
+
autorequire:
|
|
10
|
+
bindir: bin
|
|
11
|
+
cert_chain: []
|
|
12
|
+
date: 2012-10-13 00:00:00.000000000 Z
|
|
13
|
+
dependencies:
|
|
14
|
+
- !ruby/object:Gem::Dependency
|
|
15
|
+
name: rake
|
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
|
17
|
+
none: false
|
|
18
|
+
requirements:
|
|
19
|
+
- - '='
|
|
20
|
+
- !ruby/object:Gem::Version
|
|
21
|
+
version: 0.9.2.2
|
|
22
|
+
type: :runtime
|
|
23
|
+
prerelease: false
|
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
25
|
+
none: false
|
|
26
|
+
requirements:
|
|
27
|
+
- - '='
|
|
28
|
+
- !ruby/object:Gem::Version
|
|
29
|
+
version: 0.9.2.2
|
|
30
|
+
- !ruby/object:Gem::Dependency
|
|
31
|
+
name: listen
|
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
|
33
|
+
none: false
|
|
34
|
+
requirements:
|
|
35
|
+
- - '='
|
|
36
|
+
- !ruby/object:Gem::Version
|
|
37
|
+
version: 0.5.3
|
|
38
|
+
type: :runtime
|
|
39
|
+
prerelease: false
|
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
41
|
+
none: false
|
|
42
|
+
requirements:
|
|
43
|
+
- - '='
|
|
44
|
+
- !ruby/object:Gem::Version
|
|
45
|
+
version: 0.5.3
|
|
46
|
+
- !ruby/object:Gem::Dependency
|
|
47
|
+
name: rb-fsevent
|
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
|
49
|
+
none: false
|
|
50
|
+
requirements:
|
|
51
|
+
- - ~>
|
|
52
|
+
- !ruby/object:Gem::Version
|
|
53
|
+
version: 0.9.1
|
|
54
|
+
type: :runtime
|
|
55
|
+
prerelease: false
|
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
57
|
+
none: false
|
|
58
|
+
requirements:
|
|
59
|
+
- - ~>
|
|
60
|
+
- !ruby/object:Gem::Version
|
|
61
|
+
version: 0.9.1
|
|
62
|
+
- !ruby/object:Gem::Dependency
|
|
63
|
+
name: haml
|
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
|
65
|
+
none: false
|
|
66
|
+
requirements:
|
|
67
|
+
- - '='
|
|
68
|
+
- !ruby/object:Gem::Version
|
|
69
|
+
version: 3.1.7
|
|
70
|
+
type: :runtime
|
|
71
|
+
prerelease: false
|
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
73
|
+
none: false
|
|
74
|
+
requirements:
|
|
75
|
+
- - '='
|
|
76
|
+
- !ruby/object:Gem::Version
|
|
77
|
+
version: 3.1.7
|
|
78
|
+
- !ruby/object:Gem::Dependency
|
|
79
|
+
name: sass
|
|
80
|
+
requirement: !ruby/object:Gem::Requirement
|
|
81
|
+
none: false
|
|
82
|
+
requirements:
|
|
83
|
+
- - '='
|
|
84
|
+
- !ruby/object:Gem::Version
|
|
85
|
+
version: 3.2.1
|
|
86
|
+
type: :runtime
|
|
87
|
+
prerelease: false
|
|
88
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
89
|
+
none: false
|
|
90
|
+
requirements:
|
|
91
|
+
- - '='
|
|
92
|
+
- !ruby/object:Gem::Version
|
|
93
|
+
version: 3.2.1
|
|
94
|
+
description: ''
|
|
95
|
+
email:
|
|
96
|
+
- lihsuan@8thlight.com
|
|
97
|
+
executables: []
|
|
98
|
+
extensions: []
|
|
99
|
+
extra_rdoc_files: []
|
|
100
|
+
files:
|
|
101
|
+
- .gitignore
|
|
102
|
+
- Gemfile
|
|
103
|
+
- Gemfile.lock
|
|
104
|
+
- README.md
|
|
105
|
+
- Rakefile
|
|
106
|
+
- lib/midwife.rb
|
|
107
|
+
- lib/midwife/tasks.rb
|
|
108
|
+
- lib/midwife/version.rb
|
|
109
|
+
- lib/tasks/care.rake
|
|
110
|
+
- midwife.gemspec
|
|
111
|
+
homepage: http://github.com/naush/midwife
|
|
112
|
+
licenses: []
|
|
113
|
+
post_install_message:
|
|
114
|
+
rdoc_options: []
|
|
115
|
+
require_paths:
|
|
116
|
+
- lib
|
|
117
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
118
|
+
none: false
|
|
119
|
+
requirements:
|
|
120
|
+
- - ! '>='
|
|
121
|
+
- !ruby/object:Gem::Version
|
|
122
|
+
version: '0'
|
|
123
|
+
segments:
|
|
124
|
+
- 0
|
|
125
|
+
hash: -1056226323928541165
|
|
126
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
127
|
+
none: false
|
|
128
|
+
requirements:
|
|
129
|
+
- - ! '>='
|
|
130
|
+
- !ruby/object:Gem::Version
|
|
131
|
+
version: '0'
|
|
132
|
+
segments:
|
|
133
|
+
- 0
|
|
134
|
+
hash: -1056226323928541165
|
|
135
|
+
requirements: []
|
|
136
|
+
rubyforge_project:
|
|
137
|
+
rubygems_version: 1.8.24
|
|
138
|
+
signing_key:
|
|
139
|
+
specification_version: 3
|
|
140
|
+
summary: A collection of preprocessors for frontend development
|
|
141
|
+
test_files: []
|