peridot 0.1.1 → 0.1.2

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: 965e2a6b1fe6c30be1856eb4c8525175844444b7
4
- data.tar.gz: e740a77f8f4c965f43d7640804370d4bd72bf42a
3
+ metadata.gz: 9ebbd954622582f64a6dd7b398a24ff587fdf28c
4
+ data.tar.gz: a47a5794a6bce94b41ed0f7e5e4f3eec01b7d846
5
5
  SHA512:
6
- metadata.gz: ac7bb43c4b127dee95eb01fb394c11fb067ac2e0f92053a81d3a46bf51740d282f6a79ba8e32818da7b1c78f9bf916bc912135d9e3731692f00b79b7f979eb50
7
- data.tar.gz: e6a6181016bea59ca4b71c9526f79de6b49e3fa999736cfb2642ad60158b5dbbd3d8ea6c1d2cfc7850a33d334b445a9374153fc5a746a6998fd25fed5beb1b20
6
+ metadata.gz: 35aff1a9f6ed05dcf18a97a22ebdc022ce6e7db7544cbe5ea59b02ce2398363f4bffc7c5b2e15c36d7d3eed1cbdaca3bb57ec1f7f093eeff2189754e4005caad
7
+ data.tar.gz: fa9b32224f140e22c22bdc966995baf3789ea11b398e055443b2f3d1291345229828511d87463b99afcf87eff89dbe4c1b6704704f15a071cba4ce07789f8026
data/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # Peridot
2
2
 
