fake_gem 0.1.3 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -1,64 +1,10 @@
1
- require 'rake'
2
- require 'fileutils'
3
- current_dir = File.expand_path(File.dirname(__FILE__))
4
- Dir.chdir current_dir
1
+ require 'rake_ext'
5
2
 
6
-
7
- #
8
- # Specs
9
- #
10
- require 'spec/rake/spectask'
11
-
12
- task :default => :spec
13
-
14
- Spec::Rake::SpecTask.new('spec') do |t|
15
- t.spec_files = FileList["spec/**/*_spec.rb"].select{|f| f !~ /\/_/}
16
- t.libs = ["#{current_dir}/lib"]
17
- end
18
-
19
-
20
- #
21
- # Gem
22
- #
23
- require 'rake/clean'
24
- require 'rake/gempackagetask'
25
-
26
- gem_options = {
3
+ gem_spec(
27
4
  :name => "fake_gem",
28
- :version => "0.1.3",
29
- :summary => "Makes any directory looks like Ruby Gem",
30
- :dependencies => %w()
31
- }
32
-
33
- gem_name = gem_options[:name]
34
- spec = Gem::Specification.new do |s|
35
- gem_options.delete(:dependencies).each{|d| s.add_dependency d}
36
- gem_options.each{|k, v| s.send "#{k}=", v}
37
-
38
- s.name = gem_name
39
- s.author = "Alexey Petrushin"
40
- s.homepage = "http://github.com/alexeypetrushin/#{gem_options[:name]}"
41
- s.require_path = "lib"
42
- s.files = (%w{Rakefile readme.md} + Dir.glob("{lib,spec}/**/*"))
43
-
44
- s.platform = Gem::Platform::RUBY
45
- s.has_rdoc = true
46
- end
47
-
48
- package_dir = "#{current_dir}/build"
49
- Rake::GemPackageTask.new(spec) do |p|
50
- p.need_tar = true if RUBY_PLATFORM !~ /mswin/
51
- p.need_zip = true
52
- p.package_dir = package_dir
53
- end
54
-
55
- task :push do
56
- gem_file = Dir.glob("#{package_dir}/#{gem_name}*.gem").first
57
- system "gem push #{gem_file}"
58
- end
59
-
60
- task :clean do
61
- system "rm -r #{package_dir}"
62
- end
5
+ :version => "0.1.4",
6
+ :summary => "Makes any directory looks like Ruby Gem",
63
7
 
64
- task :release => [:gem, :push, :clean]
8
+ :author => "Alexey Petrushin",
9
+ :homepage => "http://github.com/alexeypetrushin/fake_gem"
10
+ )
data/lib/fake_gem.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  # If you inject this module wia RUBYOPTS it may be already be processed,
2
2
  # and include('fake_gem') will executes it one more time, so we check it manually.
3
- unless defined? FakeGem
3
+ unless defined?(FakeGem) or defined?(JRuby)
4
4
  alias :require_without_fgem :require
5
5
  def require path
6
6
  require_without_fgem path
@@ -35,7 +35,7 @@ unless defined? FakeGem
35
35
  should_exist d
36
36
  d
37
37
  end
38
- @libs.push *args
38
+ @libs.push(*args)
39
39
  end
40
40
  end
41
41
  attr_writer :libs
@@ -107,8 +107,8 @@ unless defined? FakeGem
107
107
  unless @gems
108
108
  @gems = []
109
109
  paths.each do |location|
110
- Dir.glob("#{location}/*/fake_gem.rb").each do |gem_spec_file|
111
- @gems << FakeGemSpec.new(gem_spec_file) unless gem_spec_file =~ /\/fake_gem\/fake_gem\.rb/
110
+ Dir.glob("#{location}/*/fake_gem").each do |gem_spec_file|
111
+ @gems << FakeGemSpec.new(gem_spec_file)
112
112
  end
113
113
  end
114
114
  end
