rails-maker 0.1.1 → 0.1.7

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: 1f17f2ca99a5193c6d19db65c73087559df95154
4
+ data.tar.gz: 4c86713d6c2a43900aee81a5b168eca7dfd1039b
5
+ !binary "U0hBNTEy":
6
+ metadata.gz: ea21b8a0fa59c64c514f613a83b3a3de931f4c86f0316f702f6e24958ad12750a22846c387a1faeaa092ada63f1a7aad39459ae422f41c3d440d1c264a966774
7
+ data.tar.gz: 08d9790b892def204769c7b8775493ca0254da2dd3ab9dd2d174426018c6ce5562a480b63bcc7e75fb9b49eb890170aab6205ecc472b2f3f4fdbe47fc631dab8
@@ -27,7 +27,8 @@ module RailsMaker
27
27
  rails new #{project} \
28
28
  --template=#{RailsMaker::GEM_ROOT}/templates/#{template_name}/bootstrap.rb \
29
29
  --skip-test-unit \
30
- --skip-prototype
30
+ --skip-prototype \
31
+ --skip-bundle
31
32
  COMMAND
32
33
 
33
34
  end
@@ -1,3 +1,3 @@
1
1
  module RailsMaker
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.7"
3
3
  end
@@ -1,76 +1,50 @@
1
- require "net/http"
2
- require "net/https"
3
- require "uri"
4
- require 'rbconfig'
5
1
 
6
- say "Building Application with the rails-maker..."
7
-
8
- def get_remote_https_file(source, destination)
9
- uri = URI.parse(source)
10
- http = Net::HTTP.new(uri.host, uri.port)
11
- http.use_ssl = true
12
- http.verify_mode = OpenSSL::SSL::VERIFY_NONE
13
- request = Net::HTTP::Get.new(uri.request_uri)
14
- response = http.request(request)
15
- path = File.join(destination_root, destination)
16
- File.open(path, "w") { |file| file.write(response.body) }
17
- end
18
-
19
- git :init
20
-
21
- run 'rm .gitignore'
22
- create_file '.gitignore' do
23
- <<-FILE
24
- .bundle
25
- .DS_Store
26
- log/*.log
27
- tmp/**/*
28
- config/database.yml
29
- db/*.sqlite3
30
- public/system/**/**/**/*
31
- .idea/*
32
- .sass-cache/**/*
33
- *.swp
34
- public/uploads
35
- FILE
36
- end
37
-
38
- files = %w{
39
- gemfile
40
- haml_generator
41
- rails_clean
42
- application_layout
43
- home_controller
44
- css
45
- test_suite
46
- authentication
47
- authorization
48
- admin
49
- db
50
- db_seed
51
- }
2
+ #require "net/http"
3
+ #require "net/https"
4
+ #require "uri"
5
+ #require 'rbconfig'
6
+
7
+ say 'Building Application with the rails-maker...'
8
+
9
+ files = []
10
+ files << 'general'
11
+ files << 'git'
12
+ files << 'gemfile'
13
+ files << 'db'
14
+ files << 'application_layout'
15
+ #files << 'home_controller'
16
+ files << 'css'
17
+ #files << 'test_suite'
18
+ #files << 'authentication'
19
+ #files << 'authorization'
20
+ #files << 'admin'
21
+ files << 'routes'
22
+ files << 'initializers'
52
23
 
53
24
  files.each do |file|
54
25
  apply File.expand_path("../lib/#{file}.rb", __FILE__)
55
26
  end
56
27
 
57
- login_msg = (ENV['RAILSMAKER_ADMIN']) ? "Login to admin with email #{ENV['RAILSMAKER_USER_EMAIL']} and password #{ENV['RAILSMAKER_USER_PASSWORD']}" : ""
58
-
28
+ ## INITIAL COMMIT
29
+ git add: "."
30
+ git commit: "-a -m 'Initial commit'"
31
+
32
+ ## FURTHER INSTRUCTIONS
59
33
  say <<-D
60
34
 
61
-
62
35
  ########################################################################
