expansions 0.1.18 → 0.1.19

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0ff418e9cb2297c39fa44c379759743a4dbf6960
4
- data.tar.gz: 3efb2646667f5eab579b203a210511697dc4be76
3
+ metadata.gz: 2e13bd697fcd88b621aea4a8d63f2e7c47e6b1e8
4
+ data.tar.gz: c8ca1c1a457b187af6a2588b4ed7761f8a22b934
5
5
  SHA512:
6
- metadata.gz: c56ff83f6e029ba1755c88d3aaf953f8ff47cbf33dd920ccb99edac41abcbb81106c9bcc5f4ab608217707fb378561ae6c533536cc6d3e1c332c4027c04ea3ea
7
- data.tar.gz: 8a1419896b0ab20aa237c22e2ab60b4b5dd174a3b2ee2437b79afb60a66f53dec4ad8583a45f8f3d4a1371c01325d76ab8de162dd04eac7a4e91fcde7492c33c
6
+ metadata.gz: 370f83cd2089647df889d6ea43e5355df0b0d9e0a3748e38ef001a1cdcfd4d6c3b379d65e16b90ce22eaf46cc30f00d67a6c0da8a645a12f43c4cbdec5390618
7
+ data.tar.gz: 49cba6d40cb9e6bdfe1891a6709a76c3d556f86c6cd39fdc323e9984365165f9ef906a59d99c77647f6f8f86342d32cd8452934a3b0049365e2f13d19e423764
data/Gemfile CHANGED
@@ -1,4 +1,4 @@
1
- source "http://rubygems.org"
1
+ source "https://rubygems.org"
2
2
 
3
3
  gemspec
4
4
 
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2012 - 2014 Jean-Paul Sylvain Boodhoo
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/expansions.gemspec CHANGED
@@ -6,6 +6,7 @@ Gem::Specification.new do |s|
6
6
  s.name = "expansions"
7
7
  s.version = Expansions::VERSION
8
8
  s.platform = Gem::Platform::RUBY
9
+ s.license = 'MIT'
9
10
  s.authors = ["Develop With Passion®"]
10
11
  s.email = ["open_source@developwithpassion.com"]
11
12
  s.homepage = "http://www.developwithpassion.com"
@@ -19,11 +20,11 @@ Gem::Specification.new do |s|
19
20
  s.require_paths = ["lib"]
20
21
 
21
22
  # specify any dependencies here; for example:
22
- s.add_development_dependency "guard"
23
- s.add_development_dependency "guard-rspec"
24
- s.add_development_dependency "fakes-rspec"
25
- s.add_development_dependency "rb-notifu"
23
+ s.add_development_dependency "guard", "~> 2.6.1"
24
+ s.add_development_dependency "guard-rspec", "~> 4.2.9"
25
+ s.add_development_dependency "fakes-rspec", "~> 2.0.0"
26
+ s.add_development_dependency "rb-notifu", "~> 0.0.4"
26
27
  s.add_runtime_dependency 'configatron', '2.13.0'
27
- s.add_runtime_dependency "mustache"
28
- s.add_runtime_dependency "arrayfu"
28
+ s.add_runtime_dependency "mustache", "~> 0.99.5"
29
+ s.add_runtime_dependency "arrayfu", "~> 0.2.3"
29
30
  end
@@ -30,7 +30,7 @@ module Expansions
30
30
  array :sources do
31
31
  process_using :run, copy_target
32
32
  end
33
- initialize_arrayfu
33
+ super
34
34
  end
35
35
 
36
36
  def register(folder, copy_containing_folder=false)
@@ -9,12 +9,12 @@ module Expansions
9
9
 
10
10
  array :cleanup_items do
11
11
  readable
12
- process_using :run_cleanup,:call
12
+ process_using :run_cleanup, :call
13
13
  end
14
14
 
15
15
  array :setup_items do
16
16
  readable
17
- process_using :run_setup_items,:call
17
+ process_using :run_setup_items, :call
18
18
  end
19
19
 
20
20
  array :executable_files do
@@ -36,13 +36,13 @@ module Expansions
36
36
  end
37
37
 
38
38
  def initialize
39
+ super
39
40
  initialize_hashes :files_to_merge,:copies
40
41
 
41
42
  @globber = Proc.new do |path|
42
43
  glob(path)
43
44
  end
44
45
 
45
- initialize_arrayfu
46
46
  end
47
47
 
48
48
  def copy_to(target, &block)
@@ -81,7 +81,7 @@ module Expansions
81
81
  mark_files_executable
82
82
  end
83
83
 
84
- def hash_process(target,hash,factory,&block)
84
+ def hash_process(target, hash, factory, &block)
85
85
  symbol = target.to_sym
86
86
  hash[symbol] = factory.call(target) unless hash.has_key?(symbol)
87
87
  hash[symbol].instance_eval(&block)
