Class: MigrationBundler::Targets::MavenGitTarget
- Inherits:
-
Base
- Object
- Thor
- Base
- MigrationBundler::Targets::MavenGitTarget
show all
- Defined in:
- lib/migration_bundler/targets/maven_git/maven_git_target.rb
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Base
#drop, #dump, #load, #new, register_with_cli, source_root
Methods included from Actions
#bundle, #git, #git_add, #truncate_database, #unique_tag_for_version
Class Method Details
.name ⇒ Object
6
7
8
|
# File 'lib/migration_bundler/targets/maven_git/maven_git_target.rb', line 6
def self.name
'maven_git'
end
|
Instance Method Details
#generate ⇒ Object
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
# File 'lib/migration_bundler/targets/maven_git/maven_git_target.rb', line 19
def generate
invoke :validate
remove_file "project"
empty_directory "project"
empty_directory "project/src"
empty_directory "project/src/main"
empty_directory "project/src/main/resources"
empty_directory "project/src/main/resources/schema"
copy_file "project/build.gradle", "project/build.gradle"
FileUtils.cp_r project.schema_path, "project/src/main/resources/schema/schema.sql"
FileUtils.cp_r project.migrations_path, "project/src/main/resources"
version = unique_tag_for_version(migrations.latest_version)
run "cd project && gradle#{options['quiet'] && ' -q '} -Pversion=#{version} -PgitRepoHome='' -Prepo=#{maven_git_repo_name} -Porg=#{maven_git_org_name} clean jar"
end
|
#init ⇒ Object
10
11
12
13
14
15
16
17
|
# File 'lib/migration_bundler/targets/maven_git/maven_git_target.rb', line 10
def init
unless project.config['maven_git.repo.name']
project.config['maven_git.repo.name'] = ask("What is the name of your Maven Github repo? ")
end
unless project.config['maven_git.org.name']
project.config['maven_git.org.name'] = ask("What is the name of your Github Organization? ")
end
end
|
#push ⇒ Object
41
42
43
44
45
46
47
|
# File 'lib/migration_bundler/targets/maven_git/maven_git_target.rb', line 41
def push
invoke :validate
version = project.git_latest_tag
Dir.mktmpdir do |temp_dir_path|
run "cd project && gradle#{options['quiet'] && ' -q'} -Pversion=#{version} -PgitRepoHome=#{temp_dir_path} -Prepo=#{maven_git_repo_name} -Porg=#{maven_git_org_name} publishToGithub"
end
end
|
#validate ⇒ Object
36
37
38
39
|
# File 'lib/migration_bundler/targets/maven_git/maven_git_target.rb', line 36
def validate
fail Error, "Invalid configuration: maven_git.repo.name is not configured." unless maven_git_repo_name
fail Error, "Invalid configuration: maven_git.org.name is not configured." unless maven_git_org_name
end
|