red 3.4.0 → 3.4.1

Sign up to get free protection for your applications and to get access to all the features.
data/History.txt CHANGED
@@ -1,3 +1,8 @@
1
+ == 3.4.1 2008-08-09
2
+
3
+ * 1 major enhancement:
4
+ * Edited output messages for -r and -u executable options.
5
+
1
6
  == 3.4.0 2008-08-09
2
7
 
3
8
  * 2 major enhancements:
@@ -1,46 +1,53 @@
1
1
  module Red # :nodoc:
2
2
  def build_red_plugin_for_rails(display_message = true)
3
3
  @files ||= ''
4
- self.make_rails_directory('vendor/plugins/red', true)
5
-
4
+ self.make_plugin_directory('vendor/plugins/red', true)
6
5
  self.create_plugin_file(:open, 'vendor/plugins/red/init.rb', "require 'rubygems'\nrequire 'red'\n\nRed.rails\n")
7
-
8
- self.make_rails_directory('public/javascripts/red')
6
+ self.make_plugin_directory('public/javascripts/red')
9
7
 
10
8
  return unless display_message
11
- puts RED_MESSAGES[:rails] % @files
9
+ puts @files
12
10
  exit
13
11
  end
14
12
 
15
13
  def add_unobtrusive(library)
16
14
  @files ||= ''
17
15
  self.build_red_plugin_for_rails(false)
18
-
19
16
  self.create_plugin_file(:copy, 'public/javascripts/dom_ready.js', File.join(File.dirname(__FILE__), "../javascripts/#{(library || '').downcase}_dom_ready.js"))
20
17
  self.create_plugin_file(:copy, 'public/javascripts/red/unobtrusive.red', File.join(File.dirname(__FILE__), "../javascripts/red/unobtrusive.red"))
21
18
 
22
19
  rescue Errno::ENOENT
23
20
  puts "There is no Unobtrusive Red support for #{library}"
24
21
  ensure
25
- puts RED_MESSAGES[:unobtrusive] % @files
22
+ puts @files
23
+ exit
24
+ end
25
+
26
+ def make_plugin_directory(dir, only_this_directory = false)
27
+ parent_dir = File.dirname(dir)
28
+ self.make_plugin_directory(parent_dir) unless File.exists?(parent_dir) || only_this_directory
29
+ directory_status = File.exists?(dir) ? 'exists' : Dir.mkdir(dir) && 'create'
30
+ @files << " %s %s\n" % [directory_status, dir]
31
+ rescue SystemCallError
32
+ puts "Unable to create directory in #{parent_dir}"
26
33
  exit
27
34
  end
28
35
 
29
36
  def create_plugin_file(operation, filename, contents)
30
37
  file_status = self.check_if_plugin_file_exists(filename)
31
38
  case operation
32
- when :open : File.open(filename, 'w') { |f| f.write(contents) } if file_status == 'created'
39
+ when :open : File.open(filename, 'w') { |f| f.write(contents) } if file_status == 'create'
33
40
  when :copy : File.copy(contents, filename)
34
41
  end
35
- @files << "\n%s %s" % [file_status, filename]
42
+ @files << " %s %s\n" % [file_status, filename]
36
43
  end
37
44
 
38
45
  def check_if_plugin_file_exists(filename)
39
46
  if File.exists?(filename)
40
47
  print "File #{filename} exists. Overwrite [yN]? "
41
- return (gets =~ /y/i ? 'created' : 'exists ')
48
+ return (gets =~ /y/i ? 'create' : 'exists')
42
49
  else
43
- return 'created'
50
+ return 'create'
44
51
  end
45
52
  end
46
53
 
@@ -64,15 +71,6 @@ module Red # :nodoc:
64
71
  puts RED_MESSAGES[:output] % [("- #{filename}.js" unless filename == 'test'), js_output, @@red_errors ||= '']
65
72
  end
66
73
 
67
- def make_rails_directory(dir, only_this_directory = false)
68
- parent_dir = File.dirname(dir)
69
- self.make_rails_directory(parent_dir) unless File.exists?(parent_dir) || only_this_directory
70
- @files << (File.exists?(dir) ? "\nexists %s" : Dir.mkdir(dir) && "\ncreated %s") % dir
71
- rescue SystemCallError
72
- puts "Unable to create directory in #{parent_dir}"
73
- exit
74
- end
75
-
76
74
  def compile_red_to_js(filename)
77
75
  unless File.exists?(file = "%s.red" % [filename]) || File.exists?(file = "%sred/%s.red" % [(dir = "public/javascripts/"), filename])
78
76
  puts "File #{filename}.red does not exist."
@@ -134,18 +132,4 @@ Use red -h for help.
134
132
  %s
135
133
 
136
134
  MESSAGE
137
-
138
- RED_MESSAGES[:unobtrusive] = <<-MESSAGE
139
- %s
140
-
141
- Unobtrusive Red added to project.
142
-
143
- MESSAGE
144
-
145
- RED_MESSAGES[:rails] = <<-MESSAGE
146
- %s
147
-
148
- Red plugin added to project.
149
-
150
- MESSAGE
151
135
  end
data/lib/red/version.rb CHANGED
@@ -2,7 +2,7 @@ module Red
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 3
4
4
  MINOR = 4
5
- TINY = 0
5
+ TINY = 1
6
6
 
7
7
  STRING = [MAJOR, MINOR, TINY].join('.')
8
8
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: red
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.4.0
4
+ version: 3.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jesse Sielaff