@@ -6,7 +6,7 @@ module Expansions
6
6
  end
7
7
 
8
8
  def glob(path)
9
- items = Dir.glob(path,File::FNM_DOTMATCH)
9
+ items = Dir.glob(path, File::FNM_DOTMATCH)
10
10
  items.each{|item| yield item if block_given?}
11
11
  return items
12
12
  end
@@ -24,9 +24,9 @@ module Expansions
24
24
  end
25
25
 
26
26
  def initialize(output_file)
27
+ super
27
28
  @output_file = output_file
28
29
  @read_original_contents = true
29
- initialize_arrayfu
30
30
  end
31
31
 
32
32
  def dont_read_original_file_contents
@@ -2,6 +2,7 @@ module Expansions
2
2
  class TemplateVisitor
3
3
  attr_reader :processors
4
4
  attr_reader :file
5
+ DOT_FILE_PATTERN = /\.dotfile/
5
6
 
6
7
  def initialize(args = {})
7
8
  @processors = args.fetch(:processor_registry, TemplateProcessors.instance)
@@ -10,17 +11,25 @@ module Expansions
10
11
 
11
12
  def run_using(file_name)
12
13
  processor = processors.get_processor_for(file_name)
14
+
13
15
  generated_name = File.basename(file_name,File.extname(file_name))
16
+
14
17
  load_settings_file(File.dirname(file_name), generated_name)
15
- generated_name = generated_name.gsub(/\.dotfile/,"")
16
- generated_name = ".#{generated_name}" if (/\.dotfile/ =~ file_name)
18
+
19
+ generated_name = generated_name.gsub(DOT_FILE_PATTERN, "")
20
+
21
+ generated_name = ".#{generated_name}" if (DOT_FILE_PATTERN =~ file_name)
22
+
17
23
  output = File.join(File.dirname(file_name),generated_name)
24
+
18
25
  file.delete(output) if file.exists?(output)
26
+
19
27
  processor.process(:input => file_name,:output => output)
20
28
  end
21
29
 
22
30
  def load_settings_file(folder, file_name)
23
31
  settings_file = File.join(folder, "#{file_name}.settings")
32
+
24
33
  if File.exist?(settings_file)
25
34
  load settings_file
26
35
  end
@@ -1,3 +1,3 @@
1
1
  module Expansions
2
- VERSION = "0.1.18"
2
+ VERSION = "0.1.19"
3
3
  end
@@ -10,9 +10,6 @@ module Expansions
10
10
  a.mutator :run_using
11
11
  end
12
12
 
13
- def initialize
14
- initialize_arrayfu
15
- end
16
13
  end
17
14
 
18
15
  describe Copy do
@@ -17,7 +17,7 @@ module Expansions
17
17
  end
18
18
 
19
19
  it "should copy the source to the target" do
20
- shell.should have_received(:run,"cp -rf #{source} #{target}")
20
+ shell.should have_received_message(:run,"cp -rf #{source} #{target}")
21
21
  end
22
22
  end
23
23
  end
@@ -19,16 +19,16 @@ describe Expansions do
19
19
  end
20
20
 
21
21
  after (:each) do
22
- # @file_system.teardown
22
+ @file_system.teardown
23
23
  end
24
24
 
25
25
  context "and no block is given" do
26
26
  before (:each) do
27
- @result = glob(File.join(RelativeFileSystem.base_path,"**/*"))
27
+ @result = glob(File.join(RelativeFileSystem.base_path,"**/*.*"))
28
28
  end
29
29
 
30
30
  it "should return all files in path including dotfiles" do
31
- @result.count.should == 16
31
+ @result.count.should == 17
32
32
  end
33
33
  end
34
34
  context "and a block is given" do
@@ -36,17 +36,17 @@ describe Expansions do
36
36
  @items_visited = 0
37
37
  end
38
38
  before (:each) do
39
- @result = glob(File.join(RelativeFileSystem.base_path,"**/*")) do |file|
39
+ @result = glob(File.join(RelativeFileSystem.base_path,"**/*.*")) do |file|
40
40
  @items_visited += 1
41
41
  end
42
42
  end
43
43
 
44
44
  it "should return all files in path including dotfiles" do
45
- @result.count.should == 16
45
+ @result.count.should == 17
46
46
  end
47
47
 
48
48
  it "should have run the block against each file" do
49
- @items_visited.should == 16
49
+ @items_visited.should == 17
50
50
  end
51
51
 
52
52
  end
@@ -15,7 +15,7 @@ module Expansions
15
15
  sut.run_using(file)
16
16
  end
17
17
  it "should run the shell action against the file" do
18
- shell.should have_received(:run,"rm #{file}")
18
+ shell.should have_received_message(:run,"rm #{file}")
19
19
  end
20
20
  end
21
21
  end
@@ -28,7 +28,7 @@ module Expansions
28
28
  sut.run_using("some.file.name")
