codemirror-rails 0.1.2 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Binary file
@@ -1,6 +1,6 @@
1
1
  module Codemirror
2
2
  module Rails
3
- VERSION = '0.1.2'
3
+ VERSION = '0.2.0'
4
4
  CODEMIRROR_VERSION = '2.11'
5
5
  end
6
6
  end
@@ -5,6 +5,17 @@ module Codemirror
5
5
  class InstallGenerator < ::Rails::Generators::Base
6
6
  desc "This generator installs CodeMirror #{Codemirror::Rails::CODEMIRROR_VERSION}"
7
7
  source_root File.expand_path('../../../../../vendor/assets/', __FILE__)
8
+ class_option :overlay, :type => :boolean, :default => false,
9
+ :desc => "Install the assets for mode overlays"
10
+ class_option :runmode, :type => :boolean, :default => false,
11
+ :desc => "Install the assets for running a CodeMirror outside the editor"
12
+
13
+ modes = Dir["#{source_root}/javascripts/codemirror/modes/*.js"].collect do |path|
14
+ mode = path.gsub(/.+\/(.+?)\.js/, '\1')
15
+
16
+ class_option "with-#{mode}".to_sym, :type => :boolean, :default => false, :group => 'mode',
17
+ :desc => "Install the assets for the #{mode} mode"
18
+ end
8
19
 
9
20
  def copy_codemirror
10
21
  say_status("copying", "CodeMirror #{Codemirror::Rails::CODEMIRROR_VERSION}", :green)
@@ -12,6 +23,25 @@ module Codemirror
12
23
  copy_file "stylesheets/codemirror.css", "public/stylesheets/codemirror.css"
13
24
  copy_file "stylesheets/codemirror/themes/default.css", "public/stylesheets/codemirror/themes/default.css"
14
25
  end
26
+
27
+ def copy_modes
28
+ options.keys.grep(/with-/).each do |option|
29
+ mode = option.gsub('with-', '')
30
+ copy_file "javascripts/codemirror/modes/#{mode}.js", "public/javascripts/codemirror/modes/#{mode}.js"
31
+ end
32
+ end
33
+
34
+ def copy_overlay
35
+ if options.overlay?
36
+ copy_file "javascripts/codemirror/overlay.js", "public/javascripts/codemirror/overlay.js"
37
+ end
38
+ end
39
+
40
+ def copy_runmode
41
+ if options.runmode?
42
+ copy_file "javascripts/codemirror/runmode.js", "public/javascripts/codemirror/runmode.js"
43
+ end
44
+ end
15
45
  end
16
46
  end
17
47
  end if ::Rails.version < "3.1"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: codemirror-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.2.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-07-05 00:00:00.000000000 -04:00
12
+ date: 2011-07-06 00:00:00.000000000 -04:00
13
13
  default_executable:
14
14
  dependencies: []
15
15
  description: This gem provides CodeMirror assets for your Rails 3 application.
@@ -18,8 +18,7 @@ executables: []
18
18
  extensions: []
19
19
  extra_rdoc_files: []
20
20
  files:
21
- - ./codemirror-rails-0.0.0.gem
22
- - ./codemirror-rails-0.1.gem
21
+ - ./codemirror-rails-0.1.2.gem
23
22
  - ./codemirror-rails.gemspec
24
23
  - ./doc/CodeMirror-LICENSE
25
24
  - ./lib/codemirror/rails/railtie.rb
Binary file
Binary file