forge-cli 0.0.18 → 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/README.md +106 -0
- data/bin/cucumber +16 -0
- data/bin/erubis +16 -0
- data/bin/htmldiff +16 -0
- data/bin/ldiff +16 -0
- data/bin/rackup +16 -0
- data/bin/rake +16 -0
- data/bin/rdoc +16 -0
- data/bin/ri +16 -0
- data/bin/sprockets +16 -0
- data/bin/thor +16 -0
- data/bin/tilt +16 -0
- data/bin/tt +16 -0
- data/lib/forge-cli.rb +1 -0
- data/lib/forge-cli/application_creator.rb +25 -6
- data/lib/forge-cli/controller_module_includer.rb +43 -0
- data/lib/forge-cli/module_installer.rb +18 -13
- data/lib/forge-cli/modules/banners/routes.rb +1 -1
- data/lib/forge-cli/modules/base/forge_routes.rb +4 -4
- data/lib/forge-cli/modules/base/manifest.yml +9 -4
- data/lib/forge-cli/modules/base/post_hooks.rb +9 -2
- data/lib/forge-cli/modules/base/routes.rb +4 -4
- data/lib/forge-cli/modules/dispatches/forge_routes.rb +2 -2
- data/lib/forge-cli/modules/dispatches/manifest.yml +2 -1
- data/lib/forge-cli/modules/ecommerce/manifest.yml +5 -1
- data/lib/forge-cli/modules/ecommerce/post_hooks.rb +13 -21
- data/lib/forge-cli/modules/events/routes.rb +1 -1
- data/lib/forge-cli/modules/posts/manifest.yml +4 -1
- data/lib/forge-cli/modules/posts/post_hooks.rb +9 -17
- data/lib/forge-cli/modules/posts/routes.rb +1 -1
- data/lib/forge-cli/modules/videos/routes.rb +1 -1
- data/lib/forge-cli/version.rb +2 -2
- data/lib/forge/Gemfile +3 -9
- data/lib/forge/Gemfile.lock +214 -210
- data/lib/forge/app/controllers/forge/help_topics_controller.rb +2 -2
- data/lib/forge/app/controllers/forge/posts_controller.rb +1 -0
- data/lib/forge/app/controllers/forge/products_controller.rb +0 -4
- data/lib/forge/app/controllers/forge/users_controller.rb +0 -1
- data/lib/forge/app/controllers/forge_controller.rb +7 -6
- data/lib/forge/app/controllers/posts_controller.rb +0 -2
- data/lib/forge/app/controllers/sessions_controller.rb +2 -3
- data/lib/forge/app/helpers/forge_helper.rb +2 -2
- data/lib/forge/app/models/address.rb +3 -0
- data/lib/forge/app/models/asset.rb +9 -10
- data/lib/forge/app/models/banner.rb +3 -1
- data/lib/forge/app/models/comment.rb +17 -2
- data/lib/forge/app/models/comment_subscriber.rb +3 -0
- data/lib/forge/app/models/contact.rb +3 -0
- data/lib/forge/app/models/country.rb +5 -2
- data/lib/forge/app/models/dispatch.rb +5 -2
- data/lib/forge/app/models/dispatch_bounce.rb +3 -0
- data/lib/forge/app/models/dispatch_link.rb +4 -1
- data/lib/forge/app/models/dispatch_link_click.rb +4 -0
- data/lib/forge/app/models/dispatch_open.rb +5 -1
- data/lib/forge/app/models/dispatch_unsubscribe.rb +4 -0
- data/lib/forge/app/models/event.rb +3 -1
- data/lib/forge/app/models/gallery.rb +4 -1
- data/lib/forge/app/models/help_topic.rb +4 -1
- data/lib/forge/app/models/line_item.rb +2 -2
- data/lib/forge/app/models/order.rb +1 -1
- data/lib/forge/app/models/order_transaction.rb +3 -0
- data/lib/forge/app/models/page.rb +5 -5
- data/lib/forge/app/models/photo.rb +5 -1
- data/lib/forge/app/models/post.rb +3 -1
- data/lib/forge/app/models/post_category.rb +4 -0
- data/lib/forge/app/models/product.rb +4 -2
- data/lib/forge/app/models/product_category.rb +4 -1
- data/lib/forge/app/models/product_image.rb +4 -0
- data/lib/forge/app/models/province.rb +4 -1
- data/lib/forge/app/models/queued_dispatch.rb +7 -4
- data/lib/forge/app/models/role.rb +3 -0
- data/lib/forge/app/models/sale.rb +2 -0
- data/lib/forge/app/models/subscriber.rb +4 -0
- data/lib/forge/app/models/subscriber_group.rb +4 -0
- data/lib/forge/app/models/subscriber_group_member.rb +4 -0
- data/lib/forge/app/models/tax_rate.rb +5 -2
- data/lib/forge/app/models/user.rb +1 -2
- data/lib/forge/app/models/video.rb +2 -0
- data/lib/forge/app/models/video_feed.rb +2 -2
- data/lib/forge/app/views/forge/assets/_asset.html.haml +1 -1
- data/lib/forge/app/views/forge/posts/_post.html.haml +5 -2
- data/lib/forge/app/views/forge/settings/_ecommerce.html.haml +4 -0
- data/lib/forge/app/views/forge/subscribers/_subscriber.html.haml +2 -2
- data/lib/forge/app/views/user_mailer/approved.html.haml +1 -1
- data/lib/forge/config/application.rb +3 -9
- data/lib/forge/config/database.yml.template +30 -0
- data/lib/forge/config/environments/development.rb +3 -7
- data/lib/forge/config/environments/production.rb +6 -0
- data/lib/forge/config/environments/test.rb +5 -3
- data/lib/forge/config/initializers/ckeditor.rb +15 -143
- data/lib/forge/config/initializers/devise.rb +12 -2
- data/lib/forge/config/initializers/ecommerce.rb +1 -1
- data/lib/forge/config/initializers/secret_token.rb +1 -10
- data/lib/forge/config/routes.rb +7 -11
- data/lib/forge/config/settings.yml +82 -5
- data/lib/forge/config/sitemap.yml +3 -1
- data/lib/forge/db/migrate/20130405172031_create_products_tax_rates.rb +15 -0
- data/lib/forge/db/migrate/{20130405172040_create_subscribers copy.rb → 20130405172040_create_subscribers.rb} +0 -0
- data/lib/forge/db/seeds.rb +304 -298
- data/lib/forge/doc/update_to_rails4_notes.md +15 -0
- data/lib/forge/lib/assets/javascripts/forge/features/help.js.erb +5 -4
- data/lib/forge/lib/assets/javascripts/forge/forge_manifest.js.erb +2 -2
- data/lib/forge/lib/assets/stylesheets/forge/forge.ui.css.scss +4 -3
- data/lib/forge/lib/forge/can_use_asset.rb +5 -7
- data/lib/forge/lib/forge/config/ecommerce.rb +3 -3
- data/lib/forge/lib/forge/shared_controller_methods/ecommerce.rb +3 -3
- data/lib/forge/lib/generators/forge/scaffold/USAGE +1 -1
- data/lib/forge/lib/tasks/forge.rake +5 -10
- data/lib/forge/public/500.html +1 -0
- data/lib/forge/public/javascripts/ckeditor/config.js +0 -1
- metadata +39 -39
- data/README.rdoc +0 -4
- data/lib/forge/app/models/comment_observer.rb +0 -9
- data/lib/forge/app/sweepers/page_sweeper.rb +0 -11
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA1:
|
|
3
|
+
metadata.gz: e10ec0676cc31af13d158fae4cbfd36751bb7b6c
|
|
4
|
+
data.tar.gz: 2459df7caa0e5c5db327afaefa4c9d7c9b464ae2
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: c53dd6ce30134a189abd235fd26543cde5157ce99daf8e016c4f407041fae7b03df3bd17effac3f5480364370d915f7a87bf2c88afc3ba747500a255289c0d9e
|
|
7
|
+
data.tar.gz: 38fd8650401584d9f884d5144dad934450faf64ae45d95cc5d62fac30a1ef99715592b89bb102f63b7f4566a363c1f672ab25996bb0ffa6bb1843a37f7b661cf
|
data/README.md
ADDED
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
# forge-cli
|
|
2
|
+
|
|
3
|
+
Command line interface for creating Forge apps, which are Rails-based applications that come with a host of features
|
|
4
|
+
for content management, rapid application development, and improved scaffold generation.
|
|
5
|
+
|
|
6
|
+
Although the end result of this gem is the creation of a Rails 4 application that you can certainly use as the basis
|
|
7
|
+
for a new web application, this gem itself is still alpha quality and is undergoing heavy development. You can, however,
|
|
8
|
+
create production-ready applications with it (and we do all the time). Documentation is also greatly lacking at this
|
|
9
|
+
point.
|
|
10
|
+
|
|
11
|
+
## Requirements
|
|
12
|
+
|
|
13
|
+
Ruby 1.9.3 or higher. Forge is best at creating Rails 4 applications using Ruby 2.0.
|
|
14
|
+
|
|
15
|
+
## Installation
|
|
16
|
+
|
|
17
|
+
gem install forge-cli
|
|
18
|
+
|
|
19
|
+
## Usage
|
|
20
|
+
|
|
21
|
+
### Installation And Modules
|
|
22
|
+
|
|
23
|
+
To create a new Forge site:
|
|
24
|
+
|
|
25
|
+
forge new APP_NAME LIST,OF,MODULES
|
|
26
|
+
|
|
27
|
+
For example:
|
|
28
|
+
|
|
29
|
+
forge new app banners,dispatches,ecommerce,events,galleries,posts,subscribers,videos
|
|
30
|
+
|
|
31
|
+
The gem will display next steps once you've created the application.
|
|
32
|
+
|
|
33
|
+
Once the app is created, you can see a list of available modules by running:
|
|
34
|
+
|
|
35
|
+
forge list
|
|
36
|
+
|
|
37
|
+
To install a module that is not yet installed, use:
|
|
38
|
+
|
|
39
|
+
forge install MODULE_NAME
|
|
40
|
+
|
|
41
|
+
### Scaffold Generation
|
|
42
|
+
|
|
43
|
+
Forge comes with an advanced scaffold generation system that makes it extremely simple to create new,
|
|
44
|
+
content-managed entities in the administration panel.
|
|
45
|
+
|
|
46
|
+
To use the scaffold generator, run:
|
|
47
|
+
|
|
48
|
+
rails generate forge:scaffold MODEL_NAME LIST_OF_ATTRIBUTES_IN_STANDARD_RAILS_FORMAT
|
|
49
|
+
|
|
50
|
+
For example:
|
|
51
|
+
|
|
52
|
+
rails generate forge:scaffold vehicle title:string description:text image_file_name:string image_file_size:integer image_content_type:string list_order:integer publish_on:timestamp
|
|
53
|
+
|
|
54
|
+
As well as generating standard text fields as per Rails' normal behaviour, the scaffolder understands the following:
|
|
55
|
+
|
|
56
|
+
* `ATTRIBUTE_NAME:timestamp` (generates a calendar picker with a time field)
|
|
57
|
+
* `title:string` (generates a large text field at the top of the form for the title)
|
|
58
|
+
* `ATTRIBUTE_file_name:string, ATTRIBUTE_file_size:integer, ATTRIBUTE_content_type:string` (generates Paperclip-styled attachments that hook into the Asset Library)
|
|
59
|
+
* `list_order:integer` (makes the list of items in Forge reorderable using drag & drop)
|
|
60
|
+
|
|
61
|
+
You can also generate scaffolds for "small" entities, such as post categories, that have a streamlined interface as follows:
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
## Available Modules
|
|
66
|
+
|
|
67
|
+
* banners (e.g. for image carousels on a homepage)
|
|
68
|
+
* subscribers (subscribe management)
|
|
69
|
+
* dispatches (full-fledged newsletter sending system, installs subscribers as well)
|
|
70
|
+
* ecommerce (the lack of documentation for this module makes it rather hard to use right now)
|
|
71
|
+
* events (including a calendar if you wish)
|
|
72
|
+
* galleries (for photos)
|
|
73
|
+
* posts (i.e. blogging)
|
|
74
|
+
* videos
|
|
75
|
+
|
|
76
|
+
## Contributing
|
|
77
|
+
|
|
78
|
+
Contributions are welcome. Right now the process of contributing is as follows:
|
|
79
|
+
|
|
80
|
+
1. Fork the gem
|
|
81
|
+
2. Use the local copy of the gem to create a new site, e.g: `bin/forge new testapp banners,dispatches`
|
|
82
|
+
3. Spin up the new app
|
|
83
|
+
4. Work on the new app as you would work on a normal Rails site
|
|
84
|
+
5. Copy the changed/new files from the new app into the gem's lib/forge folder. For example, if you changed
|
|
85
|
+
`app/controllers/application_controller.rb` in your new app, you would copy that into the gem's `lib/forge/app/controllers` folder.
|
|
86
|
+
6. Commit your changes and issue a pull request.
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
## LICENSE
|
|
90
|
+
|
|
91
|
+
(The MIT License)
|
|
92
|
+
|
|
93
|
+
Copyright (c) 2013 factor[e] design initiative
|
|
94
|
+
|
|
95
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
|
|
96
|
+
documentation files (the 'Software'), to deal in the Software without restriction, including without limitation
|
|
97
|
+
the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
|
|
98
|
+
to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
99
|
+
|
|
100
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of
|
|
101
|
+
the Software.
|
|
102
|
+
|
|
103
|
+
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
|
|
104
|
+
THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
105
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
|
106
|
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/bin/cucumber
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
#
|
|
3
|
+
# This file was generated by Bundler.
|
|
4
|
+
#
|
|
5
|
+
# The application 'cucumber' is installed as part of a gem, and
|
|
6
|
+
# this file is here to facilitate running it.
|
|
7
|
+
#
|
|
8
|
+
|
|
9
|
+
require 'pathname'
|
|
10
|
+
ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
|
|
11
|
+
Pathname.new(__FILE__).realpath)
|
|
12
|
+
|
|
13
|
+
require 'rubygems'
|
|
14
|
+
require 'bundler/setup'
|
|
15
|
+
|
|
16
|
+
load Gem.bin_path('cucumber', 'cucumber')
|
data/bin/erubis
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
#
|
|
3
|
+
# This file was generated by Bundler.
|
|
4
|
+
#
|
|
5
|
+
# The application 'erubis' is installed as part of a gem, and
|
|
6
|
+
# this file is here to facilitate running it.
|
|
7
|
+
#
|
|
8
|
+
|
|
9
|
+
require 'pathname'
|
|
10
|
+
ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
|
|
11
|
+
Pathname.new(__FILE__).realpath)
|
|
12
|
+
|
|
13
|
+
require 'rubygems'
|
|
14
|
+
require 'bundler/setup'
|
|
15
|
+
|
|
16
|
+
load Gem.bin_path('erubis', 'erubis')
|
data/bin/htmldiff
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
#
|
|
3
|
+
# This file was generated by Bundler.
|
|
4
|
+
#
|
|
5
|
+
# The application 'htmldiff' is installed as part of a gem, and
|
|
6
|
+
# this file is here to facilitate running it.
|
|
7
|
+
#
|
|
8
|
+
|
|
9
|
+
require 'pathname'
|
|
10
|
+
ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
|
|
11
|
+
Pathname.new(__FILE__).realpath)
|
|
12
|
+
|
|
13
|
+
require 'rubygems'
|
|
14
|
+
require 'bundler/setup'
|
|
15
|
+
|
|
16
|
+
load Gem.bin_path('diff-lcs', 'htmldiff')
|
data/bin/ldiff
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
#
|
|
3
|
+
# This file was generated by Bundler.
|
|
4
|
+
#
|
|
5
|
+
# The application 'ldiff' is installed as part of a gem, and
|
|
6
|
+
# this file is here to facilitate running it.
|
|
7
|
+
#
|
|
8
|
+
|
|
9
|
+
require 'pathname'
|
|
10
|
+
ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
|
|
11
|
+
Pathname.new(__FILE__).realpath)
|
|
12
|
+
|
|
13
|
+
require 'rubygems'
|
|
14
|
+
require 'bundler/setup'
|
|
15
|
+
|
|
16
|
+
load Gem.bin_path('diff-lcs', 'ldiff')
|
data/bin/rackup
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
#
|
|
3
|
+
# This file was generated by Bundler.
|
|
4
|
+
#
|
|
5
|
+
# The application 'rackup' is installed as part of a gem, and
|
|
6
|
+
# this file is here to facilitate running it.
|
|
7
|
+
#
|
|
8
|
+
|
|
9
|
+
require 'pathname'
|
|
10
|
+
ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
|
|
11
|
+
Pathname.new(__FILE__).realpath)
|
|
12
|
+
|
|
13
|
+
require 'rubygems'
|
|
14
|
+
require 'bundler/setup'
|
|
15
|
+
|
|
16
|
+
load Gem.bin_path('rack', 'rackup')
|
data/bin/rake
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
#
|
|
3
|
+
# This file was generated by Bundler.
|
|
4
|
+
#
|
|
5
|
+
# The application 'rake' is installed as part of a gem, and
|
|
6
|
+
# this file is here to facilitate running it.
|
|
7
|
+
#
|
|
8
|
+
|
|
9
|
+
require 'pathname'
|
|
10
|
+
ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
|
|
11
|
+
Pathname.new(__FILE__).realpath)
|
|
12
|
+
|
|
13
|
+
require 'rubygems'
|
|
14
|
+
require 'bundler/setup'
|
|
15
|
+
|
|
16
|
+
load Gem.bin_path('rake', 'rake')
|
data/bin/rdoc
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
#
|
|
3
|
+
# This file was generated by Bundler.
|
|
4
|
+
#
|
|
5
|
+
# The application 'rdoc' is installed as part of a gem, and
|
|
6
|
+
# this file is here to facilitate running it.
|
|
7
|
+
#
|
|
8
|
+
|
|
9
|
+
require 'pathname'
|
|
10
|
+
ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
|
|
11
|
+
Pathname.new(__FILE__).realpath)
|
|
12
|
+
|
|
13
|
+
require 'rubygems'
|
|
14
|
+
require 'bundler/setup'
|
|
15
|
+
|
|
16
|
+
load Gem.bin_path('rdoc', 'rdoc')
|
data/bin/ri
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
#
|
|
3
|
+
# This file was generated by Bundler.
|
|
4
|
+
#
|
|
5
|
+
# The application 'ri' is installed as part of a gem, and
|
|
6
|
+
# this file is here to facilitate running it.
|
|
7
|
+
#
|
|
8
|
+
|
|
9
|
+
require 'pathname'
|
|
10
|
+
ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
|
|
11
|
+
Pathname.new(__FILE__).realpath)
|
|
12
|
+
|
|
13
|
+
require 'rubygems'
|
|
14
|
+
require 'bundler/setup'
|
|
15
|
+
|
|
16
|
+
load Gem.bin_path('rdoc', 'ri')
|
data/bin/sprockets
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
#
|
|
3
|
+
# This file was generated by Bundler.
|
|
4
|
+
#
|
|
5
|
+
# The application 'sprockets' is installed as part of a gem, and
|
|
6
|
+
# this file is here to facilitate running it.
|
|
7
|
+
#
|
|
8
|
+
|
|
9
|
+
require 'pathname'
|
|
10
|
+
ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
|
|
11
|
+
Pathname.new(__FILE__).realpath)
|
|
12
|
+
|
|
13
|
+
require 'rubygems'
|
|
14
|
+
require 'bundler/setup'
|
|
15
|
+
|
|
16
|
+
load Gem.bin_path('sprockets', 'sprockets')
|
data/bin/thor
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
#
|
|
3
|
+
# This file was generated by Bundler.
|
|
4
|
+
#
|
|
5
|
+
# The application 'thor' is installed as part of a gem, and
|
|
6
|
+
# this file is here to facilitate running it.
|
|
7
|
+
#
|
|
8
|
+
|
|
9
|
+
require 'pathname'
|
|
10
|
+
ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
|
|
11
|
+
Pathname.new(__FILE__).realpath)
|
|
12
|
+
|
|
13
|
+
require 'rubygems'
|
|
14
|
+
require 'bundler/setup'
|
|
15
|
+
|
|
16
|
+
load Gem.bin_path('thor', 'thor')
|
data/bin/tilt
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
#
|
|
3
|
+
# This file was generated by Bundler.
|
|
4
|
+
#
|
|
5
|
+
# The application 'tilt' is installed as part of a gem, and
|
|
6
|
+
# this file is here to facilitate running it.
|
|
7
|
+
#
|
|
8
|
+
|
|
9
|
+
require 'pathname'
|
|
10
|
+
ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
|
|
11
|
+
Pathname.new(__FILE__).realpath)
|
|
12
|
+
|
|
13
|
+
require 'rubygems'
|
|
14
|
+
require 'bundler/setup'
|
|
15
|
+
|
|
16
|
+
load Gem.bin_path('tilt', 'tilt')
|
data/bin/tt
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
#
|
|
3
|
+
# This file was generated by Bundler.
|
|
4
|
+
#
|
|
5
|
+
# The application 'tt' is installed as part of a gem, and
|
|
6
|
+
# this file is here to facilitate running it.
|
|
7
|
+
#
|
|
8
|
+
|
|
9
|
+
require 'pathname'
|
|
10
|
+
ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
|
|
11
|
+
Pathname.new(__FILE__).realpath)
|
|
12
|
+
|
|
13
|
+
require 'rubygems'
|
|
14
|
+
require 'bundler/setup'
|
|
15
|
+
|
|
16
|
+
load Gem.bin_path('treetop', 'tt')
|
data/lib/forge-cli.rb
CHANGED
|
@@ -16,6 +16,7 @@ require 'forge-cli/app.rb'
|
|
|
16
16
|
# This is alphabetical
|
|
17
17
|
require 'forge-cli/ability_installer.rb'
|
|
18
18
|
require 'forge-cli/application_creator.rb'
|
|
19
|
+
require 'forge-cli/controller_module_includer.rb'
|
|
19
20
|
require 'forge-cli/custom_file_copier.rb'
|
|
20
21
|
require 'forge-cli/forge_addon_requirer.rb'
|
|
21
22
|
require 'forge-cli/module_installer.rb'
|
|
@@ -32,16 +32,26 @@ class ForgeCLI::ApplicationCreator
|
|
|
32
32
|
# Rewrite Forge3::Application
|
|
33
33
|
rewrite_app_name
|
|
34
34
|
|
|
35
|
+
# create some new tokens
|
|
36
|
+
generate_devise_tokens
|
|
37
|
+
|
|
35
38
|
STDOUT.puts completed_message
|
|
36
39
|
end
|
|
37
40
|
|
|
38
41
|
def completed_message
|
|
39
42
|
%{
|
|
40
43
|
#{"Your new Forge site is almost ready! Next steps:".foreground(:cyan)}
|
|
41
|
-
1.
|
|
42
|
-
2.
|
|
43
|
-
3.
|
|
44
|
-
4.
|
|
44
|
+
1. Run 'bundle install'
|
|
45
|
+
2. Set up config/database.yml
|
|
46
|
+
3. Run 'rake db:create' unless your database already exists
|
|
47
|
+
4. Run 'rake db:migrate'
|
|
48
|
+
5. Run 'rake forge:create_admin'
|
|
49
|
+
6. Run 'rake forge:load_help'
|
|
50
|
+
7. Edit the contents of config/sitemap.yml, then run 'rake db:seed'
|
|
51
|
+
8. Set up delayed job with 'rails generate delayed_job:active_record'
|
|
52
|
+
9. Review the settings in config/initializers/devise.rb and config/settings.yml
|
|
53
|
+
10. Run 'rails server' to spin up the application
|
|
54
|
+
11. Access Forge by going to /forge in your browser (e.g. http://localhost:3000/forge)
|
|
45
55
|
}
|
|
46
56
|
end
|
|
47
57
|
|
|
@@ -60,11 +70,20 @@ class ForgeCLI::ApplicationCreator
|
|
|
60
70
|
]
|
|
61
71
|
files.each do |file|
|
|
62
72
|
old_content = File.read(File.join(@app, file))
|
|
63
|
-
app_name = File.basename(@app).
|
|
73
|
+
app_name = File.basename(@app).gsub(/\W+/, '_').camelize
|
|
64
74
|
new_content = old_content.gsub('Forge3', app_name)
|
|
65
75
|
File.open(File.join(@app, file), 'w') do |f|
|
|
66
76
|
f.puts new_content
|
|
67
77
|
end
|
|
68
78
|
end
|
|
69
79
|
end
|
|
70
|
-
|
|
80
|
+
|
|
81
|
+
def generate_devise_tokens
|
|
82
|
+
file = '/config/initializers/devise.rb'
|
|
83
|
+
old_content = File.read(File.join(@app, file))
|
|
84
|
+
new_content = old_content.gsub('DEVISE_SECRET_KEY', SecureRandom.hex(64)).gsub('DEVISE_PEPPER', SecureRandom.hex(64))
|
|
85
|
+
File.open(File.join(@app, file), 'w') do |f|
|
|
86
|
+
f.puts new_content
|
|
87
|
+
end
|
|
88
|
+
end
|
|
89
|
+
end
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
class ForgeCLI::ControllerModuleIncluder
|
|
2
|
+
attr_reader :module_name
|
|
3
|
+
|
|
4
|
+
def initialize(app, module_name)
|
|
5
|
+
@app = app
|
|
6
|
+
@module_name = module_name
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
def run!
|
|
10
|
+
add_initializer_content
|
|
11
|
+
add_controller_content
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
private
|
|
15
|
+
def add_controller_content
|
|
16
|
+
content = app_controller_content.gsub(
|
|
17
|
+
'class ApplicationController < ActionController::Base',
|
|
18
|
+
"class ApplicationController < ActionController::Base\n include Forge::Controllers::#{module_name.camelize}\n"
|
|
19
|
+
)
|
|
20
|
+
File.open(app_controller_path, 'w') { |f| f.puts content }
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def add_initializer_content
|
|
24
|
+
content = "require 'forge/shared_controller_methods/#{module_name.downcase.underscore.gsub(/\s/, '_')}.rb'\n" + forge_initializer_content
|
|
25
|
+
File.open(forge_initializer_path, 'w') { |f| f.puts content }
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def app_controller_path
|
|
29
|
+
File.join(@app, 'app', 'controllers', 'application_controller.rb')
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def app_controller_content
|
|
33
|
+
@app_controller_content ||= File.read(app_controller_path)
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def forge_initializer_path
|
|
37
|
+
File.join(@app, 'config', 'initializers', 'forge.rb')
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
def forge_initializer_content
|
|
41
|
+
@forge_initializer_content ||= File.read(forge_initializer_path)
|
|
42
|
+
end
|
|
43
|
+
end
|
|
@@ -84,20 +84,25 @@ class ForgeCLI
|
|
|
84
84
|
end
|
|
85
85
|
files = Dir[File.join(source_path, '*.rb')]
|
|
86
86
|
@mod["migrations"].each do |migration|
|
|
87
|
-
#
|
|
88
|
-
|
|
89
|
-
|
|
87
|
+
# skip the migration if one already exists in the target path, e.g. if one was created
|
|
88
|
+
# as a result of a dependency already
|
|
89
|
+
target_files = Dir[File.join(destination_path, '*.rb')]
|
|
90
|
+
unless target_files.find {|f| f.match(%r{\d+_#{migration}.rb})}
|
|
91
|
+
# Get the old migration
|
|
92
|
+
source_file = files.find {|f| f.match(%r{\d+_#{migration}.rb})}
|
|
93
|
+
content = File.open(source_file, 'r').read
|
|
90
94
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
95
|
+
# Write the new one
|
|
96
|
+
timestamp = Time.now.strftime('%Y%m%d%H%M%S')
|
|
97
|
+
new_file_path = File.join(destination_path, "#{timestamp}_#{migration}.rb")
|
|
98
|
+
new_file = File.open(new_file_path, "w")
|
|
99
|
+
new_file.puts content
|
|
100
|
+
new_file.close
|
|
101
|
+
ForgeCLI::Output.write('migration', new_file_path.gsub("#{destination_path}/", ''))
|
|
98
102
|
|
|
99
|
-
|
|
100
|
-
|
|
103
|
+
# So that they have different timestamps
|
|
104
|
+
sleep 1
|
|
105
|
+
end
|
|
101
106
|
end
|
|
102
107
|
end
|
|
103
108
|
|
|
@@ -117,4 +122,4 @@ class ForgeCLI
|
|
|
117
122
|
end
|
|
118
123
|
end
|
|
119
124
|
end
|
|
120
|
-
end
|
|
125
|
+
end
|