I added subtree using:
git subtree add -P WLContainerControllers
https://github.com/an0/WLContainerControllers.git master
The resulting commit is:
commit bb77fe3c8244a42454b23285f174798116a5eaf8
Merge: 6686d73 755c342
Author: Ling Wang <xxx#gmail.com>
Date: Tue Jun 25 17:20:29 2013 -0500
Add 'WLContainerControllers/' from commit '755c342622fc6470e034f1b27e764329d7b8a01c'
git-subtree-dir: WLContainerControllers
git-subtree-mainline: 6686d73b438fc22514b36cdf76adf7ea9c35b558
git-subtree-split: 755c342622fc6470e034f1b27e764329d7b8a01c
Then after some upstream updates, I did a subtree pull using:
git subtree pull -P WLContainerControllers https://github.com/an0/WLContainerControllers.git master --squash
The output:
From https://github.com/an0/WLContainerControllers
* branch master -> FETCH_HEAD
Removing WLPageViewController/main.m
Removing WLPageViewController/en.lproj/InfoPlist.strings
Removing WLPageViewController/damping.m
Removing WLPageViewController/WLPageViewController.m
Removing WLPageViewController/WLPageViewController.h
Removing WLPageViewController/WLPageViewController-Prefix.pch
Removing WLPageViewController/WLPageViewController-Info.plist
Removing WLPageViewController/PageViewController.xib
Removing WLPageViewController/PageViewController.m
Removing WLPageViewController/PageViewController.h
Removing WLPageViewController/ModelController.m
Removing WLPageViewController/ModelController.h
Removing WLPageViewController/Default#2x.png
Removing WLPageViewController/Default.png
Removing WLPageViewController/Default-568h#2x.png
Removing WLPageViewController/DataViewController.xib
Removing WLPageViewController/DataViewController.m
Removing WLPageViewController/DataViewController.h
Removing WLPageViewController/AppDelegate.m
Removing WLPageViewController/AppDelegate.h
Removing WLPageViewController.xcodeproj/project.pbxproj
Removing WLContainerControllers/WLContainerControllers/README.md
Removing WLContainerControllers/WLContainerControllers/LICENSE
Removing WLContainerControllers/WLContainerControllers.xcodeproj/xcuserdata/an0.xcuserdatad/xcschemes/xcschememanagement.plist
Removing WLContainerControllers/WLContainerControllers.xcodeproj/xcuserdata/an0.xcuserdatad/xcschemes/WLContainerControllers.xcscheme
Removing WLContainerControllers/WLContainerControllers.xcodeproj/project.xcworkspace/xcuserdata/an0.xcuserdatad/WorkspaceState.xcuserstate
Removing WLContainerControllers/WLContainerControllers.xcodeproj/project.xcworkspace/contents.xcworkspacedata
Removing WLContainerControllers/WLContainerControllers.xcodeproj/project.pbxproj
Removing WLContainerControllers/WLContainerControllers.xcodeproj/an0.perspectivev3
Removing WLContainerControllers/WLContainerControllers.xcodeproj/an0.pbxuser
Removing WLContainerControllers/WLContainerControllers.xcodeproj/an0.mode1v3
Removing .gittrees
Merge made by the 'recursive' strategy.
.gittrees | 4 -
WLContainerControllers/WLContainerControllers/AppDelegate.h => AppDelegate.h | 0
WLContainerControllers/WLContainerControllers/AppDelegate.m => AppDelegate.m | 0
WLContainerControllers/WLContainerControllers/Default-568h#2x.png => Default-568h#2x.png | Bin
WLContainerControllers/WLContainerControllers/WLContainerController.h => WLContainerController.h | 0
WLContainerControllers/WLContainerControllers/WLContainerController.m => WLContainerController.m | 0
.../WLContainerControllers/WLContainerControllers-Info.plist => WLContainerControllers-Info.plist | 0
WLContainerControllers/WLContainerControllers.xcodeproj/an0.mode1v3 | 1403 ---------------------------------
WLContainerControllers/WLContainerControllers.xcodeproj/an0.pbxuser | 542 -------------
WLContainerControllers/WLContainerControllers.xcodeproj/an0.perspectivev3 | 1530 ------------------------------------
WLContainerControllers/WLContainerControllers.xcodeproj/project.pbxproj | 308 --------
WLContainerControllers/WLContainerControllers.xcodeproj/project.xcworkspace/contents.xcworkspacedata | 7 -
.../project.xcworkspace/xcuserdata/an0.xcuserdatad/WorkspaceState.xcuserstate | 2264 ------------------------------------------------------
.../WLContainerControllers.xcodeproj/xcuserdata/an0.xcuserdatad/xcschemes/WLContainerControllers.xcscheme | 76 --
.../WLContainerControllers.xcodeproj/xcuserdata/an0.xcuserdatad/xcschemes/xcschememanagement.plist | 22 -
WLContainerControllers/WLContainerControllers/LICENSE | 27 -
WLContainerControllers/WLContainerControllers/README.md | 4 -
.../WLContainerControllers/WLContainerControllers_Prefix.pch => WLContainerControllers_Prefix.pch | 0
.../WLContainerControllers/WLMultiContentContainerController.h => WLMultiContentContainerController.h | 0
.../WLContainerControllers/WLMultiContentContainerController.m => WLMultiContentContainerController.m | 0
WLPageViewController.xcodeproj/project.pbxproj | 372 ---------
WLPageViewController/AppDelegate.h | 15 -
WLPageViewController/AppDelegate.m | 52 --
WLPageViewController/DataViewController.h | 14 -
WLPageViewController/DataViewController.m | 37 -
WLPageViewController/DataViewController.xib | 236 ------
WLPageViewController/Default-568h#2x.png | Bin 18594 -> 0 bytes
WLPageViewController/Default.png | Bin 6540 -> 0 bytes
WLPageViewController/Default#2x.png | Bin 16107 -> 0 bytes
WLPageViewController/ModelController.h | 17 -
WLPageViewController/ModelController.m | 89 ---
WLPageViewController/PageViewController.h | 16 -
WLPageViewController/PageViewController.m | 68 --
WLPageViewController/PageViewController.xib | 133 ----
WLPageViewController/WLPageViewController-Info.plist | 45 --
WLPageViewController/WLPageViewController-Prefix.pch | 29 -
WLPageViewController/WLPageViewController.h | 48 --
WLPageViewController/WLPageViewController.m | 1098 --------------------------
WLPageViewController/damping.m | 53 --
WLPageViewController/en.lproj/InfoPlist.strings | 2 -
WLPageViewController/main.m | 18 -
WLContainerControllers/WLContainerControllers/main.m => main.m | 0
42 files changed, 8529 deletions(-)
delete mode 100644 .gittrees
rename WLContainerControllers/WLContainerControllers/AppDelegate.h => AppDelegate.h (100%)
rename WLContainerControllers/WLContainerControllers/AppDelegate.m => AppDelegate.m (100%)
rename WLContainerControllers/WLContainerControllers/Default-568h#2x.png => Default-568h#2x.png (100%)
rename WLContainerControllers/WLContainerControllers/WLContainerController.h => WLContainerController.h (100%)
rename WLContainerControllers/WLContainerControllers/WLContainerController.m => WLContainerController.m (100%)
rename WLContainerControllers/WLContainerControllers/WLContainerControllers-Info.plist => WLContainerControllers-Info.plist (100%)
delete mode 100644 WLContainerControllers/WLContainerControllers.xcodeproj/an0.mode1v3
delete mode 100644 WLContainerControllers/WLContainerControllers.xcodeproj/an0.pbxuser
delete mode 100644 WLContainerControllers/WLContainerControllers.xcodeproj/an0.perspectivev3
delete mode 100755 WLContainerControllers/WLContainerControllers.xcodeproj/project.pbxproj
delete mode 100644 WLContainerControllers/WLContainerControllers.xcodeproj/project.xcworkspace/contents.xcworkspacedata
delete mode 100644 WLContainerControllers/WLContainerControllers.xcodeproj/project.xcworkspace/xcuserdata/an0.xcuserdatad/WorkspaceState.xcuserstate
delete mode 100644 WLContainerControllers/WLContainerControllers.xcodeproj/xcuserdata/an0.xcuserdatad/xcschemes/WLContainerControllers.xcscheme
delete mode 100644 WLContainerControllers/WLContainerControllers.xcodeproj/xcuserdata/an0.xcuserdatad/xcschemes/xcschememanagement.plist
delete mode 100644 WLContainerControllers/WLContainerControllers/LICENSE
delete mode 100644 WLContainerControllers/WLContainerControllers/README.md
rename WLContainerControllers/WLContainerControllers/WLContainerControllers_Prefix.pch => WLContainerControllers_Prefix.pch (100%)
rename WLContainerControllers/WLContainerControllers/WLMultiContentContainerController.h => WLMultiContentContainerController.h (100%)
rename WLContainerControllers/WLContainerControllers/WLMultiContentContainerController.m => WLMultiContentContainerController.m (100%)
delete mode 100644 WLPageViewController.xcodeproj/project.pbxproj
delete mode 100644 WLPageViewController/AppDelegate.h
delete mode 100644 WLPageViewController/AppDelegate.m
delete mode 100644 WLPageViewController/DataViewController.h
delete mode 100644 WLPageViewController/DataViewController.m
delete mode 100644 WLPageViewController/DataViewController.xib
delete mode 100644 WLPageViewController/Default-568h#2x.png
delete mode 100644 WLPageViewController/Default.png
delete mode 100644 WLPageViewController/Default#2x.png
delete mode 100644 WLPageViewController/ModelController.h
delete mode 100644 WLPageViewController/ModelController.m
delete mode 100644 WLPageViewController/PageViewController.h
delete mode 100644 WLPageViewController/PageViewController.m
delete mode 100644 WLPageViewController/PageViewController.xib
delete mode 100644 WLPageViewController/WLPageViewController-Info.plist
delete mode 100644 WLPageViewController/WLPageViewController-Prefix.pch
delete mode 100644 WLPageViewController/WLPageViewController.h
delete mode 100644 WLPageViewController/WLPageViewController.m
delete mode 100644 WLPageViewController/damping.m
delete mode 100644 WLPageViewController/en.lproj/InfoPlist.strings
delete mode 100644 WLPageViewController/main.m
rename WLContainerControllers/WLContainerControllers/main.m => main.m (100%)
It messed up the who directory.
The related logs are:
commit 0eaebf9a4842e53a19d0ffbddf1dadee69ef4e11
Merge: 3093049 1efe88d
Author: Ling Wang <xxx#gmail.com>
Date: Tue Jun 25 18:02:27 2013 -0500
Merge commit '1efe88dd79cb6fd550fceaaa10d4b22dc44fb9df'
commit 1efe88dd79cb6fd550fceaaa10d4b22dc44fb9df
Author: Ling Wang <xxx#gmail.com>
Date: Tue Jun 25 18:02:27 2013 -0500
Squashed 'WLContainerControllers/' changes from 755c342..2f2ca9a
2f2ca9a Update project after moving LICENSE and README.md.
d052945 Move LICENSE and README.md to top folder.
git-subtree-dir: WLContainerControllers
git-subtree-split: 2f2ca9ac87a7eebcac590ffba32577dc93c4963f
I'm using git 1.8.3.1 installed via homebrew on OS X 10.8.4.
What's wrong with my usage of git subtree? How to correctly use it? Thanks.
I believe it is due to some bugs of git-subtree. More specifically, after reviewing the complete logs after git subtree add, I found my commit history is messed up — there is no trace of commit logs of the super tree(the top directory). So I cleaned it up manually, and redid it using the lasted git checked out from github. Everything seems all right. I tried a git subtree pull after changing upstream and it works well too.
Is git-subtree still too cutting-edge to use in real projects?
Related
I'm writing a custom virtual keyboard, which based on QtVirtualKeyboard. For my project I would need to be able to use my version of keyboard.
But the only method, which i found is recompile project and replace original "qtvirtualkeyboardplugin.dll" in "mingw53_32\plugins\platforminputcontexts" on my version of "qtvirtualkeyboardplugin.dll". And use the qputenv("QT_IM_MODULE", QByteArray("qtvirtualkeyboard")); function in main.cpp
After hours of reading the docs and trying various things I'm still cannot find method to use custom keyboard localy, without deleting original "qtvirtualkeyboardplugin.dll".
I'm assuming that you've forked the code, in which case the following modifications seem to be enough to get a differently named plugin to be installed to plugins/platforminputcontexts:
Rename qtvirtualkeyboard/src/virtualkeyboard/qtvirtualkeyboard.json to qtvirtualkeyboard/src/virtualkeyboard/customvirtualkeyboard.json.
In customvirtualkeyboard.json, rename the qtvirtualkeyboard key to customvirtualkeyboard.
In qtvirtualkeyboard/src/virtualkeyboard/plugin.cpp, change the contents of the pluginName string to customvirtualkeyboard.
In qtvirtualkeyboard/src/virtualkeyboard/plugin.h, change the FILE string to customvirtualkeyboard.
In src/virtualkeyboard/virtualkeyboard.pro, change TARGET = qtvirtualkeyboardplugin to TARGET = customvirtualkeyboardplugin. This affects the name of the installed .dll, .lib, etc. that you see in plugins/platforminputcontexts.
Here are the changes as a Git diff:
diff --git a/src/virtualkeyboard/customvirtualkeyboard.json b/src/virtualkeyboard/customvirtualkeyboard.json
new file mode 100644
index 0000000..9ef7a87
--- /dev/null
+++ b/src/virtualkeyboard/customvirtualkeyboard.json
## -0,0 +1,3 ##
+{
+ "Keys": [ "customvirtualkeyboard" ]
+}
diff --git a/src/virtualkeyboard/plugin.cpp b/src/virtualkeyboard/plugin.cpp
index 73ddeab..4abe9a4 100644
--- a/src/virtualkeyboard/plugin.cpp
+++ b/src/virtualkeyboard/plugin.cpp
## -76,7 +76,7 ## using namespace QtVirtualKeyboard;
Q_LOGGING_CATEGORY(qlcVirtualKeyboard, "qt.virtualkeyboard")
-static const char pluginName[] = "qtvirtualkeyboard";
+static const char pluginName[] = "customvirtualkeyboard";
static const char inputMethodEnvVarName[] = "QT_IM_MODULE";
static const char pluginUri[] = "QtQuick.VirtualKeyboard";
static const char pluginSettingsUri[] = "QtQuick.VirtualKeyboard.Settings";
diff --git a/src/virtualkeyboard/plugin.h b/src/virtualkeyboard/plugin.h
index 08074d1..19593a4 100644
--- a/src/virtualkeyboard/plugin.h
+++ b/src/virtualkeyboard/plugin.h
## -38,7 +38,7 ##
class QVirtualKeyboardPlugin : public QPlatformInputContextPlugin
{
Q_OBJECT
- Q_PLUGIN_METADATA(IID QPlatformInputContextFactoryInterface_iid FILE "qtvirtualkeyboard.json")
+ Q_PLUGIN_METADATA(IID QPlatformInputContextFactoryInterface_iid FILE "customvirtualkeyboard.json")
public:
QStringList keys() const;
diff --git a/src/virtualkeyboard/qtvirtualkeyboard.json b/src/virtualkeyboard/qtvirtualkeyboard.json
deleted file mode 100644
index 76d1706..0000000
--- a/src/virtualkeyboard/qtvirtualkeyboard.json
+++ /dev/null
## -1,3 +0,0 ##
-{
- "Keys": [ "qtvirtualkeyboard" ]
-}
diff --git a/src/virtualkeyboard/virtualkeyboard.pro b/src/virtualkeyboard/virtualkeyboard.pro
index 4f3ca69..e9b0ff9 100644
--- a/src/virtualkeyboard/virtualkeyboard.pro
+++ b/src/virtualkeyboard/virtualkeyboard.pro
## -1,4 +1,4 ##
-TARGET = qtvirtualkeyboardplugin
+TARGET = customvirtualkeyboardplugin
DATAPATH = $$[QT_INSTALL_DATA]/qtvirtualkeyboard
QMAKE_DOCS = $$PWD/doc/qtvirtualkeyboard.qdocconf
Remember that if you're using an open source license, you have to make modifications to Qt code available to users of your application.
when I do a git show commit of the first commit in a repository, I see all the files along with the diffs of the files (i.e all the lines being added)
$ git show cb5d132
commit cb5d13286cf9d14782f0e10445456dfe41072f55
Author: tw2 tw2LastName <tw2>
Date: Thu Oct 23 05:15:09 2014 -0400
Initial Commit
diff --git a/README.txt b/README.txt
new file mode 100644
index 0000000..96d156e
--- /dev/null
+++ b/README.txt
## -0,0 +1 ##
+First Line in README file!
\ No newline at end of file
The jgit show doesn't seem to get similar info, How can I get similar output using JGit API? I could use DiffFormatter, but it seems to require the baseTree and commitTree, wondering how I can get the DiffFormatter to work on the first commit in the repository.
ByteArrayOutputStream os = new ByteArrayOutputStream();
DiffFormatter df = new DiffFormatter( os )
RawTextComparator cmp = RawTextComparator.DEFAULT;
df.setRepository(repository);
df.setDiffComparator(cmp);
df.setDetectRenames(true);
// wondering how to use the API if we do not have baseCommit.
List<DiffEntry> diffEntries = df.scan(??baseCommitTree??, firstCommit.getTree());
for (DiffEntry diffEntry : diffEntries) {
df.format(diffEntry);
}
System.out.println(df.toString());
Use an o.e.jgit.treewalk.EmptyTreeIterator to compare the first commit against:
AbstractTreeIterator oldTreeIter = new EmptyTreeIterator();
ObjectReader reader = repository.newObjectReader();
AbstractTreeIterator newTreeIter = new CanonicalTreeParser(null, reader, firstCommit.getTree());
List<DiffEntry> diffEntries = df.scan(oldTreeIter, newTreeIter);
...
Fellow Eclim fans, I have been relegated to Windows, with cygwin as my only memory of a real operating system. Windows 7 is admittedly better than its predecessors, but I'm a pretty die-hard *nix fan. Anyway, I'm stuck. If anyone has any ideas, I'd be glad to hear them!
$ uname -a
CYGWIN_NT-6.1 AAXA22A492 1.7.32(0.274/5/3) 2014-08-13 23:06 x86_64 Cygwin
$ vim --version | head -3
VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Aug 25 2014 19:00:15)
Included patches: 1-417
Compiled by <cygwin#cygwin.com>
$ cat .vimrc
" required for eclime (and general sanity):
set nocompatible
filetype plugin indent on
syntax on
set tabstop=3 shiftwidth=3 expandtab
set ic
$ tree -L 2 .vim
.vim
|-- eclim
| |-- autoload
| |-- bin
| |-- compiler
| |-- dict
| |-- doc
| |-- ftplugin
| |-- indent
| |-- plugin
| `-- syntax
`-- plugin
`-- eclim.vim
11 directories, 1 file
$ vim
Error detected while processing function <SNR>8_Init..eclim#LoadVimSettings..ecl
im#UserHome..eclim#cygwin#WindowsHome..<SNR>10_Cygpath..eclim#util#System..eclim
#util#EchoTrace:
line 7:
E121: Undefined variable: g:EclimHighlightTrace
E116: Invalid arguments for function <SNR>11_EchoLevel
Error detected while processing function <SNR>8_Init..eclim#LoadVimSettings..ecl
im#UserHome..eclim#cygwin#WindowsHome..<SNR>10_Cygpath:
line 6:
E171: Missing :endif
Error detected while processing function <SNR>8_Init..eclim#LoadVimSettings..ecl
im#UserHome..eclim#cygwin#WindowsHome:
line 2:
E171: Missing :endif
Error detected while processing function <SNR>8_Init..eclim#LoadVimSettings..ecl
im#UserHome:
line 3:
E171: Missing :endif
Press ENTER or type command to continue
Eric solved this problem on this thread -- solution copied below.
Thanks Eric!
--- a/org.eclim.core/vim/eclim/autoload/eclim.vim
+++ b/org.eclim.core/vim/eclim/autoload/eclim.vim
## -352,6 +350,11 ## function! eclim#ShutdownEclim() " {{{
endfunction " }}}
function! eclim#LoadVimSettings() " {{{
+ if !exists('g:EclimLogLevel')
+ let g:EclimLogLevel = 'info'
+ let g:EclimHighlightTrace = 'Normal'
+ endif
+
let settings_file = eclim#UserHome() . '/.eclim/.eclim_settings'
if filereadable(settings_file)
let lines = readfile(settings_file)
--- a/org.eclim.core/vim/eclim/autoload/eclim/client/nailgun.vim
+++ b/org.eclim.core/vim/eclim/autoload/eclim/client/nailgun.vim
## -153,7 +153,7 ## function! eclim#client#nailgun#GetEclimCommand(home) " {{{
if has('win32unix')
" in cygwin, we must use 'cmd /c' to prevent issues with eclim script +
" some arg containing spaces causing a failure to invoke the script.
- return 'cmd /c "' . eclim#cygwin#WindowsPath(command) . '"'
+ return [0, 'cmd /c "' . eclim#cygwin#WindowsPath(command) . '"']
endif
return [0, '"' . command . '"']
endfunction " }}}
I am trying to apply an outOfOrder migration using maven on a "production support" branch (i.e. V3.1). The 3.1 branch has 12 migrations 3.1.0.1 through 3.1.0.12. The first 11 have been applied and in my development environment I have two migrations from the next release 3.3 already applied. the info looks like this:
+----------------+----------------------------+---------------------+---------+
| Version | Description | Installed on | State |
+----------------+----------------------------+---------------------+---------+
| 1 | > | 2013-08-16 16:35:22 | Success |
| 3.1.0.1 | CCI DDL | 2013-08-16 16:41:04 | Success |
| 3.1.0.2 | Update 1 | 2013-08-19 12:17:43 | Success |
| 3.1.0.3 | Add SVT ITEM HISTORY | 2013-08-21 16:24:28 | Success |
| 3.1.0.4 | Drop Col Event Key From ED | 2013-08-27 14:15:36 | Success |
| 3.1.0.5 | Add Job Begin Time COL | 2013-10-10 14:59:14 | Success |
| 3.1.0.6 | Update SVT Column Lengths | 2013-10-23 10:25:33 | Success |
| 3.1.0.7 | Add Seq Number to EDC ECRF | 2013-12-03 14:59:31 | Success |
| 3.1.0.8 | Set EDC ECRF ITEM Seq Numb | 2013-12-03 15:27:08 | Success |
| 3.1.0.9 | Add Table EDC USV FORM | 2013-12-03 15:37:47 | Success |
| 3.1.0.10 | Add Table SVT USV FORM MAP | 2013-12-03 15:52:24 | Success |
| 3.1.0.11 | Add Tables SUBJECT VISIT Q | 2014-04-29 17:09:13 | OutOrde |
| 3.1.0.12 | Add Table BOGUS ERIC TEST | | Ignored |
| 3.3.0.1 | Insert iMedidata CRS Info | 2014-04-24 10:50:38 | Future |
| 3.3.0.2 | Insert Study OBJECT TYPE | 2014-04-24 11:14:37 | Future |
+----------------+----------------------------+---------------------+---------+
I run the following command in my mvn build output folder in the V3.1 branch:
mvn flyway:migrate -Dflyway.outOfOrder=true -P
and I get the following output:
[ERROR] Failed to execute goal org.flywaydb:flyway-maven-plugin:3.0:migrate (default-cli) on project mdmws: org.flywaydb.core.api.FlywayException: Validate failed. Found differences between applied migrations and available migrations: Detected applied migration missing on the classpath: 3.3.0.1 -> [Help 1]
It seems to want to find the 3.3 migrations that have already been applied to the database in the same classpath target/db/migrations folder, but of course these files exist in a later release branch. Either I am missing some configuration setting or I do not understand the way the outOfOrder works. I do not want to pull these files back from the V3.3 branch to the V3.1 branch.
Can somebody please help explain?
My pom inherits the following from a parent pom and most of the configuration values are passed in from the profile:
<groupId>org.flywaydb</groupId>
<artifactId>flyway-maven-plugin</artifactId>
<version>3.0</version>
<configuration>
<driver>${flyway.driver}</driver>
<url>${flyway.url}</url>
<user>${flyway.user}</user>
<password>${flyway.password}</password>
<outOfOrder>${flyway.outOfOrder}</outOfOrder>
</configuration>
<dependencies>
<dependency>
<groupId>com.oracle.ojdbc</groupId>
<artifactId>ojdbc6</artifactId>
<version>11.2.0.3</version>
</dependency>
</dependencies>
</plugin>
Set validateOnMigrate to false and you should be OK. By default it will check whether the resolved and the applied migrations match. In your specific situation this won't work, so you have to disable it.
That's my solution. I configured flyway in Java code. Yes, I set validateOnMigrate - false.
#Bean(name = "flyway")
#Lazy(false)
public Flyway buildConfiguredFlyway() {
Flyway flyway = configure();
if (!validate(flyway)) {
migrate(flyway);
}
return flyway;
}
private Flyway configure() {
Flyway flyway = new Flyway();
flyway.setDataSource(datasource);
flyway.setBaselineOnMigrate(true);//Create meta-data table if it did not exist.
flyway.setValidateOnMigrate(false);
return flyway;
}
private boolean validate(Flyway flyway) {
try {
flyway.validate();
return true;
} catch (FlywayException o) {
return false;
}
}
private void migrate(Flyway flyway) {
try {
int result = flyway.migrate();
LOGGER.info("Number of DB mirgations successfully applied: " + result);
} catch (FlywayException e) {
LOGGER.error(e.getMessage(), e);
((ConfigurableApplicationContext) applicationContext).stop();
}
}
I just got started with SBT.
To add a custom action, I made a following task and add that .scala file to 'project' folder as SBT wiki guides.
//MyProject.scala
import sbt._
class HelloWorldProject(info: ProjectInfo) extends DefaultProject(info)
{
lazy val hi = task { println("Hello World"); None }
}
after adding the scala src file for configuration, layout of the project folder look like this.
/development/scala/SomeScalaProject/
|~lib/
|~project/
| |~boot/
| | |~scala-2.7.7/
| | | |~lib/
| | | | |-scala-compiler.jar [RO]
| | | | `-scala-library.jar [RO]
| | | `~org.scala-tools.sbt/
| | | `~sbt/
| | | `+0.7.4/
| | |~scala-2.8.1/
| | | `~lib/
| | | |-scala-compiler.jar [RO]
| | | `-scala-library.jar [RO]
| | `-sbt.boot.lock
| |-build.properties
| |
| `-MyProject.scala //here
|
|+src/
But even after 'reload' or 'update', running the hi task in SBT is not available at all. what am i missing?
D:\development\scala\SBEStudy>java -Xmx512M -jar "D:\development\.common\sbt-la
nch-0.7.4.jar" update
[info] Building project SomeScalaProject 1.0 against Scala 2.8.1
[info] using sbt.DefaultProject with sbt 0.7.4 and Scala 2.7.7
[info]
[info] == update ==
[warn] No dependency configuration found, using defaults.
[info] :: retrieving :: nephilim.practice#scalabyexample_2.8.1 [sync]
[info] confs: [default]
[info] 0 artifacts copied, 0 already retrieved (0kB/391ms)
[info] == update ==
[success] Successful.
[info]
[info] Total time: 1 s, completed 2010. 12. 8 오후 7:14:39
[info]
[info] Total session time: 2 s, completed 2010. 12. 8 오후 7:14:39
[success] Build completed successfully.
> reload
[info] Building project SomeScalaProject 1.0 against Scala 2.8.1
[info] using sbt.DefaultProject with sbt 0.7.4 and Scala 2.7.7
> hi
[error] No action named 'hi' exists.
[info] Execute 'help' for a list of commands or 'actions' for a list of availab
e project actions and methods.
It was my mistake. :(
"MyProject.scala" should be located under /project/build directory instead of /project directory.