29
29
  end
30
30
  it "should delete the original file" do
31
- file.should have_received(:delete,"./#{file_name}")
31
+ file.should have_received_message(:delete,"./#{file_name}")
32
32
  end
33
33
  end
34
34
  context "and the generated file does not already exists" do
@@ -43,7 +43,7 @@ module Expansions
43
43
  end
44
44
 
45
45
  it "should not try to delete the original file" do
46
- file.should_not have_received(:delete)
46
+ file.should_not have_received_message(:delete)
47
47
  end
48
48
  end
49
49
 
@@ -60,7 +60,7 @@ module Expansions
60
60
  end
61
61
 
62
62
  it "should tell the template to be expanded to a file with dotfile naming conventions" do
63
- the_processor.should have_received(:process,:input => file_name,:output => "blah/.bashrc")
63
+ the_processor.should have_received_message(:process,:input => file_name,:output => "blah/.bashrc")
64
64
  end
65
65
  end
66
66
  context "that represents a non dotfile" do
@@ -76,7 +76,7 @@ module Expansions
76
76
  end
77
77
 
78
78
  it "should tell the template to be expanded to a file without the template name" do
79
- the_processor.should have_received(:process,:input => file_name,:output => "blah/bashrc")
79
+ the_processor.should have_received_message(:process,:input => file_name,:output => "blah/bashrc")
80
80
  end
81
81
  end
82
82
  end
metadata CHANGED
@@ -1,71 +1,71 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: expansions
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.18
4
+ version: 0.1.19
5
5
  platform: ruby
6
6
  authors:
7
7
  - Develop With Passion®
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-03-16 00:00:00.000000000 Z
11
+ date: 2014-05-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: guard
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - '>='
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '0'
19
+ version: 2.6.1
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - '>='
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '0'
26
+ version: 2.6.1
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: guard-rspec
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - '>='
31
+ - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '0'
33
+ version: 4.2.9
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - '>='
38
+ - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '0'
40
+ version: 4.2.9
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: fakes-rspec
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - '>='
45
+ - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '0'
47
+ version: 2.0.0
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - '>='
52
+ - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: '0'
54
+ version: 2.0.0
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rb-notifu
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - '>='
59
+ - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '0'
61
+ version: 0.0.4
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - '>='
66
+ - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: '0'
68
+ version: 0.0.4
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: configatron
71
71
  requirement: !ruby/object:Gem::Requirement
@@ -84,30 +84,30 @@ dependencies:
84
84
  name: mustache
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - '>='
87
+ - - "~>"
88
88
  - !ruby/object:Gem::Version
89
- version: '0'
89
+ version: 0.99.5
90
90
  type: :runtime
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - '>='
94
+ - - "~>"
95
95
  - !ruby/object:Gem::Version
96
- version: '0'
96
+ version: 0.99.5
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: arrayfu
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
- - - '>='
101
+ - - "~>"
102
102
  - !ruby/object:Gem::Version
103
- version: '0'
103
+ version: 0.2.3
104
104
  type: :runtime
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
- - - '>='
108
+ - - "~>"
109
109
  - !ruby/object:Gem::Version
110
- version: '0'
110
+ version: 0.2.3
111
111
  description: Automation utitlity that I use to support cross platform file maintenance
112
112
  email:
113
113
  - open_source@developwithpassion.com
@@ -116,9 +116,10 @@ executables:
116
116
  extensions: []
117
117
  extra_rdoc_files: []
118
118
  files:
119
- - .gitignore
119
+ - ".gitignore"
120
120
  - Gemfile
121
121
  - Guardfile
122
+ - LICENSE
122
123
  - README.md
123
124
  - Rakefile
124
125
  - bin/expands
@@ -159,7 +160,8 @@ files:
159
160
  - spec/specs/template_processors_spec.rb
160
161
  - spec/specs/template_visitor_spec.rb
161
162
  homepage: http://www.developwithpassion.com
162
- licenses: []
163
+ licenses:
164
+ - MIT
163
165
  metadata: {}
164
166
  post_install_message:
165
167
  rdoc_options: []
@@ -167,17 +169,17 @@ require_paths:
167
169
  - lib
168
170
  required_ruby_version: !ruby/object:Gem::Requirement
169
171
  requirements:
170
- - - '>='
172
+ - - ">="
171
173
  - !ruby/object:Gem::Version
172
174
  version: '0'
173
175
  required_rubygems_version: !ruby/object:Gem::Requirement
174
176
  requirements:
175
- - - '>='
177
+ - - ">="
176
178
  - !ruby/object:Gem::Version
177
179
  version: '0'
178
180
  requirements: []
179
181
  rubyforge_project: expansions
180
- rubygems_version: 2.2.1
182
+ rubygems_version: 2.2.2
181
183
  signing_key:
182
184
  specification_version: 4
183
185
  summary: Simple Expansion Automation Utility