Permalink
Browse files

Add normalization

  • Loading branch information...
leodagdag committed Oct 4, 2012
1 parent 9da8ba8 commit 8f09d0ce59183309f511b73e52073710e41adcd7
View
@@ -0,0 +1,22 @@
+# Auto detect text files and perform LF normalization
+* text=auto
+
+# Custom for Visual Studio
+*.cs diff=csharp
+*.sln merge=union
+*.csproj merge=union
+*.vbproj merge=union
+*.fsproj merge=union
+*.dbproj merge=union
+
+# Standard to msysgit
+*.doc diff=astextplain
+*.DOC diff=astextplain
+*.docx diff=astextplain
+*.DOCX diff=astextplain
+*.dot diff=astextplain
+*.DOT diff=astextplain
+*.pdf diff=astextplain
+*.PDF diff=astextplain
+*.rtf diff=astextplain
+*.RTF diff=astextplain
View
@@ -1,61 +1,61 @@
-import sbt._
-import Keys._
-
-object Play2MorphiaPluginBuild extends Build {
-
- import Resolvers._
- import Dependencies._
- import BuildSettings._
-
- lazy val Play2MorphiaPlugin = Project(
- "play2-morphia-plugin",
- file("."),
- settings = buildSettings ++ Seq(
- libraryDependencies := runtime ++ test,
- publishMavenStyle := true,
- publishTo := Some(githubRepository),
- scalacOptions ++= Seq("-Xlint","-deprecation", "-unchecked","-encoding", "utf8"),
- javacOptions ++= Seq("-encoding", "utf8", "-g"),
- resolvers ++= Seq(DefaultMavenRepository, Resolvers.typesafeRepository, Resolvers.morphiaRepository),
- checksums := Nil // To prevent proxyToys downloding fails https://github.com/leodagdag/play2-morphia-plugin/issues/11
- )
- ).settings()
-
- object Resolvers {
- val githubRepository = Resolver.file("GitHub Repository", Path.userHome / "dev" / "leodagdag.github.com" / "repository" asFile)(Resolver.mavenStylePatterns)
- val dropboxRepository = Resolver.file("Dropbox Repository", Path.userHome / "Dropbox" / "Public" / "repository" asFile)(Resolver.mavenStylePatterns)
- val typesafeRepository = "Typesafe Repository" at "http://repo.typesafe.com/typesafe/releases/"
- val morphiaRepository = "Morphia Repository" at "http://morphia.googlecode.com/svn/mavenrepo/"
- }
-
- object Dependencies {
- val runtime = Seq(
- "com.google.code.morphia" % "morphia" % "1.00-SNAPSHOT",
- "com.google.code.morphia" % "morphia-logging-slf4j" % "0.99",
- "com.google.code.morphia" % "morphia-validation" % "0.99",
- "cglib" % "cglib-nodep" % "[2.1_3,)",
- "com.thoughtworks.proxytoys" % "proxytoys" % "1.0",
- "play" %% "play" % "2.0.4" % "compile" notTransitive(),
- ("org.springframework" % "spring-core" % "3.0.7.RELEASE" notTransitive())
- .exclude("org.springframework", "spring-asm")
- .exclude("commons-logging", "commons-logging"),
- ("org.springframework" % "spring-beans" % "3.0.7.RELEASE" notTransitive())
- .exclude("org.springframework", "spring-core")
- )
- val test = Seq(
- "play" %% "play-test" % "2.0.4" % "test"
- )
- }
-
- object BuildSettings {
- val buildOrganization = "leodagdag"
- val buildVersion = "0.0.7"
- val buildScalaVersion = "2.9.1"
- val buildSbtVersion = "0.11.3"
- val buildSettings = Defaults.defaultSettings ++ Seq (
- organization := buildOrganization,
- version := buildVersion,
- scalaVersion := buildScalaVersion
- )
- }
-}
+import sbt._
+import Keys._
+
+object Play2MorphiaPluginBuild extends Build {
+
+ import Resolvers._
+ import Dependencies._
+ import BuildSettings._
+
+ lazy val Play2MorphiaPlugin = Project(
+ "play2-morphia-plugin",
+ file("."),
+ settings = buildSettings ++ Seq(
+ libraryDependencies := runtime ++ test,
+ publishMavenStyle := true,
+ publishTo := Some(githubRepository),
+ scalacOptions ++= Seq("-Xlint","-deprecation", "-unchecked","-encoding", "utf8"),
+ javacOptions ++= Seq("-encoding", "utf8", "-g"),
+ resolvers ++= Seq(DefaultMavenRepository, Resolvers.typesafeRepository, Resolvers.morphiaRepository),
+ checksums := Nil // To prevent proxyToys downloding fails https://github.com/leodagdag/play2-morphia-plugin/issues/11
+ )
+ ).settings()
+
+ object Resolvers {
+ val githubRepository = Resolver.file("GitHub Repository", Path.userHome / "dev" / "leodagdag.github.com" / "repository" asFile)(Resolver.mavenStylePatterns)
+ val dropboxRepository = Resolver.file("Dropbox Repository", Path.userHome / "Dropbox" / "Public" / "repository" asFile)(Resolver.mavenStylePatterns)
+ val typesafeRepository = "Typesafe Repository" at "http://repo.typesafe.com/typesafe/releases/"
+ val morphiaRepository = "Morphia Repository" at "http://morphia.googlecode.com/svn/mavenrepo/"
+ }
+
+ object Dependencies {
+ val runtime = Seq(
+ "com.google.code.morphia" % "morphia" % "1.00-SNAPSHOT",
+ "com.google.code.morphia" % "morphia-logging-slf4j" % "0.99",
+ "com.google.code.morphia" % "morphia-validation" % "0.99",
+ "cglib" % "cglib-nodep" % "[2.1_3,)",
+ "com.thoughtworks.proxytoys" % "proxytoys" % "1.0",
+ "play" %% "play" % "2.0.4" % "compile" notTransitive(),
+ ("org.springframework" % "spring-core" % "3.0.7.RELEASE" notTransitive())
+ .exclude("org.springframework", "spring-asm")
+ .exclude("commons-logging", "commons-logging"),
+ ("org.springframework" % "spring-beans" % "3.0.7.RELEASE" notTransitive())
+ .exclude("org.springframework", "spring-core")
+ )
+ val test = Seq(
+ "play" %% "play-test" % "2.0.4" % "test"
+ )
+ }
+
+ object BuildSettings {
+ val buildOrganization = "leodagdag"
+ val buildVersion = "0.0.7"
+ val buildScalaVersion = "2.9.1"
+ val buildSbtVersion = "0.11.3"
+ val buildSettings = Defaults.defaultSettings ++ Seq (
+ organization := buildOrganization,
+ version := buildVersion,
+ scalaVersion := buildScalaVersion
+ )
+ }
+}
View
@@ -1,8 +1,8 @@
-logLevel := Level.Warn
-
-// Use for intellij
-resolvers += "sbt-idea-repo" at "http://mpeltonen.github.com/maven/"
-
-// Use for intellij
-addSbtPlugin("com.github.mpeltonen" % "sbt-idea" % "1.1.0")
-
+logLevel := Level.Warn
+
+// Use for intellij
+resolvers += "sbt-idea-repo" at "http://mpeltonen.github.com/maven/"
+
+// Use for intellij
+addSbtPlugin("com.github.mpeltonen" % "sbt-idea" % "1.1.0")
+
@@ -1,81 +1,81 @@
-package leodagdag.play2morphia;
-
-import com.google.code.morphia.annotations.Transient;
-import com.mongodb.BasicDBObject;
-import com.mongodb.DBObject;
-import com.mongodb.gridfs.GridFSDBFile;
-import com.mongodb.gridfs.GridFSInputFile;
-import org.bson.types.ObjectId;
-import play.Logger;
-
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.UUID;
-
-public class Blob {
-
- @Transient
- private GridFSDBFile gridFSDBFile;
-
- public Blob() {
- }
-
- public Blob(InputStream is, String type) {
- this();
- set(is, type);
- }
-
- public Blob(File inputFile, String type) {
- this();
- try {
- set(inputFile, type);
- } catch (IOException e) {
- Logger.error(String.format("File not found: %s (%s)", inputFile.getAbsolutePath(), e.getMessage()));
- }
- }
-
- public Blob(String id) {
- DBObject queryObj = new BasicDBObject("name", id);
- gridFSDBFile = MorphiaPlugin.gridFs().findOne(queryObj);
- }
-
- void set(File file, String type) throws IOException {
- if (!file.exists()) {
- Logger.warn(String.format("File not exists: %s", file));
- return;
- }
- GridFSInputFile inputFile = MorphiaPlugin.gridFs().createFile(file);
- inputFile.setContentType(type);
- inputFile.save();
- this.gridFSDBFile = MorphiaPlugin.gridFs().findOne(new ObjectId(inputFile.getId().toString()));
- }
-
- void set(InputStream is, String type) {
- GridFSInputFile inputFile = MorphiaPlugin.gridFs().createFile(is);
- inputFile.setContentType(type);
- inputFile.put("name", UUID.randomUUID().toString());
- inputFile.save();
- gridFSDBFile = MorphiaPlugin.gridFs().findOne(new ObjectId(inputFile.getId().toString()));
- }
-
- public long length() {
- return gridFSDBFile == null ? 0 : gridFSDBFile.getLength();
- }
-
- public String type() {
- return gridFSDBFile.getContentType();
- }
-
- public boolean exists() {
- return gridFSDBFile != null && gridFSDBFile.getId() != null;
- }
-
- public GridFSDBFile getGridFSFile() {
- return gridFSDBFile;
- }
-
- public static void delete(String name) {
- MorphiaPlugin.gridFs().remove(new BasicDBObject("name", name));
- }
-}
+package leodagdag.play2morphia;
+
+import com.google.code.morphia.annotations.Transient;
+import com.mongodb.BasicDBObject;
+import com.mongodb.DBObject;
+import com.mongodb.gridfs.GridFSDBFile;
+import com.mongodb.gridfs.GridFSInputFile;
+import org.bson.types.ObjectId;
+import play.Logger;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.UUID;
+
+public class Blob {
+
+ @Transient
+ private GridFSDBFile gridFSDBFile;
+
+ public Blob() {
+ }
+
+ public Blob(InputStream is, String type) {
+ this();
+ set(is, type);
+ }
+
+ public Blob(File inputFile, String type) {
+ this();
+ try {
+ set(inputFile, type);
+ } catch (IOException e) {
+ Logger.error(String.format("File not found: %s (%s)", inputFile.getAbsolutePath(), e.getMessage()));
+ }
+ }
+
+ public Blob(String id) {
+ DBObject queryObj = new BasicDBObject("name", id);
+ gridFSDBFile = MorphiaPlugin.gridFs().findOne(queryObj);
+ }
+
+ void set(File file, String type) throws IOException {
+ if (!file.exists()) {
+ Logger.warn(String.format("File not exists: %s", file));
+ return;
+ }
+ GridFSInputFile inputFile = MorphiaPlugin.gridFs().createFile(file);
+ inputFile.setContentType(type);
+ inputFile.save();
+ this.gridFSDBFile = MorphiaPlugin.gridFs().findOne(new ObjectId(inputFile.getId().toString()));
+ }
+
+ void set(InputStream is, String type) {
+ GridFSInputFile inputFile = MorphiaPlugin.gridFs().createFile(is);
+ inputFile.setContentType(type);
+ inputFile.put("name", UUID.randomUUID().toString());
+ inputFile.save();
+ gridFSDBFile = MorphiaPlugin.gridFs().findOne(new ObjectId(inputFile.getId().toString()));
+ }
+
+ public long length() {
+ return gridFSDBFile == null ? 0 : gridFSDBFile.getLength();
+ }
+
+ public String type() {
+ return gridFSDBFile.getContentType();
+ }
+
+ public boolean exists() {
+ return gridFSDBFile != null && gridFSDBFile.getId() != null;
+ }
+
+ public GridFSDBFile getGridFSFile() {
+ return gridFSDBFile;
+ }
+
+ public static void delete(String name) {
+ MorphiaPlugin.gridFs().remove(new BasicDBObject("name", name));
+ }
+}
Oops, something went wrong.

0 comments on commit 8f09d0c

Please sign in to comment.