eucalypt 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Gemfile +3 -0
- data/LICENSE +21 -0
- data/README.md +26 -0
- data/Rakefile +2 -0
- data/bin/eucalypt +3 -0
- data/eucalypt.gemspec +39 -0
- data/lib/eucalypt/app.rb +6 -0
- data/lib/eucalypt/controller.rb +10 -0
- data/lib/eucalypt/errors.rb +109 -0
- data/lib/eucalypt/eucalypt-blog/helpers.rb +106 -0
- data/lib/eucalypt/eucalypt-blog/namespaces/blog/__base__.rb +22 -0
- data/lib/eucalypt/eucalypt-blog/namespaces/blog/__require__.rb +1 -0
- data/lib/eucalypt/eucalypt-blog/namespaces/blog/cli/blog.rb +65 -0
- data/lib/eucalypt/eucalypt-blog/namespaces/blog/generators/article.rb +28 -0
- data/lib/eucalypt/eucalypt-blog/namespaces/blog/generators/controller.rb +14 -0
- data/lib/eucalypt/eucalypt-blog/namespaces/blog/generators/helper.rb +12 -0
- data/lib/eucalypt/eucalypt-blog/namespaces/blog/generators/list.rb +74 -0
- data/lib/eucalypt/eucalypt-blog/namespaces/blog/generators/views.rb +20 -0
- data/lib/eucalypt/eucalypt-blog/namespaces/blog/templates/controller/controller.tt +33 -0
- data/lib/eucalypt/eucalypt-blog/namespaces/blog/templates/controller/controller_spec.tt +43 -0
- data/lib/eucalypt/eucalypt-blog/namespaces/blog/templates/helper/helper.tt +5 -0
- data/lib/eucalypt/eucalypt-blog/namespaces/blog/templates/helper/helper_spec.tt +9 -0
- data/lib/eucalypt/eucalypt-blog/namespaces/blog/templates/views/article.erb +1 -0
- data/lib/eucalypt/eucalypt-blog/namespaces/blog/templates/views/article_layout.erb +10 -0
- data/lib/eucalypt/eucalypt-blog/namespaces/blog/templates/views/article_md.tt +9 -0
- data/lib/eucalypt/eucalypt-blog/namespaces/blog/templates/views/articles.erb +1 -0
- data/lib/eucalypt/eucalypt-blog/namespaces/blog/templates/views/articles_layout.erb +10 -0
- data/lib/eucalypt/eucalypt-blog/namespaces/blog/templates/views/search.erb +1 -0
- data/lib/eucalypt/eucalypt-blog/namespaces/blog-article/cli/article.rb +120 -0
- data/lib/eucalypt/eucalypt-blog/namespaces/blog-article-edit/cli/edit-datetime.rb +113 -0
- data/lib/eucalypt/eucalypt-blog/namespaces/blog-article-edit/cli/edit-urltitle.rb +75 -0
- data/lib/eucalypt/eucalypt-core/cli/__base__.rb +11 -0
- data/lib/eucalypt/eucalypt-core/cli/console.rb +15 -0
- data/lib/eucalypt/eucalypt-core/cli/core.rb +6 -0
- data/lib/eucalypt/eucalypt-core/cli/help.rb +11 -0
- data/lib/eucalypt/eucalypt-core/cli/init.rb +71 -0
- data/lib/eucalypt/eucalypt-core/cli/launch.rb +33 -0
- data/lib/eucalypt/eucalypt-core/cli/test.rb +16 -0
- data/lib/eucalypt/eucalypt-core/cli/version.rb +11 -0
- data/lib/eucalypt/eucalypt-core/templates/Gemfile.tt +35 -0
- data/lib/eucalypt/eucalypt-core/templates/eucalypt/.gitignore +48 -0
- data/lib/eucalypt/eucalypt-core/templates/eucalypt/.travis.yml +8 -0
- data/lib/eucalypt/eucalypt-core/templates/eucalypt/Procfile +1 -0
- data/lib/eucalypt/eucalypt-core/templates/eucalypt/Rakefile +7 -0
- data/lib/eucalypt/eucalypt-core/templates/eucalypt/app/assets/fonts/.empty_directory +0 -0
- data/lib/eucalypt/eucalypt-core/templates/eucalypt/app/assets/images/.empty_directory +0 -0
- data/lib/eucalypt/eucalypt-core/templates/eucalypt/app/assets/scripts/application.js +17 -0
- data/lib/eucalypt/eucalypt-core/templates/eucalypt/app/assets/stylesheets/__partials__.scss +16 -0
- data/lib/eucalypt/eucalypt-core/templates/eucalypt/app/assets/stylesheets/application.scss +17 -0
- data/lib/eucalypt/eucalypt-core/templates/eucalypt/app/assets/stylesheets/partials/_mixins.scss +54 -0
- data/lib/eucalypt/eucalypt-core/templates/eucalypt/app/controllers/application_controller.rb +7 -0
- data/lib/eucalypt/eucalypt-core/templates/eucalypt/app/helpers/application_helper.rb +3 -0
- data/lib/eucalypt/eucalypt-core/templates/eucalypt/app/models/.empty_directory +0 -0
- data/lib/eucalypt/eucalypt-core/templates/eucalypt/app/static/.empty_directory +0 -0
- data/lib/eucalypt/eucalypt-core/templates/eucalypt/app/static/readme.yml +34 -0
- data/lib/eucalypt/eucalypt-core/templates/eucalypt/app/views/index.erb +0 -0
- data/lib/eucalypt/eucalypt-core/templates/eucalypt/app/views/layouts/main.erb +9 -0
- data/lib/eucalypt/eucalypt-core/templates/eucalypt/app/views/partials/.empty_directory +0 -0
- data/lib/eucalypt/eucalypt-core/templates/eucalypt/app.rb +42 -0
- data/lib/eucalypt/eucalypt-core/templates/eucalypt/config/active_record.rb +6 -0
- data/lib/eucalypt/eucalypt-core/templates/eucalypt/config/asset_pipeline.rb +15 -0
- data/lib/eucalypt/eucalypt-core/templates/eucalypt/config/database.yml +16 -0
- data/lib/eucalypt/eucalypt-core/templates/eucalypt/config/initializers/.empty_directory +0 -0
- data/lib/eucalypt/eucalypt-core/templates/eucalypt/config/logging.rb +27 -0
- data/lib/eucalypt/eucalypt-core/templates/eucalypt/config/manifest.rb +15 -0
- data/lib/eucalypt/eucalypt-core/templates/eucalypt/config.ru +10 -0
- data/lib/eucalypt/eucalypt-core/templates/eucalypt/log/.empty_directory +0 -0
- data/lib/eucalypt/eucalypt-core/templates/eucalypt/spec/controllers/application_controller_spec.rb +9 -0
- data/lib/eucalypt/eucalypt-core/templates/eucalypt/spec/helpers/application_helper_spec.rb +9 -0
- data/lib/eucalypt/eucalypt-core/templates/eucalypt/spec/models/.empty_directory +0 -0
- data/lib/eucalypt/eucalypt-core/templates/eucalypt/spec/spec_helper.rb +18 -0
- data/lib/eucalypt/eucalypt-destroy/helpers.rb +77 -0
- data/lib/eucalypt/eucalypt-destroy/namespaces/destroy/cli/destroy-controller.rb +16 -0
- data/lib/eucalypt/eucalypt-destroy/namespaces/destroy/cli/destroy-helper.rb +16 -0
- data/lib/eucalypt/eucalypt-destroy/namespaces/destroy/cli/destroy-model.rb +16 -0
- data/lib/eucalypt/eucalypt-destroy/namespaces/destroy/cli/destroy-scaffold.rb +63 -0
- data/lib/eucalypt/eucalypt-destroy/namespaces/destroy/cli/destroy.rb +21 -0
- data/lib/eucalypt/eucalypt-generate/.gitkeep +0 -0
- data/lib/eucalypt/eucalypt-generate/namespaces/generate/cli/generate-scaffold.rb +62 -0
- data/lib/eucalypt/eucalypt-generate/namespaces/generate/cli/generate.rb +24 -0
- data/lib/eucalypt/eucalypt-generate/namespaces/generate-controller/cli/generate-controller.rb +29 -0
- data/lib/eucalypt/eucalypt-generate/namespaces/generate-controller/generators/controller.rb +45 -0
- data/lib/eucalypt/eucalypt-generate/namespaces/generate-controller/templates/controller/controller.tt +3 -0
- data/lib/eucalypt/eucalypt-generate/namespaces/generate-controller/templates/controller/policy_rest_controller.tt +71 -0
- data/lib/eucalypt/eucalypt-generate/namespaces/generate-controller/templates/controller/rest_controller.tt +28 -0
- data/lib/eucalypt/eucalypt-generate/namespaces/generate-controller/templates/controller_spec.tt +9 -0
- data/lib/eucalypt/eucalypt-generate/namespaces/generate-helper/cli/generate-helper.rb +23 -0
- data/lib/eucalypt/eucalypt-generate/namespaces/generate-helper/generators/helper.rb +24 -0
- data/lib/eucalypt/eucalypt-generate/namespaces/generate-helper/templates/helper.tt +3 -0
- data/lib/eucalypt/eucalypt-generate/namespaces/generate-helper/templates/helper_spec.tt +9 -0
- data/lib/eucalypt/eucalypt-generate/namespaces/generate-model/cli/generate-model.rb +26 -0
- data/lib/eucalypt/eucalypt-generate/namespaces/generate-model/generators/model.rb +25 -0
- data/lib/eucalypt/eucalypt-generate/namespaces/generate-model/templates/model.tt +3 -0
- data/lib/eucalypt/eucalypt-generate/namespaces/generate-model/templates/model_spec.tt +8 -0
- data/lib/eucalypt/eucalypt-migration/helpers.rb +93 -0
- data/lib/eucalypt/eucalypt-migration/migration_base.tt +4 -0
- data/lib/eucalypt/eucalypt-migration/namespaces/migration/cli/migration.rb +39 -0
- data/lib/eucalypt/eucalypt-migration/namespaces/migration-add/cli/add-column.rb +25 -0
- data/lib/eucalypt/eucalypt-migration/namespaces/migration-add/cli/add-index.rb +25 -0
- data/lib/eucalypt/eucalypt-migration/namespaces/migration-add/cli/add.rb +18 -0
- data/lib/eucalypt/eucalypt-migration/namespaces/migration-add/generators/column.rb +46 -0
- data/lib/eucalypt/eucalypt-migration/namespaces/migration-add/generators/index.rb +52 -0
- data/lib/eucalypt/eucalypt-migration/namespaces/migration-blank/cli/blank.rb +22 -0
- data/lib/eucalypt/eucalypt-migration/namespaces/migration-blank/generators/blank.rb +28 -0
- data/lib/eucalypt/eucalypt-migration/namespaces/migration-change/cli/change-column.rb +23 -0
- data/lib/eucalypt/eucalypt-migration/namespaces/migration-change/cli/change.rb +17 -0
- data/lib/eucalypt/eucalypt-migration/namespaces/migration-change/generators/column.rb +46 -0
- data/lib/eucalypt/eucalypt-migration/namespaces/migration-create/cli/create-table.rb +25 -0
- data/lib/eucalypt/eucalypt-migration/namespaces/migration-create/cli/create.rb +17 -0
- data/lib/eucalypt/eucalypt-migration/namespaces/migration-create/generators/table.rb +53 -0
- data/lib/eucalypt/eucalypt-migration/namespaces/migration-drop/cli/drop-column.rb +22 -0
- data/lib/eucalypt/eucalypt-migration/namespaces/migration-drop/cli/drop-index.rb +23 -0
- data/lib/eucalypt/eucalypt-migration/namespaces/migration-drop/cli/drop-table.rb +22 -0
- data/lib/eucalypt/eucalypt-migration/namespaces/migration-drop/cli/drop.rb +19 -0
- data/lib/eucalypt/eucalypt-migration/namespaces/migration-drop/generators/column.rb +38 -0
- data/lib/eucalypt/eucalypt-migration/namespaces/migration-drop/generators/index.rb +48 -0
- data/lib/eucalypt/eucalypt-migration/namespaces/migration-drop/generators/table.rb +37 -0
- data/lib/eucalypt/eucalypt-migration/namespaces/migration-rename/cli/rename-column.rb +22 -0
- data/lib/eucalypt/eucalypt-migration/namespaces/migration-rename/cli/rename-index.rb +22 -0
- data/lib/eucalypt/eucalypt-migration/namespaces/migration-rename/cli/rename-table.rb +24 -0
- data/lib/eucalypt/eucalypt-migration/namespaces/migration-rename/cli/rename.rb +19 -0
- data/lib/eucalypt/eucalypt-migration/namespaces/migration-rename/generators/column.rb +39 -0
- data/lib/eucalypt/eucalypt-migration/namespaces/migration-rename/generators/index.rb +39 -0
- data/lib/eucalypt/eucalypt-migration/namespaces/migration-rename/generators/table.rb +38 -0
- data/lib/eucalypt/eucalypt-security/helpers.rb +22 -0
- data/lib/eucalypt/eucalypt-security/namespaces/security/cli/security.rb +31 -0
- data/lib/eucalypt/eucalypt-security/namespaces/security-policy/cli/security-policy.rb +91 -0
- data/lib/eucalypt/eucalypt-security/namespaces/security-policy/generators/policy.rb +31 -0
- data/lib/eucalypt/eucalypt-security/namespaces/security-policy/templates/create_policy_roles_migration.tt +11 -0
- data/lib/eucalypt/eucalypt-security/namespaces/security-policy/templates/policy.tt +16 -0
- data/lib/eucalypt/eucalypt-security/namespaces/security-policy-permission/cli/security-policy-permission.rb +62 -0
- data/lib/eucalypt/eucalypt-security/namespaces/security-policy-permission/generators/policy-permission.rb +28 -0
- data/lib/eucalypt/eucalypt-security/namespaces/security-policy-permission/templates/add_permission_to_policy_migration.tt +5 -0
- data/lib/eucalypt/eucalypt-security/namespaces/security-policy-role/cli/security-policy-role.rb +66 -0
- data/lib/eucalypt/eucalypt-security/namespaces/security-pundit/cli/security-pundit.rb +79 -0
- data/lib/eucalypt/eucalypt-security/namespaces/security-pundit/generators/role.rb +24 -0
- data/lib/eucalypt/eucalypt-security/namespaces/security-pundit/templates/create_roles_migration.tt +7 -0
- data/lib/eucalypt/eucalypt-security/namespaces/security-pundit/templates/pundit.tt +4 -0
- data/lib/eucalypt/eucalypt-security/namespaces/security-warden/cli/security-warden.rb +61 -0
- data/lib/eucalypt/eucalypt-security/namespaces/security-warden/generators/auth_controller.rb +34 -0
- data/lib/eucalypt/eucalypt-security/namespaces/security-warden/generators/user.rb +37 -0
- data/lib/eucalypt/eucalypt-security/namespaces/security-warden/templates/auth_controller.tt +25 -0
- data/lib/eucalypt/eucalypt-security/namespaces/security-warden/templates/auth_login.tt +1 -0
- data/lib/eucalypt/eucalypt-security/namespaces/security-warden/templates/create_users_table_migration.tt +9 -0
- data/lib/eucalypt/eucalypt-security/namespaces/security-warden/templates/user.tt +16 -0
- data/lib/eucalypt/eucalypt-security/namespaces/security-warden/templates/warden.tt +35 -0
- data/lib/eucalypt/eucalypt-security/namespaces/security-warden/user_confirm.rb +38 -0
- data/lib/eucalypt/helpers/colorize.rb +27 -0
- data/lib/eucalypt/helpers/gemfile.rb +48 -0
- data/lib/eucalypt/helpers/inflect.rb +79 -0
- data/lib/eucalypt/helpers/messages.rb +31 -0
- data/lib/eucalypt/helpers/migration.rb +85 -0
- data/lib/eucalypt/helpers/numeric.rb +10 -0
- data/lib/eucalypt/helpers.rb +6 -0
- data/lib/eucalypt/list.rb +39 -0
- data/lib/eucalypt/static.rb +48 -0
- data/lib/eucalypt/version.rb +3 -0
- data/lib/eucalypt.rb +19 -0
- metadata +373 -0
@@ -0,0 +1,17 @@
|
|
1
|
+
/* -------------------------------------------------------------------------------------------- *
|
2
|
+
* This file contains `require` directives to Javascript files. *
|
3
|
+
* All of these Javascript files will be compiled into a single Javascript file. *
|
4
|
+
* To use this combined file, include the following in the head section of your views: *
|
5
|
+
* *
|
6
|
+
* <%= application :js %> If including only application.js *
|
7
|
+
* <%= application :css, :js %> If including application.css as well *
|
8
|
+
* *
|
9
|
+
* By default, every file in the /assets/scripts directory is required by `require_tree .` *
|
10
|
+
* However, you may remove the `require_tree .` directive and instead specify individual files. *
|
11
|
+
* *
|
12
|
+
* Any global Javascript code can be included directly in this file. *
|
13
|
+
* NOTE: JS code defined in this file will be overwritten by JS code written in other files. *
|
14
|
+
* -------------------------------------------------------------------------------------------- *
|
15
|
+
*= require_self
|
16
|
+
*= require_tree .
|
17
|
+
*/
|
@@ -0,0 +1,16 @@
|
|
1
|
+
/* ----------------------------------------------------------------------------------------------- *
|
2
|
+
* This file simply imports all partial stylesheets in the /assets/stylesheets/partials directory. *
|
3
|
+
* Its purpose is to declutter stylesheets which require all of the partials, by eliminating the *
|
4
|
+
* need to repeatedly require each partial file in every new stylesheet. *
|
5
|
+
* *
|
6
|
+
* To use the partials listed below in a different stylesheet, simply import this file with: *
|
7
|
+
* *
|
8
|
+
* @import '__partials__' *
|
9
|
+
* *
|
10
|
+
* You'll have to manually add any new partial files to the list below, unless you decide to use *
|
11
|
+
* the `sass-globbing` gem. *
|
12
|
+
* *
|
13
|
+
* This gem has not been included by default due to the gem only importing globbed files in *
|
14
|
+
* alphabetical order, which won't always lead to the desired outcome in CSS, since order matters. *
|
15
|
+
* ----------------------------------------------------------------------------------------------- */
|
16
|
+
@import 'partials/mixins';
|
@@ -0,0 +1,17 @@
|
|
1
|
+
/* -------------------------------------------------------------------------------------------- *
|
2
|
+
* This file contains `require` directives to stylesheet files. *
|
3
|
+
* All of these stylesheet files will be compiled into a single stylesheet. *
|
4
|
+
* To use this combined stylesheet, include the following in the head section of your views: *
|
5
|
+
* *
|
6
|
+
* <%= application :css %> If including only application.css *
|
7
|
+
* <%= application :css, :js %> If including application.js as well *
|
8
|
+
* *
|
9
|
+
* By default, every file in the /assets/stylesheets directory is required by `require_tree .` *
|
10
|
+
* However, you may remove the `require_tree .` directive and instead specify individual files. *
|
11
|
+
* *
|
12
|
+
* Any global styles can be included directly in this file (Below the CSS reset). *
|
13
|
+
* NOTE: Styles defined in this file will be overwritten by CSS written in other files. *
|
14
|
+
* -------------------------------------------------------------------------------------------- *
|
15
|
+
*= require_self
|
16
|
+
*= require_tree .
|
17
|
+
*/
|
data/lib/eucalypt/eucalypt-core/templates/eucalypt/app/assets/stylesheets/partials/_mixins.scss
ADDED
@@ -0,0 +1,54 @@
|
|
1
|
+
@mixin placeholder {
|
2
|
+
&.placeholder { @content; }
|
3
|
+
&:-moz-placeholder { @content; }
|
4
|
+
&::-moz-placeholder { @content; }
|
5
|
+
&:-ms-input-placeholder { @content; }
|
6
|
+
&::-webkit-input-placeholder { @content; }
|
7
|
+
}
|
8
|
+
|
9
|
+
@mixin transform($transformations...) {
|
10
|
+
-ms-transform: $transformations;
|
11
|
+
-webkit-transform: $transformations;
|
12
|
+
-moz-transform: $transformations;
|
13
|
+
transform: $transformations;
|
14
|
+
}
|
15
|
+
|
16
|
+
@mixin transition($transitions...) {
|
17
|
+
-ms-transition: $transitions;
|
18
|
+
-moz-transition: $transitions;
|
19
|
+
-webkit-transition: $transitions;
|
20
|
+
transition: $transitions;
|
21
|
+
}
|
22
|
+
|
23
|
+
@mixin box-shadow($box-shadows...) {
|
24
|
+
-webkit-box-shadow: $box-shadows;
|
25
|
+
-moz-box-shadow: $box-shadows;
|
26
|
+
box-shadow: $box-shadows;
|
27
|
+
}
|
28
|
+
|
29
|
+
@mixin filter($filter...) {
|
30
|
+
-webkit-filter: $filter;
|
31
|
+
-moz-filter: $filter;
|
32
|
+
-o-filter: $filter;
|
33
|
+
-ms-filter: $filter;
|
34
|
+
filter: $filter;
|
35
|
+
}
|
36
|
+
|
37
|
+
@mixin user-select($value) {
|
38
|
+
-webkit-user-select: $value;
|
39
|
+
-moz-user-select: $value;
|
40
|
+
-ms-user-select: $value;
|
41
|
+
user-select: $value;
|
42
|
+
}
|
43
|
+
|
44
|
+
@mixin appearance($value) {
|
45
|
+
-webkit-appearance: $value;
|
46
|
+
-moz-appearance: $value;
|
47
|
+
appearance: $value;
|
48
|
+
}
|
49
|
+
|
50
|
+
@mixin border-radius($radius) {
|
51
|
+
-webkit-border-radius: $radius;
|
52
|
+
-moz-border-radius: $radius;
|
53
|
+
border-radius: $radius;
|
54
|
+
}
|
File without changes
|
File without changes
|
@@ -0,0 +1,34 @@
|
|
1
|
+
# -------------------------------------------------------------------------------------------------------- #
|
2
|
+
# DESCRIPTION: #
|
3
|
+
# The `static` directory should contain structured data in the YAML or JSON formats. #
|
4
|
+
# Currently supported extensions are .yaml, .yml, .json and .geojson #
|
5
|
+
# #
|
6
|
+
# The `Static` helper constant can be accessed from anywhere within your application. #
|
7
|
+
# This constant acts as a link to the `static` directory, allowing you to access data. #
|
8
|
+
# -------------------------------------------------------------------------------------------------------- #
|
9
|
+
# EXAMPLES: #
|
10
|
+
# - The data in a GEOJSON file at `static/server-locations.geojson` can be accessed with: #
|
11
|
+
# `Static.server_locations` - Note how method names are sometimes adjusted #
|
12
|
+
# #
|
13
|
+
# - The data in a JSON file at `static/dependencies/config.json` can be accessed with: #
|
14
|
+
# `Static.dependencies.config` #
|
15
|
+
# #
|
16
|
+
# - The data in a YAML file at `static/locales/en.yml` can be accessed with: #
|
17
|
+
# `Static.locales.en` #
|
18
|
+
# -------------------------------------------------------------------------------------------------------- #
|
19
|
+
# VIEWING DEFINED SUBDIRECTORY AND FILE METHODS: #
|
20
|
+
# The `Object#methods` method can be used to check for defined subdirectory and file methods. #
|
21
|
+
# Consider a structure like the following: #
|
22
|
+
# #
|
23
|
+
# static Static.methods(false) #=> [:hobbies, :main] #
|
24
|
+
# ├── hobbies Static.hobbies.methods(false) #=> [:academic, :non_academic] #
|
25
|
+
# │ ├── academic Static.hobbies.academic.methods(false) #=> [:ruby] #
|
26
|
+
# │ │ └── ruby.yml #
|
27
|
+
# │ └── non-academic Static.hobbies.non_academic.methods(false) #=> [:games, :sports] #
|
28
|
+
# │ ├── games Static.hobbies.non_academic.games.methods(false) #=> [:chess] #
|
29
|
+
# │ │ └── chess.yml #
|
30
|
+
# │ └── sports #
|
31
|
+
# │ ├── climbing.json Static.hobbies.non_academic.sports.methods(false) #=> [:climbing, :golf] #
|
32
|
+
# │ └── golf.yml #
|
33
|
+
# └── main.yml #
|
34
|
+
# -------------------------------------------------------------------------------------------------------- #
|
File without changes
|
File without changes
|
@@ -0,0 +1,42 @@
|
|
1
|
+
require 'bundler'
|
2
|
+
Bundler.require :default
|
3
|
+
|
4
|
+
Eucalypt::ROOT = __dir__.freeze
|
5
|
+
|
6
|
+
module Eucalypt
|
7
|
+
class << self
|
8
|
+
def root() ROOT end
|
9
|
+
def path(*args) File.join(ROOT, *args) end
|
10
|
+
def glob(*args, &block) Dir.glob(self.path(*args), &block) end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
Eucalypt.glob 'config', 'initializers', '*.rb', &method(:require)
|
15
|
+
|
16
|
+
Static = Eucalypt::Static.new(Eucalypt.path('app', 'static'), symbolize: true).freeze
|
17
|
+
|
18
|
+
class ApplicationController < Sinatra::Base
|
19
|
+
# Set server
|
20
|
+
set :server, %w[thin webrick]
|
21
|
+
|
22
|
+
# Set core application file
|
23
|
+
set :app_file, __FILE__
|
24
|
+
|
25
|
+
# Set application root directory
|
26
|
+
set :root, Eucalypt.root
|
27
|
+
|
28
|
+
# Set views directory
|
29
|
+
set :views, Eucalypt.path('app', 'views')
|
30
|
+
|
31
|
+
# Set default ERB template
|
32
|
+
set :erb, layout: :'layouts/main'
|
33
|
+
|
34
|
+
# Set Hanami asset helpers
|
35
|
+
helpers Hanami::Helpers, Hanami::Assets::Helpers
|
36
|
+
end
|
37
|
+
|
38
|
+
require Eucalypt.path 'config', 'logging'
|
39
|
+
Eucalypt.glob 'config', '*.rb', &method(:require)
|
40
|
+
Eucalypt.glob 'app', 'helpers', '{application_helper.rb}', &method(:require)
|
41
|
+
require Eucalypt.path 'app', 'controllers', 'application_controller'
|
42
|
+
Eucalypt.glob 'app', '{models,policies,helpers,controllers}', '*.rb', &method(:require)
|
@@ -0,0 +1,15 @@
|
|
1
|
+
class ApplicationController < Sinatra::Base
|
2
|
+
set :environment, Sprockets::Environment.new
|
3
|
+
environment.append_path Eucalypt.path 'app', 'assets', 'stylesheets'
|
4
|
+
environment.append_path Eucalypt.path 'app', 'assets', 'scripts'
|
5
|
+
environment.append_path Eucalypt.path 'app', 'assets', 'images'
|
6
|
+
environment.append_path Eucalypt.path 'app', 'assets', 'fonts'
|
7
|
+
|
8
|
+
environment.css_compressor = :scss
|
9
|
+
environment.js_compressor = :uglify
|
10
|
+
|
11
|
+
get '/assets/*' do
|
12
|
+
env["PATH_INFO"].sub! '/assets', ''
|
13
|
+
settings.environment.call env
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
default: &default
|
2
|
+
adapter: sqlite3
|
3
|
+
pool: 5
|
4
|
+
timeout: 5000
|
5
|
+
|
6
|
+
development:
|
7
|
+
<<: *default
|
8
|
+
database: db/development.sqlite3
|
9
|
+
|
10
|
+
test:
|
11
|
+
<<: *default
|
12
|
+
database: db/test.sqlite3
|
13
|
+
|
14
|
+
production:
|
15
|
+
adapter: postgresql
|
16
|
+
url: <%= ENV['DATABASE_URL'] %>
|
File without changes
|
@@ -0,0 +1,27 @@
|
|
1
|
+
class ApplicationController < Sinatra::Base
|
2
|
+
configure :development do
|
3
|
+
set :logger, Lumberjack::Logger.new
|
4
|
+
end
|
5
|
+
|
6
|
+
configure :test do
|
7
|
+
set :logger, Lumberjack::Logger.new
|
8
|
+
end
|
9
|
+
|
10
|
+
configure :production do
|
11
|
+
log_name = Time.now.strftime("server-start_%Y-%m-%dT%H-%M-%S_%z").sub(/_\+/,'_p').sub(/_\-/,'_m')
|
12
|
+
log_file_path = Eucalypt.path 'log', "#{log_name}.log"
|
13
|
+
set :logger, Lumberjack::Logger.new
|
14
|
+
use Rack::CommonLogger, $stdout
|
15
|
+
log = File.new log_file_path, "a+"
|
16
|
+
$stdout.reopen log
|
17
|
+
$stderr.reopen log
|
18
|
+
$stderr.sync = true
|
19
|
+
$stdout.sync = true
|
20
|
+
end
|
21
|
+
|
22
|
+
helpers do
|
23
|
+
def logger
|
24
|
+
settings.logger
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
class ApplicationController < Sinatra::Base
|
2
|
+
# Application manifest file accessor method
|
3
|
+
helpers do
|
4
|
+
def application(*args)
|
5
|
+
html = String.new
|
6
|
+
args.map(&:to_sym).each do |arg|
|
7
|
+
html << stylesheet('application') if %i[css stylesheet].include? arg
|
8
|
+
html << javascript('application') if %i[js javascript].include? arg
|
9
|
+
end
|
10
|
+
html
|
11
|
+
rescue
|
12
|
+
raise ArgumentError.new "Expected arguments to be any of: #{css+js}"
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
require_relative 'app'
|
2
|
+
|
3
|
+
Eucalypt.glob('app', 'controllers', '*.rb').each do |file|
|
4
|
+
controller_name = File.basename(file,'.*').camelize
|
5
|
+
next if controller_name == 'ApplicationController'
|
6
|
+
controller = controller_name.constantize
|
7
|
+
map(controller.router) { run controller }
|
8
|
+
end
|
9
|
+
|
10
|
+
map('/') { run ApplicationController }
|
File without changes
|
File without changes
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require './app'
|
2
|
+
Bundler.require :test
|
3
|
+
|
4
|
+
ENV['RACK_ENV'] = 'test'
|
5
|
+
|
6
|
+
Shoulda::Matchers.configure do |config|
|
7
|
+
config.integrate do |with|
|
8
|
+
with.test_framework :rspec
|
9
|
+
with.library :active_record
|
10
|
+
with.library :active_model
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
RSpec.configure do |config|
|
15
|
+
config.include Rack::Test::Methods
|
16
|
+
config.include Shoulda::Matchers::ActiveModel, type: :model
|
17
|
+
config.include Shoulda::Matchers::ActiveRecord, type: :model
|
18
|
+
end
|
@@ -0,0 +1,77 @@
|
|
1
|
+
require 'thor'
|
2
|
+
require 'eucalypt/helpers'
|
3
|
+
require 'eucalypt/errors'
|
4
|
+
|
5
|
+
module Eucalypt
|
6
|
+
class Destroy < Thor
|
7
|
+
module Helpers
|
8
|
+
include Eucalypt::Helpers
|
9
|
+
include Eucalypt::Helpers::Messages
|
10
|
+
using Colorize
|
11
|
+
|
12
|
+
def delete_mvc(mvc_file, name)
|
13
|
+
directory = File.expand_path('.')
|
14
|
+
if Eucalypt.app? directory
|
15
|
+
files = Dir[File.join directory, 'app', "#{mvc_file}s", '*.rb']
|
16
|
+
file_names = files.map{|c| File.basename(c).split(?_).first}.reject{|n| n=='application'}
|
17
|
+
|
18
|
+
if files.empty?
|
19
|
+
Eucalypt::Error.no_mvc(mvc_file)
|
20
|
+
return
|
21
|
+
end
|
22
|
+
|
23
|
+
file_name = String.new
|
24
|
+
spec_file_name = String.new
|
25
|
+
|
26
|
+
if name
|
27
|
+
# If name given
|
28
|
+
file_name = mvc_file == :model ? "#{name}.rb" : "#{name}_#{mvc_file}.rb"
|
29
|
+
spec_file_name = mvc_file == :model ? "#{name}_spec.rb" : "#{name}_#{mvc_file}_spec.rb"
|
30
|
+
|
31
|
+
unless file_names.include? file_name
|
32
|
+
Eucalypt::Error.no_mvc(mvc_file)
|
33
|
+
return
|
34
|
+
end
|
35
|
+
else
|
36
|
+
# If name not given
|
37
|
+
files = Dir[File.join directory, 'app', "#{mvc_file}s", "*.rb"].reject{|f| File.basename(f).include? 'application'}
|
38
|
+
if files.empty?
|
39
|
+
Eucalypt::Error.no_mvc(mvc_file)
|
40
|
+
return
|
41
|
+
end
|
42
|
+
|
43
|
+
puts
|
44
|
+
|
45
|
+
files_hash = {}
|
46
|
+
file_numbers = []
|
47
|
+
files.each_with_index do |file, i|
|
48
|
+
number = (i+1).to_s
|
49
|
+
file_numbers << number
|
50
|
+
files_hash[number.to_sym] = File.basename file
|
51
|
+
puts "#{number.colorize(:bold)}: #{File.basename file}"
|
52
|
+
end
|
53
|
+
file_number = ask "\nEnter the number of the #{mvc_file} to delete:", limited_to: file_numbers
|
54
|
+
|
55
|
+
file_name = files_hash[file_number.to_sym]
|
56
|
+
spec_file_name = file_name.gsub('.rb','_spec.rb')
|
57
|
+
end
|
58
|
+
|
59
|
+
Out.info "This command #{"will not".colorize(:bold)} delete any associated table." if mvc_file == :model
|
60
|
+
|
61
|
+
# Deleting MVC file
|
62
|
+
file_path = File.join directory, "app", "#{mvc_file}s", file_name
|
63
|
+
delete_file = ask Out.warning_message("Delete #{mvc_file} file #{file_name.colorize(:bold)}?"), limited_to: %w[y Y Yes YES n N No NO]
|
64
|
+
remove_file(file_path) if %w[y Y Yes YES].include? delete_file
|
65
|
+
|
66
|
+
# Deleting MVC file spec
|
67
|
+
spec_file_path = File.join(directory, "spec", "#{mvc_file}s", spec_file_name)
|
68
|
+
return unless File.exist? spec_file_path
|
69
|
+
delete_file_spec = ask Out.warning_message("Delete #{mvc_file} spec file #{spec_file_name.colorize(:bold)}?"), limited_to: %w[y Y Yes YES n N No NO]
|
70
|
+
remove_file(spec_file_path) if %w[y Y Yes YES].include? delete_file_spec
|
71
|
+
else
|
72
|
+
Eucalypt::Error.wrong_directory
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'eucalypt/eucalypt-destroy/helpers'
|
2
|
+
require 'eucalypt/helpers'
|
3
|
+
|
4
|
+
module Eucalypt
|
5
|
+
class Destroy < Thor
|
6
|
+
include Thor::Actions
|
7
|
+
include Eucalypt::Helpers
|
8
|
+
include Eucalypt::Destroy::Helpers
|
9
|
+
using Colorize
|
10
|
+
|
11
|
+
desc "controller [NAME]", "Destroys a controller".colorize(:grey)
|
12
|
+
def controller(name = nil)
|
13
|
+
delete_mvc(:controller, name)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'eucalypt/eucalypt-destroy/helpers'
|
2
|
+
require 'eucalypt/helpers'
|
3
|
+
|
4
|
+
module Eucalypt
|
5
|
+
class Destroy < Thor
|
6
|
+
include Thor::Actions
|
7
|
+
include Eucalypt::Helpers
|
8
|
+
include Eucalypt::Destroy::Helpers
|
9
|
+
using Colorize
|
10
|
+
|
11
|
+
desc "helper [NAME]", "Destroys a helper".colorize(:grey)
|
12
|
+
def helper(name = nil)
|
13
|
+
delete_mvc(:helper, name)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'eucalypt/eucalypt-destroy/helpers'
|
2
|
+
require 'eucalypt/helpers'
|
3
|
+
|
4
|
+
module Eucalypt
|
5
|
+
class Destroy < Thor
|
6
|
+
include Thor::Actions
|
7
|
+
include Eucalypt::Helpers
|
8
|
+
include Eucalypt::Destroy::Helpers
|
9
|
+
using Colorize
|
10
|
+
|
11
|
+
desc "model [NAME]", "Destroys a model".colorize(:grey)
|
12
|
+
def model(name = nil)
|
13
|
+
delete_mvc(:model, name)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,63 @@
|
|
1
|
+
require_relative 'destroy-controller'
|
2
|
+
require_relative 'destroy-helper'
|
3
|
+
require_relative 'destroy-model'
|
4
|
+
require 'eucalypt/app'
|
5
|
+
require 'eucalypt/helpers'
|
6
|
+
|
7
|
+
module Eucalypt
|
8
|
+
class Destroy < Thor
|
9
|
+
include Eucalypt::Helpers
|
10
|
+
using Colorize
|
11
|
+
|
12
|
+
desc "scaffold [NAME]", "Destroys a scaffold".colorize(:grey)
|
13
|
+
def scaffold(name = nil)
|
14
|
+
directory = File.expand_path('.')
|
15
|
+
if Eucalypt.app? directory
|
16
|
+
scaffolds = Dir[File.join directory, 'app', '{controllers,models,helpers}', '*.rb'].map do |f|
|
17
|
+
File.basename(f).split(?_).first.split(?.).first
|
18
|
+
end
|
19
|
+
|
20
|
+
scaffolds.reject!{|f|f == 'application'}
|
21
|
+
scaffolds.uniq!
|
22
|
+
|
23
|
+
if scaffolds.empty?
|
24
|
+
Eucalypt::Error.no_scaffolds
|
25
|
+
return
|
26
|
+
end
|
27
|
+
|
28
|
+
if name
|
29
|
+
|
30
|
+
if scaffolds.include? name
|
31
|
+
controller(name)
|
32
|
+
helper(name)
|
33
|
+
model(name)
|
34
|
+
else
|
35
|
+
Eucalypt::Error.no_scaffolds
|
36
|
+
end
|
37
|
+
|
38
|
+
else
|
39
|
+
|
40
|
+
scaffolds_hash = {}
|
41
|
+
scaffold_numbers = []
|
42
|
+
|
43
|
+
scaffolds.each_with_index do |scaffold, i|
|
44
|
+
scaffold_numbers << (i+1).to_s
|
45
|
+
scaffolds_hash[(i+1).to_s.to_sym] = scaffold
|
46
|
+
puts "\e[1m#{i+1}\e[0m: #{scaffold}"
|
47
|
+
end
|
48
|
+
|
49
|
+
scaffold_number = ask("\nEnter the number of the scaffold to delete:", limited_to: scaffold_numbers)
|
50
|
+
scaffold_name = scaffolds_hash[scaffold_number.to_sym]
|
51
|
+
|
52
|
+
controller(scaffold_name)
|
53
|
+
helper(scaffold_name)
|
54
|
+
model(scaffold_name)
|
55
|
+
|
56
|
+
end
|
57
|
+
|
58
|
+
else
|
59
|
+
Eucalypt::Error.wrong_directory
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require_relative 'destroy-scaffold'
|
2
|
+
require 'eucalypt/helpers'
|
3
|
+
|
4
|
+
module Eucalypt
|
5
|
+
class Destroy < Thor
|
6
|
+
include Eucalypt::Helpers
|
7
|
+
using Colorize
|
8
|
+
class << self
|
9
|
+
require 'eucalypt/list'
|
10
|
+
include Eucalypt::List
|
11
|
+
def banner(task, namespace = false, subcommand = true)
|
12
|
+
basename + ' ' + task.formatted_usage(self, true, subcommand).split(':').join(' ')
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
class CLI < Thor
|
17
|
+
include Eucalypt::Helpers
|
18
|
+
using Colorize
|
19
|
+
register(Destroy, 'destroy', 'destroy [COMMAND]', 'Destroy individual MVC files or scaffolds'.colorize(:grey))
|
20
|
+
end
|
21
|
+
end
|
File without changes
|
@@ -0,0 +1,62 @@
|
|
1
|
+
require 'thor'
|
2
|
+
require 'eucalypt/helpers'
|
3
|
+
require 'eucalypt/app'
|
4
|
+
module Eucalypt
|
5
|
+
class Generate < Thor
|
6
|
+
include Eucalypt::Helpers
|
7
|
+
include Eucalypt::Helpers::Messages
|
8
|
+
using Colorize
|
9
|
+
|
10
|
+
option :no, aliases: '-n', type: :array, default: [], enum: %w[m ms c cs h hs], desc: "Omit specified scaffold files"
|
11
|
+
option :rest, aliases: '-r', type: :boolean, default: false, desc: "Generate REST routes for the controller"
|
12
|
+
option :policy, aliases: '-p', type: :boolean, default: false, desc: "Generate a policy with the scaffold"
|
13
|
+
option :table, type: :boolean, default: true, desc: "Generate a table migration"
|
14
|
+
desc "scaffold [NAME] *[COLUMN∶TYPE]", "Generates a scaffold".colorize(:grey)
|
15
|
+
def scaffold(name, *columns)
|
16
|
+
directory = File.expand_path('.')
|
17
|
+
if Eucalypt.app? directory
|
18
|
+
model = !options[:no].include?('m')
|
19
|
+
helper = !options[:no].include?('h')
|
20
|
+
controller = !options[:no].include?('c')
|
21
|
+
model_spec = !options[:no].include?('ms')
|
22
|
+
helper_spec = !options[:no].include?('hs')
|
23
|
+
controller_spec = !options[:no].include?('cs')
|
24
|
+
|
25
|
+
if model
|
26
|
+
validation = Eucalypt::Helpers::Migration::Validation.new columns
|
27
|
+
return if validation.any_invalid?
|
28
|
+
model = Eucalypt::Generators::Model.new
|
29
|
+
model.destination_root = directory
|
30
|
+
model.generate(name: name, spec: model_spec, table: options[:table], columns: columns)
|
31
|
+
end
|
32
|
+
|
33
|
+
if helper
|
34
|
+
helper = Eucalypt::Generators::Helper.new
|
35
|
+
helper.destination_root = directory
|
36
|
+
helper.generate(name: name, spec: helper_spec)
|
37
|
+
end
|
38
|
+
|
39
|
+
if controller
|
40
|
+
controller = Eucalypt::Generators::Controller.new
|
41
|
+
controller.destination_root = directory
|
42
|
+
policy = options[:rest] && options[:policy]
|
43
|
+
controller.generate(
|
44
|
+
name: name,
|
45
|
+
spec: controller_spec,
|
46
|
+
rest: options[:rest],
|
47
|
+
policy: policy
|
48
|
+
)
|
49
|
+
end
|
50
|
+
|
51
|
+
if options[:policy]
|
52
|
+
args = ['security', 'policy', 'generate', name]
|
53
|
+
args << %w[-p create edit delete] if options[:rest]
|
54
|
+
args.flatten!
|
55
|
+
Eucalypt::CLI.start(args)
|
56
|
+
end
|
57
|
+
else
|
58
|
+
Eucalypt::Error.wrong_directory
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|