suvii 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (150) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +14 -0
  3. data/.travis.yml +10 -0
  4. data/.yardopts +1 -0
  5. data/CHANGELOG.md +1 -0
  6. data/CONTRIBUTING.md +47 -0
  7. data/Gemfile +6 -0
  8. data/LICENSE.txt +22 -0
  9. data/README.md +51 -0
  10. data/Rakefile +7 -0
  11. data/lib/suvii.rb +40 -0
  12. data/lib/suvii/cache.rb +24 -0
  13. data/lib/suvii/extract.rb +58 -0
  14. data/lib/suvii/extract/targz.rb +49 -0
  15. data/lib/suvii/extract/zip.rb +19 -0
  16. data/lib/suvii/http.rb +31 -0
  17. data/suvii.gemspec +23 -0
  18. data/test/acceptance_test.rb +29 -0
  19. data/test/cache_test.rb +42 -0
  20. data/test/extract/targz_test.rb +28 -0
  21. data/test/extract/zip_test.rb +28 -0
  22. data/test/extract_test.rb +26 -0
  23. data/test/fixtures/results/Trumbowyg-1.1.7/.gitattributes +6 -0
  24. data/test/fixtures/results/Trumbowyg-1.1.7/.jshintrc +15 -0
  25. data/test/fixtures/results/Trumbowyg-1.1.7/Gulpfile.js +167 -0
  26. data/test/fixtures/results/Trumbowyg-1.1.7/LICENSE +21 -0
  27. data/test/fixtures/results/Trumbowyg-1.1.7/README.md +29 -0
  28. data/test/fixtures/results/Trumbowyg-1.1.7/bower.json +36 -0
  29. data/test/fixtures/results/Trumbowyg-1.1.7/dist/langs/ca.min.js +11 -0
  30. data/test/fixtures/results/Trumbowyg-1.1.7/dist/langs/da.min.js +9 -0
  31. data/test/fixtures/results/Trumbowyg-1.1.7/dist/langs/de.min.js +9 -0
  32. data/test/fixtures/results/Trumbowyg-1.1.7/dist/langs/es.min.js +9 -0
  33. data/test/fixtures/results/Trumbowyg-1.1.7/dist/langs/es_ar.min.js +9 -0
  34. data/test/fixtures/results/Trumbowyg-1.1.7/dist/langs/fa.min.js +10 -0
  35. data/test/fixtures/results/Trumbowyg-1.1.7/dist/langs/fi.min.js +9 -0
  36. data/test/fixtures/results/Trumbowyg-1.1.7/dist/langs/fr.min.js +10 -0
  37. data/test/fixtures/results/Trumbowyg-1.1.7/dist/langs/he.min.js +9 -0
  38. data/test/fixtures/results/Trumbowyg-1.1.7/dist/langs/id.min.js +11 -0
  39. data/test/fixtures/results/Trumbowyg-1.1.7/dist/langs/it.min.js +8 -0
  40. data/test/fixtures/results/Trumbowyg-1.1.7/dist/langs/ko.min.js +10 -0
  41. data/test/fixtures/results/Trumbowyg-1.1.7/dist/langs/pl.min.js +9 -0
  42. data/test/fixtures/results/Trumbowyg-1.1.7/dist/langs/pt.min.js +11 -0
  43. data/test/fixtures/results/Trumbowyg-1.1.7/dist/langs/ro.min.js +13 -0
  44. data/test/fixtures/results/Trumbowyg-1.1.7/dist/langs/ru.min.js +8 -0
  45. data/test/fixtures/results/Trumbowyg-1.1.7/dist/langs/tr.min.js +10 -0
  46. data/test/fixtures/results/Trumbowyg-1.1.7/dist/langs/zh_cn.min.js +10 -0
  47. data/test/fixtures/results/Trumbowyg-1.1.7/dist/plugins/base64/trumbowyg.base64.js +74 -0
  48. data/test/fixtures/results/Trumbowyg-1.1.7/dist/plugins/base64/trumbowyg.base64.min.js +1 -0
  49. data/test/fixtures/results/Trumbowyg-1.1.7/dist/plugins/colors/trumbowyg.colors.js +69 -0
  50. data/test/fixtures/results/Trumbowyg-1.1.7/dist/plugins/colors/trumbowyg.colors.min.js +1 -0
  51. data/test/fixtures/results/Trumbowyg-1.1.7/dist/plugins/colors/ui/images/icons-2x.png +0 -0
  52. data/test/fixtures/results/Trumbowyg-1.1.7/dist/plugins/colors/ui/images/icons.png +0 -0
  53. data/test/fixtures/results/Trumbowyg-1.1.7/dist/plugins/colors/ui/trumbowyg.colors.css +55 -0
  54. data/test/fixtures/results/Trumbowyg-1.1.7/dist/plugins/colors/ui/trumbowyg.colors.min.css +2 -0
  55. data/test/fixtures/results/Trumbowyg-1.1.7/dist/plugins/upload/trumbowyg.upload.js +140 -0
  56. data/test/fixtures/results/Trumbowyg-1.1.7/dist/plugins/upload/trumbowyg.upload.min.js +1 -0
  57. data/test/fixtures/results/Trumbowyg-1.1.7/dist/trumbowyg.js +1124 -0
  58. data/test/fixtures/results/Trumbowyg-1.1.7/dist/trumbowyg.min.js +2 -0
  59. data/test/fixtures/results/Trumbowyg-1.1.7/dist/ui/images/icons-2x.png +0 -0
  60. data/test/fixtures/results/Trumbowyg-1.1.7/dist/ui/images/icons.png +0 -0
  61. data/test/fixtures/results/Trumbowyg-1.1.7/dist/ui/trumbowyg.css +471 -0
  62. data/test/fixtures/results/Trumbowyg-1.1.7/dist/ui/trumbowyg.min.css +2 -0
  63. data/test/fixtures/results/Trumbowyg-1.1.7/examples/css/main.css +14 -0
  64. data/test/fixtures/results/Trumbowyg-1.1.7/examples/index.html +41 -0
  65. data/test/fixtures/results/Trumbowyg-1.1.7/examples/plugins/colors.html +49 -0
  66. data/test/fixtures/results/Trumbowyg-1.1.7/index.html +252 -0
  67. data/test/fixtures/results/Trumbowyg-1.1.7/package.json +48 -0
  68. data/test/fixtures/results/Trumbowyg-1.1.7/plugins/base64/trumbowyg.base64.js +74 -0
  69. data/test/fixtures/results/Trumbowyg-1.1.7/plugins/colors/Gulpfile.js +101 -0
  70. data/test/fixtures/results/Trumbowyg-1.1.7/plugins/colors/trumbowyg.colors.js +69 -0
  71. data/test/fixtures/results/Trumbowyg-1.1.7/plugins/colors/ui/images/icons-2x/backcolor.png +0 -0
  72. data/test/fixtures/results/Trumbowyg-1.1.7/plugins/colors/ui/images/icons-2x/forecolor.png +0 -0
  73. data/test/fixtures/results/Trumbowyg-1.1.7/plugins/colors/ui/images/icons/backcolor.png +0 -0
  74. data/test/fixtures/results/Trumbowyg-1.1.7/plugins/colors/ui/images/icons/forecolor.png +0 -0
  75. data/test/fixtures/results/Trumbowyg-1.1.7/plugins/colors/ui/sass/trumbowyg.colors.scss +65 -0
  76. data/test/fixtures/results/Trumbowyg-1.1.7/plugins/upload/trumbowyg.upload.js +140 -0
  77. data/test/fixtures/results/Trumbowyg-1.1.7/plugins/upload/trumbowyg.upload.php +49 -0
  78. data/test/fixtures/results/Trumbowyg-1.1.7/src/langs/ca.js +58 -0
  79. data/test/fixtures/results/Trumbowyg-1.1.7/src/langs/da.js +56 -0
  80. data/test/fixtures/results/Trumbowyg-1.1.7/src/langs/de.js +56 -0
  81. data/test/fixtures/results/Trumbowyg-1.1.7/src/langs/en.js +14 -0
  82. data/test/fixtures/results/Trumbowyg-1.1.7/src/langs/es.js +56 -0
  83. data/test/fixtures/results/Trumbowyg-1.1.7/src/langs/es_ar.js +56 -0
  84. data/test/fixtures/results/Trumbowyg-1.1.7/src/langs/fa.js +57 -0
  85. data/test/fixtures/results/Trumbowyg-1.1.7/src/langs/fi.js +56 -0
  86. data/test/fixtures/results/Trumbowyg-1.1.7/src/langs/fr.js +57 -0
  87. data/test/fixtures/results/Trumbowyg-1.1.7/src/langs/he.js +58 -0
  88. data/test/fixtures/results/Trumbowyg-1.1.7/src/langs/id.js +58 -0
  89. data/test/fixtures/results/Trumbowyg-1.1.7/src/langs/it.js +55 -0
  90. data/test/fixtures/results/Trumbowyg-1.1.7/src/langs/ko.js +57 -0
  91. data/test/fixtures/results/Trumbowyg-1.1.7/src/langs/pl.js +56 -0
  92. data/test/fixtures/results/Trumbowyg-1.1.7/src/langs/pt.js +58 -0
  93. data/test/fixtures/results/Trumbowyg-1.1.7/src/langs/ro.js +60 -0
  94. data/test/fixtures/results/Trumbowyg-1.1.7/src/langs/ru.js +55 -0
  95. data/test/fixtures/results/Trumbowyg-1.1.7/src/langs/tr.js +57 -0
  96. data/test/fixtures/results/Trumbowyg-1.1.7/src/langs/zh_cn.js +57 -0
  97. data/test/fixtures/results/Trumbowyg-1.1.7/src/trumbowyg.js +1113 -0
  98. data/test/fixtures/results/Trumbowyg-1.1.7/src/ui/images/icons-2x/attachement.png +0 -0
  99. data/test/fixtures/results/Trumbowyg-1.1.7/src/ui/images/icons-2x/barre.png +0 -0
  100. data/test/fixtures/results/Trumbowyg-1.1.7/src/ui/images/icons-2x/bold.png +0 -0
  101. data/test/fixtures/results/Trumbowyg-1.1.7/src/ui/images/icons-2x/center-align.png +0 -0
  102. data/test/fixtures/results/Trumbowyg-1.1.7/src/ui/images/icons-2x/close.png +0 -0
  103. data/test/fixtures/results/Trumbowyg-1.1.7/src/ui/images/icons-2x/formatting.png +0 -0
  104. data/test/fixtures/results/Trumbowyg-1.1.7/src/ui/images/icons-2x/fullscreen-exit.png +0 -0
  105. data/test/fixtures/results/Trumbowyg-1.1.7/src/ui/images/icons-2x/fullscreen.png +0 -0
  106. data/test/fixtures/results/Trumbowyg-1.1.7/src/ui/images/icons-2x/gras.png +0 -0
  107. data/test/fixtures/results/Trumbowyg-1.1.7/src/ui/images/icons-2x/horizontal-rule.png +0 -0
  108. data/test/fixtures/results/Trumbowyg-1.1.7/src/ui/images/icons-2x/image.png +0 -0
  109. data/test/fixtures/results/Trumbowyg-1.1.7/src/ui/images/icons-2x/italic.png +0 -0
  110. data/test/fixtures/results/Trumbowyg-1.1.7/src/ui/images/icons-2x/justify-align.png +0 -0
  111. data/test/fixtures/results/Trumbowyg-1.1.7/src/ui/images/icons-2x/left-align.png +0 -0
  112. data/test/fixtures/results/Trumbowyg-1.1.7/src/ui/images/icons-2x/link.png +0 -0
  113. data/test/fixtures/results/Trumbowyg-1.1.7/src/ui/images/icons-2x/ordered-list.png +0 -0
  114. data/test/fixtures/results/Trumbowyg-1.1.7/src/ui/images/icons-2x/right-align.png +0 -0
  115. data/test/fixtures/results/Trumbowyg-1.1.7/src/ui/images/icons-2x/souligne.png +0 -0
  116. data/test/fixtures/results/Trumbowyg-1.1.7/src/ui/images/icons-2x/strikethrough.png +0 -0
  117. data/test/fixtures/results/Trumbowyg-1.1.7/src/ui/images/icons-2x/underline.png +0 -0
  118. data/test/fixtures/results/Trumbowyg-1.1.7/src/ui/images/icons-2x/unordered-list.png +0 -0
  119. data/test/fixtures/results/Trumbowyg-1.1.7/src/ui/images/icons-2x/video.png +0 -0
  120. data/test/fixtures/results/Trumbowyg-1.1.7/src/ui/images/icons-2x/view-html.png +0 -0
  121. data/test/fixtures/results/Trumbowyg-1.1.7/src/ui/images/icons/attachement.png +0 -0
  122. data/test/fixtures/results/Trumbowyg-1.1.7/src/ui/images/icons/barre.png +0 -0
  123. data/test/fixtures/results/Trumbowyg-1.1.7/src/ui/images/icons/bold.png +0 -0
  124. data/test/fixtures/results/Trumbowyg-1.1.7/src/ui/images/icons/center-align.png +0 -0
  125. data/test/fixtures/results/Trumbowyg-1.1.7/src/ui/images/icons/close.png +0 -0
  126. data/test/fixtures/results/Trumbowyg-1.1.7/src/ui/images/icons/formatting.png +0 -0
  127. data/test/fixtures/results/Trumbowyg-1.1.7/src/ui/images/icons/fullscreen-exit.png +0 -0
  128. data/test/fixtures/results/Trumbowyg-1.1.7/src/ui/images/icons/fullscreen.png +0 -0
  129. data/test/fixtures/results/Trumbowyg-1.1.7/src/ui/images/icons/gras.png +0 -0
  130. data/test/fixtures/results/Trumbowyg-1.1.7/src/ui/images/icons/horizontal-rule.png +0 -0
  131. data/test/fixtures/results/Trumbowyg-1.1.7/src/ui/images/icons/image.png +0 -0
  132. data/test/fixtures/results/Trumbowyg-1.1.7/src/ui/images/icons/italic.png +0 -0
  133. data/test/fixtures/results/Trumbowyg-1.1.7/src/ui/images/icons/justify-align.png +0 -0
  134. data/test/fixtures/results/Trumbowyg-1.1.7/src/ui/images/icons/left-align.png +0 -0
  135. data/test/fixtures/results/Trumbowyg-1.1.7/src/ui/images/icons/link.png +0 -0
  136. data/test/fixtures/results/Trumbowyg-1.1.7/src/ui/images/icons/ordered-list.png +0 -0
  137. data/test/fixtures/results/Trumbowyg-1.1.7/src/ui/images/icons/right-align.png +0 -0
  138. data/test/fixtures/results/Trumbowyg-1.1.7/src/ui/images/icons/souligne.png +0 -0
  139. data/test/fixtures/results/Trumbowyg-1.1.7/src/ui/images/icons/strikethrough.png +0 -0
  140. data/test/fixtures/results/Trumbowyg-1.1.7/src/ui/images/icons/underline.png +0 -0
  141. data/test/fixtures/results/Trumbowyg-1.1.7/src/ui/images/icons/unordered-list.png +0 -0
  142. data/test/fixtures/results/Trumbowyg-1.1.7/src/ui/images/icons/video.png +0 -0
  143. data/test/fixtures/results/Trumbowyg-1.1.7/src/ui/images/icons/view-html.png +0 -0
  144. data/test/fixtures/results/Trumbowyg-1.1.7/src/ui/sass/mixins/_sprite-pos.scss +7 -0
  145. data/test/fixtures/results/Trumbowyg-1.1.7/src/ui/sass/trumbowyg.scss +564 -0
  146. data/test/fixtures/trumbowyg.tar.gz +0 -0
  147. data/test/fixtures/trumbowyg.zip +0 -0
  148. data/test/http_test.rb +61 -0
  149. data/test/test_helper.rb +24 -0
  150. metadata +409 -0
