filander 0.6.0 → 0.6.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -7,8 +7,6 @@ require 'filander/actions/copy_directory'
7
7
  require 'filander/actions/copy_file'
8
8
  require 'filander/actions/create_file'
9
9
  require 'filander/actions/empty_directory'
10
- require 'filander/actions/gem_install'
11
- require 'filander/actions/git_clone'
12
10
  require 'filander/actions/inject_into_file'
13
11
  require 'filander/actions/inside'
14
12
  require 'filander/actions/template'
@@ -28,16 +26,26 @@ module Filander
28
26
  Filander.quiet = value
29
27
  end
30
28
 
29
+ def self.verbose(value)
30
+ Filander.verbose = value
31
+ end
32
+
31
33
  # can be :pretend, :skip or :force
32
34
  def self.behavior(value)
33
- Filander.behavior = value
35
+ return unless value
36
+ Filander.behavior = value.to_sym
34
37
  end
35
38
  end
36
39
  end
37
40
 
38
41
  class << self
39
- attr_reader :source_root_stack, :destination_root_stack
40
- attr_accessor :quiet, :behavior
42
+ attr_reader :source_root_stack, :destination_root_stack, :behavior
43
+ attr_accessor :quiet, :verbose
44
+
45
+ def behavior=(value)
46
+ return unless value
47
+ @behavior = value.to_sym
48
+ end
41
49
 
42
50
  def source_root=(dirname)
43
51
  add_source_root dirname
@@ -77,8 +85,6 @@ module Filander
77
85
  include CopyFile
78
86
  include CreateFile
79
87
  include EmptyDirectory
80
- include GemInstall
81
- include GitClone
82
88
  include InjectIntoFile
83
89
  include Inside
84
90
  include Template
@@ -62,6 +62,7 @@ module Filander
62
62
  end
63
63
 
64
64
  yield unless skip || Filander.behavior == :pretend
65
+ report nil, content.gsub(/(\n+)/, '\1' + " ").strip if Filander.verbose
65
66
  end
66
67
 
67
68
  def report(verb, filename)
@@ -79,7 +80,7 @@ module Filander
79
80
  end
80
81
 
81
82
  color = case verb
82
- when :create
83
+ when :create, :clone, :enable
83
84
  :green
84
85
  when :force, :skip
85
86
  :yellow
@@ -75,8 +75,8 @@ describe "Filander" do
75
75
  Filander.included_modules.should include(Filander::Inside)
76
76
  end
77
77
 
78
- it "should include InstallGem" do
79
- Filander.included_modules.should include(Filander::InstallGem)
78
+ it "should include GemInstall" do
79
+ Filander.included_modules.should include(Filander::GemInstall)
80
80
  end
81
81
 
82
82
  it "should include Template" do
metadata CHANGED
@@ -1,12 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: filander
3
3
  version: !ruby/object:Gem::Version
4
+ hash: 5
4
5
  prerelease: false
5
6
  segments:
6
7
  - 0
7
8
  - 6
8
- - 0
9
- version: 0.6.0
9
+ - 1
10
+ version: 0.6.1
10
11
  platform: ruby
11
12
  authors:
12
13
  - Johannes J. Schmidt
@@ -14,16 +15,18 @@ autorequire:
14
15
  bindir: bin
15
16
  cert_chain: []
16
17
 
17
- date: 2010-05-06 00:00:00 +02:00
18
+ date: 2010-07-11 00:00:00 +02:00
18
19
  default_executable:
19
20
  dependencies:
20
21
  - !ruby/object:Gem::Dependency
21
22
  name: rspec
22
23
  prerelease: false
23
24
  requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
24
26
  requirements:
25
27
  - - ">="
26
28
  - !ruby/object:Gem::Version
29
+ hash: 13
27
30
  segments:
28
31
  - 1
29
32
  - 2
@@ -49,13 +52,30 @@ files:
49
52
  - lib/filander/actions/copy_file.rb
50
53
  - lib/filander/actions/create_file.rb
51
54
  - lib/filander/actions/empty_directory.rb
52
- - lib/filander/actions/gem_install.rb
53
- - lib/filander/actions/git_clone.rb
54
55
  - lib/filander/actions/inject_into_file.rb
55
56
  - lib/filander/actions/inside.rb
56
57
  - lib/filander/actions/template.rb
57
58
  - LICENSE
58
59
  - README.rdoc
60
+ - spec/filander_spec.rb
61
+ - spec/spec_helper.rb
62
+ - spec/filander/actions/copy_directory_spec.rb
63
+ - spec/filander/actions/inside_spec.rb
64
+ - spec/filander/actions/copy_file_spec.rb
65
+ - spec/filander/actions/inject_into_file_spec.rb
66
+ - spec/filander/actions/chown_spec.rb
67
+ - spec/filander/actions/template_spec.rb
68
+ - spec/filander/actions/empty_directory_spec.rb
69
+ - spec/filander/actions/create_file_spec.rb
70
+ - spec/filander/actions/gem_install_spec.rb
71
+ - spec/filander/actions/base_spec.rb
72
+ - spec/filander/actions/cmd_spec.rb
73
+ - spec/filander/actions/git_clone_spec.rb
74
+ - spec/source/myfile
75
+ - spec/source/mydir/myfile
76
+ - spec/source/mydir/mytemplate
77
+ - spec/source/mytemplate
78
+ - spec/spec.opts
59
79
  has_rdoc: true
60
80
  homepage: http://github.com/jo/filander
61
81
  licenses: []
@@ -66,23 +86,27 @@ rdoc_options:
66
86
  require_paths:
67
87
  - lib
68
88
  required_ruby_version: !ruby/object:Gem::Requirement
89
+ none: false
69
90
  requirements:
70
91
  - - ">="
71
92
  - !ruby/object:Gem::Version
93
+ hash: 3
72
94
  segments:
73
95
  - 0
74
96
  version: "0"
75
97
  required_rubygems_version: !ruby/object:Gem::Requirement
98
+ none: false
76
99
  requirements:
77
100
  - - ">="
78
101
  - !ruby/object:Gem::Version
102
+ hash: 3
79
103
  segments:
80
104
  - 0
81
105
  version: "0"
82
106
  requirements: []
83
107
 
84
108
  rubyforge_project:
85
- rubygems_version: 1.3.6
109
+ rubygems_version: 1.3.7
86
110
  signing_key:
87
111
  specification_version: 3
88
112
  summary: File manipulation tools
@@ -1,29 +0,0 @@
1
- module Filander
2
- module GemInstall
3
- include Base
4
-
5
- def gem_install(name, version = nil)
6
- if version
7
- gem_install_args = "-v=#{version} #{name}"
8
- report_name = "#{name} #{version}"
9
- else
10
- gem_install_args = name
11
- report_name = name
12
- end
13
- if gem_exists?(name, version)
14
- report :installed, report_name
15
- else
16
- report :install, report_name
17
- unless Filander.behavior == :pretend
18
- system "gem install #{gem_install_args}"
19
- end
20
- end
21
- end
22
-
23
- private
24
-
25
- def gem_exists?(name, version)
26
- Gem.path.map { |p| File.join(p, 'gems', "#{name}-#{version || '*'}") }.any? { |p| Dir[p].size > 0 }
27
- end
28
- end
29
- end
@@ -1,12 +0,0 @@
1
- module Filander
2
- module GitClone
3
- include Base
4
-
5
- def git_clone(repository, destination)
6
- report :cloning, repository
7
- unless Filander.behavior == :pretend
8
- system "git clone #{repository} #{join_destination(destination)}"
9
- end
10
- end
11
- end
12
- end