asset_stub 1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/asset_stub +77 -0
- metadata +70 -0
data/asset_stub
ADDED
@@ -0,0 +1,77 @@
|
|
1
|
+
#!/usr/bin/ruby
|
2
|
+
require "fileutils"
|
3
|
+
require "open-uri"
|
4
|
+
|
5
|
+
# --------------------------------------------------
|
6
|
+
# DEFINE HELPER METHODS
|
7
|
+
# --------------------------------------------------
|
8
|
+
|
9
|
+
def green_put(text)
|
10
|
+
puts "\e[32m #{text}\e[0m"
|
11
|
+
end
|
12
|
+
|
13
|
+
def create_file(file, contents = "")
|
14
|
+
path = File.join(Dir.pwd, file)
|
15
|
+
|
16
|
+
unless File.exists? path
|
17
|
+
File.open(path, "w") { |f| f.write contents }
|
18
|
+
green_put "Created #{file}"
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
# --------------------------------------------------
|
23
|
+
# DEFINE STANDARD FILE CONTENTS
|
24
|
+
# --------------------------------------------------
|
25
|
+
|
26
|
+
# lib/css/reset.less
|
27
|
+
reset_less = "/*\nCopyright (c) 2010, Yahoo! Inc. All rights reserved.\nCode licensed under the BSD License:\nhttp://developer.yahoo.com/yui/license.html\nversion: 3.3.0\nbuild: 3167\n*/\nhtml{color:#000;background:#FFF;}body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,code,form,fieldset,legend,input,textarea,p,blockquote,th,td{margin:0;padding:0;}table{border-collapse:collapse;border-spacing:0;}fieldset,img{border:0;}address,caption,cite,code,dfn,em,strong,th,var{font-style:normal;font-weight:normal;}li{list-style:none;}caption,th{text-align:left;}h1,h2,h3,h4,h5,h6{font-size:100%;font-weight:normal;}q:before,q:after{content:'';}abbr,acronym{border:0;font-variant:normal;}sup{vertical-align:text-top;}sub{vertical-align:text-bottom;}input,textarea,select{font-family:inherit;font-size:inherit;font-weight:inherit;}input,textarea,select{*font-size:100%;}legend{color:#000;}"
|
28
|
+
|
29
|
+
# lib/css/screen.less
|
30
|
+
screen_less = "@import \"reset\";"
|
31
|
+
|
32
|
+
# lib/js/init.js
|
33
|
+
init_js = "$(function() {\n});"
|
34
|
+
|
35
|
+
# index.html
|
36
|
+
index_html = "<!DOCTYPE html>\n<html>\n<head>\n <title>Untitled</title>\n <meta charset=\"utf8\">\n <link rel=\"stylesheet\" href=\"lib/css/screen.css\">\n <!--[if lte 7]>\n <link rel=\"stylesheet\" href=\"lib/css/ie.css\">\n <![endif]-->\n</head>\n\n<body>\n\n\n <script src=\"lib/js/jquery.min.js\"></script>\n <script src=\"lib/js/jquery.validate.min.js\"></script>\n <script src=\"lib/js/init.js\"></script>\n</body>\n</html>"
|
37
|
+
|
38
|
+
# --------------------------------------------------
|
39
|
+
# CREATE ALL DIRECTORIES
|
40
|
+
# --------------------------------------------------
|
41
|
+
|
42
|
+
["lib", "lib/css", "lib/img", "lib/js"].each do |dir|
|
43
|
+
path = File.join(Dir.pwd, dir)
|
44
|
+
|
45
|
+
unless File.exists? path
|
46
|
+
FileUtils.mkdir_p(path)
|
47
|
+
green_put "Created #{dir}/"
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
# --------------------------------------------------
|
52
|
+
# CREATE FILES
|
53
|
+
# --------------------------------------------------
|
54
|
+
|
55
|
+
create_file("lib/css/reset.less", reset_less)
|
56
|
+
create_file("lib/css/screen.less", screen_less)
|
57
|
+
create_file("lib/css/ie.css", "")
|
58
|
+
create_file("lib/js/init.js", init_js)
|
59
|
+
create_file("index.html", index_html)
|
60
|
+
|
61
|
+
# --------------------------------------------------
|
62
|
+
# DOWNLOAD FILES
|
63
|
+
# --------------------------------------------------
|
64
|
+
|
65
|
+
downloads = {
|
66
|
+
"lib/js/jquery.min.js" => "http://code.jquery.com/jquery-1.6.1.min.js",
|
67
|
+
"lib/js/jquery.validate.min.js" => "http://ajax.aspnetcdn.com/ajax/jquery.validate/1.8.1/jquery.validate.min.js"
|
68
|
+
}
|
69
|
+
|
70
|
+
downloads.each do |file, url|
|
71
|
+
path = File.join(Dir.pwd, file)
|
72
|
+
|
73
|
+
unless File.exists? path
|
74
|
+
File.open(path, "w") { |f| f.write(open(url).read) }
|
75
|
+
green_put "Downloaded #{file} from #{url}"
|
76
|
+
end
|
77
|
+
end
|
metadata
ADDED
@@ -0,0 +1,70 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: asset_stub
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 15
|
5
|
+
prerelease:
|
6
|
+
segments:
|
7
|
+
- 1
|
8
|
+
- 0
|
9
|
+
version: "1.0"
|
10
|
+
platform: ruby
|
11
|
+
authors:
|
12
|
+
- Christoffer Lejdborg
|
13
|
+
autorequire:
|
14
|
+
bindir: .
|
15
|
+
cert_chain: []
|
16
|
+
|
17
|
+
date: 2011-06-28 00:00:00 +02:00
|
18
|
+
default_executable: asset_stub
|
19
|
+
dependencies: []
|
20
|
+
|
21
|
+
description: This script generates an asset stub using the same directory structure and conventions that is usually shared in my projects. Run the script by cd-ing in to the target directory and run asset_stub.
|
22
|
+
email: hello@9muses.se
|
23
|
+
executables:
|
24
|
+
- asset_stub
|
25
|
+
extensions: []
|
26
|
+
|
27
|
+
extra_rdoc_files: []
|
28
|
+
|
29
|
+
files:
|
30
|
+
- ./asset_stub
|
31
|
+
has_rdoc: true
|
32
|
+
homepage: https://github.com/Lejdborg/Asset-Stub
|
33
|
+
licenses: []
|
34
|
+
|
35
|
+
post_install_message:
|
36
|
+
rdoc_options: []
|
37
|
+
|
38
|
+
require_paths:
|
39
|
+
- lib
|
40
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ">="
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
hash: 57
|
46
|
+
segments:
|
47
|
+
- 1
|
48
|
+
- 8
|
49
|
+
- 7
|
50
|
+
version: 1.8.7
|
51
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
52
|
+
none: false
|
53
|
+
requirements:
|
54
|
+
- - ">="
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
hash: 23
|
57
|
+
segments:
|
58
|
+
- 1
|
59
|
+
- 3
|
60
|
+
- 6
|
61
|
+
version: 1.3.6
|
62
|
+
requirements: []
|
63
|
+
|
64
|
+
rubyforge_project:
|
65
|
+
rubygems_version: 1.4.2
|
66
|
+
signing_key:
|
67
|
+
specification_version: 3
|
68
|
+
summary: Generates default website asset structure.
|
69
|
+
test_files: []
|
70
|
+
|