data/readme.md CHANGED
@@ -20,12 +20,12 @@ Let's say you have the 'application' project and want to use 'user-management' a
20
20
  /user-management
21
21
  /lib
22
22
  user_management.rb
23
- fake_gem.rb # libs :lib
23
+ fake_gem # libs :lib
24
24
 
25
25
  /billing
26
26
  /lib
27
27
  billing.rb
28
- fake_gem.rb # libs :lib
28
+ fake_gem # libs :lib
29
29
 
30
30
  /some-other-app
31
31
  /lib
@@ -33,7 +33,7 @@ Let's say you have the 'application' project and want to use 'user-management' a
33
33
 
34
34
  You should do the following steps:
35
35
 
36
- 1. create 2 files called 'fake_gem.rb' with the "libs :lib" content inside each of 'user-management' and 'billing' libraries.
36
+ 1. create 2 files called 'fake_gem' with the "libs :lib" content inside each of 'user-management' and 'billing' libraries.
37
37
 
38
38
  2. add the following lines to your 'app.rb' file:
39
39
 
@@ -45,7 +45,7 @@ Now both of those libraries are available inside of your application, like that:
45
45
  require 'user_management' # => true
46
46
  require 'billing' # => true
47
47
 
48
- FakeGem ignores and don't mess with your other projects don't marked with the 'fake_gem.rb' label.
48
+ FakeGem ignores and don't mess with your other projects don't marked with the 'fake_gem' label.
49
49
 
50
50
  require 'some_other_app' # => Error, no such file!
51
51
 
@@ -1,7 +1,8 @@
1
- dir = File.expand_path(File.dirname(__FILE__) + "/..")
2
- $LOAD_PATH << "#{dir}/lib" unless $LOAD_PATH.include? "#{dir}/lib"
1
+ require 'rspec_ext'
2
+
3
+ lib_dir = "#{__FILE__.parent_dirname}/lib"
4
+ $LOAD_PATH << lib_dir unless $LOAD_PATH.include? lib_dir
3
5
 
4
- require 'spec'
5
6
  require "fake_gem"
6
7
 
7
8
  describe FakeGem do
@@ -33,7 +34,7 @@ describe FakeGem do
33
34
  FakeGem.paths.should == [File.expand_path('.')]
34
35
  end
35
36
 
36
- it "should require directories with fake_gem.rb as gems" do
37
+ it "should require directories with fake_gem as gems" do
37
38
  FakeGem.paths @data_dir
38
39
  FakeGem.gems.size.should == 1
39
40
 
@@ -44,7 +45,7 @@ describe FakeGem do
44
45
  $LOAD_PATH.should_not include("#{@data_dir}/project_b/lib")
45
46
  end
46
47
 
47
- it "should load directories with fake_gem.rb as gems" do
48
+ it "should load directories with fake_gem as gems" do
48
49
  FakeGem.paths @data_dir
49
50
  FakeGem.gems.size.should == 1
50
51
 
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fake_gem
3
3
  version: !ruby/object:Gem::Version
4
- hash: 29
4
+ hash: 19
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 3
10
- version: 0.1.3
9
+ - 4
10
+ version: 0.1.4
11
11
  platform: ruby
12
12
  authors:
13
13
  - Alexey Petrushin
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-10-11 00:00:00 +04:00
18
+ date: 2010-10-13 00:00:00 +04:00
19
19
  default_executable:
20
20
  dependencies: []
21
21
 
@@ -31,7 +31,7 @@ files:
31
31
  - Rakefile
32
32
  - readme.md
33
33
  - lib/fake_gem.rb
34
- - spec/fake_gem_spec/project_a/fake_gem.rb
34
+ - spec/fake_gem_spec/project_a/fake_gem
35
35
  - spec/fake_gem_spec/project_a/lib/project_a_file.rb
36
36
  - spec/fake_gem_spec/project_b/lib/project_b_file.rb
37
37
  - spec/fake_gem_spec.rb