myway 0.1.6 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --color
2
+ --format progress
data/README.md CHANGED
@@ -28,6 +28,12 @@ And to start a new sinatra project:
28
28
 
29
29
  CHANGE LOG
30
30
 
31
+ Version 0.2.0
32
+ - replace head.js with yepnope.js for javascript loader
33
+ - dynamically append path for sprockets for assets
34
+ - adding path for images noted by grandslam
35
+ - refactoring
36
+
31
37
  Version 0.1.3
32
38
  - adds head, backbone, underscore js in assets pipeline
33
39
  - scaffolds capistrano deploy script
@@ -11,7 +11,7 @@ JS_LIBS = {
11
11
  'underscore' => 'http://documentcloud.github.com/underscore/underscore-min.js',
12
12
  'bootstrap' => 'http://twitter.github.com/bootstrap/assets/bootstrap.zip',
13
13
  'kickstart' => 'http://www.99lime.com/downloads/',
14
- 'yepnope' => 'https://github.com/SlexAxton/yepnope.js/zipball/master'
14
+ 'yepnope' => 'https://github.com/SlexAxton/yepnope.js/archive/master.zip'
15
15
  }
16
16
  class String
17
17
  def camelize(first_letter_in_uppercase = true)
@@ -96,24 +96,34 @@ module Myway
96
96
  }
97
97
  end
98
98
 
99
- def build_js_libs(libs=%w(head underscore backbone bootstrap))
99
+ def build_js_libs(libs=%w(yepnope underscore backbone bootstrap))
100
100
 
101
101
  libs.each do |lib|
102
102
  begin
103
- if lib != "bootstrap"
104
- File.open "./assets/js/#{lib}.min.js", 'w+' do |file|
103
+ if lib == "bootstrap" or lib == "yepnope"
104
+ File.open "assets/#{lib}.zip", 'wb' do |file|
105
105
  file.write get_latest(lib)
106
106
  end
107
+ unzip_file "./assets/#{lib}.zip", "./assets/"
108
+ File.delete "./assets/#{lib}.zip"
109
+ end
110
+
111
+ case lib
112
+ when "yepnope"
113
+ `mv ./assets/#{lib}.js-master/#{lib}.js ./assets/js/`
114
+ `mv ./assets/#{lib}.js-master/filters ./assets/js/`
115
+ `mv ./assets/#{lib}.js-master/plugins ./assets/js/`
116
+ `mv ./assets/#{lib}.js-master/prefixes ./assets/js/`
117
+ FileUtils.rm_rf "./assets/#{lib}.js-master/" if lib == "yepnope"
118
+ when "bootstrap"
119
+ `mv ./assets/#{lib}/js/* ./assets/js/`
120
+ `mv ./assets/#{lib}/css ./assets/`
121
+ `mv ./assets/#{lib}/img ./assets/`
122
+ FileUtils.rm_rf "./assets/#{lib}/" if lib == "bootstrap"
107
123
  else
108
- File.open "assets/js/#{lib}.zip", 'wb' do |file|
124
+ File.open "./assets/js/#{lib}.min.js", 'w+' do |file|
109
125
  file.write get_latest(lib)
110
126
  end
111
- unzip_file "./assets/js/#{lib}.zip", "./assets/"
112
- File.delete "./assets/js/#{lib}.zip"
113
- `mv ./assets/bootstrap/js/* ./assets/js/`
114
- `mv ./assets/bootstrap/css/ ./assets/`
115
- `mv ./assets/bootstrap/img/ ./assets/`
116
- FileUtils.rm_rf "./assets/bootstrap/"
117
127
  end
118
128
  rescue Errno::ETIMEDOUT, Timeout::Error, Errno::EINVAL, Errno::ECONNRESET, EOFError, Net::HTTPBadResponse, Net::HTTPHeaderSyntaxError, Net::ProtocolError => e
119
129
  say "#{e} Error while getting #{lib}.js"
@@ -152,8 +162,6 @@ module Myway
152
162
 
153
163
  template "myway/templates/spec/specHelper.js.tt", "#{name}/spec/javascripts/helpers/specHelper.js"
154
164
  template "myway/templates/spec/fixtures.js.tt", "#{name}/spec/javascripts/fixtures/fixtures.js"
155
-
156
-
157
165
  end
158
166
  end
159
167
  end
@@ -1,14 +1,15 @@
1
- require "sinatra/reloader"
1
+ #require "sinatra/reloader"
2
2
  require "yaml"
3
3
  require "sprockets"
4
4
  require "haml"
5
+ require "pathname"
5
6
 
6
7
  class <%= name.camelize %> < Sinatra::Base
7
8
 
8
9
  set :app_path, '/'
9
10
 
10
11
  configure :development do
11
- register Sinatra::Reloader
12
+ #register Sinatra::Reloader
12
13
  end
13
14
 
14
15
  set :logging, true
@@ -16,8 +17,7 @@ class <%= name.camelize %> < Sinatra::Base
16
17
  set :assets, Sprockets::Environment.new
17
18
 
18
19
  # Configure sprockets
19
- settings.assets.append_path "assets/js"
20
- settings.assets.append_path "assets/css"
20
+ Dir.glob('assets/**/*/').select { |d| settings.assets.append_path "#{d}" if File.directory? d }
21
21
 
22
22
  # For compressed JS and CSS output
23
23
  require "yui/compressor"
@@ -28,6 +28,12 @@ class <%= name.camelize %> < Sinatra::Base
28
28
  haml :index
29
29
  end
30
30
 