63
36
 
64
37
  The rails-maker just added like 6 hours to your life.
65
38
 
66
- Template Installed :: Default
67
-
68
- Next run...
69
-
70
- rake spec
71
- rails s
39
+ Next:
40
+ 1 - copy content of config/example-databse.yml to config/database.yml
41
+ 2 - write your username and password for database access, write your database names or leave default for all environments in database.yml
42
+ 3 - run 'rake db:create'
43
+ 4 - write your secret, public keys and appid in initializers/raven.rb
44
+ 5 - generate and copy newrelic.yml file to config directory
45
+ 6 - run 'rails s' from your project directory
72
46
 
73
- #{login_msg}
47
+ Login to admin with email admin@local.host and password admin123
74
48
 
75
49
  ########################################################################
76
50
  D
@@ -1,21 +1,22 @@
1
- say "Building admin"
1
+ say '## ADMIN >>'
2
+
2
3
  generate(:controller, "admin/dashboard index")
3
- route("match 'admin' => 'admin/dashboard#index'")
4
4
 
5
5
  # Do layout and SASS stuff
6
- apply File.expand_path("../admin/sass.rb", __FILE__)
6
+ #apply File.expand_path("../admin/sass.rb", __FILE__)
7
7
  apply File.expand_path("../admin/layout.rb", __FILE__)
8
8
 
9
9
  create_file 'app/controllers/admin/base_controller.rb' do
10
10
  <<-RUBY
11
11
  class Admin::BaseController < ApplicationController
12
+
12
13
  layout 'admin'
13
- before_filter :authenticate_user!
14
14
  before_filter :verify_admin
15
15
 
16
16
  private
17
+
17
18
  def verify_admin
18
- redirect_to root_url unless current_user.role? :admin
19
+ redirect_to root_url unless current_user.has_role? :admin
19
20
  end
20
21
  end
21
22
  RUBY
@@ -23,7 +24,6 @@ end
23
24
 
24
25
  gsub_file 'app/controllers/admin/dashboard_controller.rb', /ApplicationController/, 'Admin::BaseController'
25
26
 
26
- # make a user admin
27
- apply File.expand_path("../admin/users.rb", __FILE__)
28
- apply File.expand_path("../admin/dashboard_spec.rb", __FILE__)
29
- apply File.expand_path("../admin/users_spec.rb", __FILE__)
27
+ #apply File.expand_path("../admin/users.rb", __FILE__)
28
+ #apply File.expand_path("../admin/dashboard_spec.rb", __FILE__)
29
+ #apply File.expand_path("../admin/users_spec.rb", __FILE__)
@@ -1,79 +1,66 @@
1
- remove_file 'app/views/admin/dashboard/index.html.haml'
2
- create_file 'app/views/admin/dashboard/index.html.haml' do
3
- <<-FILE
4
- %h1 #{app_name.humanize} Admin
5
- FILE
6
- end
7
-
8
1
  run 'mkdir app/views/admin/shared'
9
2
 
10
3
  create_file 'app/views/admin/shared/_header.html.haml' do
11
- <<-FILE
12
- %header#main_admin_header
13
- %h1= link_to '#{app_name.humanize}', root_path
14
- = render 'admin/shared/messages'
15
- %nav#main_admin_nav
16
- %ul
17
- %li= link_to 'Home', root_path
18
- %ul#user_admin_nav
19
- = render 'devise/menu/login_items'
20
- FILE
4
+ <<-HAML
5
+
6
+ .navbar.navbar-fixed-top
7
+ .navbar-inner
8
+ .container
9
+ %a.btn.btn-navbar{ "data-target" => ".nav-collapse", "data-toggle" => "collapse" }
10
+ %span.icon-bar
11
+ %span.icon-bar
12
+ %span.icon-bar
13
+ %a.brand{ href: root_path } #{app_name.humanize}
14
+ .nav-collapse
15
+ =render partial: 'shared/top_navigation'
16
+ HAML
21
17
  end
22
18
 
