Skip to content
Browse files

first commit

  • Loading branch information...
0 parents commit 7b047fbe0e24bea8a45fbd9b1daa90cd7745fe6e @pulse00 committed Sep 6, 2012
36 .classpath
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" output="target/classes" path="src/main/java">
+ <attributes>
+ <attribute name="optional" value="true"/>
+ <attribute name="maven.pomderived" value="true"/>
+ </attributes>
+ </classpathentry>
+ <classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
+ <attributes>
+ <attribute name="maven.pomderived" value="true"/>
+ </attributes>
+ </classpathentry>
+ <classpathentry kind="src" output="target/test-classes" path="src/test/java">
+ <attributes>
+ <attribute name="optional" value="true"/>
+ <attribute name="maven.pomderived" value="true"/>
+ </attributes>
+ </classpathentry>
+ <classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources">
+ <attributes>
+ <attribute name="maven.pomderived" value="true"/>
+ </attributes>
+ </classpathentry>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5">
+ <attributes>
+ <attribute name="maven.pomderived" value="true"/>
+ </attributes>
+ </classpathentry>
+ <classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
+ <attributes>
+ <attribute name="maven.pomderived" value="true"/>
+ </attributes>
+ </classpathentry>
+ <classpathentry kind="output" path="target/classes"/>
+</classpath>
2 .gitignore
@@ -0,0 +1,2 @@
+.DS_Store
+target
23 .project
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>composer</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.m2e.core.maven2Builder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ <nature>org.eclipse.m2e.core.maven2Nature</nature>
+ </natures>
+</projectDescription>
5 .settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,5 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
+org.eclipse.jdt.core.compiler.source=1.5
4 .settings/org.eclipse.m2e.core.prefs
@@ -0,0 +1,4 @@
+activeProfiles=
+eclipse.preferences.version=1
+resolveWorkspaceProjects=true
+version=1
0 README.md
No changes.
20 pom.xml
@@ -0,0 +1,20 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>com.dubture</groupId>
+ <artifactId>composer</artifactId>
+ <version>0.0.1-SNAPSHOT</version>
+ <name>Java Composer API</name>
+ <description>Javabindings for the PHP dependency manager composer </description>
+ <dependencies>
+ <dependency>
+ <groupId>com.google.code.gson</groupId>
+ <artifactId>gson</artifactId>
+ <version>2.2.2</version>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.10</version>
+ </dependency>
+ </dependencies>
+</project>
42 src/main/java/com/dubture/composer/Autoload.java
@@ -0,0 +1,42 @@
+/*
+ * * This file is part of the PHPPackage Eclipse Plugin.
+ *
+ * (c) Robert Gruendler <r.gruendler@gmail.com>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+package com.dubture.composer;
+
+import java.util.Iterator;
+import java.util.Map;
+
+/**
+ *
+ */
+public class Autoload
+{
+ private Map<String, String> psr_0;
+
+ public String getPSR0Path()
+ {
+ if (psr_0 == null) {
+ return null;
+ }
+ Iterator<String> it = getPsr_0().keySet().iterator();
+ while(it.hasNext()) {
+ return psr_0.get(it.next());
+ }
+ return null;
+ }
+
+ public Map<String, String> getPsr_0()
+ {
+ return psr_0;
+ }
+
+ public void setPsr_0(Map<String, String> psr_0)
+ {
+ this.psr_0 = psr_0;
+ }
+}
36 src/main/java/com/dubture/composer/ComposerFieldNamingStrategy.java
@@ -0,0 +1,36 @@
+/*
+ * This file is part of the PHPPackage Eclipse Plugin.
+ *
+ * (c) Robert Gruendler <r.gruendler@gmail.com>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+package com.dubture.composer;
+
+import java.lang.reflect.Field;
+
+import com.google.gson.FieldNamingStrategy;
+
+/**
+ *
+ * @author Robert Gruendler <r.gruendler@gmail.com>
+ */
+public class ComposerFieldNamingStrategy implements FieldNamingStrategy
+{
+
+ public String translateName(Field field)
+ {
+ if (field.getName() == "psr_0") {
+ return "psr-0";
+ } else if (field.getName() == "targetDir") {
+ return "target-dir";
+ } else if (field.getName() == "requireDev") {
+ return "require-dev";
+ } else if (field.getName() == "phpPackage") {
+ return "package";
+ }
+
+ return field.getName();
+ }
+}
22 src/main/java/com/dubture/composer/License.java
@@ -0,0 +1,22 @@
+package com.dubture.composer;
+
+public class License {
+
+ private String[] names;
+
+ public License() {
+ names = new String[]{};
+ }
+
+ public License(String[] names) {
+ this.names = names;
+ }
+
+ public String[] getNames() {
+ return names;
+ }
+
+ public void setNames(String[] names) {
+ this.names = names;
+ }
+}
41 src/main/java/com/dubture/composer/LicenseDeserializer.java
@@ -0,0 +1,41 @@
+package com.dubture.composer;
+
+import java.lang.reflect.GenericArrayType;
+import java.lang.reflect.Type;
+
+import com.google.gson.JsonArray;
+import com.google.gson.JsonDeserializationContext;
+import com.google.gson.JsonDeserializer;
+import com.google.gson.JsonElement;
+import com.google.gson.JsonParseException;
+
+/**
+ *
+ * @see http://getcomposer.org/doc/04-schema.md#license
+ * @author Robert Gruendler <r.gruendler@gmail.com>
+ *
+ */
+public class LicenseDeserializer implements JsonDeserializer<License> {
+
+ public License deserialize(JsonElement element, Type type,
+ JsonDeserializationContext context) throws JsonParseException {
+
+ License license = new License();
+
+ if (type instanceof GenericArrayType) {
+
+ JsonArray jsonArray = element.getAsJsonArray();
+ String[] licenses = new String[jsonArray.size()];
+ int i = 0;
+
+ for (JsonElement child : jsonArray) {
+ licenses[i++] = child.getAsString();
+ }
+ license.setNames(licenses);
+ } else {
+ license.setNames(new String[]{element.getAsString()});
+ }
+
+ return license;
+ }
+}
198 src/main/java/com/dubture/composer/PHPPackage.java
@@ -0,0 +1,198 @@
+/*
+ * This file is part of the PHPPackage Eclipse Plugin.
+ *
+ * (c) Robert Gruendler <r.gruendler@gmail.com>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+package com.dubture.composer;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.lang.reflect.GenericArrayType;
+import java.lang.reflect.Type;
+import java.util.Map;
+
+import com.google.gson.Gson;
+import com.google.gson.GsonBuilder;
+import com.google.gson.JsonArray;
+import com.google.gson.JsonDeserializationContext;
+import com.google.gson.JsonDeserializer;
+import com.google.gson.JsonElement;
+import com.google.gson.JsonParseException;
+
+/**
+ *
+ */
+public class PHPPackage
+{
+ private String name;
+ private String type;
+ private String description;
+ private String homepage;
+ private String url;
+ private String fullPath;
+ private Map<String, String> require;
+ private Map<String, String> requireDev;
+ private Autoload autoload;
+ private String targetDir;
+
+ public String version;
+ public String versionNormalized;
+
+ public License license;
+
+ public String[] keywords;
+
+ public Map<String, PHPPackage> versions;
+
+ public String toString()
+ {
+ return getName();
+ }
+
+ public String getType()
+ {
+ return type;
+ }
+
+ public void setType(String type)
+ {
+ this.type = type;
+ }
+
+ public String getDescription()
+ {
+ return description;
+ }
+
+ public void setDescription(String description)
+ {
+ this.description = description;
+ }
+
+ public String getHomepage()
+ {
+ return homepage;
+ }
+
+ public void setHomepage(String homepage)
+ {
+ this.homepage = homepage;
+ }
+
+ public Map<String, String> getRequire()
+ {
+ return require;
+ }
+
+ public void setRequire(Map<String, String> require)
+ {
+ this.require = require;
+ }
+
+ public Autoload getAutoload()
+ {
+ return autoload;
+ }
+
+ public void setAutoload(Autoload autoload)
+ {
+ this.autoload = autoload;
+ }
+
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public static PHPPackage fromJson(File input) throws FileNotFoundException
+ {
+ Gson gson = getBuilder();
+ InputStream stream = new FileInputStream(input);
+ InputStreamReader reader = new InputStreamReader(stream);
+ PHPPackage pHPPackage = gson.fromJson(reader, PHPPackage.class);
+ pHPPackage.setFullPath(input.getAbsolutePath());
+
+ return pHPPackage;
+
+ }
+
+ protected static Gson getBuilder()
+ {
+ return new GsonBuilder()
+ .registerTypeAdapter(License.class, new LicenseDeserializer())
+ .setFieldNamingStrategy(new ComposerFieldNamingStrategy())
+ .create();
+ }
+
+ @Override
+ public int hashCode()
+ {
+ return getName().hashCode();
+ }
+
+ public String getTargetDir()
+ {
+ return targetDir;
+ }
+
+ public void setTargetDir(String targetDir)
+ {
+ this.targetDir = targetDir;
+ }
+
+ public String getFullPath()
+ {
+ return fullPath;
+ }
+
+ public void setFullPath(String fullPath)
+ {
+ this.fullPath = fullPath;
+ }
+
+ public Map<String, String> getRequireDev()
+ {
+ return requireDev;
+ }
+
+ public void setRequireDev(Map<String, String> requireDev)
+ {
+ this.requireDev = requireDev;
+ }
+
+ public void setName(String name)
+ {
+ this.name = name;
+ }
+
+ public String getUrl()
+ {
+ return url;
+ }
+
+ public void setUrl(String url)
+ {
+ this.url = url;
+ }
+
+ public String getDefaultVersion()
+ {
+ return versions.keySet().iterator().next();
+ }
+
+ public String getPackageName(String version) throws Exception
+ {
+ if (!versions.containsKey(version)) {
+ throw new Exception("Invalid version " + version + " for package " + name);
+ }
+
+ return String.format("%s:%s", name, version);
+ }
+}
10 src/main/java/com/dubture/composer/PackageAuthor.java
@@ -0,0 +1,10 @@
+package com.dubture.composer;
+
+public class PackageAuthor
+{
+ public String name;
+ public String email;
+ public String homepage;
+ public String role;
+
+}
45 src/main/resources/composer.json
@@ -0,0 +1,45 @@
+{
+ "name": "friendsofsymfony/user-bundle",
+ "type": "symfony-bundle",
+ "description": "Symfony FOSUserBundle",
+ "keywords": ["User management"],
+ "homepage": "http://friendsofsymfony.github.com",
+ "license": "MIT",
+ "authors": [
+ {
+ "name": "Christophe Coevoet",
+ "email": "stof@notk.org"
+ },
+ {
+ "name": "Thibault Duplessis",
+ "email": "thibault.duplessis@gmail.com"
+ },
+ {
+ "name": "FriendsOfSymfony Community",
+ "homepage": "https://github.com/friendsofsymfony/FOSUserBundle/contributors"
+ }
+ ],
+ "minimum-stability": "dev",
+ "require": {
+ "php": ">=5.3.2",
+ "symfony/framework-bundle": "2.1.*",
+ "symfony/security-bundle": "2.1.*"
+ },
+ "require-dev": {
+ "twig/twig": "*",
+ "doctrine/doctrine-bundle": "*",
+ "swiftmailer/swiftmailer": "*",
+ "willdurand/propel-typehintable-behavior": "dev-master",
+ "symfony/yaml": "2.1.*",
+ "symfony/validator": "2.1.*"
+ },
+ "autoload": {
+ "psr-0": { "FOS\\UserBundle": "" }
+ },
+ "target-dir": "FOS/UserBundle",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "2.0.x-dev"
+ }
+ }
+}
485 src/main/resources/packagist.json
@@ -0,0 +1,485 @@
+{
+ "package":{
+ "name":"friendsofsymfony\/user-bundle",
+ "description":"Symfony FOSUserBundle",
+ "maintainers":[
+ {
+ "name":"Stof",
+ "email":"stof@notk.org"
+ }
+ ],
+ "versions":{
+ "dev-master":{
+ "name":"friendsofsymfony\/user-bundle",
+ "description":"Symfony FOSUserBundle",
+ "keywords":[
+ "User management"
+ ],
+ "homepage":"http:\/\/friendsofsymfony.github.com",
+ "version":"dev-master",
+ "version_normalized":"9999999-dev",
+ "license":[
+ "MIT"
+ ],
+ "authors":[
+ {
+ "name":"Christophe Coevoet",
+ "email":"stof@notk.org"
+ },
+ {
+ "name":"Thibault Duplessis",
+ "email":"thibault.duplessis@gmail.com",
+ "homepage":"http:\/\/ornicar.github.com"
+ },
+ {
+ "name":"FriendsOfSymfony Community",
+ "homepage":"https:\/\/github.com\/friendsofsymfony\/FOSUserBundle\/contributors"
+ }
+ ],
+ "source":{
+ "type":"git",
+ "url":"https:\/\/github.com\/FriendsOfSymfony\/FOSUserBundle",
+ "reference":"24edb2f2e83b227a4ba24180c69758005e805991"
+ },
+ "dist":{
+ "type":"zip",
+ "url":"https:\/\/github.com\/FriendsOfSymfony\/FOSUserBundle\/zipball\/24edb2f2e83b227a4ba24180c69758005e805991",
+ "reference":"24edb2f2e83b227a4ba24180c69758005e805991",
+ "shasum":""
+ },
+ "type":"symfony-bundle",
+ "time":"2012-09-05T07:25:41+00:00",
+ "autoload":{
+ "psr-0":{
+ "FOS\\UserBundle":""
+ }
+ },
+ "extra":{
+ "branch-alias":{
+ "dev-master":"2.0.x-dev"
+ }
+ },
+ "target-dir":"FOS\/UserBundle",
+ "require":{
+ "php":">=5.3.2",
+ "symfony\/framework-bundle":"2.1.*",
+ "symfony\/security-bundle":"2.1.*"
+ },
+ "require-dev":{
+ "twig\/twig":"*",
+ "doctrine\/doctrine-bundle":"*",
+ "swiftmailer\/swiftmailer":"*",
+ "willdurand\/propel-typehintable-behavior":"dev-master",
+ "symfony\/validator":"2.1.*",
+ "symfony\/yaml":"2.1.*"
+ },
+ "suggest":{
+ "doctrine\/couchdb-odm-bundle":"*",
+ "doctrine\/doctrine-bundle":"*",
+ "doctrine\/mongodb-odm-bundle":"*"
+ }
+ },
+ "1.2.x-dev":{
+ "name":"friendsofsymfony\/user-bundle",
+ "description":"Symfony FOSUserBundle",
+ "keywords":[
+ "User management"
+ ],
+ "homepage":"http:\/\/friendsofsymfony.github.com",
+ "version":"1.2.x-dev",
+ "version_normalized":"1.2.9999999.9999999-dev",
+ "license":[
+ "MIT"
+ ],
+ "authors":[
+ {
+ "name":"Christophe Coevoet",
+ "email":"stof@notk.org"
+ },
+ {
+ "name":"Thibault Duplessis",
+ "email":"thibault.duplessis@gmail.com",
+ "homepage":"http:\/\/ornicar.github.com"
+ },
+ {
+ "name":"FriendsOfSymfony Community",
+ "homepage":"https:\/\/github.com\/friendsofsymfony\/FOSUserBundle\/contributors"
+ }
+ ],
+ "source":{
+ "type":"git",
+ "url":"https:\/\/github.com\/FriendsOfSymfony\/FOSUserBundle",
+ "reference":"50e81ca520a83d49378655dbd40074b44463662a"
+ },
+ "dist":{
+ "type":"zip",
+ "url":"https:\/\/github.com\/FriendsOfSymfony\/FOSUserBundle\/zipball\/50e81ca520a83d49378655dbd40074b44463662a",
+ "reference":"50e81ca520a83d49378655dbd40074b44463662a",
+ "shasum":""
+ },
+ "type":"symfony-bundle",
+ "time":"2012-08-07T11:57:49+00:00",
+ "autoload":{
+ "psr-0":{
+ "FOS\\UserBundle":""
+ }
+ },
+ "target-dir":"FOS\/UserBundle",
+ "require":{
+ "php":">=5.3.2",
+ "symfony\/framework-bundle":"2.0.*",
+ "symfony\/security-bundle":"2.0.*"
+ },
+ "suggest":{
+ "symfony\/doctrine-bundle":"2.0.*",
+ "doctrine\/mongodb-odm-bundle":"2.0.*",
+ "doctrine\/couchdb-odm-bundle":"*"
+ }
+ },
+ "v1.2.4":{
+ "name":"friendsofsymfony\/user-bundle",
+ "description":"Symfony FOSUserBundle",
+ "keywords":[
+ "User management"
+ ],
+ "homepage":"http:\/\/friendsofsymfony.github.com",
+ "version":"v1.2.4",
+ "version_normalized":"1.2.4.0",
+ "license":[
+ "MIT"
+ ],
+ "authors":[
+ {
+ "name":"Christophe Coevoet",
+ "email":"stof@notk.org"
+ },
+ {
+ "name":"Thibault Duplessis",
+ "email":"thibault.duplessis@gmail.com",
+ "homepage":"http:\/\/ornicar.github.com"
+ },
+ {
+ "name":"FriendsOfSymfony Community",
+ "homepage":"https:\/\/github.com\/friendsofsymfony\/FOSUserBundle\/contributors"
+ }
+ ],
+ "source":{
+ "type":"git",
+ "url":"https:\/\/github.com\/FriendsOfSymfony\/FOSUserBundle",
+ "reference":"v1.2.4"
+ },
+ "dist":{
+ "type":"zip",
+ "url":"https:\/\/github.com\/FriendsOfSymfony\/FOSUserBundle\/zipball\/v1.2.4",
+ "reference":"v1.2.4",
+ "shasum":""
+ },
+ "type":"symfony-bundle",
+ "time":"2012-07-10T15:28:35+00:00",
+ "autoload":{
+ "psr-0":{
+ "FOS\\UserBundle":""
+ }
+ },
+ "target-dir":"FOS\/UserBundle",
+ "require":{
+ "php":">=5.3.2",
+ "symfony\/framework-bundle":"2.0.*",
+ "symfony\/security-bundle":"2.0.*"
+ },
+ "suggest":{
+ "symfony\/doctrine-bundle":"2.0.*",
+ "doctrine\/mongodb-odm-bundle":"2.0.*",
+ "doctrine\/couchdb-odm-bundle":"*"
+ }
+ },
+ "v1.2.3":{
+ "name":"friendsofsymfony\/user-bundle",
+ "description":"Symfony FOSUserBundle",
+ "keywords":[
+ "User management"
+ ],
+ "homepage":"http:\/\/friendsofsymfony.github.com",
+ "version":"v1.2.3",
+ "version_normalized":"1.2.3.0",
+ "license":[
+ "MIT"
+ ],
+ "authors":[
+ {
+ "name":"Christophe Coevoet",
+ "email":"stof@notk.org"
+ },
+ {
+ "name":"Thibault Duplessis",
+ "email":"thibault.duplessis@gmail.com",
+ "homepage":"http:\/\/ornicar.github.com"
+ },
+ {
+ "name":"FriendsOfSymfony Community",
+ "homepage":"https:\/\/github.com\/friendsofsymfony\/FOSUserBundle\/contributors"
+ }
+ ],
+ "source":{
+ "type":"git",
+ "url":"https:\/\/github.com\/FriendsOfSymfony\/FOSUserBundle",
+ "reference":"v1.2.3"
+ },
+ "dist":{
+ "type":"zip",
+ "url":"https:\/\/github.com\/FriendsOfSymfony\/FOSUserBundle\/zipball\/v1.2.3",
+ "reference":"v1.2.3",
+ "shasum":""
+ },
+ "type":"symfony-bundle",
+ "time":"2012-07-10T14:32:37+00:00",
+ "autoload":{
+ "psr-0":{
+ "FOS\\UserBundle":""
+ }
+ },
+ "target-dir":"FOS\/UserBundle",
+ "require":{
+ "php":">=5.3.2",
+ "symfony\/framework-bundle":"2.0.*",
+ "symfony\/security-bundle":"2.0.*"
+ },
+ "suggest":{
+ "symfony\/doctrine-bundle":"2.0.*",
+ "doctrine\/mongodb-odm-bundle":"2.0.*",
+ "doctrine\/couchdb-odm-bundle":"*"
+ }
+ },
+ "v1.2.2":{
+ "name":"friendsofsymfony\/user-bundle",
+ "description":"Symfony FOSUserBundle",
+ "keywords":[
+ "User management"
+ ],
+ "homepage":"http:\/\/friendsofsymfony.github.com",
+ "version":"v1.2.2",
+ "version_normalized":"1.2.2.0",
+ "license":[
+ "MIT"
+ ],
+ "authors":[
+ {
+ "name":"Christophe Coevoet",
+ "email":"stof@notk.org"
+ },
+ {
+ "name":"Thibault Duplessis",
+ "email":"thibault.duplessis@gmail.com",
+ "homepage":"http:\/\/ornicar.github.com"
+ },
+ {
+ "name":"FriendsOfSymfony Community",
+ "homepage":"https:\/\/github.com\/friendsofsymfony\/FOSUserBundle\/contributors"
+ }
+ ],
+ "source":{
+ "type":"git",
+ "url":"https:\/\/github.com\/FriendsOfSymfony\/FOSUserBundle",
+ "reference":"v1.2.2"
+ },
+ "dist":{
+ "type":"zip",
+ "url":"https:\/\/github.com\/FriendsOfSymfony\/FOSUserBundle\/zipball\/v1.2.2",
+ "reference":"v1.2.2",
+ "shasum":""
+ },
+ "type":"symfony-bundle",
+ "time":"2012-07-10T10:51:12+00:00",
+ "autoload":{
+ "psr-0":{
+ "FOS\\UserBundle":""
+ }
+ },
+ "target-dir":"FOS\/UserBundle",
+ "require":{
+ "php":">=5.3.2",
+ "symfony\/framework-bundle":"2.0.*",
+ "symfony\/security-bundle":"2.0.*"
+ },
+ "suggest":{
+ "symfony\/doctrine-bundle":"2.0.*",
+ "doctrine\/mongodb-odm-bundle":"2.0.*",
+ "doctrine\/couchdb-odm-bundle":"*"
+ }
+ },
+ "v1.2.1":{
+ "name":"friendsofsymfony\/user-bundle",
+ "description":"Symfony FOSUserBundle",
+ "keywords":[
+ "User management"
+ ],
+ "homepage":"http:\/\/friendsofsymfony.github.com",
+ "version":"v1.2.1",
+ "version_normalized":"1.2.1.0",
+ "license":[
+ "MIT"
+ ],
+ "authors":[
+ {
+ "name":"Christophe Coevoet",
+ "email":"stof@notk.org"
+ },
+ {
+ "name":"Thibault Duplessis",
+ "email":"thibault.duplessis@gmail.com",
+ "homepage":"http:\/\/ornicar.github.com"
+ },
+ {
+ "name":"FriendsOfSymfony Community",
+ "homepage":"https:\/\/github.com\/friendsofsymfony\/FOSUserBundle\/contributors"
+ }
+ ],
+ "source":{
+ "type":"git",
+ "url":"https:\/\/github.com\/FriendsOfSymfony\/FOSUserBundle",
+ "reference":"v1.2.1"
+ },
+ "dist":{
+ "type":"zip",
+ "url":"https:\/\/github.com\/FriendsOfSymfony\/FOSUserBundle\/zipball\/v1.2.1",
+ "reference":"v1.2.1",
+ "shasum":""
+ },
+ "type":"symfony-bundle",
+ "time":"2012-07-10T10:40:25+00:00",
+ "autoload":{
+ "psr-0":{
+ "FOS\\UserBundle":""
+ }
+ },
+ "target-dir":"FOS\/UserBundle",
+ "require":{
+ "php":">=5.3.2",
+ "symfony\/framework-bundle":"2.0.*",
+ "symfony\/security-bundle":"2.0.*"
+ },
+ "suggest":{
+ "symfony\/doctrine-bundle":"2.0.*",
+ "doctrine\/mongodb-odm-bundle":"2.0.*",
+ "doctrine\/couchdb-odm-bundle":"*"
+ }
+ },
+ "1.2.0":{
+ "name":"friendsofsymfony\/user-bundle",
+ "description":"Symfony FOSUserBundle",
+ "keywords":[
+ "User management"
+ ],
+ "homepage":"http:\/\/friendsofsymfony.github.com",
+ "version":"1.2.0",
+ "version_normalized":"1.2.0.0",
+ "license":[
+ "MIT"
+ ],
+ "authors":[
+ {
+ "name":"Christophe Coevoet",
+ "email":"stof@notk.org"
+ },
+ {
+ "name":"Thibault Duplessis",
+ "email":"thibault.duplessis@gmail.com",
+ "homepage":"http:\/\/ornicar.github.com"
+ },
+ {
+ "name":"FriendsOfSymfony Community",
+ "homepage":"https:\/\/github.com\/friendsofsymfony\/FOSUserBundle\/contributors"
+ }
+ ],
+ "source":{
+ "type":"git",
+ "url":"https:\/\/github.com\/FriendsOfSymfony\/FOSUserBundle",
+ "reference":"1.2.0"
+ },
+ "dist":{
+ "type":"zip",
+ "url":"https:\/\/github.com\/FriendsOfSymfony\/FOSUserBundle\/zipball\/1.2.0",
+ "reference":"1.2.0",
+ "shasum":""
+ },
+ "type":"symfony-bundle",
+ "time":"2012-04-11T23:07:46+00:00",
+ "autoload":{
+ "psr-0":{
+ "FOS\\UserBundle":""
+ }
+ },
+ "target-dir":"FOS\/UserBundle",
+ "require":{
+ "php":">=5.3.2",
+ "symfony\/framework-bundle":"2.0.*",
+ "symfony\/security-bundle":"2.0.*"
+ },
+ "suggest":{
+ "symfony\/doctrine-bundle":"2.0.*",
+ "doctrine\/mongodb-odm-bundle":"2.0.*",
+ "doctrine\/couchdb-odm-bundle":"*"
+ }
+ },
+ "1.1.0":{
+ "name":"friendsofsymfony\/user-bundle",
+ "description":"Symfony FOSUserBundle",
+ "keywords":[
+ "User management"
+ ],
+ "homepage":"http:\/\/friendsofsymfony.github.com",
+ "version":"1.1.0",
+ "version_normalized":"1.1.0.0",
+ "license":[
+ "MIT"
+ ],
+ "authors":[
+ {
+ "name":"Christophe Coevoet",
+ "email":"stof@notk.org"
+ },
+ {
+ "name":"Thibault Duplessis",
+ "email":"thibault.duplessis@gmail.com",
+ "homepage":"http:\/\/ornicar.github.com"
+ },
+ {
+ "name":"FriendsOfSymfony Community",
+ "homepage":"https:\/\/github.com\/friendsofsymfony\/FOSUserBundle\/contributors"
+ }
+ ],
+ "source":{
+ "type":"git",
+ "url":"https:\/\/github.com\/FriendsOfSymfony\/FOSUserBundle",
+ "reference":"1.1.0"
+ },
+ "dist":{
+ "type":"zip",
+ "url":"https:\/\/github.com\/FriendsOfSymfony\/FOSUserBundle\/zipball\/1.1.0",
+ "reference":"1.1.0",
+ "shasum":""
+ },
+ "type":"symfony-bundle",
+ "time":"2011-12-15T15:47:55+00:00",
+ "autoload":{
+ "psr-0":{
+ "FOS\\UserBundle":""
+ }
+ },
+ "target-dir":"FOS\/UserBundle",
+ "require":{
+ "php":">=5.3.2",
+ "symfony\/framework-bundle":"2.*",
+ "symfony\/security-bundle":"2.*"
+ },
+ "suggest":{
+ "symfony\/doctrine-bundle":"*",
+ "symfony\/mongodb-odm-bundle":"*",
+ "doctrine\/couchdb-odm-bundle":"*"
+ }
+ }
+ },
+ "type":"symfony-bundle",
+ "repository":"https:\/\/github.com\/FriendsOfSymfony\/FOSUserBundle"
+ }
+}
44 src/test/java/com/dubture/composer/test/JsonParserTest.java
@@ -0,0 +1,44 @@
+package com.dubture.composer.test;
+
+import java.io.File;
+import java.net.URISyntaxException;
+import java.net.URL;
+
+import junit.framework.TestCase;
+
+import org.junit.Test;
+
+import com.dubture.composer.PHPPackage;
+
+public class JsonParserTest extends TestCase {
+
+ @Test
+ public void testComposerJson() {
+
+ try {
+ PHPPackage phpPackage = PHPPackage.fromJson(loadFile("composer.json"));
+
+ } catch (Exception e) {
+ e.printStackTrace();
+ fail();
+ }
+ }
+
+ @Test
+ public void testPackagistJson() {
+
+ try {
+ PHPPackage phpPackage = PHPPackage.fromJson(loadFile("packagist.json"));
+ } catch (Exception e) {
+ e.printStackTrace();
+ fail();
+ }
+ }
+
+ protected File loadFile(String name) throws URISyntaxException {
+
+ ClassLoader loader = getClass().getClassLoader();
+ URL resource = loader.getResource(name);
+ return new File(resource.toURI());
+ }
+}

0 comments on commit 7b047fb

Please sign in to comment.
Something went wrong with that request. Please try again.