jhc 0.0.0

Sign up to get free protection for your applications and to get access to all the features.
data/.document ADDED
@@ -0,0 +1,5 @@
1
+ lib/**/*.rb
2
+ bin/*
3
+ -
4
+ features/**/*.feature
5
+ LICENSE.txt
data/Gemfile ADDED
@@ -0,0 +1,13 @@
1
+ source "http://rubygems.org"
2
+ # Add dependencies required to use your gem here.
3
+ # Example:
4
+ # gem "activesupport", ">= 2.3.5"
5
+
6
+ # Add dependencies to develop your gem here.
7
+ # Include everything needed to run rake, tests, features, etc.
8
+ group :development do
9
+ gem "shoulda", ">= 0"
10
+ gem "bundler", "~> 1.0.0"
11
+ gem "jeweler", "~> 1.6.4"
12
+ gem "rcov", ">= 0"
13
+ end
data/LICENSE.txt ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2011 tily
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,35 @@
1
+ # jhc
2
+
3
+ ## USAGE
4
+ $ jhc
5
+ Usage: jhc -t HTML_TITLE -j backbone,underscore,jquery -s bootstrap
6
+ $ jhc -t "hello world" -j jquery -s bootstrap testapp
7
+
8
+ $ ls testapp/*
9
+ testapp/index.html
10
+
11
+ testapp/javascripts:
12
+ jquery.js
13
+
14
+ testapp/stylesheets:
15
+ bootstrap.css
16
+
17
+ $ cat testapp/index.html
18
+ <!DOCTYPE html>
19
+ <html>
20
+ <head>
21
+ <meta charset="utf-8">
22
+ <title>hello world</title>
23
+ <script language="javascript" type="text/javascript" src="./javascripts/jquery.js"></script>
24
+ <link rel="stylesheet" type="text/css" href="./stylesheets/bootstrap.css" />
25
+ </head>
26
+ <body>
27
+ </body>
28
+ </html>
29
+
30
+ ## INSTALL
31
+ gem install jhc
32
+
33
+ ## SEE ALSO
34
+
35
+ * <http://d.hatena.ne.jp/hitode909/20110614/1308032945>
data/README.rdoc ADDED
@@ -0,0 +1,19 @@
1
+ = jhc
2
+
3
+ Description goes here.
4
+
5
+ == Contributing to jhc
6
+
7
+ * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
8
+ * Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
9
+ * Fork the project
10
+ * Start a feature/bugfix branch
11
+ * Commit and push until you are happy with your contribution
12
+ * Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
13
+ * Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
14
+
15
+ == Copyright
16
+
17
+ Copyright (c) 2011 tily. See LICENSE.txt for
18
+ further details.
19
+
data/Rakefile ADDED
@@ -0,0 +1,54 @@
1
+ # encoding: utf-8
2
+
3
+ require 'rubygems'
4
+ require 'bundler'
5
+ begin
6
+ Bundler.setup(:default, :development)
7
+ rescue Bundler::BundlerError => e
8
+ $stderr.puts e.message
9
+ $stderr.puts "Run `bundle install` to install missing gems"
10
+ exit e.status_code
11
+ end
12
+ require 'rake'
13
+
14
+ require 'jeweler'
15
+ Jeweler::Tasks.new do |gem|
16
+ # gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
17
+ gem.name = "jhc"
18
+ gem.homepage = "http://github.com/tily/jhc"
19
+ gem.license = "MIT"
20
+ gem.summary = %Q{generate modern html scaffold}
21
+ gem.description = %Q{generate modern html scaffold}
22
+ gem.email = "tily05@gmail.com"
23
+ gem.authors = ["tily"]
24
+ gem.bindir = 'bin'
25
+ # dependencies defined in Gemfile
26
+ end
27
+ Jeweler::RubygemsDotOrgTasks.new
28
+
29
+ require 'rake/testtask'
30
+ Rake::TestTask.new(:test) do |test|
31
+ test.libs << 'lib' << 'test'
32
+ test.pattern = 'test/**/test_*.rb'
33
+ test.verbose = true
34
+ end
35
+
36
+ require 'rcov/rcovtask'
37
+ Rcov::RcovTask.new do |test|
38
+ test.libs << 'test'
39
+ test.pattern = 'test/**/test_*.rb'
40
+ test.verbose = true
41
+ test.rcov_opts << '--exclude "gems/*"'
42
+ end
43
+
44
+ task :default => :test
45
+
46
+ require 'rake/rdoctask'
47
+ Rake::RDocTask.new do |rdoc|
48
+ version = File.exist?('VERSION') ? File.read('VERSION') : ""
49
+
50
+ rdoc.rdoc_dir = 'rdoc'
51
+ rdoc.title = "jhc #{version}"
52
+ rdoc.rdoc_files.include('README*')
53
+ rdoc.rdoc_files.include('lib/**/*.rb')
54
+ end
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.0.0
data/bin/jhc ADDED
@@ -0,0 +1,80 @@
1
+ #!/usr/bin/ruby
2
+ # inspired by http://d.hatena.ne.jp/hitode909/20110614/1308032945
3
+ # TODO: -e option (extract body from url)
4
+ require 'yaml'
5
+ require 'erb'
6
+ require 'optparse'
7
+ require 'open-uri'
8
+ require 'fileutils'
9
+
10
+ def main(args)
11
+ cfg = YAML.load(DATA.read)
12
+ opt = parse_args(args)
13
+ dir = args[0]
14
+ hlp = "Usage: jhc -t HTML_TITLE -j #{cfg['javascripts'].keys.join(',')} -s #{cfg['stylesheets'].keys.join(',')}"
15
+
16
+ raise hlp unless dir
17
+
18
+ FileUtils.mkdir_p(dir)
19
+
20
+ %w(javascripts stylesheets).each do |key|
21
+ next unless opt[key]
22
+ FileUtils.mkdir_p(File.join(dir, key))
23
+ opt[key].split(',').each do |lib|
24
+ if url = cfg[key][lib]
25
+ content = open(url).read
26
+ ext = key == 'javascripts' ? 'js' : 'css'
27
+ File.open(File.join(dir, key, "#{lib}.#{ext}"), 'w').write(content)
28
+ end
29
+ end
30
+ end
31
+
32
+ erb = <<-HTML
33
+ <!DOCTYPE html>
34
+ <html>
35
+ <head>
36
+ <meta charset="utf-8">
37
+ <title><%= opt['title'] %></title>
38
+ <% if opt['javascripts'] -%>
39
+ <% opt['javascripts'].split(',').each do |key| -%>
40
+ <script language="javascript" type="text/javascript" src="./javascripts/<%= key %>.js"></script>
41
+ <% end -%>
42
+ <% end -%>
43
+ <% if opt['stylesheets'] -%>
44
+ <% opt['stylesheets'].split(',').each do |key| -%>
45
+ <link rel="stylesheet" type="text/css" href="./stylesheets/<%= key %>.css" />
46
+ <% end -%>
47
+ <% end -%>
48
+ </head>
49
+ <body>
50
+ </body>
51
+ </html>
52
+ HTML
53
+ html = ERB.new(erb, nil, '-').result(binding)
54
+ File.open(File.join(dir, 'index.html'), 'w').write(html)
55
+ rescue StandardError => e
56
+ puts e
57
+ exit 1
58
+ end
59
+
60
+ def parse_args(args)
61
+ opt = {}
62
+ OptionParser.new do |o|
63
+ %w(title javascripts stylesheets extract).each do |key|
64
+ o.on("-#{key.first} #{key.upcase}") {|v| opt[key.first] = v }
65
+ end
66
+ o.parse!(args)
67
+ end
68
+ opt
69
+ end
70
+
71
+ main(ARGV.dup)
72
+
73
+ __END__
74
+ ---
75
+ javascripts:
76
+ jquery: http://code.jquery.com/jquery-1.7.js
77
+ underscore: http://documentcloud.github.com/underscore/underscore.js
78
+ backbone: http://documentcloud.github.com/backbone/backbone.js
79
+ stylesheets:
80
+ bootstrap: https://raw.github.com/twitter/bootstrap/master/bootstrap.css
data/lib/jhc.rb ADDED
File without changes
data/test/helper.rb ADDED
@@ -0,0 +1,18 @@
1
+ require 'rubygems'
2
+ require 'bundler'
3
+ begin
4
+ Bundler.setup(:default, :development)
5
+ rescue Bundler::BundlerError => e
6
+ $stderr.puts e.message
7
+ $stderr.puts "Run `bundle install` to install missing gems"
8
+ exit e.status_code
9
+ end
10
+ require 'test/unit'
11
+ require 'shoulda'
12
+
13
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
14
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
15
+ require 'jhc'
16
+
17
+ class Test::Unit::TestCase
18
+ end
data/test/test_jhc.rb ADDED
@@ -0,0 +1,7 @@
1
+ require 'helper'
2
+
3
+ class TestJhc < Test::Unit::TestCase
4
+ should "probably rename this file and start testing for real" do
5
+ flunk "hey buddy, you should probably rename this file and start testing for real"
6
+ end
7
+ end
metadata ADDED
@@ -0,0 +1,136 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: jhc
3
+ version: !ruby/object:Gem::Version
4
+ hash: 31
5
+ prerelease:
6
+ segments:
7
+ - 0
8
+ - 0
9
+ - 0
10
+ version: 0.0.0
11
+ platform: ruby
12
+ authors:
13
+ - tily
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2011-11-24 00:00:00 Z
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
21
+ version_requirements: &id001 !ruby/object:Gem::Requirement
22
+ none: false
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ hash: 3
27
+ segments:
28
+ - 0
29
+ version: "0"
30
+ name: shoulda
31
+ prerelease: false
32
+ type: :development
33
+ requirement: *id001
34
+ - !ruby/object:Gem::Dependency
35
+ version_requirements: &id002 !ruby/object:Gem::Requirement
36
+ none: false
37
+ requirements:
38
+ - - ~>
39
+ - !ruby/object:Gem::Version
40
+ hash: 23
41
+ segments:
42
+ - 1
43
+ - 0
44
+ - 0
45
+ version: 1.0.0
46
+ name: bundler
47
+ prerelease: false
48
+ type: :development
49
+ requirement: *id002
50
+ - !ruby/object:Gem::Dependency
51
+ version_requirements: &id003 !ruby/object:Gem::Requirement
52
+ none: false
53
+ requirements:
54
+ - - ~>
55
+ - !ruby/object:Gem::Version
56
+ hash: 7
57
+ segments:
58
+ - 1
59
+ - 6
60
+ - 4
61
+ version: 1.6.4
62
+ name: jeweler
63
+ prerelease: false
64
+ type: :development
65
+ requirement: *id003
66
+ - !ruby/object:Gem::Dependency
67
+ version_requirements: &id004 !ruby/object:Gem::Requirement
68
+ none: false
69
+ requirements:
70
+ - - ">="
71
+ - !ruby/object:Gem::Version
72
+ hash: 3
73
+ segments:
74
+ - 0
75
+ version: "0"
76
+ name: rcov
77
+ prerelease: false
78
+ type: :development
79
+ requirement: *id004
80
+ description: generate modern html scaffold
81
+ email: tily05@gmail.com
82
+ executables:
83
+ - jhc
84
+ extensions: []
85
+
86
+ extra_rdoc_files:
87
+ - LICENSE.txt
88
+ - README.md
89
+ - README.rdoc
90
+ files:
91
+ - .document
92
+ - Gemfile
93
+ - LICENSE.txt
94
+ - README.md
95
+ - README.rdoc
96
+ - Rakefile
97
+ - VERSION
98
+ - bin/jhc
99
+ - lib/jhc.rb
100
+ - test/helper.rb
101
+ - test/test_jhc.rb
102
+ homepage: http://github.com/tily/jhc
103
+ licenses:
104
+ - MIT
105
+ post_install_message:
106
+ rdoc_options: []
107
+
108
+ require_paths:
109
+ - lib
110
+ required_ruby_version: !ruby/object:Gem::Requirement
111
+ none: false
112
+ requirements:
113
+ - - ">="
114
+ - !ruby/object:Gem::Version
115
+ hash: 3
116
+ segments:
117
+ - 0
118
+ version: "0"
119
+ required_rubygems_version: !ruby/object:Gem::Requirement
120
+ none: false
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ hash: 3
125
+ segments:
126
+ - 0
127
+ version: "0"
128
+ requirements: []
129
+
130
+ rubyforge_project:
131
+ rubygems_version: 1.8.11
132
+ signing_key:
133
+ specification_version: 3
134
+ summary: generate modern html scaffold
135
+ test_files: []
136
+