3
+ [![Gem Version](https://badge.fury.io/rb/peridot.png)](http://badge.fury.io/rb/peridot)
4
+
3
5
  Peridot let's you manage your dotfiles with `rake` and you should love `rake`!
4
6
  Seriously!
5
7
 
@@ -7,43 +9,41 @@ Seriously!
7
9
 
8
10
  Install it yourself via:
9
11
 
10
- $ gem install peridot
12
+ ```bash
13
+ $ gem install peridot
14
+ ```
11
15
 
12
16
  ## Usage
13
17
 
14
18
  In your Rakefile require Peridot. If run inside rake, it will automagically
15
19
  include Peridot module:
16
20
 
17
- require 'peridot'
21
+ ```ruby
22
+ require 'peridot'
23
+ ```
18
24
 
19
25
  After this, copy the following to a fresh Rakefile:
20
26
 
21
- require 'rubygems'
22
- require 'peridot'
27
+ ```ruby
28
+ require 'rubygems'
29
+ require 'peridot'
30
+ ```
23
31
 
24
32
  After this Peridot provides you with 2 standard tasks:
25
33
 
26
- $ rake -T
27
- rake dotfiles # Runs all your task in the dotfiles namespace
28
- rake watch # Watches for changes and reruns rake
34
+ ```bash
35
+ $ rake -T
36
+ rake dotfiles # Runs all your task in the dotfiles namespace
37
+ rake watch # Watches for changes and reruns rake
38
+ ```
29
39
 
30
40
  Peridot runs every task under `dotfiles` namespace if you run the `dotfiles`
31
41
  task.
32
42
 
33
- If you need to set up some environment for your dotfiles
34
- (e.g. different values for git email at home/work) you do this with tasks for
35
- each environment as Peridot relies heavily on `rake`.
36
-
37
- task(:work) { set :git_email, 'work@startup.com' }
38
- task(:home) { set :git_email, 'home@hotel-mama.com' }
39
-
40
- You can than use it in an erb file like this:
41
-
42
- email = <%= get! :git_email %>
43
43
 
44
44
  ## Features
45
45
 
46
- Peridot gives you some nice methods for interacting with your dotfiles.
46
+ Peridot gives you some methods for interacting with your dotfiles.
47
47
 
48
48
  ### Path helpers
49
49
 
@@ -54,40 +54,57 @@ files.
54
54
 
55
55
  There is a convenience method to generate a regular files from erb input.
56
56
 
57
- generate_file(from, to)
57
+ ```ruby
58
+ generate_file repo_file('gitconfig.erb'), home_file('.gitconfig')
59
+ ```
58
60
 
59
61
  ### Watch for changes
60
62
 
61
63
  You can add a special task `watch` to your rake command to have Peridot
62
64
  watch for changes and rerun your rake command.
63
65
 
64
- ### Attributes
65
-
66
- There is `#set` to aid you in setting options for later use in
67
- your rake tasks. On the other side there is `#get` which fetches attributes
68
- from a central storage. To raise an exception if a required attribute is
69
- missing there is also `#get!`.
70
-
71
66
  ### Ignoring files
72
67
 
73
68
  With `#ignored_files` there is a standard list of files and filetypes
74
- which can be matched (regexp) again certain files with `#ignored?(file)`
69
+ which can be matched (regexp) again certain files with `#ignored?(file)`.
75
70
 
76
- ignored_files << 'README'
77
- link_file from, to unless ignored?('README')
71
+ ```ruby
72
+ ignored_files << 'README'
73
+ link_file(from, to) unless ignored?('README')
74
+ ```
78
75
 
79
76
  ### FileUtils
80
77
 
81
78
  All methods from `FileUtils` are included in the global namespace and can be
82
79
  used for mastering your dotfiles.
83
80
 
81
+ ### Configuration
82
+
83
+ If you need to have some configuration in place you are free to use environment
84
+ variables. [Dotenv](https://github.com/bkeepers/dotenv) can also be used by
85
+ making it a dependency of your task.
86
+
87
+ ```ruby
88
+ require 'dotenv/tasks'
89
+
90
+ task :zsh => :dotenv do …
91
+ ```
92
+
93
+ You can even raise an exception if a required configuration file is missing.
94
+
95
+ ```ruby
96
+ require 'dotenv'
97
+ Dotenv.load! '~/.env'
98
+ ```
99
+
84
100
  ## Examples in the wild
85
101
 
86
- Take look at my dotfiles: https://github.com/svenwin/dotfiles/blob/master/Rakefile
102
+ * Take look at my [dotfiles](https://github.com/svenwin/dotfiles/blob/master/Rakefile)
103
+ * [@danielbayerlein](https://github.com/danielbayerlein/dotfiles/blob/master/Rakefile)
87
104
 
88
105
  ## Special Thanks
89
106
 
90
- * [Daniel Bayerlein(@danielbayerlein)](https://github.com/danielbayerlein) -
107
+ * [Daniel Bayerlein (@danielbayerlein)](https://github.com/danielbayerlein) -
91
108
  For support, code review and much more
92
109
  * [Jim Weirich (@jimweirich)](https://github.com/jimweirich) - for creating
93
110
  [Rake](https://github.com/jimweirich/rake)
data/Rakefile CHANGED
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env rake
2
- require "bundler/gem_tasks"
2
+ require 'bundler/gem_tasks'
@@ -1,39 +1,27 @@
1
1
  require 'fileutils'
2
2
 
3
- module Peridot::FileAccess
4
- include(::FileUtils)
5
-
6
- def ignored_files
7
- @ignored_files ||= %w(Rakefile \.erb$)
8
- end
9
-
10
- def ignored_files=(files)
11
- @ignored_files = files
12
- end
13
-
14
- def ignored?(file)
15
- ignored_files.any? { |ignore_file| file.match(ignore_file) }
16
- end
17
-
18
- def generate_file(source, target)
19
- puts("Generating #{target}")
20
- template = ERB.new(File.read(source))
21
- template.filename = target
22
- File.open(target, 'w') do |f|
23
- f.write(template.result(binding))
3
+ module Peridot
4
+ module FileAccess
5
+ include ::FileUtils
6
+
7
+ def generate_file source, target
8
+ puts "Generating #{target}"
9
+ template = ERB.new File.read source
10
+ template.filename = target
11
+ File.open(target, 'w') { |f| f.write template.result(binding) }
24
12
  end
25
- end
26
13
 
27
- def home_file(file)
28
- File.join(Dir.home, file)
29
- end
14
+ def home_file file
15
+ File.join Dir.home, file
16
+ end
30
17
 
31
- def repo_file(file)
32
- File.join(Dir.pwd, file)
33
- end
18
+ def repo_file file
19
+ File.join Dir.pwd, file
20
+ end
34
21
 
35
- def link_file(source, target)
36
- rm_f(target)
37
- ln_s(source, target)
22
+ def link_file source, target
23
+ rm_f target
24
+ ln_s source, target
25
+ end
38
26
  end
39
27
  end
@@ -1,13 +1,15 @@
1
- module Peridot::Ignores
2
- def ignored_files
3
- @ignored_files ||= %w(Rakefile \.erb$)
4
- end
1
+ module Peridot
2
+ module Ignores
3
+ def ignored_files
4
+ @ignored_files ||= %w(Rakefile README.*$ \.erb$)
5
+ end
5
6
 
6
- def ignored_files=(files)
7
- @ignored_files = files
8
- end
7
+ def ignored_files=(files)
8
+ @ignored_files = files
9
+ end
9
10
 
10
- def ignored?(file)
11
- ignored_files.any? { |ignore_file| file.match(ignore_file) }
11
+ def ignored?(file)
12
+ ignored_files.any? { |ignore_expr| file.match ignore_expr }
13
+ end
12
14
  end
13
15
  end
@@ -1,3 +1,3 @@
1
1
  module Peridot
2
- VERSION = '0.1.1'
2
+ VERSION = '0.1.2'
3
3
  end
data/lib/peridot.rb CHANGED
@@ -1,22 +1,14 @@
1
1
  require 'erb'
2
- require 'peridot/attribute_storage'
3
2
  require 'peridot/file_access'
4
- require 'peridot/forwardable'
5
3
  require 'peridot/ignores'
6
4
  require 'peridot/version'
7
5
  require 'peridot/watcher'
8
6
 
9
7
  module Peridot
10
8
  def self.included(base)
11
- [FileAccess, Forwardable].each { |klass| base.send(:include, klass) }
12
-
13
- base.forward(:get, :get!, :set, to: :attributes)
14
-
15
- load('peridot/tasks.rake') if defined?(Rake)
16
- end
17
-
18
- def attributes
19
- @attributes ||= AttributeStorage.new
9
+ base.send :include, FileAccess
10
+ base.send :include, Ignores
11
+ load 'peridot/tasks.rake'
20
12
  end
21
13
  end
22
14
 
data/peridot.gemspec CHANGED
@@ -8,10 +8,12 @@ Gem::Specification.new do |gem|
8
8
  gem.summary = %q{Dotfile management with rake on steroids}
9
9
 
10
10
  gem.files = `git ls-files`.split($\)
11
+ gem.homepage = 'https://github.com/svenwin/peridot'
11
12
  gem.name = 'peridot'
12
13
  gem.require_paths = %w(lib)
13
14
  gem.version = Peridot::VERSION
14
15
 
15
- gem.add_dependency('rake')
16
- gem.add_dependency('listen')
16
+ gem.add_dependency('dotenv', '0.9.0')
17
+ gem.add_dependency('listen', '1.3.1')
18
+ gem.add_dependency('rake', '10.1.0')
17
19
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: peridot
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sven
@@ -9,36 +9,50 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-08-18 00:00:00.000000000 Z
12
+ date: 2013-11-15 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
- name: rake
15
+ name: dotenv
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  requirements:
18
- - - '>='
18
+ - - '='
19
19
  - !ruby/object:Gem::Version
20
- version: '0'
20
+ version: 0.9.0
21
21
  type: :runtime
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
- - - '>='
25
+ - - '='
26
26
  - !ruby/object:Gem::Version
27
- version: '0'
27
+ version: 0.9.0
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: listen
30
30
  requirement: !ruby/object:Gem::Requirement
31
31
  requirements:
32
- - - '>='
32
+ - - '='
33
+ - !ruby/object:Gem::Version
34
+ version: 1.3.1
35
+ type: :runtime
36
+ prerelease: false
37
+ version_requirements: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - '='
40
+ - !ruby/object:Gem::Version
41
+ version: 1.3.1
42
+ - !ruby/object:Gem::Dependency
43
+ name: rake
44
+ requirement: !ruby/object:Gem::Requirement
45
+ requirements:
46
+ - - '='
33
47
  - !ruby/object:Gem::Version
34
- version: '0'
48
+ version: 10.1.0
35
49
  type: :runtime
36
50
  prerelease: false
37
51
  version_requirements: !ruby/object:Gem::Requirement
38
52
  requirements:
39
- - - '>='
53
+ - - '='
40
54
  - !ruby/object:Gem::Version
41
- version: '0'
55
+ version: 10.1.0
42
56
  description: Dotfile management with rake on steroids
43
57
  email:
44
58
  - sven@w5r.org
@@ -52,15 +66,13 @@ files:
52
66
  - README.md
53
67
  - Rakefile
54
68
  - lib/peridot.rb
55
- - lib/peridot/attribute_storage.rb
56
69
  - lib/peridot/file_access.rb
57
- - lib/peridot/forwardable.rb
58
70
  - lib/peridot/ignores.rb
59
71
  - lib/peridot/tasks.rake
60
72
  - lib/peridot/version.rb
61
73
  - lib/peridot/watcher.rb
62
74
  - peridot.gemspec
63
- homepage:
75
+ homepage: https://github.com/svenwin/peridot
64
76
  licenses: []
65
77
  metadata: {}
66
78
  post_install_message:
@@ -1,19 +0,0 @@
1
- module Peridot
2
- class AttributeStorage
3
- def initialize(hash = {})
4
- @hash = hash
5
- end
6
-
7
- def get(key)
8
- @hash.fetch(key)
9
- end
10
-
11
- def get!(key)
12
- get(key) or raise("#{key} is not an attribute")
13
- end
14
-
15
- def set(key, value)
16
- @hash.store(key, value)
17
- end
18
- end
19
- end
@@ -1,9 +0,0 @@
1
- module Peridot::Forwardable
2
- def forward(*methods, target_hash)
3
- methods.each do |m|
4
- define_method m do |*args|
5
- send(target_hash[:to]).send(m, *args)
6
- end
7
- end
8
- end
9
- end