tidyflash 0.9.5 → 0.9.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/Manifest CHANGED
@@ -8,11 +8,11 @@ lib/script/generate
8
8
  lib/script/server
9
9
  lib/script/server.rb
10
10
  lib/tasks/assets.rb
11
- lib/tasks/demo_config.rb
12
11
  lib/tasks/deploy.rb
13
12
  lib/tidy/air_packager.rb
14
13
  lib/tidy/axml.rb
15
14
  lib/tidy/compile.rb
15
+ lib/tidy/demo_config.rb
16
16
  lib/tidy/generate.rb
17
17
  lib/tidy/template.rb
18
18
  lib/tidy/template_binding.rb
@@ -9,15 +9,19 @@ module Tidy
9
9
  FileUtils.mkdir_p("../releases")
10
10
  Dir.chdir "bin" do
11
11
  certificate_command = "adt -certificate -cn SelfSigned 1024-RSA #{certificate} #{password}"
12
- puts `#{certificate_command}`
13
- package_command= "adt -package -storetype pkcs12 -keystore ../config/air_cert.pfx -storepass #{password} ../../releases/#{id}.air #{id}.axml #{id}.swf #{files.join(' ')}"
12
+ unless File.exists?(certificate)
13
+ puts `#{certificate_command}`
14
+ end
15
+ package_command= "adt -package -storetype pkcs12 -keystore #{certificate} -storepass #{password} ../../releases/#{id}.air #{id}.axml #{id}.swf #{files.join(' ')}"
14
16
  puts `#{package_command}`
15
17
  end
16
- unless RUBY_PLATFORM =~ /linux/
17
- `open ../releases/#{id}.air`
18
- else
19
- `gnome-open ../releases/#{id}.air`
20
- end
18
+ unless options[:do_not_launch]
19
+ unless RUBY_PLATFORM =~ /linux/
20
+ `open ../releases/#{id}.air`
21
+ else
22
+ `gnome-open ../releases/#{id}.air`
23
+ end
24
+ end
21
25
  end
22
26
  end
23
27
  end
data/lib/tidy/axml.rb CHANGED
@@ -37,7 +37,7 @@ module Tidy
37
37
  return file
38
38
  end
39
39
  end
40
- puts "CAN'T find existing file in #{files}"
40
+ raise "CAN'T find existing file in #{files.inspect} running in #{File.expand_path('.')}"
41
41
  # throw error
42
42
  end
43
43
 
data/lib/tidy/compile.rb CHANGED
@@ -15,6 +15,7 @@ require 'sprout/user'
15
15
  require 'sprout/fcsh_socket'
16
16
  require "#{File.expand_path(File.dirname(__FILE__))}/axml"
17
17
  require "#{File.expand_path(File.dirname(__FILE__))}/version"
18
+ require "#{File.expand_path(File.dirname(__FILE__))}/demo_config"
18
19
 
19
20
  def method_name
20
21
 
@@ -61,8 +62,8 @@ module Tidy
61
62
  def self.demo(args)
62
63
  DemoConfig.new(:vars=>args[:vars] || {},
63
64
  :class=>'DemoConfig',
64
- :output=>"demos/#{args[:output]}/DemoConfig.as")
65
- air(args.merge(:paths=>["demos/#{args[:output]}"]))
65
+ :output=>"src/DemoConfig.as")
66
+ air(args.merge(:paths=>["src"]))
66
67
  end
67
68
 
68
69
  def self.get_compile_command(args, initial_command)
@@ -82,7 +83,7 @@ module Tidy
82
83
  =end
83
84
  IO.popen(command){ |process| process.each { |line| puts line } }
84
85
  end
85
- DEFAULT_PATHS = %w[src assets ~/.tidy/tidy-as3]
86
+ DEFAULT_PATHS = %w[src ~/.tidy/tidy-as3]
86
87
  def self.parse_options(args)
87
88
  options = DEFAULTS.dup()
88
89
  options.each_pair do |k,v|
@@ -14,7 +14,7 @@ class String
14
14
  end
15
15
  class DemoConfig
16
16
  def initialize(options)
