shipmonk 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.
- checksums.yaml +7 -0
- data/.gitignore +19 -0
- data/Gemfile +4 -0
- data/LICENSE +20 -0
- data/LICENSE.txt +22 -0
- data/README.md +28 -0
- data/Rakefile +1 -0
- data/bin/shipmonk +4 -0
- data/lib/shipmonk.rb +8 -0
- data/lib/shipmonk/cli.rb +38 -0
- data/lib/shipmonk/default/Gemfile +3 -0
- data/lib/shipmonk/default/config.ru +3 -0
- data/lib/shipmonk/default/src/index.html.haml +11 -0
- data/lib/shipmonk/server.rb +17 -0
- data/lib/shipmonk/server/request_responder.rb +43 -0
- data/lib/shipmonk/version.rb +3 -0
- data/lib/shipmonk/view_context.rb +19 -0
- data/shipmonk.gemspec +29 -0
- metadata +145 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 803e1d39ec02e4b25f343cd7de3d1910be53c1c0
|
4
|
+
data.tar.gz: 7982556478a5660b28d4bf03dc3e058676d9f627
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: e116a29e63a37d8a29d72384dd55ffee826695f8717cfffe811ad45ced9b2dff20bae12aa32e7ac3be48d77c655f3b530c4ba22f7a94b48624589d51aa15a40a
|
7
|
+
data.tar.gz: fe097f38e06eaadd97233107619d05e5b4506800b16c09f182d6bfbfb9748321f1dbfa32be1327b2eb2aa53ee5450d2f3a1b2084be33867bd608b42dfe9b02d5
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2013 Jason Wall
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
6
|
+
this software and associated documentation files (the "Software"), to deal in
|
7
|
+
the Software without restriction, including without limitation the rights to
|
8
|
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
9
|
+
the Software, and to permit persons to whom the Software is furnished to do so,
|
10
|
+
subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
17
|
+
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
18
|
+
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
19
|
+
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
20
|
+
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2013 Jason Wall
|
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.
|
data/README.md
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
shipmonk
|
2
|
+
========
|
3
|
+
|
4
|
+
Environment for prototyping, developing, and maintaining static websites
|
5
|
+
|
6
|
+
I do this quite frequently: I'll just want to play around with some HTML/CSS/Javascript, either for an idea I have for a website design, a CSS attribute I've never seen before that I want to try out, or a Javascript library I want to play aroudn with. Regardless, I always end up with the same problem.
|
7
|
+
|
8
|
+
* I want a local server I can start up quickly, like as in as soon as I create the project
|
9
|
+
* I want to use HAML because HTML is irritating after using HAML
|
10
|
+
* I hate repeating myself for things like menus
|
11
|
+
|
12
|
+
I came up with the idea for shipmonk to be a dev-happy static website prototyping environment that can then generate html files that can be transferred to a static host server via FTP or SSH or whatever you want to use to deploy.
|
13
|
+
|
14
|
+
I've since expanded on the vision behind what I want Shipmonk to be. Picture a website development environment that can take a website from a prototype you do for a client, to a "compiled" version of your prototype to be that client's website, all easily maintainable through a dynamic templating environment that you can then recompile and redistribute to the host site. Then if the client's needs grow, they can graduate to a user friendly CMS system all the while the entire codebase never has to switch frameworks.
|
15
|
+
|
16
|
+
Below is a list of features I want to see eventually added to Shipmonk, because right now the current feature set is quite small. It's just a basic library I use myself to quickly whip up proof of concept websites.
|
17
|
+
|
18
|
+
TODO
|
19
|
+
==========
|
20
|
+
* A CLI command to generate a new shipmonk projects - our `rails new` equivalent.
|
21
|
+
* A CLI command for compiling the website into HTML - I think right now I just use a local ruby script to do this on a project per project basis
|
22
|
+
* A CLI command for starting the server on an agreed upon port - our `rails server` equivalent.
|
23
|
+
* The templating engine needs beefing up, for supporting and selecting layouts through a convention over configuration approach
|
24
|
+
* Supporting multiple templating engines beyond just HAML. ERB, Markdown, or whatever else someone may want to add support for.
|
25
|
+
* A CMS UI
|
26
|
+
* Having the website that's hosted by the internal server support being run under a Rails Engine
|
27
|
+
* Having the CMS UI run under a Rails Engine
|
28
|
+
* A cool logo/mascot that involves a ship (old school sailing ship) or just the crowsnest, a Chipmunk dressed as a monk with possibly some pirate elements woven into it.
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
data/bin/shipmonk
ADDED
data/lib/shipmonk.rb
ADDED
data/lib/shipmonk/cli.rb
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
require 'thor'
|
2
|
+
|
3
|
+
module Shipmonk
|
4
|
+
class CLI < Thor
|
5
|
+
include Thor::Actions
|
6
|
+
desc 'new <name>', 'Create a new Shipmonk site'
|
7
|
+
|
8
|
+
def new(site_name)
|
9
|
+
site_path = File.expand_path site_name, Dir.pwd
|
10
|
+
abort "Site already exists, choose another name or delete the existing site." if Dir.exists? site_path
|
11
|
+
create_site site_path
|
12
|
+
end
|
13
|
+
|
14
|
+
desc 'server', 'Start up a local server that hosts your site.'
|
15
|
+
|
16
|
+
def server(*args)
|
17
|
+
require 'shipmonk/server'
|
18
|
+
# get rid of 'server' in the args list
|
19
|
+
# otherwise :config in default_options gets set to 'server'
|
20
|
+
ARGV.shift
|
21
|
+
Shipmonk::Server.new.start
|
22
|
+
end
|
23
|
+
|
24
|
+
def self.source_root
|
25
|
+
File.expand_path '../shipmonk/default', File.dirname(__FILE__)
|
26
|
+
end
|
27
|
+
|
28
|
+
private
|
29
|
+
|
30
|
+
def create_site(site_path)
|
31
|
+
self.destination_root = site_path
|
32
|
+
Dir.mkdir destination_root
|
33
|
+
copy_file 'config.ru'
|
34
|
+
copy_file 'Gemfile'
|
35
|
+
directory 'src'
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'rack'
|
2
|
+
|
3
|
+
class Shipmonk::Server < Rack::Server
|
4
|
+
def middleware
|
5
|
+
middlewares = []
|
6
|
+
middlewares << [Rack::Static, { urls: ['/images', '/styles', '/scripts'], root: 'public' }]
|
7
|
+
middlewares << [Rack::Reloader]
|
8
|
+
Hash.new(middlewares)
|
9
|
+
end
|
10
|
+
|
11
|
+
def call(env)
|
12
|
+
responder = RequestResponder.new Rack::Request.new(env)
|
13
|
+
responder.respond
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
require 'shipmonk/server/request_responder'
|
@@ -0,0 +1,43 @@
|
|
1
|
+
require 'haml'
|
2
|
+
require 'shipmonk/view_context'
|
3
|
+
|
4
|
+
class Shipmonk::Server::RequestResponder
|
5
|
+
attr_accessor :request
|
6
|
+
|
7
|
+
def initialize(request)
|
8
|
+
@request = request
|
9
|
+
end
|
10
|
+
|
11
|
+
def respond
|
12
|
+
if template_source_file.exist?
|
13
|
+
content = compile_haml template_source_file
|
14
|
+
Rack::Response.new.finish do |response|
|
15
|
+
response['content-type'] = 'text/html'
|
16
|
+
response.status = 200
|
17
|
+
response.write content
|
18
|
+
end
|
19
|
+
else
|
20
|
+
Rack::Response.new.finish do |response|
|
21
|
+
response['content-type'] = 'text/plain'
|
22
|
+
response.status = 404
|
23
|
+
response.write "404ed!\n"
|
24
|
+
response.write "file not found: #{request.path_info}\n"
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
def compile_haml(file, haml_options = {})
|
30
|
+
content = File.read file
|
31
|
+
engine = Haml::Engine.new(content, haml_options)
|
32
|
+
engine.render Shipmonk::ViewContext.new
|
33
|
+
end
|
34
|
+
|
35
|
+
def template_source_file
|
36
|
+
@template_source_file ||= Shipmonk.root.join 'src', case request.path_info
|
37
|
+
when '/' then 'index.html.haml'
|
38
|
+
when /\/(\w+)$/, /\/(.+).html$/ then "#{$1}.html.haml"
|
39
|
+
else
|
40
|
+
request.path_info
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module Shipmonk
|
2
|
+
class ViewContext
|
3
|
+
def livereload_tag
|
4
|
+
%Q{<script type="text/javascript">
|
5
|
+
var tag = '<script type="text/javascript" src="http://thejayvm.ca/livereload.js?host=';
|
6
|
+
tag += location.hostname;
|
7
|
+
tag += '"></scr';
|
8
|
+
tag += 'ipt>';
|
9
|
+
document.write(tag);
|
10
|
+
</script>
|
11
|
+
} unless ENV.fetch('SHIPMONK_ENV', :local).to_sym == :live
|
12
|
+
end
|
13
|
+
|
14
|
+
def include_file(partial, locals = {})
|
15
|
+
content = File.read(File.expand_path "src/_#{partial.to_s}.html.haml")
|
16
|
+
Haml::Engine.new(content).render Object.new, locals
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
data/shipmonk.gemspec
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'shipmonk/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "shipmonk"
|
8
|
+
spec.version = Shipmonk::VERSION
|
9
|
+
spec.authors = ["Jason Wall"]
|
10
|
+
spec.email = ["javajo@gmail.com"]
|
11
|
+
spec.description = %q{Environment for prototyping, developing, and maintaining static websites}
|
12
|
+
spec.summary = <<-MD
|
13
|
+
Prototype a website with dynamic templating. Compile it. Deploy it to a static host.
|
14
|
+
MD
|
15
|
+
spec.homepage = "https://github.com/thejayvm/shipmonk"
|
16
|
+
spec.license = "MIT"
|
17
|
+
|
18
|
+
spec.files = `git ls-files`.split($/)
|
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_runtime_dependency "haml", '~> 4.0', '>= 4.0.3'
|
24
|
+
spec.add_runtime_dependency "rack", '~> 1.5', '>= 1.5.2'
|
25
|
+
spec.add_runtime_dependency "thor", '~> 0'
|
26
|
+
|
27
|
+
spec.add_development_dependency "bundler", "~> 1.3"
|
28
|
+
spec.add_development_dependency "rake", '~> 0'
|
29
|
+
end
|
metadata
ADDED
@@ -0,0 +1,145 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: shipmonk
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Jason Wall
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-01-02 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: haml
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '4.0'
|
20
|
+
- - ">="
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: 4.0.3
|
23
|
+
type: :runtime
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
26
|
+
requirements:
|
27
|
+
- - "~>"
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '4.0'
|
30
|
+
- - ">="
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: 4.0.3
|
33
|
+
- !ruby/object:Gem::Dependency
|
34
|
+
name: rack
|
35
|
+
requirement: !ruby/object:Gem::Requirement
|
36
|
+
requirements:
|
37
|
+
- - "~>"
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: '1.5'
|
40
|
+
- - ">="
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
version: 1.5.2
|
43
|
+
type: :runtime
|
44
|
+
prerelease: false
|
45
|
+
version_requirements: !ruby/object:Gem::Requirement
|
46
|
+
requirements:
|
47
|
+
- - "~>"
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
version: '1.5'
|
50
|
+
- - ">="
|
51
|
+
- !ruby/object:Gem::Version
|
52
|
+
version: 1.5.2
|
53
|
+
- !ruby/object:Gem::Dependency
|
54
|
+
name: thor
|
55
|
+
requirement: !ruby/object:Gem::Requirement
|
56
|
+
requirements:
|
57
|
+
- - "~>"
|
58
|
+
- !ruby/object:Gem::Version
|
59
|
+
version: '0'
|
60
|
+
type: :runtime
|
61
|
+
prerelease: false
|
62
|
+
version_requirements: !ruby/object:Gem::Requirement
|
63
|
+
requirements:
|
64
|
+
- - "~>"
|
65
|
+
- !ruby/object:Gem::Version
|
66
|
+
version: '0'
|
67
|
+
- !ruby/object:Gem::Dependency
|
68
|
+
name: bundler
|
69
|
+
requirement: !ruby/object:Gem::Requirement
|
70
|
+
requirements:
|
71
|
+
- - "~>"
|
72
|
+
- !ruby/object:Gem::Version
|
73
|
+
version: '1.3'
|
74
|
+
type: :development
|
75
|
+
prerelease: false
|
76
|
+
version_requirements: !ruby/object:Gem::Requirement
|
77
|
+
requirements:
|
78
|
+
- - "~>"
|
79
|
+
- !ruby/object:Gem::Version
|
80
|
+
version: '1.3'
|
81
|
+
- !ruby/object:Gem::Dependency
|
82
|
+
name: rake
|
83
|
+
requirement: !ruby/object:Gem::Requirement
|
84
|
+
requirements:
|
85
|
+
- - "~>"
|
86
|
+
- !ruby/object:Gem::Version
|
87
|
+
version: '0'
|
88
|
+
type: :development
|
89
|
+
prerelease: false
|
90
|
+
version_requirements: !ruby/object:Gem::Requirement
|
91
|
+
requirements:
|
92
|
+
- - "~>"
|
93
|
+
- !ruby/object:Gem::Version
|
94
|
+
version: '0'
|
95
|
+
description: Environment for prototyping, developing, and maintaining static websites
|
96
|
+
email:
|
97
|
+
- javajo@gmail.com
|
98
|
+
executables:
|
99
|
+
- shipmonk
|
100
|
+
extensions: []
|
101
|
+
extra_rdoc_files: []
|
102
|
+
files:
|
103
|
+
- ".gitignore"
|
104
|
+
- Gemfile
|
105
|
+
- LICENSE
|
106
|
+
- LICENSE.txt
|
107
|
+
- README.md
|
108
|
+
- Rakefile
|
109
|
+
- bin/shipmonk
|
110
|
+
- lib/shipmonk.rb
|
111
|
+
- lib/shipmonk/cli.rb
|
112
|
+
- lib/shipmonk/default/Gemfile
|
113
|
+
- lib/shipmonk/default/config.ru
|
114
|
+
- lib/shipmonk/default/src/index.html.haml
|
115
|
+
- lib/shipmonk/server.rb
|
116
|
+
- lib/shipmonk/server/request_responder.rb
|
117
|
+
- lib/shipmonk/version.rb
|
118
|
+
- lib/shipmonk/view_context.rb
|
119
|
+
- shipmonk.gemspec
|
120
|
+
homepage: https://github.com/thejayvm/shipmonk
|
121
|
+
licenses:
|
122
|
+
- MIT
|
123
|
+
metadata: {}
|
124
|
+
post_install_message:
|
125
|
+
rdoc_options: []
|
126
|
+
require_paths:
|
127
|
+
- lib
|
128
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
129
|
+
requirements:
|
130
|
+
- - ">="
|
131
|
+
- !ruby/object:Gem::Version
|
132
|
+
version: '0'
|
133
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
134
|
+
requirements:
|
135
|
+
- - ">="
|
136
|
+
- !ruby/object:Gem::Version
|
137
|
+
version: '0'
|
138
|
+
requirements: []
|
139
|
+
rubyforge_project:
|
140
|
+
rubygems_version: 2.4.5.1
|
141
|
+
signing_key:
|
142
|
+
specification_version: 4
|
143
|
+
summary: Prototype a website with dynamic templating. Compile it. Deploy it to a static
|
144
|
+
host.
|
145
|
+
test_files: []
|