31
+ get "/img/:file" do
32
+ file = params[:file].split(".")
33
+ content_type "image/#{file[1]}"
34
+ settings.assets["#{file[0]}.#{file[1]}"]
35
+ end
36
+
31
37
  get "/js/:file.js" do
32
38
  content_type "application/javascript"
33
39
  settings.assets["#{params[:file]}.js"]
@@ -5,7 +5,7 @@
5
5
  %span.icon-bar
6
6
  %span.icon-bar
7
7
  %span.icon-bar
8
- %a.brand{:href => "#"} Project <%= name %>
8
+ %a.brand{:href => "#"} Project <%= name.camelize %>
9
9
  .nav-collapse
10
10
  %ul.nav
11
11
  %li.active
@@ -0,0 +1,8 @@
1
+ .hero-unit
2
+ %h1 MyWay
3
+ %p It is just a base tool to build your own sinatra way - ftaher
4
+ %p
5
+ %a.btn.btn-primary.btn-large{:href=> "https://github.com/mftaher/myway"}
6
+ Fork me on Github
7
+
8
+
@@ -1,36 +1,37 @@
1
1
  !!!
2
2
  %html
3
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')
4
+ %title Project: <%= name.camelize %>
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/yepnope.js"}
9
+ %link{:href=>'/css/bootstrap.css', :rel=>'stylesheet'}
10
10
  %style
11
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')
12
+ %link{:href=>'/css/bootstrap-responsive.css', :rel=>'stylesheet'}
13
13
 
14
14
  //Le HTML5 shim, for IE6-8 support of HTML5 elements
15
15
  //if lt IE 9
16
- %script(src='http://html5shim.googlecode.com/svn/trunk/html5.js')
16
+ %script{:src=>'http://html5shim.googlecode.com/svn/trunk/html5.js'}
17
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')
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
22
 
23
23
  %body
24
24
  = haml :'includes/navbar'
25
25
  .container
26
26
  =yield
27
27
  %script
28
- head.js(
28
+ yepnope({
29
+ load:[
29
30
  "/js/underscore.min.js", "/js/backbone.min.js",
30
31
  "/js/bootstrap-alert.js", "/js/bootstrap-dropdown.js",
31
32
  "/js/bootstrap-modal.js","/js/bootstrap-tooltip.js"
32
33
  //"/js/bootstrap-button.js","/js/bootstrap-collapse.js","/js/bootstrap-carousel.js",
33
34
  //"/js/bootstrap-popover.js","/js/bootstrap-scrollspy.js","/js/bootstrap-tab.js",
34
- //"/js/bootstrap-transition.js","/js/bootstrap-typeahead.js"
35
- )
35
+ //"/js/bootstrap-transition.js","/js/bootstrap-typeahead.js"]
36
+ })
36
37
 
@@ -1,3 +1,4 @@
1
+ require "sinatra/base"
1
2
  APP_ROOT = File.expand_path(File.dirname(__FILE__))
2
3
  $: << "#{APP_ROOT}/app/"
3
4
 
@@ -1,3 +1,3 @@
1
1
  module Myway
2
- VERSION = "0.1.6"
2
+ VERSION = "0.2.0"
3
3
  end
@@ -0,0 +1,20 @@
1
+ # This file was generated by the `rspec --init` command. Conventionally, all
2
+ # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
3
+ # Require this file using `require "spec_helper"` to ensure that it is only
4
+ # loaded once.
5
+ #
6
+ # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
7
+ require "rspec"
8
+ require "../lib/myway"
9
+
10
+ RSpec.configure do |config|
11
+ config.treat_symbols_as_metadata_keys_with_true_values = true
12
+ config.run_all_when_everything_filtered = true
13
+ config.filter_run :focus
14
+
15
+ # Run specs in random order to surface order dependencies. If you find an
16
+ # order dependency and want to debug it, you can fix the order by providing
17
+ # the seed, which is printed after each run.
18
+ # --seed 1234
19
+ config.order = 'random'
20
+ end
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.6
4
+ version: 0.2.0
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-10-19 00:00:00.000000000 Z
12
+ date: 2012-11-20 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: thor
@@ -53,6 +53,7 @@ extensions: []
53
53
  extra_rdoc_files: []
54
54
  files:
55
55
  - .gitignore
56
+ - .rspec
56
57
  - Gemfile
57
58
  - LICENSE
58
59
  - README.md
@@ -64,6 +65,10 @@ files:
64
65
  - lib/myway/templates/app/views/includes/navbar.haml.tt
65
66
  - lib/myway/templates/app/views/index.haml.tt
66
67
  - lib/myway/templates/app/views/layout.haml.tt
68
+ - lib/myway/templates/backbone/collection.js.tt
69
+ - lib/myway/templates/backbone/model.js.tt
70
+ - lib/myway/templates/backbone/route.js.tt
71
+ - lib/myway/templates/backbone/view.js.tt
67
72
  - lib/myway/templates/config.ru.tt
68
73
  - lib/myway/templates/config/deploy.rb.tt
69
74
  - lib/myway/templates/config/unicorn.tt
@@ -79,6 +84,7 @@ files:
79
84
  - lib/myway/templates/spec/spec_helper.rb.tt
80
85
  - lib/myway/version.rb
81
86
  - myway.gemspec
87
+ - spec/spec_helper.rb
82
88
  homepage: http://github.com/mftaher/myway
83
89
  licenses: []
84
90
  post_install_message:
@@ -103,5 +109,6 @@ rubygems_version: 1.8.23
103
109
  signing_key:
104
110
  specification_version: 3
105
111
  summary: Scaffolding application for Sinatra web applications
106
- test_files: []
112
+ test_files:
113
+ - spec/spec_helper.rb
107
114
  has_rdoc: