sproutpunk 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/.DS_Store ADDED
Binary file
data/Gemfile ADDED
@@ -0,0 +1,12 @@
1
+ source :rubygems
2
+
3
+ gem 'flashsdk'
4
+ gem 'thor'
5
+
6
+ # Add dependencies to develop your gem here.
7
+ # Include everything needed to run rake, tests, features, etc.
8
+ group :development do
9
+ gem "shoulda", ">= 0"
10
+ gem "bundler", "~> 1.0.0"
11
+ gem "jeweler", "~> 1.7.0"
12
+ end
data/LICENSE.txt ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2012 Michael Hansen
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.rdoc ADDED
@@ -0,0 +1,19 @@
1
+ = sproutpunk
2
+
3
+ Description goes here.
4
+
5
+ == Contributing to sproutpunk
6
+
7
+ * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
8
+ * Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
9
+ * Fork the project.
10
+ * Start a feature/bugfix branch.
11
+ * Commit and push until you are happy with your contribution.
12
+ * Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
13
+ * Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
14
+
15
+ == Copyright
16
+
17
+ Copyright (c) 2012 Michael Hansen. See LICENSE.txt for
18
+ further details.
19
+
data/Rakefile ADDED
@@ -0,0 +1,48 @@
1
+ # encoding: utf-8
2
+
3
+ require 'rubygems'
4
+ require 'bundler'
5
+ begin
6
+ Bundler.setup(:default, :development)
7
+ rescue Bundler::BundlerError => e
8
+ $stderr.puts e.message
9
+ $stderr.puts "Run `bundle install` to install missing gems"
10
+ exit e.status_code
11
+ end
12
+ require 'rake'
13
+
14
+ require 'jeweler'
15
+ Jeweler::Tasks.new do |gem|
16
+ # gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
17
+ gem.name = "sproutpunk"
18
+ gem.homepage = "http://github.com/modality/sproutpunk"
19
+ gem.license = "MIT"
20
+ gem.summary = %Q{Project Sprouts meets FlashPunk}
21
+ gem.description = %Q{A gem with some common tasks and code generation tools for users of FlashPunk.}
22
+ gem.email = "michael@subtlefish.com"
23
+ gem.authors = ["Michael Hansen"]
24
+ gem.executables = ['sp']
25
+
26
+ gem.add_dependency 'flashsdk'
27
+ gem.add_dependency 'thor'
28
+ end
29
+ Jeweler::RubygemsDotOrgTasks.new
30
+
31
+ require 'rake/testtask'
32
+ Rake::TestTask.new(:test) do |test|
33
+ test.libs << 'lib' << 'test'
34
+ test.pattern = 'test/**/test_*.rb'
35
+ test.verbose = true
36
+ end
37
+
38
+ task :default => :test
39
+
40
+ require 'rdoc/task'
41
+ Rake::RDocTask.new do |rdoc|
42
+ version = File.exist?('VERSION') ? File.read('VERSION') : ""
43
+
44
+ rdoc.rdoc_dir = 'rdoc'
45
+ rdoc.title = "sproutpunk #{version}"
46
+ rdoc.rdoc_files.include('README*')
47
+ rdoc.rdoc_files.include('lib/**/*.rb')
48
+ end
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.1.0
data/bin/sp ADDED
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'sproutpunk'
4
+ require 'sproutpunk/runner'
5
+
6
+ SproutPunk::Runner.start
@@ -0,0 +1,54 @@
1
+ require 'flashsdk'
2
+
3
+ module SproutPunk
4
+ module Assets
5
+ class Asset
6
+ attr_accessor :source_file, :class_name
7
+
8
+ def initialize(source_file, class_name)
9
+ @source_file = source_file
10
+ @class_name = class_name
11
+ end
12
+ end
13
+
14
+ class ClassGenerator < FlashSDK::ClassGenerator
15
+ def initialize
16
+ super
17
+ @assets = []
18
+ end
19
+
20
+ def manifest
21
+ @assets << Asset.new('../assets/ghoul.png', 'GHOUL_SPRITE')
22
+ @assets << Asset.new('../assets/cone.png', 'CONE_SPRITE')
23
+ @assets << Asset.new('../assets/friendly.png', 'FRIENDLY_SPRITE')
24
+ @assets << Asset.new('../assets/priest.png', 'PRIEST_SPRITE')
25
+
26
+ puts 'asset list:'
27
+ @assets.each do |asset|
28
+ puts "#{asset.class_name} -- #{asset.source_file}"
29
+ end
30
+
31
+ template "Assets.as", 'FlashpunkAssetsClass.as'
32
+ end
33
+ end
34
+ end
35
+ end
36
+
37
+ =begin
38
+ namespace :sp do
39
+ namespace :assets do
40
+ desc "remove generated Assets.as file"
41
+ task :clean do
42
+ end
43
+
44
+ desc "compile assets into Assets.as file"
45
+ task :compile do
46
+ generator = SproutPunk::Assets::ClassGenerator.new
47
+ generator.parse! ARGV
48
+ generator.execute
49
+ end
50
+ end
51
+
52
+ task :assets => ["assets:clean", "assets:compile"]
53
+ end
54
+ =end
File without changes
@@ -0,0 +1,21 @@
1
+ module SproutPunk
2
+ module Commands
3
+
4
+ class Base < Thor
5
+ include Thor::Actions
6
+ include SproutPunk::Helpers
7
+
8
+ def initialize(*)
9
+ super
10
+ if options[:version]
11
+ say "SproutPunk v#{SproutPunk::VERSION}", :red
12
+ exit
13
+ end
14
+ end
15
+
16
+ def self.command_set(name, usage, desc)
17
+ SproutPunk::Runner.register(self, name, usage, desc)
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,19 @@
1
+ module SproutPunk
2
+ module Commands
3
+ class Build < Base
4
+ command_set "build", "build [TASK]", "execute various commands related to builds"
5
+
6
+ default_task :help
7
+
8
+ desc "build list", "show the current list of builds"
9
+ def list
10
+ unless _config.builds
11
+ say "No builds listed in configuration"
12
+ exit
13
+ end
14
+
15
+ print_table _config.builds.to_hash, :ident => 2
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,15 @@
1
+ module SproutPunk
2
+ module Commands
3
+ class Config < Base
4
+ command_set "config", "config [TASK]", "manage sproutpunk configurations"
5
+
6
+ default_task :show
7
+
8
+ desc "show", "show the current configuration settings"
9
+ def show
10
+ say "Current config at #{_config.config_path}", :green
11
+ print_table _config.to_hash, :ident => 2
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,40 @@
1
+ require 'yaml'
2
+
3
+ module SproutPunk
4
+ class Config
5
+
6
+ def self.default_path
7
+ File.expand_path(File.join('config', 'sproutpunk.yml'))
8
+ end
9
+
10
+ def self.load(path = self.default_path)
11
+ new.load(path)
12
+ end
13
+
14
+ def load(path = Config.default_path)
15
+ @options = YAML.load_file(path) || {}
16
+ self.config_path = path
17
+ self
18
+ end
19
+
20
+ def initialize(hash = {})
21
+ @options = hash
22
+ end
23
+
24
+ def to_hash
25
+ @options.dup
26
+ end
27
+
28
+ def method_missing(meth, *args)
29
+ name = meth.to_s
30
+ if name =~ /(.*)\=$/
31
+ @options[$1] = args.first
32
+ elsif @options.has_key?(name)
33
+ val = @options[name]
34
+ val.is_a?(Hash) ? @options[name] = self.class.new(val) : val
35
+ else
36
+ super
37
+ end
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,7 @@
1
+ module SproutPunk
2
+ module Helpers
3
+ def _config
4
+ SproutPunk.config
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,36 @@
1
+ require 'thor'
2
+ require 'thor/actions'
3
+ require 'thor/group'
4
+ require 'sproutpunk/commands/base'
5
+
6
+ module SproutPunk
7
+ class Runner < Commands::Base
8
+ default_task :help
9
+
10
+ desc "start [ENV, ...]", "start the specified environment"
11
+ def start(*envs)
12
+ envs.each do |name|
13
+ src = _config.builds.send(name)
14
+ if src
15
+ say "starting #{name}", :green
16
+ mxmlc "bin/#{name}.swf" do |t|
17
+ t.source_path << "lib"
18
+ t.input = src
19
+ end
20
+
21
+ flashplayer :run => "bin/#{name}.swf"
22
+
23
+ system "bundle exec rake run"
24
+ #Rake.application["bin/#{name}.swf"].invoke
25
+ end
26
+ end
27
+ exit
28
+ end
29
+ end
30
+
31
+ end
32
+
33
+ # require all commands
34
+ Dir[File.join(File.dirname(__FILE__), 'commands', "*.rb")].each {|file|
35
+ load File.expand_path(file)
36
+ }
@@ -0,0 +1,11 @@
1
+ package
2
+ {
3
+ public class Assets
4
+ {
5
+ <% @assets.each do |asset| %>
6
+ [Embed(source = '<%=asset.source_file %>')]public static const <%=asset.class_name %>:Class;
7
+ <% end %>
8
+ }
9
+
10
+ }
11
+
@@ -0,0 +1 @@
1
+ assets: 'config/sproutpunk/assets.yml'
data/lib/sproutpunk.rb ADDED
@@ -0,0 +1,21 @@
1
+ lib = File.expand_path File.dirname(__FILE__)
2
+ $:.unshift lib unless $:.include?(lib)
3
+
4
+ module SproutPunk
5
+
6
+ VERSION = '0.0.1.pre'
7
+
8
+ def self.config_path=(config_path)
9
+ @_config_path = config_path
10
+ @_config = Config.load(@_config_path)
11
+ end
12
+
13
+ def self.config
14
+ @_config ||= Config.load
15
+ end
16
+ end
17
+
18
+
19
+ require 'sproutpunk/config'
20
+ require 'sproutpunk/helpers'
21
+ require 'sproutpunk/assets'
data/test/helper.rb ADDED
@@ -0,0 +1,18 @@
1
+ require 'rubygems'
2
+ require 'bundler'
3
+ begin
4
+ Bundler.setup(:default, :development)
5
+ rescue Bundler::BundlerError => e
6
+ $stderr.puts e.message
7
+ $stderr.puts "Run `bundle install` to install missing gems"
8
+ exit e.status_code
9
+ end
10
+ require 'test/unit'
11
+ require 'shoulda'
12
+
13
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
14
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
15
+ require 'sproutpunk'
16
+
17
+ class Test::Unit::TestCase
18
+ end
data/test/sp ADDED
@@ -0,0 +1,9 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ $:.unshift(File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib')))
4
+
5
+ require 'sproutpunk'
6
+ require 'sproutpunk/runner'
7
+
8
+ SproutPunk.config_path = File.expand_path(File.join('test', 'sproutpunk.yml'))
9
+ SproutPunk::Runner.start
@@ -0,0 +1,3 @@
1
+ builds:
2
+ robo-debug: 'src/Main.as'
3
+
@@ -0,0 +1,7 @@
1
+ require 'helper'
2
+
3
+ class TestSproutpunk < Test::Unit::TestCase
4
+ should "probably rename this file and start testing for real" do
5
+ flunk "hey buddy, you should probably rename this file and start testing for real"
6
+ end
7
+ end
metadata ADDED
@@ -0,0 +1,150 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: sproutpunk
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Michael Hansen
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-01-24 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: flashsdk
16
+ requirement: &2160257020 !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: *2160257020
25
+ - !ruby/object:Gem::Dependency
26
+ name: thor
27
+ requirement: &2160255720 !ruby/object:Gem::Requirement
28
+ none: false
29
+ requirements:
30
+ - - ! '>='
31
+ - !ruby/object:Gem::Version
32
+ version: '0'
33
+ type: :runtime
34
+ prerelease: false
35
+ version_requirements: *2160255720
36
+ - !ruby/object:Gem::Dependency
37
+ name: shoulda
38
+ requirement: &2160270560 !ruby/object:Gem::Requirement
39
+ none: false
40
+ requirements:
41
+ - - ! '>='
42
+ - !ruby/object:Gem::Version
43
+ version: '0'
44
+ type: :development
45
+ prerelease: false
46
+ version_requirements: *2160270560
47
+ - !ruby/object:Gem::Dependency
48
+ name: bundler
49
+ requirement: &2160267960 !ruby/object:Gem::Requirement
50
+ none: false
51
+ requirements:
52
+ - - ~>
53
+ - !ruby/object:Gem::Version
54
+ version: 1.0.0
55
+ type: :development
56
+ prerelease: false
57
+ version_requirements: *2160267960
58
+ - !ruby/object:Gem::Dependency
59
+ name: jeweler
60
+ requirement: &2160265280 !ruby/object:Gem::Requirement
61
+ none: false
62
+ requirements:
63
+ - - ~>
64
+ - !ruby/object:Gem::Version
65
+ version: 1.7.0
66
+ type: :development
67
+ prerelease: false
68
+ version_requirements: *2160265280
69
+ - !ruby/object:Gem::Dependency
70
+ name: flashsdk
71
+ requirement: &2160264440 !ruby/object:Gem::Requirement
72
+ none: false
73
+ requirements:
74
+ - - ! '>='
75
+ - !ruby/object:Gem::Version
76
+ version: '0'
77
+ type: :runtime
78
+ prerelease: false
79
+ version_requirements: *2160264440
80
+ - !ruby/object:Gem::Dependency
81
+ name: thor
82
+ requirement: &2160263720 !ruby/object:Gem::Requirement
83
+ none: false
84
+ requirements:
85
+ - - ! '>='
86
+ - !ruby/object:Gem::Version
87
+ version: '0'
88
+ type: :runtime
89
+ prerelease: false
90
+ version_requirements: *2160263720
91
+ description: A gem with some common tasks and code generation tools for users of FlashPunk.
92
+ email: michael@subtlefish.com
93
+ executables:
94
+ - sp
95
+ extensions: []
96
+ extra_rdoc_files:
97
+ - LICENSE.txt
98
+ - README.rdoc
99
+ files:
100
+ - .DS_Store
101
+ - Gemfile
102
+ - LICENSE.txt
103
+ - README.rdoc
104
+ - Rakefile
105
+ - VERSION
106
+ - bin/sp
107
+ - lib/sproutpunk.rb
108
+ - lib/sproutpunk/assets.rb
109
+ - lib/sproutpunk/commands/assets.rb
110
+ - lib/sproutpunk/commands/base.rb
111
+ - lib/sproutpunk/commands/build.rb
112
+ - lib/sproutpunk/commands/config.rb
113
+ - lib/sproutpunk/config.rb
114
+ - lib/sproutpunk/helpers.rb
115
+ - lib/sproutpunk/runner.rb
116
+ - lib/sproutpunk/templates/FlashpunkAssetsClass.as
117
+ - lib/sproutpunk/templates/sproutpunk.yml
118
+ - test/helper.rb
119
+ - test/sp
120
+ - test/sproutpunk.yml
121
+ - test/test_sproutpunk.rb
122
+ homepage: http://github.com/modality/sproutpunk
123
+ licenses:
124
+ - MIT
125
+ post_install_message:
126
+ rdoc_options: []
127
+ require_paths:
128
+ - lib
129
+ required_ruby_version: !ruby/object:Gem::Requirement
130
+ none: false
131
+ requirements:
132
+ - - ! '>='
133
+ - !ruby/object:Gem::Version
134
+ version: '0'
135
+ segments:
136
+ - 0
137
+ hash: 2621364529482320345
138
+ required_rubygems_version: !ruby/object:Gem::Requirement
139
+ none: false
140
+ requirements:
141
+ - - ! '>='
142
+ - !ruby/object:Gem::Version
143
+ version: '0'
144
+ requirements: []
145
+ rubyforge_project:
146
+ rubygems_version: 1.8.10
147
+ signing_key:
148
+ specification_version: 3
149
+ summary: Project Sprouts meets FlashPunk
150
+ test_files: []