myway 0.1.2 → 0.1.3
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/README.md +14 -2
- data/bin/mw +0 -0
- data/lib/myway.rb +51 -4
- data/lib/myway/templates/app/views/includes/navbar.haml.tt +21 -0
- data/lib/myway/templates/app/views/index.haml.tt +0 -0
- data/lib/myway/templates/app/views/layout.haml.tt +36 -0
- data/lib/myway/templates/gemspec.tt +3 -4
- data/lib/myway/version.rb +1 -1
- data/myway.gemspec +1 -0
- metadata +22 -3
data/README.md
CHANGED
@@ -6,19 +6,31 @@ default the sinatra app uses haml as it's templating engine.
|
|
6
6
|
|
7
7
|
## Installation and Usage
|
8
8
|
|
9
|
-
Install it yourself
|
9
|
+
Install it yourself from source:
|
10
10
|
|
11
11
|
$ rake install
|
12
12
|
|
13
13
|
|
14
|
+
Or,
|
15
|
+
|
16
|
+
Install from rubygems
|
17
|
+
|
18
|
+
$ gem install myway
|
19
|
+
|
14
20
|
And then execute:
|
15
21
|
|
16
22
|
$ mw
|
17
23
|
|
18
24
|
And to start a new sinatra project:
|
19
25
|
|
20
|
-
$ mw new "
|
26
|
+
$ mw new "YourProjectName"
|
27
|
+
|
28
|
+
|
29
|
+
CHANGE LOG
|
21
30
|
|
31
|
+
Version 0.1.3
|
32
|
+
- adds head, backbone, underscore js in assets pipeline
|
33
|
+
- scaffolds capistrano deploy script
|
22
34
|
|
23
35
|
## Contributing
|
24
36
|
|
data/bin/mw
CHANGED
File without changes
|
data/lib/myway.rb
CHANGED
@@ -1,6 +1,16 @@
|
|
1
1
|
require "myway/version"
|
2
|
+
require "open-uri"
|
3
|
+
require "zip/zipfilesystem"
|
4
|
+
require "fileutils"
|
2
5
|
require "thor"
|
3
6
|
|
7
|
+
JS_LIBS = {
|
8
|
+
'head' => 'https://github.com/headjs/headjs/raw/v0.96/dist/head.load.min.js',
|
9
|
+
'jquery' => 'http://code.jquery.com/jquery-1.7.2.min.js',
|
10
|
+
'backbone' => 'http://documentcloud.github.com/backbone/backbone-min.js',
|
11
|
+
'underscore' => 'http://documentcloud.github.com/underscore/underscore-min.js',
|
12
|
+
'bootstrap' => 'http://twitter.github.com/bootstrap/assets/bootstrap.zip'
|
13
|
+
}
|
4
14
|
class String
|
5
15
|
def camelize(first_letter_in_uppercase = true)
|
6
16
|
if first_letter_in_uppercase
|
@@ -31,15 +41,15 @@ module Myway
|
|
31
41
|
user_info
|
32
42
|
|
33
43
|
empty_directory "#{name}/app/routes"
|
34
|
-
empty_directory "#{name}/app/views"
|
35
44
|
empty_directory "#{name}/app/models"
|
36
|
-
empty_directory "#{name}/config"
|
37
45
|
empty_directory "#{name}/assets/js"
|
38
|
-
empty_directory "#{name}/assets/css"
|
39
46
|
empty_directory "#{name}/spec"
|
40
47
|
|
41
48
|
template "myway/templates/app/version.tt", "#{name}/app/version.rb"
|
42
49
|
template "myway/templates/app/app.tt", "#{name}/app/#{name}.rb"
|
50
|
+
template "myway/templates/app/views/layout.haml.tt", "#{name}/app/views/layout.haml"
|
51
|
+
template "myway/templates/app/views/index.haml.tt", "#{name}/app/views/index.haml"
|
52
|
+
template "myway/templates/app/views/includes/navbar.haml.tt", "#{name}/app/views/includes/navbar.haml"
|
43
53
|
template "myway/templates/config/unicorn.tt", "#{name}/config/unicorn.rb"
|
44
54
|
template "myway/templates/config.ru.tt", "#{name}/config.ru"
|
45
55
|
template "myway/templates/gemspec.tt", "#{name}/#{name}.gemspec"
|
@@ -50,6 +60,8 @@ module Myway
|
|
50
60
|
|
51
61
|
Dir.chdir(File.join(Dir.pwd, name))
|
52
62
|
|
63
|
+
build_js_libs
|
64
|
+
|
53
65
|
init_git
|
54
66
|
init_bundle
|
55
67
|
init_capistrano
|
@@ -66,6 +78,41 @@ module Myway
|
|
66
78
|
@email = IO.popen("git config --global user.email").read.gsub("\n", "")
|
67
79
|
end
|
68
80
|
|
81
|
+
def unzip_file (file, destination)
|
82
|
+
Zip::ZipFile.open(file) { |zip_file|
|
83
|
+
zip_file.each { |f|
|
84
|
+
f_path=File.join(destination, f.name)
|
85
|
+
FileUtils.mkdir_p(File.dirname(f_path))
|
86
|
+
zip_file.extract(f, f_path) unless File.exist?(f_path)
|
87
|
+
}
|
88
|
+
}
|
89
|
+
end
|
90
|
+
|
91
|
+
def build_js_libs(libs=%w(head underscore backbone bootstrap))
|
92
|
+
libs.each do |lib|
|
93
|
+
if lib != "bootstrap"
|
94
|
+
File.open "./assets/js/#{lib}.min.js", 'w+' do |file|
|
95
|
+
file.write get_latest(lib)
|
96
|
+
say " - ./assets/js/#{lib}.min.js"
|
97
|
+
end
|
98
|
+
else
|
99
|
+
File.open "assets/js/#{lib}.zip", 'wb' do |file|
|
100
|
+
file.write get_latest(lib)
|
101
|
+
end
|
102
|
+
unzip_file "./assets/js/#{lib}.zip", "./assets/"
|
103
|
+
File.delete "./assets/js/#{lib}.zip"
|
104
|
+
`mv ./assets/bootstrap/js/* ./assets/js/`
|
105
|
+
`mv ./assets/bootstrap/css/ ./assets/`
|
106
|
+
`mv ./assets/bootstrap/img/ ./assets/`
|
107
|
+
FileUtils.rm_rf "./assets/bootstrap/"
|
108
|
+
end
|
109
|
+
end
|
110
|
+
end
|
111
|
+
|
112
|
+
def get_latest(scriptname)
|
113
|
+
open(JS_LIBS[scriptname]).read
|
114
|
+
end
|
115
|
+
|
69
116
|
def method_missing(meth, *args, &block)
|
70
117
|
return init($1.to_sym) if meth.to_s =~ /^init_(.*)/
|
71
118
|
super
|
@@ -81,7 +128,7 @@ module Myway
|
|
81
128
|
say "Installing gems for #{name} ..."
|
82
129
|
`bundle install`
|
83
130
|
when :capistrano
|
84
|
-
say "
|
131
|
+
say "Initializing capistrano deploy script"
|
85
132
|
template "myway/templates/config/deploy.rb.tt", "#{name}/config/deploy.rb"
|
86
133
|
end
|
87
134
|
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
.navbar.navbar-fixed-top
|
2
|
+
.navbar-inner
|
3
|
+
.container
|
4
|
+
%a.btn.btn-navbar{"data-target" => ".nav-collapse", "data-toggle" => "collapse"}
|
5
|
+
%span.icon-bar
|
6
|
+
%span.icon-bar
|
7
|
+
%span.icon-bar
|
8
|
+
%a.brand{:href => "#"} Project
|
9
|
+
.nav-collapse
|
10
|
+
%ul.nav
|
11
|
+
%li.active
|
12
|
+
%a{:href => "#"} Home
|
13
|
+
%form.navbar-search.pull-left{:id => "nav_search" ,:name=> "nav_search", :action => "/search", :method => "post"}
|
14
|
+
%input.search-query.span2{:placeholder => "search", :type => "text", :name => "search"}
|
15
|
+
%ul.nav.pull-right
|
16
|
+
%li
|
17
|
+
%a{:href => "#"} Link
|
18
|
+
|
19
|
+
/ /.nav-collapse
|
20
|
+
/ /navbar-inner
|
21
|
+
/ /navbar
|
File without changes
|
@@ -0,0 +1,36 @@
|
|
1
|
+
!!!
|
2
|
+
%html
|
3
|
+
%head
|
4
|
+
%title Project: <%= name %>
|
5
|
+
%meta(name='viewport' content='width=device-width, initial-scale=1.0')
|
6
|
+
%meta(name='description' content='')
|
7
|
+
%meta(name='author' content='')
|
8
|
+
%script{:src=> "/js/head.min.js"}
|
9
|
+
%link(href='/css/bootstrap.css' rel='stylesheet')
|
10
|
+
%style
|
11
|
+
body {padding-top: 60px;} /* 60px to make the container go all the way to the bottom of the topbar */
|
12
|
+
%link(href='/css/bootstrap-responsive.css' rel='stylesheet')
|
13
|
+
|
14
|
+
//Le HTML5 shim, for IE6-8 support of HTML5 elements
|
15
|
+
//if lt IE 9
|
16
|
+
%script(src='http://html5shim.googlecode.com/svn/trunk/html5.js')
|
17
|
+
//Le fav and touch icons
|
18
|
+
%link(rel='shortcut icon' href='/assets/ico/favicon.ico')
|
19
|
+
%link(rel='apple-touch-icon-precomposed' sizes='114x114' href='/assets/ico/apple-touch-icon-114-precomposed.png')
|
20
|
+
%link(rel='apple-touch-icon-precomposed' sizes='72x72' href='/assets/ico/apple-touch-icon-72-precomposed.png')
|
21
|
+
%link(rel='apple-touch-icon-precomposed' href='/assets/ico/apple-touch-icon-57-precomposed.png')
|
22
|
+
|
23
|
+
%body
|
24
|
+
= haml :'includes/navbar'
|
25
|
+
.container
|
26
|
+
=yield
|
27
|
+
%script
|
28
|
+
head.js(
|
29
|
+
/js/underscore.min.js", "/js/backbone.min.js",
|
30
|
+
"/js/bootstrap-alert.js", "/js/bootstrap-dropdown.js",
|
31
|
+
"/js/bootstrap-modal.js","/js/bootstrap-tooltip.js"
|
32
|
+
)
|
33
|
+
|
34
|
+
//"/js/bootstrap-button.js","/js/bootstrap-collapse.js","/js/bootstrap-carousel.js",
|
35
|
+
//"/js/bootstrap-popover.js","/js/bootstrap-scrollspy.js","/js/bootstrap-tab.js",
|
36
|
+
//"/js/bootstrap-transition.js","/js/bootstrap-typeahead.js",
|
@@ -13,8 +13,8 @@ Gem::Specification.new do |gem|
|
|
13
13
|
gem.name = "<%= name %>"
|
14
14
|
gem.require_paths = ["app"]
|
15
15
|
gem.version = <%= name.camelize %>::VERSION
|
16
|
-
gem.add_runtime_dependency "sinatra", "
|
17
|
-
gem.add_runtime_dependency "sinatra-contrib"
|
16
|
+
gem.add_runtime_dependency "sinatra", "~> 1.3.2"
|
17
|
+
gem.add_runtime_dependency "sinatra-contrib", "~> 1.3.1"
|
18
18
|
gem.add_runtime_dependency "unicorn"
|
19
19
|
gem.add_runtime_dependency "sprockets"
|
20
20
|
gem.add_runtime_dependency "yui-compressor"
|
@@ -22,6 +22,5 @@ Gem::Specification.new do |gem|
|
|
22
22
|
|
23
23
|
gem.add_development_dependency "capybara"
|
24
24
|
gem.add_development_dependency "rspec"
|
25
|
-
gem.add_development_dependency "capistrano"
|
26
|
-
gem.add_development_dependency "capistrano-ext"
|
25
|
+
gem.add_development_dependency "capistrano", "~> 2.12.0"
|
27
26
|
end
|
data/lib/myway/version.rb
CHANGED
data/myway.gemspec
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: myway
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-09-15 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: thor
|
@@ -27,6 +27,22 @@ dependencies:
|
|
27
27
|
- - ! '>='
|
28
28
|
- !ruby/object:Gem::Version
|
29
29
|
version: 0.15.2
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: zip
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ~>
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: 2.0.2
|
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: 2.0.2
|
30
46
|
description: ! "Sinatra project generator for sinatra based web applications. Named
|
31
47
|
after\n Frank Sinatra's popular song during 1969 'My way'"
|
32
48
|
email:
|
@@ -45,6 +61,9 @@ files:
|
|
45
61
|
- lib/myway.rb
|
46
62
|
- lib/myway/templates/app/app.tt
|
47
63
|
- lib/myway/templates/app/version.tt
|
64
|
+
- lib/myway/templates/app/views/includes/navbar.haml.tt
|
65
|
+
- lib/myway/templates/app/views/index.haml.tt
|
66
|
+
- lib/myway/templates/app/views/layout.haml.tt
|
48
67
|
- lib/myway/templates/config.ru.tt
|
49
68
|
- lib/myway/templates/config/deploy.rb.tt
|
50
69
|
- lib/myway/templates/config/unicorn.tt
|
@@ -75,7 +94,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
75
94
|
version: '0'
|
76
95
|
requirements: []
|
77
96
|
rubyforge_project:
|
78
|
-
rubygems_version: 1.8.
|
97
|
+
rubygems_version: 1.8.23
|
79
98
|
signing_key:
|
80
99
|
specification_version: 3
|
81
100
|
summary: Scaffolding application for Sinatra web applications
|