23
- create_file 'app/views/admin/shared/_messages.html.haml' do
24
- <<-FILE
25
- - if flash[:notice]
26
- %div#messenger{:class => "flasher"}= flash[:notice]
27
- - if flash[:error]
28
- %div#error{:class => "flasher"}= flash[:error]
29
- - if flash[:alert]
30
- %div#alert{:class => "flasher"}= flash[:alert]
31
- FILE
19
+ create_file 'app/views/admin/shared/_flash_messages.html.haml' do
20
+ <<-HAML
21
+ - flash.each do |key, value|
22
+ .alert{ class: "alert-" + key.to_s }
23
+ %button{ type: "button", class: "close", "data-dismiss" => "alert"}
24
+ &times;
25
+ = value
26
+ HAML
32
27
  end
33
28
 
34
29
  create_file 'app/views/admin/shared/_footer.html.haml' do
35
- <<-FILE
36
- %footer#main_admin_footer
37
- FILE
30
+ <<-HAML
31
+ HAML
38
32
  end
39
33
 
40
- create_file 'app/views/admin/shared/_end_scripts.html.haml' do
41
- <<-FILE
42
- = include_javascripts :common
43
- FILE
34
+ create_file 'app/views/admin/shared/_navigation_menu.html.haml' do
35
+ <<-HAML
36
+ %ul.nav
37
+ = nav_link "Dashboard", admin_root_path
38
+ HAML
44
39
  end
45
40
 
41
+ run 'rm app/views/layouts/admin.html.erb'
46
42
  create_file 'app/views/layouts/admin.html.haml' do
47
- <<-FILE
43
+ <<-HAML
48
44
  !!! 5
49
- -# paulirish.com/2008/conditional-stylesheets-vs-css-hacks-answer-neither/
50
- <!--[if lt IE 7 ]> <html lang="en" class="no-js ie6"> <![endif]-->
51
- <!--[if IE 7 ]> <html lang="en" class="no-js ie7"> <![endif]-->
52
- <!--[if IE 8 ]> <html lang="en" class="no-js ie8"> <![endif]-->
53
- <!--[if IE 9 ]> <html lang="en" class="no-js ie9"> <![endif]-->
54
- <!--[if (gte IE 9)|!(IE)]><!-->
55
- %html.no-js{ :lang => "en" }
56
- <!--<![endif]-->
45
+ %html{ lang: I18n.locale }
57
46
  %head
58
- %meta{'http-equiv' => 'Content-Type', :content => 'text/html; charset=utf-8'}
59
- %meta{'http-equiv' => 'X-UA-Compatible', :content => 'IE=edge,chrome=1'}
60
- %title<
61
- #{app_name.humanize}
62
- = yield(:title)
63
- %meta{:name => 'viewport', :content => 'width=device-width initial-scale=1.0 maximum-scale=1.0'}
64
- %meta{:name => 'apple-mobile-web-app-capable', :content => 'yes'}
47
+ %meta{ charset: 'utf-8'}
48
+ %title #{app_name.humanize} - AdminPanel
49
+ %link{ rel: "shortcut icon", href: "/favicon.ico" }
65
50
  = csrf_meta_tag
66
- %link{:rel => "shortcut icon", :href => "/favicon.ico", :type => "image/x-icon"}
67
- /[if lt IE 9]
68
- %script{:type => "text/javascript", :src => "/javascripts/shiv.js"}
69
- = include_stylesheets :admin, :media => 'all'
70
- = yield(:head)
71
- %body
72
- #container
73
- = render :partial => "admin/shared/header"
74
- %section#content
75
- = yield
76
- = render :partial => "admin/shared/footer"
77
- = render :partial => "admin/shared/end_scripts"
78
- FILE
51
+ = stylesheet_link_tag "admin"
52
+
53
+ %body{ "data-locale" => I18n.locale }
54
+
55
+ =render partial: 'admin/shared/header'
56
+
57
+ .container
58
+ =render partial: 'admin/shared/flash_messages'
59
+
60
+ = yield
61
+
62
+ = javascript_include_tag "admin"
63
+
64
+ //= debug params if Rails.env.development?
65
+ HAML
79
66
  end
