furnace-swf 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,9 +1,24 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
3
  require "rubygems"
4
- require "bundler/setup"
5
4
 
6
- $: << File.join(File.dirname(__FILE__), '..', 'lib')
5
+ root_dir = File.expand_path(File.join(File.dirname(__FILE__),'..'))
6
+ if File.directory?(File.join(root_dir,'.git'))
7
+ Dir.chdir(root_dir) do |path|
8
+ require 'bundler'
9
+
10
+ begin
11
+ Bundler.setup(:default)
12
+ rescue Bundler::BundlerError => e
13
+ warn e.message
14
+ warn "Run `bundle install` to install missing gems"
15
+ exit e.status_code
16
+ end
17
+ end
18
+ end
19
+
20
+ lib_dir = File.join(root_dir,'lib')
21
+ $LOAD_PATH << lib_dir unless $LOAD_PATH.include?(lib_dir)
7
22
 
8
23
  require "trollop"
9
24
  require "furnace-swf"
@@ -18,9 +33,9 @@ opts = Trollop::options do
18
33
  furnace-swf is a processing tool which operates on Flash SWF files.
19
34
 
20
35
  Possible subcommands: #{SUBCOMMANDS.join ' '}
21
- Try #{__FILE__} subcommand --help.
36
+ Try #{$0} subcommand --help.
22
37
 
23
- Usage: #{__FILE__} [options] <subcommand>
38
+ Usage: #{$0} [options] <subcommand>
24
39
  EOS
25
40
 
26
41
  opt :input, "SWF input file", :type => :io
@@ -78,8 +93,8 @@ when 'abcextract'
78
93
  f.write tag.bytecode
79
94
  end
80
95
  else
81
- puts "Tag #{subopts[:name].inspect} was not found"
82
- exit 1
96
+ $stderr.puts "Tag #{subopts[:name].inspect} was not found"
97
+ exit -1
83
98
  end
84
99
 
85
100
  when 'abcreplace'
@@ -90,7 +105,7 @@ when 'abcreplace'
90
105
  swf.write f
91
106
  end
92
107
  else
93
- puts "Tag #{subopts[:name].inspect} was not found"
94
- exit 1
108
+ $stderr.puts "Tag #{subopts[:name].inspect} was not found"
109
+ exit -1
95
110
  end
96
- end
111
+ end
@@ -18,6 +18,6 @@ Gem::Specification.new do |s|
18
18
  s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
19
19
  s.require_paths = ["lib"]
20
20
 
21
- s.add_runtime_dependency "bindata"
21
+ s.add_runtime_dependency "bindata"
22
22
  s.add_runtime_dependency "trollop"
23
23
  end
@@ -81,5 +81,13 @@ module Furnace::SWF
81
81
  @content.length
82
82
  end
83
83
  end
84
+
85
+ def debug_name_of(child)
86
+ if child.is_a?(Tag)
87
+ "#{debug_name}.content"
88
+ else
89
+ super
90
+ end
91
+ end
84
92
  end
85
93
  end
@@ -1,3 +1,3 @@
1
1
  module Furnace::SWF
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: furnace-swf
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2012-07-07 00:00:00.000000000 Z
13
+ date: 2012-07-08 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: bindata