drezyna 0.1.0
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 +9 -0
- data/.travis.yml +4 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +21 -0
- data/README.md +22 -0
- data/Rakefile +1 -0
- data/bin/drezyna +15 -0
- data/drezyna.gemspec +23 -0
- data/lib/drezyna.rb +7 -0
- data/lib/drezyna/action_helpers.rb +19 -0
- data/lib/drezyna/app_builder.rb +103 -0
- data/lib/drezyna/generators/app_generator.rb +60 -0
- data/lib/drezyna/version.rb +3 -0
- data/templates/Gemfile.erb +51 -0
- data/templates/Procfile.erb +1 -0
- data/templates/README.md.erb +3 -0
- data/templates/_messages.html.erb +0 -0
- data/templates/_navigation.html.erb +43 -0
- data/templates/_navigation.scss +333 -0
- data/templates/application.scss +4 -0
- data/templates/application_controller.rb +15 -0
- data/templates/database.yml.erb +11 -0
- data/templates/gitignore.erb +13 -0
- data/templates/layout.html.erb +15 -0
- data/templates/pryrc.rb +51 -0
- data/templates/registrations_controller.rb +2 -0
- data/templates/routes.rb.erb +19 -0
- data/templates/users_controller.rb +46 -0
- metadata +102 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 2ff7284de6f044ba97f47d0ff4fec08c2faa50d7
|
4
|
+
data.tar.gz: 69acf341e0b94ebfa1d16e71147989ec3158fad1
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 7eb5b830fd071306adc84dab33508da6022883da993b434a33ff3e9a32823dd975c9ae88968fa026867aee4626c1ca8f414e14b05e7ed078c0c03cfb9842df1a
|
7
|
+
data.tar.gz: d8c2ac3e2ecdafef9877fbd82f8955c719265d38c6495d3688bcbe46bd01ec8f6f189e128a7aa0f945bb404b128d23375060858d9d3ca76abc8973365042477f
|
data/.gitignore
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2015 Zaiste
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all 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,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
# Drezyna
|
2
|
+
|
3
|
+
Drezyna is a simple Rails application template used at Nukomeet.
|
4
|
+
|
5
|
+

|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Install it as:
|
10
|
+
|
11
|
+
$ gem install drezyna
|
12
|
+
|
13
|
+
## Usage
|
14
|
+
|
15
|
+
drezyna <your name>
|
16
|
+
|
17
|
+
## Gems
|
18
|
+
|
19
|
+
## License
|
20
|
+
|
21
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
22
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
data/bin/drezyna
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'pathname'
|
4
|
+
|
5
|
+
source_path = (Pathname.new(__FILE__).dirname + '../lib').expand_path
|
6
|
+
$LOAD_PATH << source_path
|
7
|
+
|
8
|
+
require 'drezyna'
|
9
|
+
|
10
|
+
templates_root = File.expand_path(File.join('..', 'templates'), File.dirname(__FILE__))
|
11
|
+
|
12
|
+
Drezyna::AppGenerator.source_root templates_root
|
13
|
+
Drezyna::AppGenerator.source_paths << Rails::Generators::AppGenerator.source_root << templates_root
|
14
|
+
|
15
|
+
Drezyna::AppGenerator.start
|
data/drezyna.gemspec
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'drezyna/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "drezyna"
|
8
|
+
spec.version = Drezyna::VERSION
|
9
|
+
spec.authors = ["Zaiste"]
|
10
|
+
spec.email = ["oh@zaiste.net"]
|
11
|
+
|
12
|
+
spec.summary = %q{Rails application template by Nukomeet}
|
13
|
+
spec.description = %q{Rails application template by Nukomeet}
|
14
|
+
spec.homepage = "http://github.com/nukomeet/drezyna"
|
15
|
+
spec.license = "MIT"
|
16
|
+
|
17
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
18
|
+
spec.executables = ["drezyna"]
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_development_dependency "bundler", "~> 1.10"
|
22
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
23
|
+
end
|
data/lib/drezyna.rb
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
module Drezyna
|
2
|
+
module ActionHelpers
|
3
|
+
|
4
|
+
def configure_environment(rails_env, config)
|
5
|
+
inject_into_file("config/environments/#{rails_env}.rb",
|
6
|
+
"\n\n #{config}", before: "\nend")
|
7
|
+
end
|
8
|
+
|
9
|
+
def replace_in_file(relative_path, find, replace)
|
10
|
+
path = File.join(destination_root, relative_path)
|
11
|
+
contents = IO.read(path)
|
12
|
+
unless contents.gsub!(find, replace)
|
13
|
+
raise "#{find.inspect} not found in #{relative_path}"
|
14
|
+
end
|
15
|
+
File.open(path, "w") { |file| file.write(contents) }
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,103 @@
|
|
1
|
+
module Drezyna
|
2
|
+
class AppBuilder < Rails::AppBuilder
|
3
|
+
|
4
|
+
include Drezyna::ActionHelpers
|
5
|
+
|
6
|
+
def readme
|
7
|
+
template 'README.md.erb', 'README.md'
|
8
|
+
end
|
9
|
+
|
10
|
+
def gitignore
|
11
|
+
template 'gitignore.erb', '.gitignore'
|
12
|
+
end
|
13
|
+
|
14
|
+
def gemfile
|
15
|
+
template 'Gemfile.erb', 'Gemfile'
|
16
|
+
end
|
17
|
+
|
18
|
+
def use_postgres_config_template
|
19
|
+
template 'database.yml.erb', 'config/database.yml', force: true
|
20
|
+
template 'database.yml.erb', 'config/database.yml.example'
|
21
|
+
end
|
22
|
+
|
23
|
+
def create_partials_directory
|
24
|
+
empty_directory 'app/views/shared'
|
25
|
+
end
|
26
|
+
|
27
|
+
def setup_stylesheets
|
28
|
+
remove_file 'app/assets/stylesheets/application.css'
|
29
|
+
copy_file 'application.scss', 'app/assets/stylesheets/application.scss'
|
30
|
+
copy_file '_navigation.scss', 'app/assets/stylesheets/_navigation.scss'
|
31
|
+
end
|
32
|
+
|
33
|
+
def setup_javascripts
|
34
|
+
end
|
35
|
+
|
36
|
+
def setup_application
|
37
|
+
remove_file 'app/controllers/application_controller.rb'
|
38
|
+
copy_file 'application_controller.rb', 'app/controllers/application_controller.rb'
|
39
|
+
copy_file 'registrations_controller.rb', 'app/controllers/registrations_controller.rb'
|
40
|
+
copy_file 'users_controller.rb', 'app/controllers/users_controller.rb'
|
41
|
+
end
|
42
|
+
|
43
|
+
def create_application_layout
|
44
|
+
remove_file 'app/views/layouts/application.html.erb'
|
45
|
+
copy_file 'layout.html.erb', 'app/views/layouts/application.html.erb'
|
46
|
+
copy_file '_navigation.html.erb', 'app/views/shared/_navigation.html.erb'
|
47
|
+
copy_file '_messages.html.erb', 'app/views/shared/_messages.html.erb'
|
48
|
+
end
|
49
|
+
|
50
|
+
def create_pryrc
|
51
|
+
copy_file 'pryrc.rb', '.pryrc'
|
52
|
+
end
|
53
|
+
|
54
|
+
def create_database
|
55
|
+
bundle_command 'exec rake db:create'
|
56
|
+
end
|
57
|
+
|
58
|
+
def setup_routes
|
59
|
+
copy_file 'routes.rb.erb', 'config/routes.rb', force: true
|
60
|
+
end
|
61
|
+
|
62
|
+
def raise_on_unpermitted_parameters
|
63
|
+
configure_environment 'development',
|
64
|
+
'config.action_controller.action_on_unpermitted_parameters = :raise'
|
65
|
+
end
|
66
|
+
|
67
|
+
def configure_generators
|
68
|
+
config = <<-RUBY
|
69
|
+
config.generators do |generate|
|
70
|
+
generate.helper false
|
71
|
+
generate.javascript_engine false
|
72
|
+
generate.request_specs false
|
73
|
+
generate.routing_specs false
|
74
|
+
generate.stylesheets false
|
75
|
+
generate.test_framework :rspec
|
76
|
+
generate.view_specs false
|
77
|
+
end
|
78
|
+
RUBY
|
79
|
+
|
80
|
+
inject_into_class 'config/application.rb', 'Application', config
|
81
|
+
end
|
82
|
+
|
83
|
+
def configure_i18n_logger
|
84
|
+
configure_environment 'development',
|
85
|
+
"# I18n debug\n I18nLogger = ActiveSupport::" \
|
86
|
+
"Logger.new(Rails.root.join('log/i18n.log'))"
|
87
|
+
end
|
88
|
+
|
89
|
+
def setup_devise
|
90
|
+
generate 'devise:install'
|
91
|
+
generate 'controller', 'home index'
|
92
|
+
generate 'devise', options[:devise_model]
|
93
|
+
end
|
94
|
+
|
95
|
+
def setup_simple_form
|
96
|
+
generate 'simple_form:install'
|
97
|
+
end
|
98
|
+
|
99
|
+
def init_git
|
100
|
+
run 'git init'
|
101
|
+
end
|
102
|
+
end
|
103
|
+
end
|
@@ -0,0 +1,60 @@
|
|
1
|
+
require 'rails/generators'
|
2
|
+
require 'rails/generators/rails/app/app_generator'
|
3
|
+
|
4
|
+
module Drezyna
|
5
|
+
class AppGenerator < Rails::Generators::AppGenerator
|
6
|
+
class_option :database, type: :string, aliases: "-d", default: "postgresql",
|
7
|
+
desc: "Configure for selected database (options: #{DATABASES.join("/")})"
|
8
|
+
|
9
|
+
class_option :devise_model, type: :string, aliases: '-M', default: 'User',
|
10
|
+
desc: 'Name of devise model to generate'
|
11
|
+
|
12
|
+
class_option :skip_test_unit, type: :boolean, aliases: '-T', default: true,
|
13
|
+
desc: 'Skip Test::Unit files'
|
14
|
+
|
15
|
+
class_option :skip_bundle, type: :boolean, aliases: "-B", default: true,
|
16
|
+
desc: "Don't run bundle install"
|
17
|
+
|
18
|
+
def finish_template
|
19
|
+
invoke :custom
|
20
|
+
super
|
21
|
+
end
|
22
|
+
|
23
|
+
def custom
|
24
|
+
say 'Setting up database'
|
25
|
+
build :use_postgres_config_template
|
26
|
+
build :create_database
|
27
|
+
|
28
|
+
say 'Setting up the development environment'
|
29
|
+
build :configure_generators
|
30
|
+
build :raise_on_unpermitted_parameters
|
31
|
+
build :configure_i18n_logger
|
32
|
+
|
33
|
+
build :create_partials_directory
|
34
|
+
build :create_application_layout
|
35
|
+
build :create_pryrc
|
36
|
+
|
37
|
+
build :setup_application
|
38
|
+
|
39
|
+
build :setup_stylesheets
|
40
|
+
|
41
|
+
say 'Setting up devise'
|
42
|
+
build :setup_devise
|
43
|
+
|
44
|
+
say 'Setting up SimpleForm'
|
45
|
+
build :setup_simple_form
|
46
|
+
|
47
|
+
build :setup_routes
|
48
|
+
|
49
|
+
say 'Initializing git'
|
50
|
+
build :setup_gitignore
|
51
|
+
build :init_git
|
52
|
+
end
|
53
|
+
|
54
|
+
protected
|
55
|
+
|
56
|
+
def get_builder_class
|
57
|
+
Drezyna::AppBuilder
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
source 'https://rubygems.org'
|
2
|
+
|
3
|
+
gem 'rails', '4.2.4'
|
4
|
+
gem 'pg'
|
5
|
+
|
6
|
+
gem 'sass-rails', '~> 5.0'
|
7
|
+
gem 'uglifier', '>= 1.3.0'
|
8
|
+
gem 'jquery-rails'
|
9
|
+
gem 'turbolinks'
|
10
|
+
gem 'jbuilder', '~> 2.0'
|
11
|
+
gem 'sdoc', '~> 0.4.0', group: :doc
|
12
|
+
|
13
|
+
gem 'devise'
|
14
|
+
gem 'pundit'
|
15
|
+
gem 'simple_form'
|
16
|
+
gem 'flutie'
|
17
|
+
|
18
|
+
gem 'bourbon'
|
19
|
+
gem 'neat'
|
20
|
+
|
21
|
+
|
22
|
+
group :development do
|
23
|
+
gem 'thin'
|
24
|
+
gem 'foreman'
|
25
|
+
gem 'pry-rails'
|
26
|
+
|
27
|
+
gem 'better_errors'
|
28
|
+
gem 'binding_of_caller'
|
29
|
+
gem 'quiet_assets'
|
30
|
+
|
31
|
+
gem 'brakeman', require: false
|
32
|
+
gem 'rubocop', require: false
|
33
|
+
|
34
|
+
gem 'awesome_print'
|
35
|
+
gem 'i18n-debug'
|
36
|
+
|
37
|
+
gem 'spring'
|
38
|
+
gem 'spring-commands-rspec'
|
39
|
+
end
|
40
|
+
|
41
|
+
group :development, :test do
|
42
|
+
gem 'web-console', '~> 2.0'
|
43
|
+
gem 'spring'
|
44
|
+
|
45
|
+
gem 'pry-byebug'
|
46
|
+
gem 'pry-doc'
|
47
|
+
end
|
48
|
+
|
49
|
+
group :production do
|
50
|
+
gem 'newrelic_rpm'
|
51
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
web: bundle exec rails server -p $PORT
|
File without changes
|
@@ -0,0 +1,43 @@
|
|
1
|
+
<header class="navigation" role="banner">
|
2
|
+
<div class="navigation-wrapper">
|
3
|
+
<a href="javascript:void(0)" class="logo">
|
4
|
+
<img src="https://raw.githubusercontent.com/thoughtbot/refills/master/source/images/placeholder_logo_1.png" alt="Logo Image">
|
5
|
+
</a>
|
6
|
+
<a href="javascript:void(0)" class="navigation-menu-button" id="js-mobile-menu">MENU</a>
|
7
|
+
<nav role="navigation">
|
8
|
+
<ul id="js-navigation-menu" class="navigation-menu show">
|
9
|
+
<li class="nav-link"><a href="javascript:void(0)">Products</a></li>
|
10
|
+
<li class="nav-link"><a href="javascript:void(0)">About Us</a></li>
|
11
|
+
<li class="nav-link"><a href="javascript:void(0)">Contact</a></li>
|
12
|
+
<li class="nav-link more"><a href="javascript:void(0)">More</a>
|
13
|
+
<ul class="submenu">
|
14
|
+
<li><a href="javascript:void(0)">Submenu Item</a></li>
|
15
|
+
<li><a href="javascript:void(0)">Another Item</a></li>
|
16
|
+
<li class="more"><a href="javascript:void(0)">Item with submenu</a>
|
17
|
+
<ul class="submenu">
|
18
|
+
<li><a href="javascript:void(0)">Sub-submenu Item</a></li>
|
19
|
+
<li><a href="javascript:void(0)">Another Item</a></li>
|
20
|
+
</ul>
|
21
|
+
</li>
|
22
|
+
<li class="more"><a href="javascript:void(0)">Another submenu</a>
|
23
|
+
<ul class="submenu">
|
24
|
+
<li><a href="javascript:void(0)">Sub-submenu</a></li>
|
25
|
+
<li><a href="javascript:void(0)">An Item</a></li>
|
26
|
+
</ul>
|
27
|
+
</li>
|
28
|
+
</ul>
|
29
|
+
</li>
|
30
|
+
</ul>
|
31
|
+
</nav>
|
32
|
+
<div class="navigation-tools">
|
33
|
+
<div class="search-bar">
|
34
|
+
<form role="search">
|
35
|
+
<input type="search" placeholder="Enter Search" />
|
36
|
+
<button type="submit">
|
37
|
+
<img src="https://raw.githubusercontent.com/thoughtbot/refills/master/source/images/search-icon.png" alt="Search Icon">
|
38
|
+
</button>
|
39
|
+
</form>
|
40
|
+
</div>
|
41
|
+
</div>
|
42
|
+
</div>
|
43
|
+
</header>
|
@@ -0,0 +1,333 @@
|
|
1
|
+
header.navigation {
|
2
|
+
$base-border-color: gainsboro !default;
|
3
|
+
$base-border-radius: 3px !default;
|
4
|
+
$action-color: #477DCA !default;
|
5
|
+
$dark-gray: #333 !default;
|
6
|
+
$large-screen: em(860) !default;
|
7
|
+
$navigation-padding: 1em;
|
8
|
+
$navigation-background: $dark-gray;
|
9
|
+
$navigation-color: transparentize(white, 0.3);
|
10
|
+
$navigation-color-hover: white;
|
11
|
+
$navigation-height: 60px;
|
12
|
+
$navigation-nav-button-background: $action-color;
|
13
|
+
$navigation-nav-button-background-hover: lighten($navigation-background, 10%);
|
14
|
+
$navigation-nav-button-border: 1px solid lighten($navigation-nav-button-background, 20%);
|
15
|
+
$navigation-search-background: lighten($navigation-background, 5);
|
16
|
+
$navigation-search-border: 1px solid darken($navigation-background, 5);
|
17
|
+
$navigation-active-link-color: transparentize(white, 0.5);
|
18
|
+
$navigation-submenu-padding: 1em;
|
19
|
+
$navigation-submenu-width: 12em;
|
20
|
+
$horizontal-bar-mode: $large-screen;
|
21
|
+
|
22
|
+
background-color: $navigation-background;
|
23
|
+
border-bottom: 1px solid darken($navigation-background, 10);
|
24
|
+
min-height: $navigation-height;
|
25
|
+
width: 100%;
|
26
|
+
z-index: 999;
|
27
|
+
|
28
|
+
.navigation-wrapper {
|
29
|
+
@include clearfix;
|
30
|
+
@include outer-container;
|
31
|
+
position: relative;
|
32
|
+
z-index: 9999;
|
33
|
+
}
|
34
|
+
|
35
|
+
.logo {
|
36
|
+
float: left;
|
37
|
+
max-height: $navigation-height;
|
38
|
+
padding-left: $navigation-padding;
|
39
|
+
padding-right: 2em;
|
40
|
+
|
41
|
+
img {
|
42
|
+
max-height: $navigation-height;
|
43
|
+
padding: 0.8em 0;
|
44
|
+
}
|
45
|
+
}
|
46
|
+
|
47
|
+
// Mobile view
|
48
|
+
|
49
|
+
.navigation-menu-button {
|
50
|
+
color: $navigation-color;
|
51
|
+
display: block;
|
52
|
+
float: right;
|
53
|
+
line-height: $navigation-height;
|
54
|
+
margin: 0;
|
55
|
+
padding-right: 1em;
|
56
|
+
text-decoration: none;
|
57
|
+
text-transform: uppercase;
|
58
|
+
|
59
|
+
@include media ($horizontal-bar-mode) {
|
60
|
+
display: none;
|
61
|
+
}
|
62
|
+
|
63
|
+
&:focus,
|
64
|
+
&:hover {
|
65
|
+
color: $navigation-color-hover;
|
66
|
+
}
|
67
|
+
}
|
68
|
+
|
69
|
+
// Nav menu
|
70
|
+
|
71
|
+
nav {
|
72
|
+
float: none;
|
73
|
+
min-height: $navigation-height;
|
74
|
+
z-index: 9999999;
|
75
|
+
|
76
|
+
@include media ($horizontal-bar-mode) {
|
77
|
+
float: left;
|
78
|
+
}
|
79
|
+
}
|
80
|
+
|
81
|
+
ul.navigation-menu {
|
82
|
+
clear: both;
|
83
|
+
display: none;
|
84
|
+
margin: 0 auto;
|
85
|
+
overflow: visible;
|
86
|
+
padding: 0;
|
87
|
+
width: 100%;
|
88
|
+
z-index: 9999;
|
89
|
+
|
90
|
+
&.show {
|
91
|
+
display: block;
|
92
|
+
}
|
93
|
+
|
94
|
+
@include media ($horizontal-bar-mode) {
|
95
|
+
display: inline;
|
96
|
+
margin: 0;
|
97
|
+
padding: 0;
|
98
|
+
}
|
99
|
+
}
|
100
|
+
|
101
|
+
// The nav items
|
102
|
+
|
103
|
+
ul li.nav-link {
|
104
|
+
background: $navigation-background;
|
105
|
+
display: block;
|
106
|
+
line-height: $navigation-height;
|
107
|
+
overflow: hidden;
|
108
|
+
padding-right: 0.8em;
|
109
|
+
text-align: right;
|
110
|
+
width: 100%;
|
111
|
+
z-index: 9999;
|
112
|
+
|
113
|
+
@include media ($horizontal-bar-mode) {
|
114
|
+
background: transparent;
|
115
|
+
display: inline;
|
116
|
+
line-height: $navigation-height;
|
117
|
+
text-decoration: none;
|
118
|
+
width: auto;
|
119
|
+
}
|
120
|
+
|
121
|
+
a {
|
122
|
+
color: $navigation-color;
|
123
|
+
display: inline-block;
|
124
|
+
text-decoration: none;
|
125
|
+
|
126
|
+
@include media ($horizontal-bar-mode) {
|
127
|
+
padding-right: 1em;
|
128
|
+
}
|
129
|
+
|
130
|
+
&:focus,
|
131
|
+
&:hover {
|
132
|
+
color: $navigation-color-hover;
|
133
|
+
}
|
134
|
+
}
|
135
|
+
}
|
136
|
+
|
137
|
+
.active-nav-item a {
|
138
|
+
border-bottom: 1px solid $navigation-active-link-color;
|
139
|
+
padding-bottom: 3px;
|
140
|
+
}
|
141
|
+
|
142
|
+
// Sub menus
|
143
|
+
|
144
|
+
li.more.nav-link {
|
145
|
+
padding-right: 0;
|
146
|
+
|
147
|
+
@include media($horizontal-bar-mode) {
|
148
|
+
padding-right: $navigation-submenu-padding;
|
149
|
+
}
|
150
|
+
|
151
|
+
> ul > li:first-child a {
|
152
|
+
padding-top: 1em;
|
153
|
+
}
|
154
|
+
|
155
|
+
a {
|
156
|
+
margin-right: $navigation-submenu-padding;
|
157
|
+
}
|
158
|
+
|
159
|
+
> a {
|
160
|
+
padding-right: 0.6em;
|
161
|
+
}
|
162
|
+
|
163
|
+
> a:after {
|
164
|
+
@include position(absolute, auto -0.4em auto auto);
|
165
|
+
content: '\25BE';
|
166
|
+
color: $navigation-color;
|
167
|
+
}
|
168
|
+
}
|
169
|
+
|
170
|
+
li.more {
|
171
|
+
overflow: visible;
|
172
|
+
padding-right: 0;
|
173
|
+
|
174
|
+
a {
|
175
|
+
padding-right: 0.8em;
|
176
|
+
}
|
177
|
+
|
178
|
+
> a {
|
179
|
+
padding-right: 1.6em;
|
180
|
+
position: relative;
|
181
|
+
|
182
|
+
@include media($horizontal-bar-mode) {
|
183
|
+
margin-right: $navigation-submenu-padding;
|
184
|
+
}
|
185
|
+
|
186
|
+
&:after {
|
187
|
+
content: '›';
|
188
|
+
font-size: 1.2em;
|
189
|
+
position: absolute;
|
190
|
+
right: $navigation-submenu-padding / 2;
|
191
|
+
}
|
192
|
+
}
|
193
|
+
|
194
|
+
&:focus > .submenu,
|
195
|
+
&:hover > .submenu {
|
196
|
+
display: block;
|
197
|
+
}
|
198
|
+
|
199
|
+
@include media($horizontal-bar-mode) {
|
200
|
+
padding-right: 0.8em;
|
201
|
+
position: relative;
|
202
|
+
}
|
203
|
+
}
|
204
|
+
|
205
|
+
ul.submenu {
|
206
|
+
display: none;
|
207
|
+
padding-left: 0;
|
208
|
+
|
209
|
+
@include media($horizontal-bar-mode) {
|
210
|
+
left: -$navigation-submenu-padding;
|
211
|
+
position: absolute;
|
212
|
+
top: 1.5em;
|
213
|
+
}
|
214
|
+
|
215
|
+
.submenu {
|
216
|
+
@include media($horizontal-bar-mode) {
|
217
|
+
left: $navigation-submenu-width - 0.2em;
|
218
|
+
top: 0;
|
219
|
+
}
|
220
|
+
}
|
221
|
+
|
222
|
+
li {
|
223
|
+
display: block;
|
224
|
+
padding-right: 0;
|
225
|
+
|
226
|
+
@include media($horizontal-bar-mode) {
|
227
|
+
line-height: $navigation-height / 1.3;
|
228
|
+
|
229
|
+
&:first-child > a {
|
230
|
+
border-top-left-radius: $base-border-radius;
|
231
|
+
border-top-right-radius: $base-border-radius;
|
232
|
+
}
|
233
|
+
|
234
|
+
&:last-child > a {
|
235
|
+
border-bottom-left-radius: $base-border-radius;
|
236
|
+
border-bottom-right-radius: $base-border-radius;
|
237
|
+
padding-bottom: 0.7em;
|
238
|
+
}
|
239
|
+
}
|
240
|
+
|
241
|
+
a {
|
242
|
+
background-color: darken($navigation-background, 3%);
|
243
|
+
display: inline-block;
|
244
|
+
text-align: right;
|
245
|
+
width: 100%;
|
246
|
+
|
247
|
+
@include media($horizontal-bar-mode) {
|
248
|
+
background-color: $navigation-background;
|
249
|
+
padding-left: $navigation-submenu-padding;
|
250
|
+
text-align: left;
|
251
|
+
width: $navigation-submenu-width;
|
252
|
+
}
|
253
|
+
}
|
254
|
+
}
|
255
|
+
}
|
256
|
+
|
257
|
+
// Elements on the far right
|
258
|
+
|
259
|
+
.navigation-tools {
|
260
|
+
background: #505050;
|
261
|
+
clear: both;
|
262
|
+
display: block;
|
263
|
+
height: $navigation-height;
|
264
|
+
|
265
|
+
@include media($horizontal-bar-mode) {
|
266
|
+
background: transparent;
|
267
|
+
clear: none;
|
268
|
+
float: right;
|
269
|
+
}
|
270
|
+
}
|
271
|
+
|
272
|
+
// Search bar
|
273
|
+
|
274
|
+
.search-bar {
|
275
|
+
$search-bar-border-color: $base-border-color;
|
276
|
+
$search-bar-border: 1px solid $search-bar-border-color;
|
277
|
+
$search-bar-background: lighten($search-bar-border-color, 10%);
|
278
|
+
|
279
|
+
float: left;
|
280
|
+
padding: 0.85em 0.85em 0.7em 0.6em;
|
281
|
+
width: 60%;
|
282
|
+
|
283
|
+
form {
|
284
|
+
position: relative;
|
285
|
+
|
286
|
+
input[type=search] {
|
287
|
+
@include box-sizing(border-box);
|
288
|
+
background: $navigation-search-background;
|
289
|
+
border-radius: $base-border-radius * 2;
|
290
|
+
border: $navigation-search-border;
|
291
|
+
color: $navigation-color;
|
292
|
+
font-size: 0.9em;
|
293
|
+
font-style: italic;
|
294
|
+
margin: 0;
|
295
|
+
padding: 0.5em 0.8em;
|
296
|
+
width: 100%;
|
297
|
+
|
298
|
+
@include media($horizontal-bar-mode) {
|
299
|
+
width: 100%;
|
300
|
+
}
|
301
|
+
}
|
302
|
+
|
303
|
+
button[type=submit] {
|
304
|
+
background: $navigation-search-background;
|
305
|
+
border: none;
|
306
|
+
bottom: 0.3em;
|
307
|
+
left: auto;
|
308
|
+
outline: none;
|
309
|
+
padding: 0 9px;
|
310
|
+
position: absolute;
|
311
|
+
right: 0.3em;
|
312
|
+
top: 0.3em;
|
313
|
+
|
314
|
+
img {
|
315
|
+
height: 12px;
|
316
|
+
opacity: 0.7;
|
317
|
+
padding: 1px;
|
318
|
+
}
|
319
|
+
}
|
320
|
+
}
|
321
|
+
|
322
|
+
@include media($horizontal-bar-mode) {
|
323
|
+
display: inline-block;
|
324
|
+
position: relative;
|
325
|
+
width: 16em;
|
326
|
+
|
327
|
+
input {
|
328
|
+
@include box-sizing(border-box);
|
329
|
+
display: block;
|
330
|
+
}
|
331
|
+
}
|
332
|
+
}
|
333
|
+
}
|
@@ -0,0 +1,15 @@
|
|
1
|
+
class ApplicationController < ActionController::Base
|
2
|
+
include Pundit
|
3
|
+
# Prevent CSRF attacks by raising an exception.
|
4
|
+
# For APIs, you may want to use :null_session instead.
|
5
|
+
protect_from_forgery with: :exception
|
6
|
+
|
7
|
+
rescue_from Pundit::NotAuthorizedError, with: :user_not_authorized
|
8
|
+
|
9
|
+
private
|
10
|
+
|
11
|
+
def user_not_authorized
|
12
|
+
flash[:alert] = "Access denied."
|
13
|
+
redirect_to (request.referrer || root_path)
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title></title>
|
5
|
+
<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %>
|
6
|
+
<%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
|
7
|
+
<%= csrf_meta_tags %>
|
8
|
+
</head>
|
9
|
+
<body class="<%= body_class %>">
|
10
|
+
<%= render 'shared/messages' %>
|
11
|
+
<%= render 'shared/navigation' %>
|
12
|
+
|
13
|
+
<%= yield %>
|
14
|
+
</body>
|
15
|
+
</html>
|
data/templates/pryrc.rb
ADDED
@@ -0,0 +1,51 @@
|
|
1
|
+
# Switch default editor for pry to Sublime text
|
2
|
+
Pry.config.editor = ENV['PRY_EDITOR'] || 'sublime'
|
3
|
+
|
4
|
+
# History
|
5
|
+
Pry.config.history.file = '.pry_history'
|
6
|
+
|
7
|
+
# Support for debugger - remove aliases
|
8
|
+
if defined? PryDebugger
|
9
|
+
Pry::Commands.delete 'c'
|
10
|
+
Pry::Commands.delete 'n'
|
11
|
+
Pry::Commands.delete 's'
|
12
|
+
end
|
13
|
+
|
14
|
+
# awesome_print gem
|
15
|
+
begin
|
16
|
+
require 'awesome_print'
|
17
|
+
Pry.config.print = proc { |output, value| Pry::Helpers::BaseHelpers.stagger_output("=> #{value.ai}", output) }
|
18
|
+
rescue LoadError
|
19
|
+
# no awesome_print present
|
20
|
+
end
|
21
|
+
|
22
|
+
# Prompt with app name
|
23
|
+
Pry.config.prompt_name = begin
|
24
|
+
current_branch = `git rev-parse --abbrev-ref HEAD`.chomp
|
25
|
+
current_branch = "#{current_branch[0..14]}.." if current_branch.length > 16
|
26
|
+
|
27
|
+
prompt_name = ENV['APP_NAME'] || File.basename(Rails.root)
|
28
|
+
prompt_name << "#{Rails.env.to_s.first}" unless Rails.env.development?
|
29
|
+
prompt_name << " (#{current_branch})"
|
30
|
+
prompt_name
|
31
|
+
end
|
32
|
+
|
33
|
+
Pry.config.prompt = [
|
34
|
+
# Default
|
35
|
+
-> (target_self, nest_level, pry) {
|
36
|
+
prompt = "[#{pry.input_array.size}]"
|
37
|
+
prompt << " #{Pry.config.prompt_name}:"
|
38
|
+
prompt << " #{Pry.view_clip(target_self)}"
|
39
|
+
prompt << "#{":#{nest_level}" unless nest_level.zero?}> "
|
40
|
+
prompt
|
41
|
+
},
|
42
|
+
|
43
|
+
# Nested under def, class etc.
|
44
|
+
->(target_self, nest_level, pry) {
|
45
|
+
default_prompt = Pry.config.prompt[0].call(target_self, nest_level, pry)
|
46
|
+
prompt = (' ' * default_prompt.length)[0...-(pry.input_array.size.to_s.length + 4)]
|
47
|
+
prompt << " #{pry.input_array.size} "
|
48
|
+
prompt << '> '
|
49
|
+
prompt
|
50
|
+
}
|
51
|
+
]
|
@@ -0,0 +1,19 @@
|
|
1
|
+
Rails.application.routes.draw do
|
2
|
+
devise_for :users,
|
3
|
+
path: "",
|
4
|
+
controllers: { registrations: "registrations" },
|
5
|
+
path_names: { sign_in: 'login', password: 'forgot', confirmation: 'confirm', unlock: 'unblock', sign_up: 'register', sign_out: 'signout'}
|
6
|
+
as :user do
|
7
|
+
end
|
8
|
+
|
9
|
+
authenticated :user do
|
10
|
+
root to: 'home#dashboard', as: :authenticated_root
|
11
|
+
end
|
12
|
+
unauthenticated :user do
|
13
|
+
root to: 'home#index', as: :unauthenticated_root
|
14
|
+
end
|
15
|
+
|
16
|
+
root to: 'home#index'
|
17
|
+
|
18
|
+
resources :users
|
19
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
class UsersController < ApplicationController
|
2
|
+
before_filter :authenticate_user!
|
3
|
+
after_action :verify_authorized, except: [:show]
|
4
|
+
|
5
|
+
def index
|
6
|
+
@users = User.all
|
7
|
+
authorize @users
|
8
|
+
end
|
9
|
+
|
10
|
+
def show
|
11
|
+
@user = User.find(params[:id])
|
12
|
+
unless current_user.admin?
|
13
|
+
unless @user == current_user
|
14
|
+
redirect_to root_path, :alert => "Access denied."
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
def update
|
20
|
+
@user = User.find(params[:id])
|
21
|
+
authorize @user
|
22
|
+
if @user.update_attributes(secure_params)
|
23
|
+
redirect_to users_path, :notice => "User updated."
|
24
|
+
else
|
25
|
+
redirect_to users_path, :alert => "Unable to update user."
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
def destroy
|
30
|
+
user = User.find(params[:id])
|
31
|
+
authorize user
|
32
|
+
unless user == current_user
|
33
|
+
user.destroy
|
34
|
+
redirect_to users_path, :notice => "User deleted."
|
35
|
+
else
|
36
|
+
redirect_to users_path, :notice => "Can't delete yourself."
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
private
|
41
|
+
|
42
|
+
def secure_params
|
43
|
+
params.require(:user).permit(:role)
|
44
|
+
end
|
45
|
+
|
46
|
+
end
|
metadata
ADDED
@@ -0,0 +1,102 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: drezyna
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Zaiste
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-10-07 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.10'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.10'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
description: Rails application template by Nukomeet
|
42
|
+
email:
|
43
|
+
- oh@zaiste.net
|
44
|
+
executables:
|
45
|
+
- drezyna
|
46
|
+
extensions: []
|
47
|
+
extra_rdoc_files: []
|
48
|
+
files:
|
49
|
+
- ".gitignore"
|
50
|
+
- ".travis.yml"
|
51
|
+
- Gemfile
|
52
|
+
- LICENSE.txt
|
53
|
+
- README.md
|
54
|
+
- Rakefile
|
55
|
+
- bin/drezyna
|
56
|
+
- drezyna.gemspec
|
57
|
+
- lib/drezyna.rb
|
58
|
+
- lib/drezyna/action_helpers.rb
|
59
|
+
- lib/drezyna/app_builder.rb
|
60
|
+
- lib/drezyna/generators/app_generator.rb
|
61
|
+
- lib/drezyna/version.rb
|
62
|
+
- templates/Gemfile.erb
|
63
|
+
- templates/Procfile.erb
|
64
|
+
- templates/README.md.erb
|
65
|
+
- templates/_messages.html.erb
|
66
|
+
- templates/_navigation.html.erb
|
67
|
+
- templates/_navigation.scss
|
68
|
+
- templates/application.scss
|
69
|
+
- templates/application_controller.rb
|
70
|
+
- templates/database.yml.erb
|
71
|
+
- templates/gitignore.erb
|
72
|
+
- templates/layout.html.erb
|
73
|
+
- templates/pryrc.rb
|
74
|
+
- templates/registrations_controller.rb
|
75
|
+
- templates/routes.rb.erb
|
76
|
+
- templates/users_controller.rb
|
77
|
+
homepage: http://github.com/nukomeet/drezyna
|
78
|
+
licenses:
|
79
|
+
- MIT
|
80
|
+
metadata: {}
|
81
|
+
post_install_message:
|
82
|
+
rdoc_options: []
|
83
|
+
require_paths:
|
84
|
+
- lib
|
85
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
91
|
+
requirements:
|
92
|
+
- - ">="
|
93
|
+
- !ruby/object:Gem::Version
|
94
|
+
version: '0'
|
95
|
+
requirements: []
|
96
|
+
rubyforge_project:
|
97
|
+
rubygems_version: 2.4.8
|
98
|
+
signing_key:
|
99
|
+
specification_version: 4
|
100
|
+
summary: Rails application template by Nukomeet
|
101
|
+
test_files: []
|
102
|
+
has_rdoc:
|