@@ -1,38 +1,48 @@
1
+ say '## APPLICATION LAYOUT >>'
2
+
1
3
  run 'mkdir app/views/shared'
2
4
 
3
5
  create_file 'app/views/shared/_header.html.haml' do
6
+ <<-HAML
7
+
8
+ .navbar.navbar-fixed-top
9
+ .navbar-inner
10
+ .container
11
+ %a.btn.btn-navbar{ "data-target" => ".nav-collapse", "data-toggle" => "collapse" }
12
+ %span.icon-bar
13
+ %span.icon-bar
14
+ %span.icon-bar
15
+ %a#logo.brand{ href: root_path } #{app_name.humanize}
16
+ .nav-collapse
17
+ =render partial: 'shared/navigation_menu'
18
+ HAML
19
+ end
20
+
21
+ create_file 'app/views/shared/_flash_messages.html.haml' do
4
22
  <<-FILE
5
- %header#main_header
6
- %h1= link_to '#{app_name.humanize}', root_path
7
- = render 'shared/messages'
8
- %nav#main_nav
9
- %ul
10
- %li= link_to 'Home', root_path
23
+ - flash.each do |key, value|
24
+ .alert{ class: "alert-" + key.to_s }
25
+ %button{ type: "button", class: "close", "data-dismiss" => "alert"}
26
+ &times;
27
+ = value
11
28
  FILE
12
29
  end
13
30
 
14
- create_file 'app/views/shared/_messages.html.haml' do
31
+ create_file 'app/views/shared/_footer.html.haml' do
15
32
  <<-FILE
16
- - if flash[:notice]
17
- %div#messenger{:class => "flasher"}= flash[:notice]
18
- - if flash[:error]
19
- %div#error{:class => "flasher"}= flash[:error]
20
- - if flash[:alert]
21
- %div#alert{:class => "flasher"}= flash[:alert]
33
+
22
34
  FILE
23
35
  end
24
36
 
25
- create_file 'app/views/shared/_footer.html.haml' do
37
+ create_file 'app/views/shared/_navigation_menu.html.haml' do
26
38
  <<-FILE
27
- %footer#main_footer
39
+ %ul.nav
40
+ = nav_link "Home", root_path
28
41
  FILE
29
42
  end
30
43
 
31
44
  create_file 'app/views/shared/_end_scripts.html.haml' do
32
45
  <<-FILE
33
- = include_javascripts :common
34
- = yield(:end_scripts)
35
- - if Rails.env == 'production'
36
46
  :javascript
37
47
  var _gaq = [['_setAccount', 'UA-XXXXX-X'], ['_trackPageview']];
