rails_component 0.1 → 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/bin/rails_component CHANGED
@@ -6,6 +6,7 @@ require "slop"
6
6
  opts = Slop.parse do
7
7
  on :u, :url, 'Apply component from url', true
8
8
  on :d, :dir, 'Apply component from local directory', true
9
+ on :r, :recept, 'Apply only recept. from file or url', true
9
10
  on :v, :verbose, 'Enable verbose mode'
10
11
 
11
12
  on :h, :help, 'Print this help message', :tail => true do
@@ -16,8 +17,11 @@ end
16
17
 
17
18
  if opts[:url]
18
19
  RComponent::Applier.remote(opts[:url], Dir.pwd)
19
- elsif dir = opts[:dir]
20
+ elsif opts[:dir]
20
21
  RComponent::Applier.new(opts[:dir], Dir.pwd)
22
+ elsif opts[:recept]
23
+ require "open-uri"
24
+ RComponent::Applier.new(Dir.pwd, Dir.pwd, false).fire_recept!(open(opts[:recept]).read)
21
25
  else
22
26
  puts opts.help
23
27
  end
@@ -19,11 +19,16 @@ module RComponent
19
19
  new(dir, rails_root)
20
20
  end
21
21
 
22
- def initialize(component_root, rails_root)
22
+ def initialize(component_root, rails_root, autofire = true)
23
23
  @rails_root = rails_root
24
24
  @component_root = component_root
25
- eval File.open(File.join(component_root, 'recept.rb'), 'r:utf-8', &:read)
26
-
25
+
26
+ recept_path = File.join(component_root, 'recept.rb')
27
+ fire_recept!(File.read(recept_path)) if autofire
28
+ end
29
+
30
+ def fire_recept!(source)
31
+ eval source
27
32
  print "Done!"
28
33
  end
29
34
 
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "rails_component"
3
- s.version = "0.1"
3
+ s.version = "0.1.1"
4
4
  s.summary = "Applyng components for rails"
5
5
  s.description = ""
6
6
  s.author = "Pavel Evstigneev"
@@ -19,7 +19,7 @@ Gem::Specification.new do |s|
19
19
  s.add_runtime_dependency(%q<slop>, [">= 1.7"])
20
20
 
21
21
  else
22
- s.add_dependency(%q<slop>, [">= 1.0"])
22
+ s.add_dependency(%q<slop>, [">= 1.7"])
23
23
  end
24
24
  else
25
25
  s.add_dependency(%q<slop>, [">= 1.7"])
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: rails_component
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: "0.1"
5
+ version: 0.1.1
6
6
  platform: ruby
7
7
  authors:
8
8
  - Pavel Evstigneev
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-06-08 00:00:00 Z
13
+ date: 2011-06-09 00:00:00 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: slop