ssproto 1.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.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 6c047fac39459ab6aa88b6ef720b5ac4260550f1
4
+ data.tar.gz: 7c95df29e5472edb48a90bbf5befd759d358391b
5
+ SHA512:
6
+ metadata.gz: 6889f3cf637edd2119daee5024f357de9ff969955eee9d758aa0a0df29347713774488892056f610809e676889efd149b6cbc50565281b8fcfbc1879a1e70e95
7
+ data.tar.gz: b7b3da9154e20d1977728460da85e68dd1df1051f21cfd5717f5c20e37d3ba8e2072959fa0453fd227f79c82c0c103a7af61e07998d04a61989dc64780387467
data/bin/ssproto ADDED
@@ -0,0 +1,12 @@
1
+ #!/usr/bin/env ruby
2
+ require 'ssproto'
3
+
4
+ cmd = ARGV.shift
5
+ case cmd
6
+ when "create"
7
+ SSProto.create
8
+ when "watch"
9
+ SSProto.watch
10
+ else
11
+ SSProto.watch
12
+ end
data/lib/slim/slim.rb ADDED
@@ -0,0 +1,16 @@
1
+ require 'slim'
2
+ require 'tilt'
3
+ class SSProto::Slim
4
+ def self.setSlimOptions(hash)
5
+ Slim::Engine.set_default_options( hash )
6
+ end
7
+ def self.renderSlim(filename,path)
8
+ begin
9
+ eval File.read("#{Dir.pwd}/config.rb")
10
+ tilt_result = Tilt.new(filename).render self
11
+ File.write(path,tilt_result)
12
+ rescue Exception => e
13
+ puts e.message
14
+ end
15
+ end
16
+ end
data/lib/ssproto.rb ADDED
@@ -0,0 +1,25 @@
1
+ require 'filewatcher'
2
+ class SSProto
3
+ def self.create
4
+ require 'fileutils'
5
+ FileUtils.cp_r(Dir["#{File.expand_path('../../template/',__FILE__)}/*"],Dir.pwd)
6
+ self.watch
7
+ end
8
+ def self.watch
9
+ begin
10
+ sass =Process.spawn("sass --watch sass/:css/ --style compressed")
11
+ Process.detach sass
12
+ SSProto::Slim.setSlimOptions :pretty => true,:sort_attrs => false
13
+ directories_to_watch = ["index.slim","config.rb","css/","js/"]
14
+ puts "Watching:\n #{directories_to_watch.join("\n ")}\n"
15
+ FileWatcher.new(directories_to_watch).watch do |f|
16
+ puts "Rendering index.html"
17
+ SSProto::Slim.renderSlim("#{Dir.pwd}/index.slim","#{Dir.pwd}/index.html")
18
+ puts " finished"
19
+ end
20
+ rescue SystemExit, Interrupt
21
+ Process.kill "SIGINT",sass
22
+ end
23
+ end
24
+ end
25
+ require 'slim/slim.rb'
@@ -0,0 +1,2 @@
1
+ @javascript_files = Dir.entries( "#{Dir.pwd}/js/" ) - ["..","."]
2
+ @css_files = Dir.entries( "#{Dir.pwd}/css/" ) - ["..","."]
File without changes
@@ -0,0 +1,11 @@
1
+ <html>
2
+ <head>
3
+ <link href="css/example.css" type="text/css" rel="stylesheet" />
4
+ <script href="js/example.js" type="text/javascript"></script>
5
+ </head>
6
+ <body>
7
+ <p class="text">
8
+ Welcome, all your javascript and css files are being included.
9
+ </p>
10
+ </body>
11
+ </html>
@@ -0,0 +1,8 @@
1
+ html
2
+ head
3
+ -@css_files.each do |f|
4
+ link href="css/#{f}" type="text/css" rel="stylesheet"
5
+ -@javascript_files.each do |f|
6
+ script href="js/#{f}" type="text/javascript"
7
+ body
8
+ p.text Welcome, all your javascript and css files are being included.
File without changes
File without changes
metadata ADDED
@@ -0,0 +1,123 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: ssproto
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Johnydays
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-04-15 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: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - '>='
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: slim
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: tilt
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: fileutils
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - '>='
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: find
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - '>='
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - '>='
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ description: Single page slim prototyping (use of sass is encouraged)
84
+ email: nick@quaran.to
85
+ executables:
86
+ - ssproto
87
+ extensions: []
88
+ extra_rdoc_files: []
89
+ files:
90
+ - lib/ssproto.rb
91
+ - lib/slim/slim.rb
92
+ - template/config.rb
93
+ - template/css/example.css
94
+ - template/index.html
95
+ - template/index.slim
96
+ - template/js/example.js
97
+ - template/sass/example.sass
98
+ - bin/ssproto
99
+ homepage: http://rubygems.org/gems/ssproto
100
+ licenses:
101
+ - MIT
102
+ metadata: {}
103
+ post_install_message:
104
+ rdoc_options: []
105
+ require_paths:
106
+ - lib
107
+ required_ruby_version: !ruby/object:Gem::Requirement
108
+ requirements:
109
+ - - '>='
110
+ - !ruby/object:Gem::Version
111
+ version: '0'
112
+ required_rubygems_version: !ruby/object:Gem::Requirement
113
+ requirements:
114
+ - - '>='
115
+ - !ruby/object:Gem::Version
116
+ version: '0'
117
+ requirements: []
118
+ rubyforge_project:
119
+ rubygems_version: 2.0.2
120
+ signing_key:
121
+ specification_version: 4
122
+ summary: Rapid slim prototyping
123
+ test_files: []