38
48
  (function(d, t) {
@@ -47,72 +57,45 @@ end
47
57
 
48
58
  run 'rm app/views/layouts/application.html.erb'
49
59
  create_file 'app/views/layouts/application.html.haml' do
50
- <<-FILE
60
+ <<-HAML
51
61
  !!! 5
52
- -# paulirish.com/2008/conditional-stylesheets-vs-css-hacks-answer-neither/
53
- <!--[if lt IE 7 ]> <html lang="en" class="no-js ie6"> <![endif]-->
54
- <!--[if IE 7 ]> <html lang="en" class="no-js ie7"> <![endif]-->
55
- <!--[if IE 8 ]> <html lang="en" class="no-js ie8"> <![endif]-->
56
- <!--[if IE 9 ]> <html lang="en" class="no-js ie9"> <![endif]-->
57
- <!--[if (gte IE 9)|!(IE)]><!-->
58
- %html.no-js{ :lang => "en" }
59
- <!--<![endif]-->
62
+ %html{ lang: I18n.locale }
60
63
  %head
61
- %meta{'http-equiv' => 'Content-Type', :content => 'text/html; charset=utf-8'}
62
- %meta{'http-equiv' => 'X-UA-Compatible', :content => 'IE=edge,chrome=1'}
63
- %title<
64
- #{app_name.humanize}
65
- = yield(:title)
66
- %meta{:name => 'description', :content => ''}
67
- %meta{:name => 'author', :content => ''}
68
- %meta{:name => 'viewport', :content => 'width=device-width initial-scale=1.0 maximum-scale=1.0'}
69
- %meta{:name => 'apple-mobile-web-app-capable', :content => 'yes'}
64
+ %meta{ charset: 'utf-8'}
65
+ %title #{app_name.humanize}
66
+ %link{ rel: "shortcut icon", href: "/favicon.ico" }
70
67
  = csrf_meta_tag
71
- %link{:rel => "shortcut icon", :href => "/favicon.ico", :type => "image/x-icon"}
72
- %link{:rel => "apple-touch-icon", :href => "/images/ati.png"}
73
- /[if lt IE 9]
74
- %script{:type => "text/javascript", :src => "/javascripts/shiv.js"}
75
- = include_stylesheets :main, :media => 'all'
76
- = yield(:head)
77
- %body
78
- #container
79
- = render :partial => "shared/header"
80
- %section#content
81
- = yield
82
- = render :partial => "shared/footer"
83
- = render :partial => "shared/end_scripts"
84
- FILE
68
+ = stylesheet_link_tag "application"
69
+
70
+ %body{ "data-locale" => I18n.locale }
71
+
72
+ =render partial: 'shared/header'
73
+
74
+ .container
75
+ =render partial: 'shared/flash_messages'
76
+
77
+ = yield
78
+
79
+ = javascript_include_tag "application"
80
+ = render partial: 'shared/analytics' if Rails.env.production?
81
+
82
+ //= debug params if Rails.env.development?
83
+ HAML
85
84
  end
86
85
 
87
- create_file 'public/maintenance.html' do
88
- <<-FILE
89
- <!DOCTYPE html>
90
- <!--[if lt IE 7 ]> <html lang="en" class="no-js ie6"> <![endif]-->
91
- <!--[if IE 7 ]> <html lang="en" class="no-js ie7"> <![endif]-->
92
- <!--[if IE 8 ]> <html lang="en" class="no-js ie8"> <![endif]-->
93
- <!--[if IE 9 ]> <html lang="en" class="no-js ie9"> <![endif]-->
94
- <!--[if (gte IE 9)|!(IE)]><!-->
95
- <html class='no-js' lang='en'>
96
- <!--<![endif]-->
97
- <head>
98
- <meta content='text/html; charset=utf-8' http-equiv='Content-Type'>
99
- <meta content='IE=edge,chrome=1' http-equiv='X-UA-Compatible'>
100
- <title>#{app_name.humanize} is down for maintenance</title>
101
- <meta content='width=device-width initial-scale=1.0 maximum-scale=1.0' name='viewport'>
102
- <link href='/favicon.ico' rel='shortcut icon' type='image/x-icon'>
103
- <!--[if lt IE 9]>
104
- <script src='/javascripts/shiv.js' type='text/javascript'></script>
105
- <![endif]-->
106
- <link href="/stylesheets/reset.css" media="all" rel="stylesheet" type="text/css" />
107
- <link href="/stylesheets/main.css" media="all" rel="stylesheet" type="text/css" />
108
- </head>
109
- <body>
110
- <div id='container'>
111
- <section id='content'>
112
- <h1>#{app_name.humanize} is down for maintenance</h1>
113
- </section>
114
- </div>
115
- </body>
116
- </html>
117
- FILE
86
+ run 'rm app/helpers/application_helper.rb'
87
+ create_file 'app/helpers/application_helper.rb' do
88
+ <<-RUBY
89
+ module ApplicationHelper
90
+
91
+ def nav_link(link_text, link_path)
92
+ class_name = current_page?(link_path) ? 'current' : ''
93
+
94
+ content_tag(:li, :class => class_name) do
95
+ link_to link_text, link_path
96
+ end
97
+ end
98
+
118
99
  end
100
+ RUBY
101
+ end