fcshd 0.1 → 0.2

Sign up to get free protection for your applications and to get access to all the features.
data/README ADDED
@@ -0,0 +1,4 @@
1
+ By using a client-server architecture, we are able to make the Adobe Flex
2
+ compiler run fast while still being usable in command-line environments.
3
+ In practice, you start the `fcshd' server, and are then able to use the
4
+ client program `fcshc' as a faster and more usable replacement for `mxmlc'.
@@ -1,52 +1,66 @@
1
1
  require "find"
2
2
 
3
3
  module FCSHD
4
- class Compiler
5
- FLEX_HOME = ENV["FLEX_HOME"]
4
+ module FlexHome
5
+ extend self
6
6
 
7
- def self.flex_path(*components)
8
- File.join(FLEX_HOME, *components)
9
- end
7
+ DEFAULT_FLEX_HOME = "/Library/Flex"
10
8
 
11
- def self.standard_fcsh_executable
12
- FLEX_HOME ? flex_path("bin", "fcsh") : "fcsh"
9
+ def known?
10
+ !!flex_home
13
11
  end
14
12
 
15
- def self.standard_source_directory_root
16
- flex_path("frameworks", "projects")
13
+ def fcsh
14
+ flex_path("bin", "fcsh")
17
15
  end
18
16
 
19
- def self.barename(filename)
20
- File.basename(filename).sub(/\..*/, "")
17
+ def find_standard_component(name)
18
+ Find.find(standard_source_directory_root) do |filename|
19
+ if barename(filename) == name
20
+ break File.dirname(filename).
21
+ sub(%r{.+/src/}, "").gsub("/", ".")
22
+ end
23
+ end
21
24
  end
22
25
 
23
- def self.find_standard_component(name)
24
- if FLEX_HOME
25
- Find.find(standard_source_directory_root) do |filename|
26
- if barename(filename) == name
27
- break File.dirname(filename).
28
- sub(%r{.+/src/}, "").gsub("/", ".")
29
- end
26
+ private
27
+
28
+ def flex_home
29
+ ENV["FLEX_HOME"] or
30
+ if File.directory? DEFAULT_FLEX_HOME
31
+ DEFAULT_FLEX_HOME
32
+ else
33
+ nil
30
34
  end
31
- end
32
35
  end
33
36
 
34
- FCSH_EXECUTABLE = ENV["FCSH"] || standard_fcsh_executable
37
+ def flex_path(*components)
38
+ File.join(flex_home, *components)
39
+ end
40
+
41
+ def standard_source_directory_root
42
+ flex_path("frameworks", "projects")
43
+ end
35
44
 
45
+ def barename(filename)
46
+ File.basename(filename).sub(/\..*/, "")
47
+ end
48
+ end
49
+
50
+ class Compiler
36
51
  def initialize(logger)
37
52
  @logger = logger
38
53
  @output_buffer = ""
39
54
  end
40
55
 
41
56
  def start!
57
+ ensure_flex_home_known!
42
58
  start_fcsh_process!
43
59
  parse_fcsh_boilerplate!
44
60
  @logger.log "Started Flex #@flex_version compiler shell."
45
61
  rescue PromptNotFound => error
46
62
  @logger.error "Could not find fcsh prompt:"
47
- @logger.error @logger.format_command(FCSH_EXECUTABLE, error.message)
48
- @logger.log "Please set $FLEX_HOME or $FCSH." if
49
- error.message.include? "command not found"
63
+ @logger.error @logger.format_command(FlexHome.fcsh, error.message)
50
64
  @logger.exit
51
65
  end
52
66
 
@@ -62,9 +76,18 @@ module FCSHD
62
76
 
63
77
  private
64
78
 
79
+ def ensure_flex_home_known!
80
+ if not FlexHome.known?
81
+ @logger.log <<"^D"
82
+ Please put the Flex SDK in #{FlexHome::DEFAULT_FLEX_HOME} or set $FLEX_HOME.
83
+ ^D
84
+ @logger.exit
85
+ end
86
+ end
87
+
65
88
  def start_fcsh_process!
66
89
  stop_fcsh_process!
67
- @fcsh_process = IO.popen("#{FCSH_EXECUTABLE} 2>&1", "r+")
90
+ @fcsh_process = IO.popen("#{FlexHome.fcsh} 2>&1", "r+")
68
91
  read_fcsh_output!
69
92
  end
70
93
 
data/lib/fcshd/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  unless defined? FCSHD::VERSION
2
2
  module FCSHD
3
- VERSION = "0.1"
3
+ VERSION = "0.2"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,12 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fcshd
3
3
  version: !ruby/object:Gem::Version
4
- hash: 9
4
+ hash: 15
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
- - 1
9
- version: "0.1"
8
+ - 2
9
+ version: "0.2"
10
10
  platform: ruby
11
11
  authors:
12
12
  - Daniel Brockman
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2011-08-31 00:00:00 Z
17
+ date: 2011-11-01 00:00:00 Z
18
18
  dependencies: []
19
19
 
20
20
  description: |
@@ -33,9 +33,9 @@ extra_rdoc_files: []
33
33
 
34
34
  files:
35
35
  - .gitignore
36
- - .rvmrc
37
36
  - Gemfile
38
37
  - Gemfile.lock
38
+ - README
39
39
  - bin/fcshc
40
40
  - bin/fcshd
41
41
  - fcshd.gemspec
@@ -77,7 +77,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
77
77
  requirements: []
78
78
 
79
79
  rubyforge_project:
80
- rubygems_version: 1.8.8
80
+ rubygems_version: 1.8.11
81
81
  signing_key:
82
82
  specification_version: 3
83
83
  summary: Usable CLI for the Adobe Flex compiler shell (fcsh)
data/.rvmrc DELETED
@@ -1 +0,0 @@
1
- rvm use 1.9.2@fcshd --create