Skip to content

Commit

Permalink
Merge branch 'Linuus-feature/git-init'
Browse files Browse the repository at this point in the history
  • Loading branch information
jodosha committed Feb 27, 2015
2 parents 4048160 + 5b9ff42 commit bfd2453
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 0 deletions.
12 changes: 12 additions & 0 deletions lib/lotus/generators/application/container.rb
@@ -1,3 +1,4 @@
require 'shellwords'
require 'lotus/generators/abstract'
require 'lotus/generators/slice'

Expand Down Expand Up @@ -75,8 +76,19 @@ def start
cli.template(source.join(gitkeep), target.join(dir, gitkeep), opts)
end

unless git_dir_present?
cli.template(source.join('gitignore.tt'), target.join('.gitignore'), opts)
cli.run("git init #{Shellwords.escape(target)}", capture: true)
end

@slice_generator.start
end

private

def git_dir_present?
File.directory?(source.join('.git'))
end
end
end
end
Expand Down
2 changes: 2 additions & 0 deletions lib/lotus/generators/application/container/gitignore.tt
@@ -0,0 +1,2 @@
/db/<%= config[:app_name] %>_development
/db/<%= config[:app_name] %>_test
8 changes: 8 additions & 0 deletions test/commands/new_test.rb
Expand Up @@ -144,6 +144,14 @@ def container_options
end
end

describe '.gitignore' do
it 'generates it' do
content = @root.join('.gitignore').read
content.must_match %(/db/chirp_development)
content.must_match %(/db/chirp_test)
end
end

describe 'config/environment.rb' do
it 'generates it' do
content = @root.join('config/environment.rb').read
Expand Down

0 comments on commit bfd2453

Please sign in to comment.