forge-cli 0.0.9 → 0.0.10

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.
@@ -12,7 +12,7 @@ class ForgeCLI::App < Thor
12
12
  app = Dir.pwd
13
13
  modules = modules.split(',')
14
14
  modules.each do |mod|
15
- ForgeCLI::ModuleInstaller.install_module!(app, mod)
15
+ ForgeCLI::ModuleInstaller.install_module!(mod, app)
16
16
  end
17
17
  end
18
18
 
@@ -8,30 +8,32 @@ class ForgeCLI::ApplicationCreator < ForgeCLI::App
8
8
  @modules = modules
9
9
  end
10
10
 
11
- def create_application!
12
- system("/usr/bin/env rails new #{@app}")
13
- ForgeCLI::ModuleInstaller.install_module!(:base, @app)
14
- @modules.each do |mod|
15
- ForgeCLI::ModuleInstaller.install_module!(mod, @app)
16
- end
11
+ no_commands do
12
+ def create_application!
13
+ system("/usr/bin/env rails new #{@app}")
14
+ ForgeCLI::ModuleInstaller.install_module!(:base, @app)
15
+ @modules.each do |mod|
16
+ ForgeCLI::ModuleInstaller.install_module!(mod, @app)
17
+ end
17
18
 
18
- # Remove some base Rails files that we don't want
19
- remove_file File.join(@app, 'app', 'views', 'layouts', 'application.html.erb')
20
- remove_file File.join(@app, 'app', 'assets', 'stylesheets', 'application.css')
21
- remove_file File.join(@app, 'public', 'index.html')
22
- remove_file File.join(@app, 'Gemfile.lock')
19
+ # Remove some base Rails files that we don't want
20
+ remove_file File.join(@app, 'app', 'views', 'layouts', 'application.html.erb')
21
+ remove_file File.join(@app, 'app', 'assets', 'stylesheets', 'application.css')
22
+ remove_file File.join(@app, 'public', 'index.html')
23
+ remove_file File.join(@app, 'Gemfile.lock')
23
24
 
24
25
 
25
- STDOUT.puts completed_message
26
- end
26
+ STDOUT.puts completed_message
27
+ end
27
28
 
28
- def completed_message
29
- %{
29
+ def completed_message
30
+ %{
30
31
  #{"Your new Forge site is almost ready! Next steps:".foreground(:cyan)}
31
32
  1. Run 'bundle install'
32
33
  2. Set up config/database.yml
33
34
  3. Run 'rake db:migrate'
34
35
  4. Run 'rake forge:create_admin
35
- }
36
+ }
37
+ end
36
38
  end
37
39
  end
@@ -4,37 +4,39 @@ class ForgeCLI::RouteInstaller < Thor
4
4
  @module_path = module_path
5
5
  end
6
6
 
7
- def install_routes(type = :normal)
8
- file = File.join(@app, 'config', 'routes.rb')
9
- existing_routes = File.read(file)
10
- if type.to_sym == :normal
11
- routes_to_add = routes
12
- line = "Application.routes.draw do"
13
- indent = 2
14
- else
15
- routes_to_add = self.send("#{type}_routes")
16
- line = "namespace :#{type} do"
17
- indent = 4
7
+ no_commands do
8
+ def install_routes(type = :normal)
9
+ file = File.join(@app, 'config', 'routes.rb')
10
+ existing_routes = File.read(file)
11
+ if type.to_sym == :normal
12
+ routes_to_add = routes
13
+ line = "Application.routes.draw do"
14
+ indent = 2
15
+ else
16
+ routes_to_add = self.send("#{type}_routes")
17
+ line = "namespace :#{type} do"
18
+ indent = 4
19
+ end
20
+ routes = routes_to_add.split("\n").map {|r| " " * indent + r }.join("\n")
21
+ updated_routes = existing_routes.gsub(line, "#{line}\n#{routes}")
22
+ File.open(file, 'w') do |f|
23
+ f.puts updated_routes
24
+ end
18
25
  end
19
- routes = routes_to_add.split("\n").map {|r| " " * indent + r }.join("\n")
20
- updated_routes = existing_routes.gsub(line, "#{line}\n#{routes}")
21
- File.open(file, 'w') do |f|
22
- f.puts updated_routes
23
- end
24
- end
25
26
 
26
- def routes
27
- @routes ||= get_routes
28
- end
27
+ def routes
28
+ @routes ||= get_routes
29
+ end
29
30
 
30
- def forge_routes
31
- @forge_routes ||= get_routes('forge_')
32
- end
31
+ def forge_routes
32
+ @forge_routes ||= get_routes('forge_')
33
+ end
33
34
 
34
- def get_routes(prefix = '')
35
- file = File.join(@module_path, "#{prefix}routes.rb")
36
- if File.exist?(file)
37
- File.open(file, "r").read
35
+ def get_routes(prefix = '')
36
+ file = File.join(@module_path, "#{prefix}routes.rb")
37
+ if File.exist?(file)
38
+ File.open(file, "r").read
39
+ end
38
40
  end
39
41
  end
40
42
  end
@@ -1,3 +1,3 @@
1
1
  class ForgeCLI
2
- VERSION = '0.0.9'
2
+ VERSION = '0.0.10'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: forge-cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.9
4
+ version: 0.0.10
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: