provideal-plugin-utils 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/README CHANGED
@@ -1,7 +1,53 @@
1
1
  Provideal Plugin Utils
2
2
  ======================
3
3
 
4
- A small collection of Rails plugin utilities to deal with assets
5
- bundled within Rails plugins/engines.
4
+ A small collection of utilities to deal with assets bundled within Rails
5
+ plugins/engines.
6
6
 
7
- Copyright (c) 2009 Provideal Systems GmbH, released under the MIT license
7
+ The official homepgae is: http://github.com/provideal/provideal-plugin-utils
8
+
9
+ It provides two things. First it provides a method to install assets bundled
10
+ within a Rails plugin/engine into your host application (symlink into
11
+ /public/plugins/my_plugin).
12
+
13
+ Secondly it adds a :plugin option to Rails asset helper tags 'stylesheet_link_tag',
14
+ 'javascript_include_tag', 'image_path' and 'image_tag'.
15
+
16
+ Example:
17
+
18
+ Suppose you have a JavaScript file called foo.js bundled with your plugin 'my_plugin'.
19
+ Using <%= javascript_include_tag 'foo.js', :plugin => 'my_plugin' %> will then create
20
+ the correct uri to that asset.
21
+
22
+ Installation
23
+ ------------
24
+
25
+ sudo gem install provideal-plugin-utils -s http://gemcutter.org
26
+
27
+
28
+ Usage
29
+ -----
30
+
31
+ * Install the gem
32
+ * Make sure your plugins' assets are organized following Rails conventions
33
+ (images in public/images, stylesheets in public/stylesheets etc).
34
+ * Trigger the installtion of your plugin assets with:
35
+
36
+ Provideal::PluginUtils.install_assets('my_plugin', 'path to your plugins public folder')
37
+
38
+ Example (called in init.rb):
39
+
40
+ Provideal::PluginUtils.install_assets('my_plugin', File.expand_path(File.join(File.dirname(__FILE__), 'public')))
41
+
42
+
43
+ Known issues
44
+ ------------
45
+
46
+ This version supports only symlinking the assets. As a result this version is
47
+ not supported on Windows.
48
+
49
+
50
+ Copyright
51
+ ---------
52
+
53
+ Copyright (c) 2009 Provideal Systems GmbH, released under the MIT license.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.0
1
+ 0.1.1
@@ -19,26 +19,26 @@ module Provideal
19
19
  #
20
20
  # This will create a proper link to '/plugins/your_plugin/javascripts/foo.js'.
21
21
  #
22
- def install_assets(plugin_name, target_path)
22
+ def install_assets(plugin_name, source_path)
23
23
  # Precheck conditions
24
24
  raise "Plugin name required" unless plugin_name
25
- raise "Target path required" unless target_path
26
- raise "Taget does't exists" unless File.exists?(target_path)
25
+ raise "Source path required" unless source_path
26
+ raise "Source path does't exists" unless File.exists?(source_path)
27
27
 
28
- # Create the plugins base path inside the hosts public folder
29
- plugins_public_base_path = "#{RAILS_ROOT}/public/plugins"
30
- FileUtils.mkdir_p(plugins_public_base_path)
28
+ # Target path
29
+ target_base_path = "#{RAILS_ROOT}/public/plugins"
30
+ FileUtils.mkdir_p(target_base_path) unless File.exists?(target_base_path)
31
+ target_path = "#{target_base_path}/#{plugin_name}"
31
32
 
32
- # The source path
33
- source_path = "#{plugins_public_base_path}/#{plugin_name}"
34
-
35
- # Create the symlink if the source_path is not present
36
- # This allows for manual overrides
37
- unless File.exists?(source_path)
38
- system "ln -s #{target_path} #{source_path}"
33
+ # Only install if the target path does not
34
+ # exists
35
+ unless File.exists?(target_path)
36
+ File.symlink(source_path, target_path)
37
+ else
38
+ puts "Info: Assets for plugin #{plugin_name} exists. Skipping installation."
39
39
  end
40
40
  end
41
-
41
+
42
42
  #
43
43
  # Enables Rails extensions
44
44
  #
@@ -0,0 +1,43 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run `rake gemspec`
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = %q{provideal-plugin-utils}
8
+ s.version = "0.1.1"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["Ren\303\251 Sprotte"]
12
+ s.date = %q{2009-09-17}
13
+ s.email = %q{info@provideal.net}
14
+ s.extra_rdoc_files = [
15
+ "README"
16
+ ]
17
+ s.files = [
18
+ ".gitignore",
19
+ "MIT-LICENSE",
20
+ "README",
21
+ "Rakefile",
22
+ "VERSION",
23
+ "init.rb",
24
+ "lib/provideal_plugin_utils.rb",
25
+ "lib/provideal_plugin_utils/asset_tag_helper.rb",
26
+ "provideal-plugin-utils.gemspec"
27
+ ]
28
+ s.homepage = %q{http://github.com/provideal/plugin-utils/}
29
+ s.rdoc_options = ["--charset=UTF-8"]
30
+ s.require_paths = ["lib"]
31
+ s.rubygems_version = %q{1.3.5}
32
+ s.summary = %q{A collection of Rails plugin utilities}
33
+
34
+ if s.respond_to? :specification_version then
35
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
36
+ s.specification_version = 3
37
+
38
+ if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
39
+ else
40
+ end
41
+ else
42
+ end
43
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: provideal-plugin-utils
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - "Ren\xC3\xA9 Sprotte"
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-09-15 00:00:00 +02:00
12
+ date: 2009-09-17 00:00:00 +02:00
13
13
  default_executable:
14
14
  dependencies: []
15
15
 
@@ -30,6 +30,7 @@ files:
30
30
  - init.rb
31
31
  - lib/provideal_plugin_utils.rb
32
32
  - lib/provideal_plugin_utils/asset_tag_helper.rb
33
+ - provideal-plugin-utils.gemspec
33
34
  has_rdoc: true
34
35
  homepage: http://github.com/provideal/plugin-utils/
35
36
  licenses: []