fluby 0.6.6 → 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore ADDED
@@ -0,0 +1,2 @@
1
+ pkg
2
+ *.gem
data/Changelog ADDED
@@ -0,0 +1,37 @@
1
+ 0.X.X
2
+ -----
3
+ * Support for user templates
4
+
5
+ 0.7.0
6
+ -----
7
+ * Moved gem to gemcutter.org
8
+
9
+ 0.6.4
10
+ -----
11
+ * Added 'rake monitor' task to fluby project, so the project autocompiles whenever you save the main .as file or any of the auxiliary files (index.rhtml, project.rxml or Rakefile)
12
+ * Added :assets task to fluby Rakefile. js and xml files in the 'assets' folder are copied to the 'deploy' folder when compiling.
13
+ * Run 'pack' task when running 'rake release'
14
+ * Create swfobject.js in 'assets' folder instead of 'deploy'
15
+ * Added Video asset to the rxml template. It's commented out in case you don't need it, but it's nice to have it there as I always forget the syntax :)
16
+ * Use packed swfobject.js
17
+
18
+ 0.6.1
19
+ -----
20
+ * Added 'delegate' template for script/generate
21
+
22
+ 0.6
23
+ ---
24
+ * Added colorized output to terminal operations
25
+ * Added 'rake package' task
26
+ * Added 'script/generate' tool to generate common classes (right now there's only a 'xml_loader' template)
27
+
28
+ 0.5.7
29
+ -----
30
+ * Improved Rakefile for non-Mac systems
31
+
32
+ 0.5.6
33
+ -----
34
+
35
+ * Added support for multiple weights of a font family (thanks mamuso)
36
+ * Fixed a bug on the project Rakefile that made it imposible to add assets (the SWF was overwritten by MTASC after swfmill imported the assets)
37
+ * Improved documentation (just a little bit :)
data/Rakefile ADDED
@@ -0,0 +1,49 @@
1
+ ##### Requirements
2
+
3
+ require 'rake'
4
+ require 'rake/clean'
5
+ require 'rake/testtask'
6
+ require File.dirname(__FILE__) + '/lib/fluby.rb'
7
+
8
+ ##### Jeweler
9
+ begin
10
+ require 'jeweler'
11
+ Jeweler::Tasks.new do |gemspec|
12
+ gemspec.name = "fluby"
13
+ gemspec.summary = "MTASC + SWFMILL + Rake helper"
14
+ gemspec.description = "A simple command to create and compile an ActionScript project for MTASC + SWFMILL + Rake"
15
+ gemspec.email = "bomberstudios@gmail.com"
16
+ gemspec.homepage = "http://github.com/bomberstudios/fluby"
17
+ gemspec.authors = ["Ale Muñoz"]
18
+ gemspec.rubyforge_project = 'fluby'
19
+ end
20
+ Jeweler::GemcutterTasks.new
21
+ # release with: $ rake gemcutter:release
22
+ rescue LoadError
23
+ puts "Jeweler not available. Install it with: sudo gem install technicalpickles-jeweler -s http://gems.github.com"
24
+ end
25
+
26
+ ##### Cleaning
27
+ CLEAN.include [ 'tmp', 'test/fixtures/*/output/*', 'test/fixtures/*/tmp' ]
28
+ CLOBBER.include [ 'pkg', '*.gem', 'coverage.data' ]
29
+
30
+ ### Testing
31
+ Rake::TestTask.new(:test) do |test|
32
+ test.test_files = Dir['test/test_*.rb']
33
+ end
34
+
35
+ desc 'Test code coverage using rcov'
36
+ task :rcov do
37
+ rm_f "coverage"
38
+ rm_f "coverage.data"
39
+ rcov = "rcov --exclude gem --aggregate coverage.data --text-summary -Ilib"
40
+ sh "#{rcov} --no-html test/*", :verbose => false
41
+ end
42
+
43
+ desc "Test and package gem"
44
+ task :default => [ :test, :gemspec, :build ]
45
+
46
+ desc "Push GEM to Gemcutter"
47
+ task :push => [ :clobber, :default ] do
48
+ %x(rake gemcutter:release)
49
+ end
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.7.0
data/fluby.gemspec ADDED
@@ -0,0 +1,62 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run `rake gemspec`
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = %q{fluby}
8
+ s.version = "0.7.0"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["Ale Muñoz"]
12
+ s.date = %q{2009-10-14}
13
+ s.default_executable = %q{fluby}
14
+ s.description = %q{A simple command to create and compile an ActionScript project for MTASC + SWFMILL + Rake}
15
+ s.email = %q{bomberstudios@gmail.com}
16
+ s.executables = ["fluby"]
17
+ s.extra_rdoc_files = [
18
+ "README.mdown"
19
+ ]
20
+ s.files = [
21
+ ".gitignore",
22
+ "Changelog",
23
+ "README.mdown",
24
+ "Rakefile",
25
+ "VERSION",
26
+ "bin/fluby",
27
+ "fluby.gemspec",
28
+ "lib/fluby.rb",
29
+ "lib/templates/ASClass.as",
30
+ "lib/templates/README",
31
+ "lib/templates/Rakefile",
32
+ "lib/templates/generate",
33
+ "lib/templates/generators/class",
34
+ "lib/templates/generators/delegate",
35
+ "lib/templates/generators/xml_loader",
36
+ "lib/templates/index.rhtml",
37
+ "lib/templates/project.rxml",
38
+ "lib/templates/swfobject.js",
39
+ "test/helper.rb",
40
+ "test/test_fluby.rb"
41
+ ]
42
+ s.homepage = %q{http://github.com/bomberstudios/fluby}
43
+ s.rdoc_options = ["--charset=UTF-8"]
44
+ s.require_paths = ["lib"]
45
+ s.rubyforge_project = %q{fluby}
46
+ s.rubygems_version = %q{1.3.5}
47
+ s.summary = %q{MTASC + SWFMILL + Rake helper}
48
+ s.test_files = [
49
+ "test/helper.rb",
50
+ "test/test_fluby.rb"
51
+ ]
52
+
53
+ if s.respond_to? :specification_version then
54
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
55
+ s.specification_version = 3
56
+
57
+ if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
58
+ else
59
+ end
60
+ else
61
+ end
62
+ end
data/lib/fluby.rb CHANGED
@@ -3,7 +3,7 @@ require "fileutils"
3
3
 
4
4
  module Fluby
5
5
  NAME = 'fluby'
6
- VERSION = '0.6.6'
6
+ VERSION = %x(cat VERSION)
7
7
 
8
8
  COLORS = {
9
9
  :black => "\033[0;30m",
@@ -1,7 +1,7 @@
1
1
  class <%= @project_name %> {
2
- var _timeline:MovieClip;
2
+ var mc:MovieClip;
3
3
  function <%= @project_name %>(timeline){
4
- _timeline = timeline;
4
+ mc = timeline;
5
5
  }
6
6
  static function main(tl:MovieClip){
7
7
  var app:<%= @project_name %> = new <%= @project_name %>(tl);
data/test/helper.rb ADDED
@@ -0,0 +1,38 @@
1
+ require "lib/fluby"
2
+ require "fileutils"
3
+ require "erb"
4
+ require "stringio"
5
+
6
+ PROJECT = "TestProject"
7
+ APP = PROJECT
8
+ @project_name = PROJECT
9
+ @project_folder = @project_name
10
+
11
+ def global_setup
12
+ # Go quiet
13
+ $stdout_real = $stdout
14
+ $stderr_real = $stderr
15
+ unless ENV['QUIET'] == 'false'
16
+ $stdout = StringIO.new
17
+ $stderr = StringIO.new
18
+ end
19
+ make_project PROJECT
20
+ end
21
+
22
+ def global_teardown
23
+ %x(rm -Rf #{PROJECT})
24
+ # Go unquiet
25
+ unless ENV['QUIET'] == 'false'
26
+ $stdout = $stdout_real
27
+ $stderr = $stderr_real
28
+ end
29
+ end
30
+ def make_project(name)
31
+ Fluby.create_project(name)
32
+ end
33
+
34
+ def in_folder(name)
35
+ FileUtils.cd(name) do
36
+ yield
37
+ end
38
+ end
@@ -0,0 +1,110 @@
1
+ require "test/helper"
2
+ require "test/unit"
3
+ # TODO: test log
4
+ # TODO: test install
5
+
6
+ class TestFluby < Test::Unit::TestCase
7
+
8
+ def setup
9
+ global_setup
10
+ end
11
+ def teardown
12
+ global_teardown
13
+ end
14
+
15
+ def test_fluby_is_loaded
16
+ assert_not_nil Fluby::VERSION
17
+ assert_equal "fluby", Fluby::NAME
18
+ end
19
+
20
+ def test_project_creation
21
+ assert_not_nil File.exist?(PROJECT)
22
+ end
23
+ def test_error_creating_existing_project
24
+ assert_raise RuntimeError do
25
+ make_project PROJECT
26
+ end
27
+ end
28
+
29
+ def test_files_are_created_ok
30
+ assert_equal 1, Dir["#{PROJECT}/*.as"].size
31
+ assert_equal 1, Dir["#{PROJECT}/*.rxml"].size
32
+ assert_equal 1, Dir["#{PROJECT}/*.rhtml"].size
33
+ assert_equal 1, Dir["#{PROJECT}/assets/swfobject.js"].size
34
+ end
35
+
36
+ def test_file_contents
37
+ assert_equal ERB.new(IO.read("lib/templates/README")).result, File.read("#{PROJECT}/README")
38
+ assert_equal ERB.new(IO.read("lib/templates/Rakefile")).result, File.read("#{PROJECT}/Rakefile")
39
+ assert_equal ERB.new(IO.read("lib/templates/ASClass.as")).result, File.read("#{PROJECT}/#{PROJECT}.as")
40
+ end
41
+
42
+ def test_compilation
43
+ in_folder(PROJECT) do
44
+ %x(rake compile)
45
+ assert File.exist?("deploy/#{PROJECT}.swf"), "Compilation failed. Have you installed mtasc and swfmill?"
46
+ end
47
+ end
48
+
49
+ def test_generator
50
+ in_folder(PROJECT) do
51
+ Fluby.available_templates.each do |tpl|
52
+ Fluby.generate tpl, "com.bomberstudios.#{tpl}"
53
+ assert File.exist?("com/bomberstudios/#{tpl}.as"), "Error generating #{tpl}"
54
+ end
55
+ end
56
+ end
57
+ def test_generator_with_single_option
58
+ in_folder(PROJECT) do
59
+ Fluby.generate "class", "com.bomberstudios.ClassTest", "foo:String"
60
+ assert File.exist?("com/bomberstudios/ClassTest.as")
61
+ assert_not_nil File.read("com/bomberstudios/ClassTest.as").match("var foo:String;")
62
+ end
63
+ end
64
+ def test_generator_with_multiple_options
65
+ in_folder(PROJECT) do
66
+ Fluby.generate "class", "com.bomberstudios.ClassTest", ["foo:String", "bar:XML"]
67
+ assert File.exist?("com/bomberstudios/ClassTest.as")
68
+ assert_not_nil File.read("com/bomberstudios/ClassTest.as").match("var foo:String;")
69
+ assert_not_nil File.read("com/bomberstudios/ClassTest.as").match("var bar:XML;")
70
+ end
71
+ end
72
+ def test_generator_with_multiple_options_via_commandline
73
+ in_folder(PROJECT) do
74
+ %x(script/generate class com.bomberstudios.Car make:String model:String year:Number)
75
+ assert File.exist?("com/bomberstudios/Car.as")
76
+ assert_not_nil File.read("com/bomberstudios/Car.as").match("var make:String;")
77
+ assert_not_nil File.read("com/bomberstudios/Car.as").match("var model:String;")
78
+ assert_not_nil File.read("com/bomberstudios/Car.as").match("var year:Number;")
79
+ end
80
+ end
81
+ def test_error_creating_existing_template
82
+ in_folder(PROJECT) do
83
+ assert_raise RuntimeError do
84
+ Fluby.generate "class", "com.bomberstudios.ClassTest", ["foo:String", "bar:XML"]
85
+ Fluby.generate "class", "com.bomberstudios.ClassTest", ["foo:String", "bar:XML"]
86
+ end
87
+ end
88
+ end
89
+
90
+ def test_available_templates
91
+ assert_equal Dir["lib/templates/generators/*"].size, Fluby.available_templates.size, "Template count mismatch"
92
+ in_folder PROJECT do
93
+ templates = %x(script/generate)
94
+ tpl_list = Fluby.available_templates.join("\n\t")
95
+ assert_equal "Usage: script/generate type classpath [options]\nwhere type is one of\n\t#{tpl_list}\n", templates
96
+ end
97
+ end
98
+
99
+ def test_textmate
100
+ assert !Fluby.in_textmate?
101
+ end
102
+
103
+ def test_package
104
+ in_folder(PROJECT) do
105
+ %x(rake package)
106
+ now = Time.now.strftime("%Y%m%d")
107
+ assert File.exist?("pkg/#{now}-#{PROJECT}.zip")
108
+ end
109
+ end
110
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.6
4
+ version: 0.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - "Ale Mu\xC3\xB1oz"
@@ -9,46 +9,53 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-10-11 00:00:00 +02:00
13
- default_executable:
12
+ date: 2009-10-14 00:00:00 +02:00
13
+ default_executable: fluby
14
14
  dependencies: []
15
15
 
16
- description: A simple command to create an empty ActionScript project for MTASC + SWFMILL + Rake
16
+ description: A simple command to create and compile an ActionScript project for MTASC + SWFMILL + Rake
17
17
  email: bomberstudios@gmail.com
18
18
  executables:
19
19
  - fluby
20
20
  extensions: []
21
21
 
22
- extra_rdoc_files: []
23
-
22
+ extra_rdoc_files:
23
+ - README.mdown
24
24
  files:
25
+ - .gitignore
26
+ - Changelog
25
27
  - README.mdown
28
+ - Rakefile
29
+ - VERSION
26
30
  - bin/fluby
31
+ - fluby.gemspec
27
32
  - lib/fluby.rb
28
33
  - lib/templates/ASClass.as
29
- - lib/templates/index.rhtml
30
- - lib/templates/project.rxml
31
- - lib/templates/Rakefile
32
34
  - lib/templates/README
33
- - lib/templates/swfobject.js
35
+ - lib/templates/Rakefile
34
36
  - lib/templates/generate
35
37
  - lib/templates/generators/class
36
38
  - lib/templates/generators/delegate
37
39
  - lib/templates/generators/xml_loader
40
+ - lib/templates/index.rhtml
41
+ - lib/templates/project.rxml
42
+ - lib/templates/swfobject.js
43
+ - test/helper.rb
44
+ - test/test_fluby.rb
38
45
  has_rdoc: true
39
- homepage: http://github.com/bomberstudios/fluby/
46
+ homepage: http://github.com/bomberstudios/fluby
40
47
  licenses: []
41
48
 
42
49
  post_install_message:
43
- rdoc_options: []
44
-
50
+ rdoc_options:
51
+ - --charset=UTF-8
45
52
  require_paths:
46
53
  - lib
47
54
  required_ruby_version: !ruby/object:Gem::Requirement
48
55
  requirements:
49
56
  - - ">="
50
57
  - !ruby/object:Gem::Version
51
- version: 1.8.5
58
+ version: "0"
52
59
  version:
53
60
  required_rubygems_version: !ruby/object:Gem::Requirement
54
61
  requirements:
@@ -63,5 +70,6 @@ rubygems_version: 1.3.5
63
70
  signing_key:
64
71
  specification_version: 3
65
72
  summary: MTASC + SWFMILL + Rake helper
66
- test_files: []
67
-
73
+ test_files:
74
+ - test/helper.rb
75
+ - test/test_fluby.rb