Class: MigrationBundler::Targets::MavenTarget
- Inherits:
-
Base
- Object
- Thor
- Base
- MigrationBundler::Targets::MavenTarget
show all
- Defined in:
- lib/migration_bundler/targets/maven/maven_target.rb
Instance Method Summary
collapse
Methods inherited from Base
#drop, #dump, #load, name, #new, register_with_cli, source_root
Methods included from Actions
#bundle, #git, #git_add, #truncate_database, #unique_tag_for_version
Instance Method Details
#generate ⇒ Object
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
# File 'lib/migration_bundler/targets/maven/maven_target.rb', line 18
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} clean jar"
end
|
#init ⇒ Object
6
7
8
9
10
11
12
13
14
15
16
|
# File 'lib/migration_bundler/targets/maven/maven_target.rb', line 6
def init
unless project.config['maven.url']
project.config['maven.url'] = ask("What is the URL of your Java Maven repo? ")
end
unless project.config['maven.username']
project.config['maven.username'] = ask("What is the username for your Java Maven repo? ")
end
unless project.config['maven.password']
project.config['maven.password'] = ask("What is the password for your Java Maven repo? ")
end
end
|
#push ⇒ Object
41
42
43
44
45
|
# File 'lib/migration_bundler/targets/maven/maven_target.rb', line 41
def push
invoke :validate
version = project.git_latest_tag
run "cd project && gradle#{options['quiet'] && ' -q'} -Pversion=#{version} -Purl=#{maven_url} -Pusername=#{maven_username} -Ppassword=#{maven_password} publish"
end
|
#validate ⇒ Object
35
36
37
38
39
|
# File 'lib/migration_bundler/targets/maven/maven_target.rb', line 35
def validate
fail Error, "Invalid configuration: maven.repo is not configured." unless maven_url
fail Error, "Invalid configuration: maven.username is not configured." unless maven_username
fail Error, "Invalid configuration: maven.password is not configured." unless maven_password
end
|