8000 Keep instantiated generator · stephancom/activeadmin@b2fcfc6 · GitHub
[go: up one dir, main page]

Skip to content

Commit b2fcfc6

Browse files
Keep instantiated generator
So we can ask any information about the generated application that we need.
1 parent 7b7a2bf commit b2fcfc6

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

tasks/application_generator.rb

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,10 @@ def generate
3333

3434
Bundler.with_original_env { abort unless Kernel.system(env, command) }
3535
end
36+
end
3637

37-
app_dir
38+
def app_dir
39+
@app_dir ||= "#{base_dir}/#{app_name}"
3840
end
3941

4042
private
@@ -43,10 +45,6 @@ def base_dir
4345
@base_dir ||= rails_env == 'test' ? 'tmp/rails' : '.test-rails-apps'
4446
end
4547

46-
def app_dir
47-
@app_dir ||= "#{base_dir}/#{app_name}"
48-
end
49-
5048
def app_name
5149
return "rails_52" if main_app?
5250

tasks/local.rake

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,12 @@ require_relative "application_generator"
22

33
desc 'Run a command against the local sample application'
44
task :local do
5-
app_folder = ActiveAdmin::ApplicationGenerator.new(
5+
generator = ActiveAdmin::ApplicationGenerator.new(
66
rails_env: 'development',
77
template: 'rails_template_with_data'
8-
).generate
8+
)
9+
10+
generator.generate
911

1012
# Discard the "local" argument (name of the task)
1113
argv = ARGV[1..-1]
@@ -20,7 +22,7 @@ task :local do
2022
gemfile = ENV['BUNDLE_GEMFILE'] || File.expand_path("../Gemfile", __dir__)
2123
env = { 'BUNDLE_GEMFILE' => gemfile }
2224

23-
Dir.chdir(app_folder) do
25+
Dir.chdir(generator.app_dir) do
2426
Bundler.with_original_env { Kernel.exec(env, command) }
2527
end
2628
end

0 commit comments

Comments
 (0)
0