17
- template = File.read( 'lib/tasks/templates/demo_config.as.erb' )
17
+ template = File.read( "#{File.expand_path(File.dirname(__FILE__))}/templates/demo_config.as.erb" )
18
18
  @vars = options[:vars]
19
19
  @class = options[:class]
20
20
  @package = ""
@@ -1,7 +1,9 @@
1
- package <%=@package%>{
2
- public class <%=@class%> {
1
+ package <%=@package%>
2
+ {
3
+ public class <%=@class%>
4
+ {
3
5
  <% @vars.each do |key,value| %>
4
6
  public static var <%=key%> : <%=value.class%> = <%=value.inspect.to_actionscript%>;
5
7
  <% end %>
6
- }
8
+ }
7
9
  }
data/lib/tidy/version.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  module Tidy
2
2
  class Version
3
3
  def self.number
4
- '0.9.5'
4
+ '0.9.6'
5
5
  end
6
6
  end
7
7
  end
data/lib/tidy_project.rb CHANGED
@@ -8,7 +8,7 @@ class TidyProject
8
8
  def initialize(project_name)
9
9
  unless File.exists?(File.expand_path("~/.tidy/tidy-as3"))
10
10
  puts "You don't have the tidy as3 libs installed. Attempting to pull them from github..."
11
- command = "git clone git://github.com/michaelforrest/tidy-as3.git ~/.tidy/tidy-as3"
11
+ command = "git clone http://github.com/michaelforrest/tidy-as3.git ~/.tidy/tidy-as3"
12
12
  puts command
13
13
  IO.popen(command) { |process| process.each { |line| puts line } }
14
14
  end
@@ -9,6 +9,7 @@ class TestTidyProject < Test::Unit::TestCase
9
9
  lib_path = File.expand_path('lib', __FILE__)
10
10
  $:.unshift(lib_path) unless $:.include?(lib_path)
11
11
  require 'tidy/compile'
12
+ require 'tidy/air_packager'
12
13
 
13
14
  Dir.chdir "tmp" do
14
15
  puts `rm -fr #{TEST_PROJECT_NAME}`
@@ -16,7 +17,21 @@ class TestTidyProject < Test::Unit::TestCase
16
17
  TidyProject.new(TEST_PROJECT_NAME)
17
18
  end
18
19
  end
19
-
20
+
21
+ def test_demo
22
+ in_project_folder do
23
+ Tidy::Compile.demo(:main=>'src/app/views/MainView.as',
24
+ :output=>TEST_PROJECT_FILE_NAME,
25
+ :version=> "0.1",
26
+ :vars=>{:isTouch=>true,
27
+ :variation=>0},
28
+ :do_not_launch=>true)
29
+ config_file = File.new('src/DemoConfig.as','r')
30
+ assert file_contains_string?(config_file, 'isTouch : Boolean = true'), 'DemoConfig.as should add booleans'
31
+ assert file_contains_string?(config_file, 'variation : Number = 0'), 'DemoConfig.as should add numbers'
32
+ end
33
+ end
34
+
20
35
  def test_parse_options
21
36
  #ENV['SPROUT_FLEX4SDK_TOOL'] = "/Users/christian/Library/Sprouts/cache/0.7/sprout-flex3sdk-tool-3.5.1"
22
37
 
@@ -78,6 +93,21 @@ class TestTidyProject < Test::Unit::TestCase
78
93
  "AXML config file should be generated by custom template")
79
94
  end
80
95
  end
96
+
97
+ def test_air_packaging
98
+ in_project_folder do
99
+ do_silent_rake()
100
+ Tidy::AirPackager.package(:id=>TEST_PROJECT_FILE_NAME, :do_not_launch=>true)
101
+ f = "config/air_cert.pfx";
102
+ assert File.exists?(f), "The certificate file should be created the first time the application is packaged"
103
+ content1 = get_file_as_string(f)
104
+ Tidy::AirPackager.package(:id=>TEST_PROJECT_FILE_NAME, :do_not_launch=>true)
105
+ content2 = get_file_as_string(f)
106
+ assert content1 == content2, "The certificate file shouldn't be recreated if already present"
107
+ f = "../releases/#{TEST_PROJECT_FILE_NAME}.air"
108
+ assert File.exists?(f), "The packaged file should be created in the releases folder"
109
+ end
110
+ end
81
111
 
82
112
  def do_silent_rake
83
113
  Tidy::Compile.air(:main=>'src/app/views/MainView.as',
@@ -96,6 +126,24 @@ class TestTidyProject < Test::Unit::TestCase
96
126
  i=i+1
97
127
  end
98
128
  end
129
+
130
+ def file_contains_string?(file, string)
131
+ while (line = file.gets)
132
+ if line.include? string
133
+ return true
134
+ end
135
+ end
136
+ return false
137
+ end
138
+
139
+ def get_file_as_string(filename)
140
+ data = ''
141
+ f = File.open(filename, "r")
142
+ f.each_line do |line|
143
+ data += line
144
+ end
145
+ return data
146
+ end
99
147
  #def test_add_libs
100
148
  # in_project_folder do
101
149
  # assert File.exists?('script'), "No script folder"
data/tidyflash.gemspec CHANGED
@@ -2,16 +2,16 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{tidyflash}
5
- s.version = "0.9.5"
5
+ s.version = "0.9.6"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Michael Forrest"]
9
- s.date = %q{2010-09-21}
9
+ s.date = %q{2011-01-04}
10
10
  s.description = %q{Tidy Flash - an ActionScript framework for people who love Ruby}
11
11
  s.email = %q{mf@grimaceworks.com}
12
12
  s.executables = ["test_project.axml", "tidyflash"]
13
- s.extra_rdoc_files = ["README", "bin/test_project.axml", "bin/tidyflash", "lib/script/bwlimit.rb", "lib/script/generate", "lib/script/server", "lib/script/server.rb", "lib/tasks/assets.rb", "lib/tasks/demo_config.rb", "lib/tasks/deploy.rb", "lib/tidy/air_packager.rb", "lib/tidy/axml.rb", "lib/tidy/compile.rb", "lib/tidy/generate.rb", "lib/tidy/template.rb", "lib/tidy/template_binding.rb", "lib/tidy/templates/demo_config.as.erb", "lib/tidy/version.rb", "lib/tidy_project.rb"]
14
- s.files = ["Manifest", "README", "Rakefile", "bin/test_project.axml", "bin/tidyflash", "lib/script/bwlimit.rb", "lib/script/generate", "lib/script/server", "lib/script/server.rb", "lib/tasks/assets.rb", "lib/tasks/demo_config.rb", "lib/tasks/deploy.rb", "lib/tidy/air_packager.rb", "lib/tidy/axml.rb", "lib/tidy/compile.rb", "lib/tidy/generate.rb", "lib/tidy/template.rb", "lib/tidy/template_binding.rb", "lib/tidy/templates/demo_config.as.erb", "lib/tidy/version.rb", "lib/tidy_project.rb", "templates/project/config/templates/air.axml.erb", "templates/project/project.rb", "templates/project/rakefile.rb", "templates/project/script/fcsh/rakefile.rb", "templates/project/src/app/helpers/Colours.as", "templates/project/src/app/helpers/Debug.as", "templates/project/src/app/helpers/Style.as", "templates/project/src/app/helpers/Typography.as", "templates/project/src/app/models/App.as", "templates/project/src/app/models/FlashVars.as", "templates/project/src/app/views/MainView.as", "templates/project/src/app/views/PreloaderView.as", "templates/project/src/app/views/ViewBase.as", "templates/project/src/assets/fonts/Fonts.as", "templates/scaffold/bin/xml/__model.xml", "templates/scaffold/scaffold.rb", "templates/scaffold/src/models/__Model.as", "templates/scaffold/src/views/__model/__ModelDetailView.as", "templates/scaffold/src/views/__model/__ModelListItemView.as", "templates/scaffold/src/views/__model/__ModelListView.as", "templates/swfobject/bin/index.html", "templates/swfobject/bin/js/swfobject.js", "templates/swfobject/swfobject.rb", "test/test_tidy_project.rb", "tidyflash.gemspec"]
13
+ s.extra_rdoc_files = ["README", "bin/test_project.axml", "bin/tidyflash", "lib/script/bwlimit.rb", "lib/script/generate", "lib/script/server", "lib/script/server.rb", "lib/tasks/assets.rb", "lib/tasks/deploy.rb", "lib/tidy/air_packager.rb", "lib/tidy/axml.rb", "lib/tidy/compile.rb", "lib/tidy/demo_config.rb", "lib/tidy/generate.rb", "lib/tidy/template.rb", "lib/tidy/template_binding.rb", "lib/tidy/templates/demo_config.as.erb", "lib/tidy/version.rb", "lib/tidy_project.rb"]
14
+ s.files = ["Manifest", "README", "Rakefile", "bin/test_project.axml", "bin/tidyflash", "lib/script/bwlimit.rb", "lib/script/generate", "lib/script/server", "lib/script/server.rb", "lib/tasks/assets.rb", "lib/tasks/deploy.rb", "lib/tidy/air_packager.rb", "lib/tidy/axml.rb", "lib/tidy/compile.rb", "lib/tidy/demo_config.rb", "lib/tidy/generate.rb", "lib/tidy/template.rb", "lib/tidy/template_binding.rb", "lib/tidy/templates/demo_config.as.erb", "lib/tidy/version.rb", "lib/tidy_project.rb", "templates/project/config/templates/air.axml.erb", "templates/project/project.rb", "templates/project/rakefile.rb", "templates/project/script/fcsh/rakefile.rb", "templates/project/src/app/helpers/Colours.as", "templates/project/src/app/helpers/Debug.as", "templates/project/src/app/helpers/Style.as", "templates/project/src/app/helpers/Typography.as", "templates/project/src/app/models/App.as", "templates/project/src/app/models/FlashVars.as", "templates/project/src/app/views/MainView.as", "templates/project/src/app/views/PreloaderView.as", "templates/project/src/app/views/ViewBase.as", "templates/project/src/assets/fonts/Fonts.as", "templates/scaffold/bin/xml/__model.xml", "templates/scaffold/scaffold.rb", "templates/scaffold/src/models/__Model.as", "templates/scaffold/src/views/__model/__ModelDetailView.as", "templates/scaffold/src/views/__model/__ModelListItemView.as", "templates/scaffold/src/views/__model/__ModelListView.as", "templates/swfobject/bin/index.html", "templates/swfobject/bin/js/swfobject.js", "templates/swfobject/swfobject.rb", "test/test_tidy_project.rb", "tidyflash.gemspec"]
15
15
  s.homepage = %q{http://github.com/michaelforrest/tidy}
16
16
  s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Tidyflash", "--main", "README"]
17
17
  s.require_paths = ["lib"]
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tidyflash
3
3
  version: !ruby/object:Gem::Version
4
- hash: 49
4
+ hash: 55
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 9
9
- - 5
10
- version: 0.9.5
9
+ - 6
10
+ version: 0.9.6
11
11
  platform: ruby
12
12
  authors:
13
13
  - Michael Forrest
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-09-21 00:00:00 +01:00
18
+ date: 2011-01-04 00:00:00 +00:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -76,11 +76,11 @@ extra_rdoc_files:
76
76
  - lib/script/server
77
77
  - lib/script/server.rb
78
78
  - lib/tasks/assets.rb
79
- - lib/tasks/demo_config.rb
80
79
  - lib/tasks/deploy.rb
81
80
  - lib/tidy/air_packager.rb
82
81
  - lib/tidy/axml.rb
83
82
  - lib/tidy/compile.rb
83
+ - lib/tidy/demo_config.rb
84
84
  - lib/tidy/generate.rb
85
85
  - lib/tidy/template.rb
86
86
  - lib/tidy/template_binding.rb
@@ -98,11 +98,11 @@ files:
98
98
  - lib/script/server
99
99
  - lib/script/server.rb
100
100
  - lib/tasks/assets.rb
101
- - lib/tasks/demo_config.rb
102
101
  - lib/tasks/deploy.rb
103
102
  - lib/tidy/air_packager.rb
104
103
  - lib/tidy/axml.rb
105
104
  - lib/tidy/compile.rb
105
+ - lib/tidy/demo_config.rb
106
106
  - lib/tidy/generate.rb
107
107
  - lib/tidy/template.rb
108
108
  - lib/tidy/template_binding.rb