coolstrap-generator 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.DS_Store +0 -0
- data/.gitignore +4 -0
- data/.rvmrc +1 -0
- data/Gemfile +4 -0
- data/Rakefile +6 -0
- data/bin/coolstrap +5 -0
- data/coolstrap-generator.gemspec +42 -0
- data/lib/.DS_Store +0 -0
- data/lib/coolstrap-generator.rb +39 -0
- data/lib/coolstrap-generator/.DS_Store +0 -0
- data/lib/coolstrap-generator/builder/middleman.rb +0 -0
- data/lib/coolstrap-generator/cli.rb +71 -0
- data/lib/coolstrap-generator/generate/project.rb +96 -0
- data/lib/coolstrap-generator/generate/view.rb +54 -0
- data/lib/coolstrap-generator/logger.rb +13 -0
- data/lib/coolstrap-generator/middleman/helpers.rb +176 -0
- data/lib/coolstrap-generator/templates/.DS_Store +0 -0
- data/lib/coolstrap-generator/templates/app/.DS_Store +0 -0
- data/lib/coolstrap-generator/templates/app/assets/.DS_Store +0 -0
- data/lib/coolstrap-generator/templates/app/assets/fonts/fontawesome-webfont.eot +0 -0
- data/lib/coolstrap-generator/templates/app/assets/fonts/fontawesome-webfont.svg +255 -0
- data/lib/coolstrap-generator/templates/app/assets/fonts/fontawesome-webfont.ttf +0 -0
- data/lib/coolstrap-generator/templates/app/assets/fonts/fontawesome-webfont.woff +0 -0
- data/lib/coolstrap-generator/templates/app/assets/images/.DS_Store +0 -0
- data/lib/coolstrap-generator/templates/app/assets/images/coolstrap/arrow-list.png +0 -0
- data/lib/coolstrap-generator/templates/app/assets/images/coolstrap/arrow.png +0 -0
- data/lib/coolstrap-generator/templates/app/assets/images/coolstrap/menu.png +0 -0
- data/lib/coolstrap-generator/templates/app/assets/images/coolstrap/startup/smatphone.png +0 -0
- data/lib/coolstrap-generator/templates/app/assets/images/coolstrap/startup/smatphone@2x.png +0 -0
- data/lib/coolstrap-generator/templates/app/assets/images/coolstrap/startup/tablet-landscape.png +0 -0
- data/lib/coolstrap-generator/templates/app/assets/images/coolstrap/startup/tablet-landscape@2x.png +0 -0
- data/lib/coolstrap-generator/templates/app/assets/images/coolstrap/startup/tablet-portrait.png +0 -0
- data/lib/coolstrap-generator/templates/app/assets/images/coolstrap/startup/tablet-portrait@2x.png +0 -0
- data/lib/coolstrap-generator/templates/app/assets/images/startup/smatphone.png +0 -0
- data/lib/coolstrap-generator/templates/app/assets/images/startup/smatphone@2x.png +0 -0
- data/lib/coolstrap-generator/templates/app/assets/images/startup/tablet-landscape.png +0 -0
- data/lib/coolstrap-generator/templates/app/assets/images/startup/tablet-landscape@2x.png +0 -0
- data/lib/coolstrap-generator/templates/app/assets/images/startup/tablet-portrait.png +0 -0
- data/lib/coolstrap-generator/templates/app/assets/images/startup/tablet-portrait@2x.png +0 -0
- data/lib/coolstrap-generator/templates/app/assets/javascripts/.DS_Store +0 -0
- data/lib/coolstrap-generator/templates/app/assets/javascripts/app.js +18 -0
- data/lib/coolstrap-generator/templates/app/assets/javascripts/coolstrap/_Coolstrap.App.coffee +39 -0
- data/lib/coolstrap-generator/templates/app/assets/javascripts/coolstrap/_Coolstrap.Console.coffee +49 -0
- data/lib/coolstrap-generator/templates/app/assets/javascripts/coolstrap/_Coolstrap.Constants.coffee +89 -0
- data/lib/coolstrap-generator/templates/app/assets/javascripts/coolstrap/_Coolstrap.js +13 -0
- data/lib/coolstrap-generator/templates/app/assets/javascripts/coolstrap/build/_wrap-start.js +18 -0
- data/lib/coolstrap-generator/templates/app/assets/javascripts/coolstrap/coolstrap-0.1.js +20 -0
- data/lib/coolstrap-generator/templates/app/assets/javascripts/coolstrap/coolstrap-0.1.packed.js +23 -0
- data/lib/coolstrap-generator/templates/app/assets/javascripts/coolstrap/fallback/_Coolstrap.Fallback.Android.coffee +53 -0
- data/lib/coolstrap-generator/templates/app/assets/javascripts/coolstrap/fallback/_Coolstrap.Fallback.iOS.coffee +29 -0
- data/lib/coolstrap-generator/templates/app/assets/javascripts/coolstrap/framework/_Coolstrap.Framework.Articles.coffee +34 -0
- data/lib/coolstrap-generator/templates/app/assets/javascripts/coolstrap/framework/_Coolstrap.Framework.Dialogs.coffee +33 -0
- data/lib/coolstrap-generator/templates/app/assets/javascripts/coolstrap/framework/_Coolstrap.Framework.Navigation.coffee +118 -0
- data/lib/coolstrap-generator/templates/app/assets/javascripts/coolstrap/framework/_Coolstrap.Framework.Sections.coffee +60 -0
- data/lib/coolstrap-generator/templates/app/assets/javascripts/coolstrap/lib/iscroll.js +1076 -0
- data/lib/coolstrap-generator/templates/app/assets/javascripts/coolstrap/lib/modernizr-2.5.3.js +1265 -0
- data/lib/coolstrap-generator/templates/app/assets/javascripts/coolstrap/lib/zepto-1.0rc1.js +1357 -0
- data/lib/coolstrap-generator/templates/app/assets/javascripts/coolstrap/navigate/_Coolstrap.Navigate.History.coffee +164 -0
- data/lib/coolstrap-generator/templates/app/assets/javascripts/coolstrap/navigate/_Coolstrap.Navigate.coffee +105 -0
- data/lib/coolstrap-generator/templates/app/assets/javascripts/coolstrap/plugins/_Coolstrap.Plugins.coffee +157 -0
- data/lib/coolstrap-generator/templates/app/assets/javascripts/coolstrap/util/_Coolstrap.Util.Core.coffee +54 -0
- data/lib/coolstrap-generator/templates/app/assets/javascripts/coolstrap/util/_Coolstrap.Util.Platform.coffee +89 -0
- data/lib/coolstrap-generator/templates/app/assets/javascripts/coolstrap/util/_Coolstrap.Util.UI.coffee +96 -0
- data/lib/coolstrap-generator/templates/app/assets/javascripts/coolstrap/util/_Coolstrap.Util.coffee +41 -0
- data/lib/coolstrap-generator/templates/app/assets/javascripts/coolstrap/view/_Coolstrap.View.Article.coffee +43 -0
- data/lib/coolstrap-generator/templates/app/assets/javascripts/coolstrap/view/_Coolstrap.View.Aside.coffee +65 -0
- data/lib/coolstrap-generator/templates/app/assets/javascripts/coolstrap/view/_Coolstrap.View.Dialog.coffee +129 -0
- data/lib/coolstrap-generator/templates/app/assets/javascripts/coolstrap/view/_Coolstrap.View.Scroll.coffee +191 -0
- data/lib/coolstrap-generator/templates/app/assets/stylesheets/.DS_Store +0 -0
- data/lib/coolstrap-generator/templates/app/assets/stylesheets/coolstrap/_structure.scss +8 -0
- data/lib/coolstrap-generator/templates/app/assets/stylesheets/coolstrap/coolstrap.css.scss +2 -0
- data/lib/coolstrap-generator/templates/app/assets/stylesheets/coolstrap/structure/_components.scss +5 -0
- data/lib/coolstrap-generator/templates/app/assets/stylesheets/coolstrap/structure/_layout.scss +4 -0
- data/lib/coolstrap-generator/templates/app/assets/stylesheets/coolstrap/structure/_utilities.scss +6 -0
- data/lib/coolstrap-generator/templates/app/assets/stylesheets/coolstrap/structure/components/_dialog.scss +122 -0
- data/lib/coolstrap-generator/templates/app/assets/stylesheets/coolstrap/structure/components/_formelements.scss +89 -0
- data/lib/coolstrap-generator/templates/app/assets/stylesheets/coolstrap/structure/components/_listview.scss +76 -0
- data/lib/coolstrap-generator/templates/app/assets/stylesheets/coolstrap/structure/components/_navigations.scss +192 -0
- data/lib/coolstrap-generator/templates/app/assets/stylesheets/coolstrap/structure/components/_tools.scss +169 -0
- data/lib/coolstrap-generator/templates/app/assets/stylesheets/coolstrap/structure/layout/_layers.scss +57 -0
- data/lib/coolstrap-generator/templates/app/assets/stylesheets/coolstrap/structure/layout/_layout.scss +62 -0
- data/lib/coolstrap-generator/templates/app/assets/stylesheets/coolstrap/structure/layout/_positions.scss +38 -0
- data/lib/coolstrap-generator/templates/app/assets/stylesheets/coolstrap/structure/layout/_transitions.scss +35 -0
- data/lib/coolstrap-generator/templates/app/assets/stylesheets/coolstrap/structure/utilities/_animate.scss +63 -0
- data/lib/coolstrap-generator/templates/app/assets/stylesheets/coolstrap/structure/utilities/_helpers.scss +82 -0
- data/lib/coolstrap-generator/templates/app/assets/stylesheets/coolstrap/structure/utilities/_icons.scss +336 -0
- data/lib/coolstrap-generator/templates/app/assets/stylesheets/coolstrap/structure/utilities/_mixins.scss +45 -0
- data/lib/coolstrap-generator/templates/app/assets/stylesheets/coolstrap/structure/utilities/_reset.scss +367 -0
- data/lib/coolstrap-generator/templates/app/assets/stylesheets/coolstrap/structure/utilities/_variables.scss +176 -0
- data/lib/coolstrap-generator/templates/app/assets/stylesheets/coolstrap/themes/_default.scss +255 -0
- data/lib/coolstrap-generator/templates/app/assets/stylesheets/coolstrap/themes/coolstrap.css.scss +164 -0
- data/lib/coolstrap-generator/templates/app/assets/stylesheets/customtheme.css.scss +19 -0
- data/lib/coolstrap-generator/templates/app/components/_formelements.html.haml +130 -0
- data/lib/coolstrap-generator/templates/app/components/_tabbar.html.haml +343 -0
- data/lib/coolstrap-generator/templates/app/components/_toolbar.html.haml +463 -0
- data/lib/coolstrap-generator/templates/app/components/formelements.html.haml +196 -0
- data/lib/coolstrap-generator/templates/app/components/listview/_complexlistavatar.html.haml.erb +77 -0
- data/lib/coolstrap-generator/templates/app/components/listview/_simplelist.html.haml.erb +31 -0
- data/lib/coolstrap-generator/templates/app/components/tabbar.html.haml.erb +16 -0
- data/lib/coolstrap-generator/templates/app/components/toolbar.html.haml.erb +32 -0
- data/lib/coolstrap-generator/templates/app/index.html.haml.erb +21 -0
- data/lib/coolstrap-generator/templates/app/layout.haml.erb +79 -0
- data/lib/coolstrap-generator/templates/app/views/.DS_Store +0 -0
- data/lib/coolstrap-generator/templates/app/views/_home.haml.erb +31 -0
- data/lib/coolstrap-generator/templates/app/views/shared/_aside_onbottom.haml +2 -0
- data/lib/coolstrap-generator/templates/app/views/shared/_aside_onleft.haml +56 -0
- data/lib/coolstrap-generator/templates/app/views/shared/_aside_onright.haml +66 -0
- data/lib/coolstrap-generator/templates/app/views/shared/_aside_ontop.haml +19 -0
- data/lib/coolstrap-generator/templates/defaults/Gemfile.erb +3 -0
- data/lib/coolstrap-generator/templates/defaults/LICENSE.erb +1 -0
- data/lib/coolstrap-generator/templates/defaults/Readme.mkd.erb +1 -0
- data/lib/coolstrap-generator/templates/defaults/config.erb +42 -0
- data/lib/coolstrap-generator/templates/defaults/gitignore.erb +2 -0
- data/lib/coolstrap-generator/templates/rakefile +102 -0
- data/lib/coolstrap-generator/templates/specs/app_spec.coffee +3 -0
- data/lib/coolstrap-generator/utils.rb +82 -0
- data/lib/coolstrap-generator/version.rb +5 -0
- data/readme.md +107 -0
- data/spec/cli/command_spec.rb +88 -0
- data/spec/coolstrap-generator/generate/project_spec.rb +126 -0
- data/spec/coolstrap-generator/generate/view_spec.rb +26 -0
- data/spec/coolstrap-generator/logger_spec.rb +25 -0
- data/spec/coolstrap-generator/middleman/helpers_spec.rb +16 -0
- data/spec/coolstrap-generator/utils_spec.rb +120 -0
- data/spec/spec_helper.rb +39 -0
- metadata +321 -0
Binary file
|
@@ -0,0 +1,31 @@
|
|
1
|
+
= section({:id=>"home"}) do
|
2
|
+
|
3
|
+
= header do
|
4
|
+
= link_to "#aside-left" , "data-target" => "aside" do
|
5
|
+
%i.icon-reorder
|
6
|
+
|
7
|
+
%h1 <%= app_name %>
|
8
|
+
= link_to "#first-page", "data-target" => "section" do
|
9
|
+
%i.icon-home
|
10
|
+
|
11
|
+
= link_to "#aside-top", "data-target" => "aside" do
|
12
|
+
%i.icon-search
|
13
|
+
|
14
|
+
= footer("data-type" => "toolbar") do
|
15
|
+
%a.onlyIcon
|
16
|
+
%i.icon-refresh
|
17
|
+
.content
|
18
|
+
%h2
|
19
|
+
Generated at:
|
20
|
+
= Time.now
|
21
|
+
%a.onlyIcon
|
22
|
+
%i.icon-edit
|
23
|
+
|
24
|
+
= article( { :id => 'first-page', :class => 'scrollable' }) do
|
25
|
+
%ul#mail{"data-type" => "listview"}
|
26
|
+
%li
|
27
|
+
= link_to "#collection" , "data-target" => "section" do
|
28
|
+
.content
|
29
|
+
.title Example Link - run "coolstrap s list [Domain] [collection]"
|
30
|
+
.aside
|
31
|
+
%i.icon-chevron-right
|
@@ -0,0 +1,56 @@
|
|
1
|
+
%aside.onLeft#aside-left
|
2
|
+
= header do
|
3
|
+
%input{ :placeholder => 'Busquedas' }
|
4
|
+
|
5
|
+
= section({ :class => 'scrollable' }) do
|
6
|
+
= list_view do
|
7
|
+
|
8
|
+
%li
|
9
|
+
.aside
|
10
|
+
.picture.small
|
11
|
+
.content
|
12
|
+
%h1 Don Francisco
|
13
|
+
|
14
|
+
%li.list-divider Favorites
|
15
|
+
|
16
|
+
%li
|
17
|
+
.aside
|
18
|
+
= icon :"comment-alt"
|
19
|
+
.content
|
20
|
+
%h1 Messages
|
21
|
+
.aside
|
22
|
+
.badge 30 +
|
23
|
+
%li
|
24
|
+
.aside
|
25
|
+
= icon :"map-marker"
|
26
|
+
.content
|
27
|
+
%h1 Near from you
|
28
|
+
%li
|
29
|
+
.aside
|
30
|
+
= icon :group
|
31
|
+
.content
|
32
|
+
%h1 Friends
|
33
|
+
%li.list-divider Apps
|
34
|
+
|
35
|
+
%li
|
36
|
+
= link_to "#twitter", {"data-target" => "section"} do
|
37
|
+
.aside
|
38
|
+
= icon :twitter
|
39
|
+
.content
|
40
|
+
%h1 Twitter
|
41
|
+
.aside
|
42
|
+
= icon :signin
|
43
|
+
%li
|
44
|
+
.aside
|
45
|
+
= icon :pinterest
|
46
|
+
.content
|
47
|
+
%h1 Pinterest
|
48
|
+
.aside
|
49
|
+
= icon :signin
|
50
|
+
%li
|
51
|
+
.aside
|
52
|
+
= icon :github
|
53
|
+
.content
|
54
|
+
%h1 Github
|
55
|
+
.aside
|
56
|
+
= icon :signin
|
@@ -0,0 +1,66 @@
|
|
1
|
+
%aside.onRight#aside-right
|
2
|
+
%header
|
3
|
+
%h1 Dialogs
|
4
|
+
|
5
|
+
%section{ :class => 'scrollable' }
|
6
|
+
%ul{"data-type" => "listview"}
|
7
|
+
%li
|
8
|
+
%a{"href" => "#mymodal", "data-target" => "dialog"}
|
9
|
+
.content Open dialog type [modal]
|
10
|
+
%i.icon-play-circle
|
11
|
+
%li
|
12
|
+
%a{"href" => "#myalert", "data-target" => "dialog"}
|
13
|
+
.content Open dialog type [alert]
|
14
|
+
%i.icon-play-circle
|
15
|
+
%li
|
16
|
+
%a{"href" => "#myaction", "data-target" => "dialog"}
|
17
|
+
.content Open dialog type [action]
|
18
|
+
%i.icon-play-circle
|
19
|
+
%li
|
20
|
+
%a{"href" => "#myaction2", "data-target" => "dialog"}
|
21
|
+
.content Open another dialog type [action]
|
22
|
+
%i.icon-play-circle
|
23
|
+
%li
|
24
|
+
%a{"href" => "#myaction3", "data-target" => "dialog"}
|
25
|
+
.content even more, open dialog type [action]
|
26
|
+
%i.icon-play-circle
|
27
|
+
|
28
|
+
|
29
|
+
%div#mymodal{:role => "dialog", "data-type" => "modal", "data-transition" => "slideup"}
|
30
|
+
%a.close{"href" => "#mymodal", "data-target" => "close"}
|
31
|
+
%i.icon-remove-circle
|
32
|
+
%h1 Cras mattis consectetur purus sit amet fermentumm agnis dis parturient mo.
|
33
|
+
|
34
|
+
%div#myalert{:role => "dialog", "data-type" => "alert"}
|
35
|
+
%h1 Cras mattis consectetur purus agnis dis parturient mo.
|
36
|
+
%p Donec id elit non mi porta gravida at eget metus estibulum id ligula porta felis euismod semper.
|
37
|
+
.button-group
|
38
|
+
%a Ullamcorper
|
39
|
+
%a.close{"href" => "#myalert", "data-target" => "close"}
|
40
|
+
Close
|
41
|
+
|
42
|
+
%div#myaction{:role => "dialog", "data-type" => "action"}
|
43
|
+
%h1 Cras mattis consectetur purus sit amet fermentumm agnis dis parturient mo.
|
44
|
+
.button-group
|
45
|
+
%a Ullamcorper Ridiculus
|
46
|
+
%a.close{"href" => "#myaction", "data-target" => "close"}
|
47
|
+
Close
|
48
|
+
|
49
|
+
%div#myaction2{:role => "dialog", "data-type" => "action"}
|
50
|
+
%h1 Cras mattis consectetur purus sit amet fermentumm agnis dis parturient mo.
|
51
|
+
%a Ullamcorper Ridiculus
|
52
|
+
%a.close{"href" => "#myaction2", "data-target" => "close"}
|
53
|
+
Close
|
54
|
+
|
55
|
+
%div#myaction3{:role => "dialog", "data-type" => "action"}
|
56
|
+
%h1 Cras mattis consectetur purus sit amet fermentumm agnis dis parturient mo.
|
57
|
+
.button-group
|
58
|
+
%a Ullamcorper
|
59
|
+
%a Tristique
|
60
|
+
%p Cras mattis consectetur purus sit amet fermentumm agnis dis parturient mo.
|
61
|
+
.button-group.alignVertical
|
62
|
+
%a Ullamcorper Ridiculus
|
63
|
+
%a Tristique Lorem
|
64
|
+
%a.close{"href" => "#myaction3", "data-target" => "close"}
|
65
|
+
Close
|
66
|
+
|
@@ -0,0 +1,19 @@
|
|
1
|
+
%aside.onTop#aside-top
|
2
|
+
= toolbar do
|
3
|
+
%input
|
4
|
+
%a
|
5
|
+
= icon(:search)
|
6
|
+
|
7
|
+
= section do
|
8
|
+
= tabbar do
|
9
|
+
%a= icon(:picture, :text=>"PHOTOS")
|
10
|
+
|
11
|
+
%a.is-active
|
12
|
+
= icon(:music) do
|
13
|
+
AUDIO
|
14
|
+
%a
|
15
|
+
= icon(:film)
|
16
|
+
%a
|
17
|
+
= icon(:group)
|
18
|
+
%a
|
19
|
+
= icon(:book)
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= app_name %> <%= Time.now.year %>, made with coolstrap, see coolstrap license.
|
@@ -0,0 +1 @@
|
|
1
|
+
# <%= app_name %> - Created with Coolstrap, the mobile development framework.
|
@@ -0,0 +1,42 @@
|
|
1
|
+
#"<%= app_name %>"
|
2
|
+
|
3
|
+
require "coolstrap-generator/middleman/helpers"
|
4
|
+
|
5
|
+
|
6
|
+
compass_config do |config|
|
7
|
+
config.sass_options = {:output_style => :nested, :images_dir => 'images', :fonts_dir => 'fonts'}
|
8
|
+
end
|
9
|
+
|
10
|
+
set :images_dir, "assets/images"
|
11
|
+
set :fonts_dir, "assets/fonts"
|
12
|
+
set :css_dir, "assets/stylesheets"
|
13
|
+
set :js_dir, "assets/javascripts"
|
14
|
+
set :markdown, :layout_engine => :haml
|
15
|
+
set :default_encoding, 'utf-8'
|
16
|
+
|
17
|
+
activate :helpers
|
18
|
+
|
19
|
+
configure :build do
|
20
|
+
activate :compass
|
21
|
+
activate :minify_css
|
22
|
+
activate :minify_javascript
|
23
|
+
activate :relative_assets
|
24
|
+
end
|
25
|
+
|
26
|
+
|
27
|
+
# Per-page layout changes:
|
28
|
+
#
|
29
|
+
# With no layout
|
30
|
+
# page "/path/to/file.html", :layout => false
|
31
|
+
#
|
32
|
+
# With alternative layout
|
33
|
+
page "/examples/layouts/*", :layout => "/examples/examples"
|
34
|
+
page "/examples/kitchen-sink/*", :layout => "/examples/examples"
|
35
|
+
page "/examples/components/*", :layout => "/examples/examples"
|
36
|
+
page "/examples/demo/*", :layout => "/examples/examples"
|
37
|
+
page "/examples/rhyboo/*", :layout => "/examples/examples"
|
38
|
+
#
|
39
|
+
# A path which all have the same layout
|
40
|
+
# with_layout :admin do
|
41
|
+
# page "/admin/*"
|
42
|
+
# end
|
@@ -0,0 +1,102 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'colored'
|
3
|
+
require File.join(File.dirname(__FILE__), 'config.rb')
|
4
|
+
include Config
|
5
|
+
|
6
|
+
task :default => ["build:iphone"]
|
7
|
+
|
8
|
+
namespace :project do
|
9
|
+
desc "Get project information"
|
10
|
+
task :info do
|
11
|
+
puts "#{PROJECT_NAME} at version #{PROJECT_VERSION}."
|
12
|
+
puts " App ID: #{APP_ID}."
|
13
|
+
puts " App Name: #{APP_NAME}."
|
14
|
+
puts " Building for: #{APP_DEVICE}."
|
15
|
+
puts " Using iOS SDK Version #{IPHONE_SDK_VERSION}."
|
16
|
+
puts " Using Android Version #{ANDROID_SDK_VERSION}."
|
17
|
+
puts " Titanium Build Version #{TI_SDK_VERSION}."
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
namespace :compile do
|
22
|
+
desc "Compile all"
|
23
|
+
task :all do
|
24
|
+
compile
|
25
|
+
end
|
26
|
+
|
27
|
+
desc "Compile coffee"
|
28
|
+
task :coffee do
|
29
|
+
compile_coffee
|
30
|
+
end
|
31
|
+
|
32
|
+
desc "Compile sass"
|
33
|
+
task :styles do
|
34
|
+
compile_sass
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
namespace :build do
|
39
|
+
desc "Build the app for the iPhone"
|
40
|
+
task :iphone do
|
41
|
+
build
|
42
|
+
end
|
43
|
+
|
44
|
+
desc "Build the app for Android"
|
45
|
+
task :android do
|
46
|
+
build({ :device => 'android' })
|
47
|
+
end
|
48
|
+
|
49
|
+
desc "Recreate build folder"
|
50
|
+
task :new do
|
51
|
+
system "rm -rf build"
|
52
|
+
system "mkdir -p build/iphone"
|
53
|
+
Rake::Task["setup:all"].invoke
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
def compile
|
58
|
+
compile_coffee && compile_sass
|
59
|
+
end
|
60
|
+
|
61
|
+
def compile_sass
|
62
|
+
puts "Compiling stylesheets".blue
|
63
|
+
`sass --compass -C -t expanded stylesheets/app.sass > Resources/app.jss`
|
64
|
+
puts "Done".green
|
65
|
+
end
|
66
|
+
|
67
|
+
def compile_coffee
|
68
|
+
puts "Compiling CoffeeScript".blue
|
69
|
+
paths = [
|
70
|
+
"app/#{APP_NAME}.coffee",
|
71
|
+
"app/models/*.coffee",
|
72
|
+
"app/views/*.coffee"
|
73
|
+
]
|
74
|
+
|
75
|
+
puts "PATHS: #{paths.join(' ')} ".yellow
|
76
|
+
|
77
|
+
compilation = (
|
78
|
+
system "coffee -c -b --join Resources/#{APP_NAME}.js -c -b #{paths.join(' ')}" and
|
79
|
+
system "coffee -p --bare src/app.coffee > Resources/app.js"
|
80
|
+
)
|
81
|
+
|
82
|
+
if compilation
|
83
|
+
puts "Successfully compiled CoffeeScript".green
|
84
|
+
else
|
85
|
+
puts "Error compiling CoffeeScript".red
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
89
|
+
def build(options={})
|
90
|
+
return "Broken" unless compile
|
91
|
+
options[:device] ||= 'iphone'
|
92
|
+
if options[:device] == 'android'
|
93
|
+
sdk = ANDROID_SDK_VERSION
|
94
|
+
builder = "#{TI_ANDROID_DIR}/builder.py"
|
95
|
+
elsif options[:device].match /^i/
|
96
|
+
sdk = IPHONE_SDK_VERSION
|
97
|
+
builder = "#{TI_IPHONE_DIR}/builder.py"
|
98
|
+
end
|
99
|
+
puts "Building with Titanium... (DEVICE_TYPE: #{options[:device]})".blue
|
100
|
+
sh %Q{bash -c "#{builder} run #{PROJECT_ROOT}/ #{sdk} #{APP_ID} #{APP_NAME} #{options[:device]} " \
|
101
|
+
| perl -pe 's/^\\[DEBUG\\].*$/\\e[35m$&\\e[0m/g;s/^\\[INFO\\].*$/\\e[36m$&\\e[0m/g;s/^\\[WARN\\].*$/\\e[33m$&\\e[0m/g;s/^\\[ERROR\\].*$/\\e[31m$&\\e[0m/g;'}
|
102
|
+
end
|
@@ -0,0 +1,82 @@
|
|
1
|
+
module Coolstrap::Generator
|
2
|
+
module Utils
|
3
|
+
|
4
|
+
def create_new_file(name, file=nil)
|
5
|
+
log "Creating #{name}"
|
6
|
+
contents = file.nil? ? '' : File.read(file)
|
7
|
+
unless File.file?(location.join(name))
|
8
|
+
File.open(location.join(name), 'w') { |f| f.write(contents) }
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
def get_app_name
|
13
|
+
config = File.open("tiapp.xml")
|
14
|
+
doc = ::Nokogiri::XML(config)
|
15
|
+
config.close
|
16
|
+
doc.xpath('ti:app/name').text
|
17
|
+
end
|
18
|
+
|
19
|
+
def remove_files(*files)
|
20
|
+
files.each do |file|
|
21
|
+
log "Removing #{file} file."
|
22
|
+
FileUtils.rm(location.join(file))
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
def touch(*filenames)
|
27
|
+
filenames.each do |filename|
|
28
|
+
log "Creating #{filename} file."
|
29
|
+
FileUtils.touch(location.join(filename))
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
def create_directories(*dirs)
|
34
|
+
dirs.each do |dir|
|
35
|
+
log "Creating the #{dir} directory."
|
36
|
+
FileUtils.mkdir_p(location.join(dir))
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
def remove_directories(*names)
|
41
|
+
names.each do |name|
|
42
|
+
log "Removing #{name} directory."
|
43
|
+
FileUtils.rm_rf(location.join(name))
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
|
48
|
+
def create_with_template(name, template_location, contents={})
|
49
|
+
template = templates("#{template_location}.erb")
|
50
|
+
eruby = Erubis::Eruby.new(File.read(template))
|
51
|
+
File.open(location.join(name.gsub(/^\//, '')), 'w') { |f| f.write(eruby.result(contents))}
|
52
|
+
end
|
53
|
+
|
54
|
+
def templates(path)
|
55
|
+
::Coolstrap::Generator.root.join('coolstrap-generator/templates').join(path)
|
56
|
+
end
|
57
|
+
|
58
|
+
|
59
|
+
def log(msg)
|
60
|
+
::Coolstrap::Generator::Logger.report(msg)
|
61
|
+
end
|
62
|
+
|
63
|
+
def error(msg)
|
64
|
+
::Coolstrap::Generator::Logger.error(msg)
|
65
|
+
end
|
66
|
+
|
67
|
+
def base_location
|
68
|
+
@location ||= Pathname.new(Dir.pwd)
|
69
|
+
end
|
70
|
+
|
71
|
+
alias_method :location, :base_location
|
72
|
+
|
73
|
+
def underscore(string)
|
74
|
+
string.gsub(/::/, '/').
|
75
|
+
gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2').
|
76
|
+
gsub(/([a-z\d])([A-Z])/,'\1_\2').
|
77
|
+
tr("-", "_").
|
78
|
+
downcase
|
79
|
+
end
|
80
|
+
|
81
|
+
end
|
82
|
+
end
|
data/readme.md
ADDED
@@ -0,0 +1,107 @@
|
|
1
|
+
# CoolsTrap Generator
|
2
|
+
|
3
|
+
### An app generator for rapid Html5 mobile development with coolstrap framework.
|
4
|
+
|
5
|
+
## DISCLAIMER:
|
6
|
+
|
7
|
+
Coolstrap is in alpha development phase, so the project should be treated like that until the coolstrap team generates the stable version of the framework.
|
8
|
+
|
9
|
+
## Requirements
|
10
|
+
|
11
|
+
* ruby 1.9.3
|
12
|
+
* install bundler
|
13
|
+
* CoffeeScript
|
14
|
+
|
15
|
+
## Install the gem
|
16
|
+
|
17
|
+
➜ gem install coolstrap-generator
|
18
|
+
|
19
|
+
### Create a new Project
|
20
|
+
|
21
|
+
➜ coolstrap new HelloWorld
|
22
|
+
|
23
|
+
### Create your views
|
24
|
+
|
25
|
+
➜ coolstrap s list Developers commiters
|
26
|
+
➜ coolstrap s list Developers watchers
|
27
|
+
|
28
|
+
When the view is created you must to include the generated partial in views/index.html.haml.
|
29
|
+
|
30
|
+
Then, to show the view you just have to call the section with something like this in your views/_home.haml:
|
31
|
+
|
32
|
+
%a{"href" => "#commiters", "data-target" => "section"}
|
33
|
+
|
34
|
+
|
35
|
+
### Create your tabbars & toolbars
|
36
|
+
|
37
|
+
➜ coolstrap s tabbar Developers watchers
|
38
|
+
➜ coolstrap s toolbar Developers watchers
|
39
|
+
|
40
|
+
Those lines generates partials in views/tabbars & views/toolbars.
|
41
|
+
|
42
|
+
To use Tabbars or Toolbars you need to call the partials in the views, for example in a header or footer elements.
|
43
|
+
|
44
|
+
## Run it
|
45
|
+
|
46
|
+
➜ coolstrap r # or coolstrap server
|
47
|
+
|
48
|
+
This command will run an instance of middleman server, since is middleman you can also start the server with 'middleman server' command
|
49
|
+
|
50
|
+
## Build it
|
51
|
+
|
52
|
+
➜ coolstrap b # or coolstrap build
|
53
|
+
|
54
|
+
This command will build middleman static site, since is middleman you can also build with 'middleman build' command
|
55
|
+
|
56
|
+
## Convenience Helpers
|
57
|
+
|
58
|
+
Coolstrap Generator comes with some convenience helpers methods for header, footer, sections, list_view and more.
|
59
|
+
see: coolstrap-generator/templates/.
|
60
|
+
|
61
|
+
### some examples
|
62
|
+
|
63
|
+
= header do
|
64
|
+
= toolbar(:control=>true) do
|
65
|
+
%a= icon(:facebook)
|
66
|
+
%a= icon(:facebook)
|
67
|
+
%a= icon(:comments)
|
68
|
+
|
69
|
+
= footer do
|
70
|
+
= tabbar do
|
71
|
+
= link_to "#" do
|
72
|
+
= icon(:facebook)
|
73
|
+
|
74
|
+
= article(:class=>"scrollable") do
|
75
|
+
= list_view(:class=>"inset") do
|
76
|
+
= list_item(:arrow=>"right")
|
77
|
+
= divider do
|
78
|
+
2. Title and description with arrow and avatar
|
79
|
+
|
80
|
+
= list_view(:class=>"inset") do
|
81
|
+
= divider do
|
82
|
+
1. Title and description widht avatar
|
83
|
+
= list_item do
|
84
|
+
....
|
85
|
+
|
86
|
+
|
87
|
+
### Contributing to Coolstrap-Generator
|
88
|
+
|
89
|
+
* Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
|
90
|
+
* Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
|
91
|
+
* Fork the project
|
92
|
+
* Start a feature/bugfix branch
|
93
|
+
* Commit and push until you are happy with your contribution
|
94
|
+
* Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
|
95
|
+
* 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.
|
96
|
+
|
97
|
+
### acknowledgments
|
98
|
+
* Coolstrap team for their awesome work on coolstrap framework.
|
99
|
+
* This gem is heavily inspired in Ti gem from Robert Evans, so many of this gorgeous code was taken verbatim from that gem, the main difference is that I adapted the code to work with coolstrap mobile framework and middleman static page generator system.
|
100
|
+
|
101
|
+
|
102
|
+
|
103
|
+
### Copyright
|
104
|
+
|
105
|
+
Copyright Miguel Michelson Martinez (c) 2012 , the same licence as coolstrap.
|
106
|
+
|
107
|
+
ruby -Ilib ./bin/coolstrap
|