@@ -0,0 +1,42 @@
1
+ require "test_helper"
2
+
3
+ module Suvii
4
+ class CacheTest < Minitest::Test
5
+ def test_with_cache_path
6
+ path = Cache.fetch("http://hello.com/file.gz", cache_path: "/tmp/dir") { }
7
+ assert_equal "/tmp/dir/http%3A%2F%2Fhello.com%2Ffile.gz", path
8
+ end
9
+
10
+ def test_without_cache_path
11
+ path = Cache.fetch("http://hello.com/file.gz") { }
12
+ assert path.start_with?(Dir.tmpdir, path)
13
+ assert path.end_with?("/http%3A%2F%2Fhello.com%2Ffile.gz", path)
14
+ end
15
+
16
+ def test_no_block_is_called_when_file_exists
17
+ cache_path = Dir.mktmpdir
18
+ archive_path = File.join(cache_path, "hello.world")
19
+ FileUtils.touch(archive_path)
20
+
21
+ block_executed = false
22
+ Cache.fetch("hello.world", cache_path: cache_path) do
23
+ block_executed = true
24
+ end
25
+ refute block_executed
26
+ ensure
27
+ FileUtils.rm_rf(archive_path)
28
+ end
29
+
30
+ def test_block_is_called_when_file_doesnt_exist
31
+ cache_path = "/tmp"
32
+ archive_path = File.join(cache_path, "hello.world")
33
+
34
+ block_executed = false
35
+ Cache.fetch("hello.world", cache_path: cache_path) do |path|
36
+ assert_equal archive_path, path
37
+ block_executed = true
38
+ end
39
+ assert block_executed, "block should be executed"
40
+ end
41
+ end
42
+ end
@@ -0,0 +1,28 @@
1
+ require "test_helper"
2
+
3
+ module Suvii
4
+ class Extract
5
+ class TargzTest < Minitest::Test
6
+ def teardown
7
+ FileUtils.rm_rf(destination)
8
+ end
9
+
10
+ def destination
11
+ @destination ||= Dir.mktmpdir
12
+ end
13
+
14
+ def test_extract_to
15
+ subject = Targz.new("test/fixtures/trumbowyg.tar.gz")
16
+ result = subject.extract_to(destination)
17
+ assert_equal destination, result
18
+ assert_dirs_equal "test/fixtures/results", destination
19
+ end
20
+
21
+ def test_extract_to_with_strip_components
22
+ subject = Targz.new("test/fixtures/trumbowyg.tar.gz", strip_components: 1)
23
+ subject.extract_to(destination)
24
+ assert_dirs_equal "test/fixtures/results/Trumbowyg-1.1.7", destination
25
+ end
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,28 @@
1
+ require "test_helper"
2
+
3
+ module Suvii
4
+ class Extract
5
+ class ZipTest < Minitest::Test
6
+ def teardown
7
+ FileUtils.rm_rf(destination)
8
+ end
9
+
10
+ def destination
11
+ @destination ||= Dir.mktmpdir
12
+ end
13
+
14
+ def test_extract_to
15
+ subject = Zip.new("test/fixtures/trumbowyg.zip")
16
+ result = subject.extract_to(destination)
17
+ assert_equal destination, result
18
+ assert_dirs_equal "test/fixtures/results", destination
19
+ end
20
+
21
+ def test_extract_to_with_strip_components
22
+ subject = Zip.new("test/fixtures/trumbowyg.zip", strip_components: 1)
23
+ subject.extract_to(destination)
24
+ assert_dirs_equal "test/fixtures/results/Trumbowyg-1.1.7", destination
25
+ end
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,26 @@
1
+ require "test_helper"
2
+
3
+ module Suvii
4
+ class ExtractTest < Minitest::Test
5
+ def test_class_for_targz
6
+ klass = Extract.class_for("/tmp/hello.tar.gz")
7
+ assert_equal Extract::Targz, klass
8
+ end
9
+
10
+ def test_class_for_tgz
11
+ klass = Extract.class_for("/tmp/hello.tgz")
12
+ assert_equal Extract::Targz, klass
13
+ end
14
+
15
+ def test_class_for_zip
16
+ klass = Extract.class_for("/tmp/hello.zip")
17
+ assert_equal Extract::Zip, klass
18
+ end
19
+
20
+ def test_class_for_unknown
21
+ assert_raises(Extract::UnknownFormatError) do
22
+ Extract.class_for("/tmp/hello.rar")
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,6 @@
1
+ # Auto detect text files and perform LF normalization
2
+ * text=auto
3
+
4
+ # SCSS and JS files must always use LF for tools to work
5
+ *.js eol=lf
6
+ *.scss eol=lf
@@ -0,0 +1,15 @@
1
+ {
2
+ "expr": true,
3
+ "noarg": true,
4
+ "onevar": true,
5
+ "quotmark": "simple",
6
+ "undef": true,
7
+ "unused": true,
8
+
9
+ "browser": true,
10
+ "node": true,
11
+
12
+ "globals": {
13
+ "jQuery": false
14
+ }
15
+ }
@@ -0,0 +1,167 @@
1
+ var gulp = require('gulp'),
2
+ $ = require('gulp-load-plugins')(),
3
+ path = require('path'),
4
+ spritesmith = require('gulp.spritesmith');
5
+
6
+ var paths = {
7
+ scripts: ['src/trumbowyg.js'],
8
+ langs: ['src/langs/**.js', '!src/langs/en.js'],
9
+ plugins: ['plugins/*/**.js', '!plugins/*/Gulpfile.js'],
10
+ sprites: {
11
+ 'icons': 'src/ui/images/icons/**.png',
12
+ 'icons-2x': 'src/ui/images/icons-2x/**.png'
13
+ },
14
+ mainStyle: 'src/ui/sass/trumbowyg.scss',
15
+ styles: {
16
+ sass: 'src/ui/sass',
17
+ includePaths: ['src/ui/sass']
18
+ }
19
+ };
20
+
21
+ var pkg = require('./package.json');
22
+ var banner = ['/**',
23
+ ' * <%= pkg.title %> v<%= pkg.version %> - <%= pkg.description %>',
24
+ ' * <%= description %>',
25
+ ' * ------------------------',
26
+ ' * @link <%= pkg.homepage %>',
27
+ ' * @license <%= pkg.license %>',
28
+ ' * @author <%= pkg.author.name %>',
29
+ ' * Twitter : @AlexandreDemode',
30
+ ' * Website : <%= pkg.author.url.replace("http://", "") %>',
31
+ ' */',
32
+ '\n'].join('\n');
33
+ var bannerLight = ['/** <%= pkg.title %> v<%= pkg.version %> - <%= pkg.description %>',
34
+ ' - <%= pkg.homepage.replace("http://", "") %>',
35
+ ' - License <%= pkg.license %>',
36
+ ' - Author : <%= pkg.author.name %>',
37
+ ' / <%= pkg.author.url.replace("http://", "") %>',
38
+ ' */',
39
+ '\n'].join('');
40
+
41
+
42
+
43
+
44
+ gulp.task('clean', function(){
45
+ return gulp.src(['dist/*', 'src/ui/sass/_sprite*.scss'])
46
+ .pipe($.clean());
47
+ });
48
+
49
+ gulp.task('test', ['test-scripts', 'test-langs', 'test-plugins']);
50
+ gulp.task('test-scripts', function(){
51
+ return gulp.src(paths.scripts)
52
+ .pipe($.jshint())
53
+ .pipe($.jshint.reporter('jshint-stylish'));
54
+ });
55
+ gulp.task('test-langs', function(){
56
+ return gulp.src(paths.langs)
57
+ .pipe($.jshint())
58
+ .pipe($.jshint.reporter('jshint-stylish'));
59
+ });
60
+ gulp.task('test-plugins', function(){
61
+ return gulp.src(paths.plugins)
62
+ .pipe($.jshint())
63
+ .pipe($.jshint.reporter('jshint-stylish'));
64
+ });
65
+
66
+ gulp.task('scripts', ['test-scripts'], function(){
67
+ return gulp.src(paths.scripts)
68
+ .pipe($.header(banner, { pkg: pkg, description: 'Trumbowyg core file' }))
69
+ .pipe($.newer('dist/trumbowyg.js'))
70
+ .pipe($.concat('trumbowyg.js', { newLine: '\r\n\r\n' }))
71
+ .pipe(gulp.dest('dist/'))
72
+ .pipe($.size({ title: 'trumbowyg.js' }))
73
+ .pipe($.rename({ suffix: ".min" }))
74
+ .pipe($.uglify())
75
+ .pipe($.header(bannerLight, { pkg: pkg }))
76
+ .pipe(gulp.dest('dist/'))
77
+ .pipe($.size({ title: 'trumbowyg.min.js' }))
78
+ });
79
+
80
+ gulp.task('langs', ['test-langs'], function(){
81
+ return gulp.src(paths.langs)
82
+ .pipe($.rename({ suffix: ".min" }))
83
+ .pipe($.uglify({
84
+ preserveComments: 'all'
85
+ }))
86
+ .pipe(gulp.dest('dist/langs/'))
87
+ });
88
+
89
+ gulp.task('plugins', ['test-plugins'], function(){
90
+ return gulp.src(paths.plugins)
91
+ .pipe(gulp.dest('dist/plugins/'))
92
+ .pipe($.rename({ suffix: ".min" }))
93
+ .pipe($.uglify())
94
+ .pipe(gulp.dest('dist/plugins/'))
95
+ });
96
+
97
+
98
+
99
+ gulp.task('sprites', function(){
100
+ return makeSprite() && makeSprite('-2x');
101
+ });
102
+ function makeSprite(resolution){
103
+ if(!resolution)
104
+ resolution = '';
105
+
106
+ var sprite = gulp.src(paths.sprites['icons' + resolution])
107
+ .pipe(spritesmith({
108
+ imgName: 'icons' + resolution + '.png',
109
+ cssName: '_sprite' + resolution + '.scss',
110
+ cssTemplate: function(params){
111
+ var output = '', e;
112
+ for(var i in params.items){
113
+ e = params.items[i];
114
+ output += '$' + e.name + resolution + ': ' + e.px.offset_x + ' ' + e.px.offset_y + ';\n';
115
+ }
116
+ if(params.items.length > 0){
117
+ output += '\n\n';
118
+ output += '$sprite-height' + resolution + ': ' + params.items[0].px.total_height + ';\n';
119
+ output += '$sprite-width' + resolution + ': ' + params.items[0].px.total_width + ';\n';
120
+ output += '$icons' + resolution + ': "./images/icons' + resolution + '.png";';
121
+ }
122
+
123
+ return output;
124
+ }
125
+ }));
126
+ sprite.img.pipe(gulp.dest('dist/ui/images/'));
127
+ sprite.css.pipe(gulp.dest(paths.styles.sass));
128
+ return sprite.css;
129
+ }
130
+
131
+
132
+
133
+ gulp.task("styles", ["sprites"], function(){
134
+ return gulp.src(paths.mainStyle)
135
+ .pipe($.sass({
136
+ sass: paths.styles.sass,
137
+ includePaths: paths.styles.includePaths
138
+ }))
139
+ .pipe($.autoprefixer(["last 1 version", "> 1%", "ff >= 20", "ie >= 8", "opera >= 12", "Android >= 2.2"], { cascade: true }))
140
+ .pipe($.header(banner, { pkg: pkg, description: "Default stylesheet for Trumbowyg editor" }))
141
+ .pipe(gulp.dest("dist/ui/"))
142
+ .pipe($.size({ title: "trumbowyg.css" }))
143
+ .pipe($.rename({ suffix: ".min" })) // génère une version minimifié
144
+ .pipe($.minifyCss())
145
+ .pipe($.header(bannerLight, { pkg: pkg }))
146
+ .pipe(gulp.dest("dist/ui/"))
147
+ .pipe($.size({ title: "trumbowyg.min.css" }));
148
+ });
149
+
150
+
151
+
152
+ gulp.task('watch', function(){
153
+ gulp.watch(paths.scripts, ['scripts']);
154
+ gulp.watch(paths.langs, ['langs']);
155
+ gulp.watch(paths.plugins, ['plugins']);
156
+ gulp.watch(paths.mainStyle, ['styles']);
157
+
158
+ gulp.watch(['dist/**', 'dist/*/**'], function(file){
159
+ $.livereload.changed(file);
160
+ });
161
+
162
+ $.livereload.listen();
163
+ });
164
+
165
+ gulp.task('build', ['scripts', 'langs', 'plugins', 'styles']);
166
+
167
+ gulp.task('default', ['build', 'watch']);
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2012-2014 Alexandre Demode (Alex-D)
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
@@ -0,0 +1,29 @@
1
+ # Trumbowyg WYSIWYG Editor
2
+
3
+ Trumbowyg is a simple and lightweight WYSIWYG editor, is only 15kB for faster page loading.
4
+
5
+
6
+ # Website
7
+
8
+ http://alex-d.github.io/Trumbowyg/
9
+
10
+
11
+ # Documentation
12
+
13
+ http://alex-d.github.io/Trumbowyg/documentation.html
14
+
15
+
16
+ # Contribute
17
+
18
+ You can contribute to Trumbowyg with translations in languages you know.
19
+ Thanks to `node` and `gulp`, you can improve core script, style or icons easily.
20
+
21
+
22
+ # Thanks
23
+
24
+ Vinz, who has make some icons for default design.
25
+
26
+
27
+ # License
28
+
29
+ This project is under MIT license. See LICENSE file for details.
@@ -0,0 +1,36 @@
1
+ {
2
+ "name": "trumbowyg",
3
+ "version": "1.1.7",
4
+ "homepage": "https://github.com/Alex-D/Trumbowyg",
5
+ "authors": [
6
+ {
7
+ "name": "Alexandre Demode (Alex-D)",
8
+ "email": "contact@alex-d.fr",
9
+ "homepage": "http://alex-d.fr"
10
+ }
11
+ ],
12
+ "description": "A lightweight WYSIWYG editor",
13
+ "main": "dist/trumbowyg.js",
14
+ "keywords": [
15
+ "editor",
16
+ "wysiwyg",
17
+ "javascript",
18
+ "richtext"
19
+ ],
20
+ "license": "MIT",
21
+ "ignore": [
22
+ "**/.*",
23
+ "bower_components",
24
+ "node_modules",
25
+ "plugins",
26
+ "!dist/plugins",
27
+ "test",
28
+ "tests",
29
+ "src",
30
+ "Gulpfile.js",
31
+ "package.json"
32
+ ],
33
+ "dependencies": {
34
+ "jquery": ">=1.7"
35
+ }
36
+ }
@@ -0,0 +1,11 @@
1
+ /* ===========================================================
2
+ * ca.js
3
+ * Catalan translation for Trumbowyg
4
+ * http://alex-d.github.com/Trumbowyg
5
+ * ===========================================================
6
+ * Author : Àlfons Sánchez (alsanan)
7
+ * Twitter : @alsanan
8
+ * Website : about.me/alsanan
9
+ * Github : https://github.com/alsanan
10
+ */
11
+ jQuery.trumbowyg.langs.ca={viewHTML:"Veure HTML",formatting:"Formatar",p:"Paragraf",blockquote:"Citació",code:"Codi",header:"Títol",bold:"Negreta",italic:"Itàlica",strikethrough:"Suprimir",underline:"Subratllat",strong:"Forta",em:"Èmfasi",del:"Apagar",unorderedList:"Lista desordenada",orderedList:"Lista ordenada",insertImage:"Inserir imatge",insertVideo:"Inserir vídeo",link:"Enllaç",createLink:"Crear un enllaç",unlink:"Eliminar enllaç",justifyLeft:"Alinear a esquerra",justifyCenter:"Centrar",justifyRight:"Alinear a dreta",justifyFull:"Justificar",horizontalRule:"Inserir separador horitzontal",fullscreen:"Pantalla completa",close:"Tancar",submit:"Enviar",reset:"Reiniciar",invalidUrl:"URL invàlida",required:"Obligatori",description:"Descripció",title:"Títol",text:"Text"};
@@ -0,0 +1,9 @@
1
+ /* ===========================================================
2
+ * da.js
3
+ * Danish translation for Trumbowyg
4
+ * http://alex-d.github.com/Trumbowyg
5
+ * ===========================================================
6
+ * Author : Christian Pedersen
7
+ * Github : https://github.com/chripede
8
+ */
9
+ jQuery.trumbowyg.langs.da={viewHTML:"Vis HTML",formatting:"Formatter",p:"Afsnit",blockquote:"Citat",code:"Kode",header:"Overskrift",bold:"Fed",italic:"Kursiv",strikethrough:"Gennemstreg",underline:"Understreg",strong:"Vigtig",em:"Fremhæv",del:"Slettet",unorderedList:"Uordnet liste",orderedList:"Ordnet liste",insertImage:"Indsæt billede",insertVideo:"Indsæt video",link:"Link",createLink:"Indsæt link",unlink:"Fjern link",justifyLeft:"Venstrestil",justifyCenter:"Centrer",justifyRight:"Højrestil",justifyFull:"Lige margener",horizontalRule:"Horisontal linie",fullscreen:"Fuld skærm",close:"Luk",submit:"Bekræft",reset:"Annuller",invalidUrl:"Ugyldig URL",required:"Påkrævet",description:"Beskrivelse",title:"Titel",text:"Tekst"};
@@ -0,0 +1,9 @@
1
+ /* ===========================================================
2
+ * de.js
3
+ * German translation for Trumbowyg
4
+ * http://alex-d.github.com/Trumbowyg
5
+ * ===========================================================
6
+ * Author : Manfred Timm
7
+ * Github : https://github.com/Manfred62
8
+ */
9
+ jQuery.trumbowyg.langs.de={viewHTML:"HTML anzeigen",formatting:"Formatieren",p:"Absatz",blockquote:"Zitat",code:"Code",header:"Überschrift",bold:"Fett",italic:"Kursiv",strikethrough:"Durchgestrichen",underline:"Unterstrichen",strong:"Wichtig",em:"Betont",del:"Gelöscht",unorderedList:"Ungeordnete Liste",orderedList:"Geordnete Liste",insertImage:"Bild einfügen",insertVideo:"Video einfügen",link:"Link",createLink:"Link einfügen",unlink:"Link entfernen",justifyLeft:"Links ausrichten",justifyCenter:"Zentrieren",justifyRight:"Rechts ausrichten",justifyFull:"Blocksatz",horizontalRule:"Horizontale Linie einfügen",fullscreen:"Vollbild",close:"Schliessen",submit:"Bestätigen",reset:"Rücksetzen",invalidUrl:"Ungültige URL",required:"Erforderlich",description:"Beschreibung",title:"Titel",text:"Text"};