Wednesday, August 17, 2016

Gradle

generate dependency tree

$ ./gradlew dependencies > dep.txt


generate dependency tree and refresh dependencies

$ ./gradlew dependencies > dep.txt --refresh-dependencies
The --refresh-dependencies option tells Gradle to ignore all cached entries for resolved modules and artifacts.

Ref: Listing project dependencies

create java project

$ gradle init --type java-application
More info at Build Init Plugin
Clean build.gradle file

eclipse - download sources and javadoc

apply plugin: 'java'
apply plugin: 'eclipse'

eclipse {
    classpath {
        downloadJavadoc = true
        downloadSources = true
    }
}

repositories {
    mavenCentral()
    mavenLocal()
}

$ gradle cleanEclipse eclipse

If mavenLocal() is present in your repositories, don't forget to put it at the bottom of the list.


add test sources from one project to second in multiproject environment

testCompile project(':sub-project').sourceSets.test.output

publish to local repository

$ ./gradlew publishToMavenLocal

Ref

https://stackoverflow.com/questions/28404149/how-to-download-javadocs-and-sources-for-jar-using-gradle-2-0

Tuesday, August 9, 2016

Angular.JS notes

Notes

AngularJS is a JavaScript framework. It can be added to an HTML page with a <script> tag.
AngularJS extends HTML attributes with Directives, and binds data to HTML with Expressions.




A Directive is a marker on a HTML tag that tells Angular to run or reference some JavaScript code.
Controllers are where we define our app’s behavior by defining functions and values.
Modules – where our application components live
Expressions – how values get displayed within the page

AngularJS Example

index.html
<!DOCTYPE html>
<html ng-app="gemStore">
  <head>
    <script type="text/javascript" src="angular.min.js"></script>
    <script type="text/javascript" src="app.js"></script>
  </head>
  
<body ng-controller="StoreController as store">
<div ng-repeat="product in store.products">
<h1>{{product.name}}</h1>
<h2> ${{product.price}}</h2>
<p> {{product.description}}</p>
<button ng-show="product.canPurchase">Add to Cart</button>
</div>
</body>
</html>

app.js
(function() {
var app = angular.module('gemStore', []);

app.controller('StoreController', function() {
// store data in the controller
this.products = gems;
});

var gems = [
{ name: 'Azurite', price: 2.95, description: 'Dobar za prodaju....', canPurchase : true },
{ name: 'Bloodstone', price: 5.95, description: 'Ne mozes kupiti', canPurchase : false },
{ name: 'Zircon', price: 3.95, description: 'ZZZZZZ', canPurchase : true }
];

})();

Ref