briefcase 0.4.0 → 0.4.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/README.md +34 -0
- data/briefcase.gemspec +1 -4
- data/lib/briefcase/commands/git.rb +2 -1
- data/lib/briefcase/main.rb +14 -2
- data/lib/briefcase/version.rb +1 -1
- data/lib/briefcase.rb +17 -13
- data/spec/git_spec.rb +1 -1
- data/spec/helpers/files.rb +1 -1
- metadata +15 -30
- data/README.rdoc +0 -104
data/README.md
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
# Briefcase
|
2
|
+
|
3
|
+
[Briefcase](http://jim.github.com/briefcase/) is a tool to facilitate keeping dotfiles in git, including those with private information (such as .gitconfig).
|
4
|
+
|
5
|
+
By keeping your configuration files in a git public git repository, you can share your settings with others. Any secret information is kept in a single file outside the repository (it’s up to you to backup and transport this file).
|
6
|
+
|
7
|
+
[The project homepage](http://jim.github.com/briefcase/) includes
|
8
|
+
installation and usage documentation.
|
9
|
+
|
10
|
+
[](http://travis-ci.org/jim/briefcase)
|
11
|
+
|
12
|
+
## Changelog
|
13
|
+
|
14
|
+
* 0.4.1 Git command now properly passes options through to git, and also allows
|
15
|
+
git output to display in color.
|
16
|
+
|
17
|
+
Path environment variables inherit settings for parent directories.
|
18
|
+
* 0.4.0 Renamed project to Briefcase. First public release.
|
19
|
+
* 0.3.0 Added code documentation, internal renaming, general cleanup. First public release.
|
20
|
+
* 0.2.0 Added redact command, use .redacted for dynamic dotfiles
|
21
|
+
* 0.1.3 The sync command no longer creates symlinks for dynamic files
|
22
|
+
* 0.1.2 Added dynamic file generation
|
23
|
+
|
24
|
+
## Note on Patches/Pull Requests
|
25
|
+
* Fork the project.
|
26
|
+
* Make your feature addition or bug fix on a topic branch.
|
27
|
+
* Add tests for it. This is important so I don't break it in a future version unintentionally.
|
28
|
+
* Commit, do not mess with rakefile, version, or history.
|
29
|
+
(if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
|
30
|
+
* Send me a pull request.
|
31
|
+
|
32
|
+
## Copyright
|
33
|
+
|
34
|
+
Copyright (c) 2012 Jim Benton. See LICENSE for details.
|
data/briefcase.gemspec
CHANGED
@@ -10,21 +10,18 @@ Gem::Specification.new do |s|
|
|
10
10
|
s.default_executable = %q{briefcase}
|
11
11
|
s.email = %q{jim@autonomousmachine.com}
|
12
12
|
s.executables = ["briefcase"]
|
13
|
-
s.extra_rdoc_files = %w{README.rdoc LICENSE}
|
14
13
|
s.files = Dir['lib/**/*.rb'] + # library
|
15
14
|
Dir['bin/*'] + # executable
|
16
15
|
Dir['spec/**/*.rb'] + # spec files
|
17
16
|
Dir['spec/bin/editor'] + # spec editor
|
18
|
-
%w{README.
|
17
|
+
%w{README.md LICENSE briefcase.gemspec Rakefile} # misc
|
19
18
|
|
20
19
|
s.homepage = %q{http://github.com/jim/briefcase}
|
21
|
-
s.rdoc_options = ["--charset=UTF-8"]
|
22
20
|
s.require_paths = ["lib"]
|
23
21
|
s.rubygems_version = %q{1.3.7}
|
24
22
|
s.test_files = Dir['spec/*.rb']
|
25
23
|
|
26
24
|
s.add_runtime_dependency('commander')
|
27
|
-
s.add_runtime_dependency('activesupport')
|
28
25
|
s.add_development_dependency('minitest')
|
29
26
|
s.add_development_dependency('open4')
|
30
27
|
s.add_development_dependency('rake', '0.9.2.2')
|
data/lib/briefcase/main.rb
CHANGED
@@ -1,6 +1,17 @@
|
|
1
|
-
require '
|
1
|
+
require 'highline/import'
|
2
2
|
require File.expand_path('../briefcase', File.dirname(__FILE__))
|
3
3
|
|
4
|
+
# In the case of the git passthrough command, we want to pass the complete command
|
5
|
+
# off to git so the options aren't mangled by Commander.
|
6
|
+
#
|
7
|
+
# Initializing a Briefcase::Commands::Git object will eventually call out to
|
8
|
+
# git using exec, so this script will be aborted.
|
9
|
+
if ARGV[0] == 'git'
|
10
|
+
Briefcase::Commands::Git.new(ARGV[1..-1], {})
|
11
|
+
end
|
12
|
+
|
13
|
+
require 'commander/import'
|
14
|
+
|
4
15
|
program :name, 'Briefcase'
|
5
16
|
program :version, Briefcase::VERSION
|
6
17
|
program :description, 'Makes it easier to keep dotfiles in git'
|
@@ -29,10 +40,11 @@ command :generate do |c|
|
|
29
40
|
c.when_called Briefcase::Commands::Generate
|
30
41
|
end
|
31
42
|
|
43
|
+
# This is a placeholder so that this command appears in the documentation. Any git
|
44
|
+
# passthrough commands are caught earlier in this file.
|
32
45
|
command :git do |c|
|
33
46
|
c.syntax = 'briefcase git [options]'
|
34
47
|
c.description = 'Run a git command in the dotfiles directory'
|
35
|
-
c.when_called Briefcase::Commands::Git
|
36
48
|
end
|
37
49
|
|
38
50
|
default_command :help
|
data/lib/briefcase/version.rb
CHANGED
data/lib/briefcase.rb
CHANGED
@@ -1,34 +1,38 @@
|
|
1
1
|
require 'yaml'
|
2
2
|
|
3
|
-
require 'active_support/core_ext/hash/deep_merge'
|
4
|
-
|
5
3
|
require File.expand_path('briefcase/commands', File.dirname(__FILE__))
|
6
4
|
require File.expand_path('briefcase/version', File.dirname(__FILE__))
|
7
5
|
|
8
6
|
module Briefcase
|
9
7
|
|
10
|
-
|
11
|
-
|
8
|
+
class << self
|
9
|
+
attr_accessor :dotfiles_path, :home_path, :secrets_path, :testing
|
12
10
|
|
13
|
-
|
14
|
-
|
11
|
+
# The user's home path
|
12
|
+
def default_home_path
|
13
|
+
'~'
|
14
|
+
end
|
15
15
|
|
16
|
-
|
17
|
-
|
16
|
+
# The default path where dotfiles are stored
|
17
|
+
def default_dotfiles_path
|
18
|
+
File.join(home_path, '.dotfiles')
|
19
|
+
end
|
18
20
|
|
19
|
-
|
20
|
-
|
21
|
+
# The default path to where secret information is stored
|
22
|
+
def default_secrets_path
|
23
|
+
File.join(home_path, '.briefcase_secrets')
|
24
|
+
end
|
21
25
|
|
22
26
|
def dotfiles_path
|
23
|
-
@dotfiles_path ||= File.expand_path(ENV['BRIEFCASE_DOTFILES_PATH'] ||
|
27
|
+
@dotfiles_path ||= File.expand_path(ENV['BRIEFCASE_DOTFILES_PATH'] || default_dotfiles_path)
|
24
28
|
end
|
25
29
|
|
26
30
|
def home_path
|
27
|
-
@home_path ||= File.expand_path(ENV['BRIEFCASE_HOME_PATH'] ||
|
31
|
+
@home_path ||= File.expand_path(ENV['BRIEFCASE_HOME_PATH'] || default_home_path)
|
28
32
|
end
|
29
33
|
|
30
34
|
def secrets_path
|
31
|
-
@secrets_path ||= File.expand_path(ENV['BRIEFCASE_SECRETS_PATH'] ||
|
35
|
+
@secrets_path ||= File.expand_path(ENV['BRIEFCASE_SECRETS_PATH'] || default_secrets_path)
|
32
36
|
end
|
33
37
|
|
34
38
|
def testing?
|
data/spec/git_spec.rb
CHANGED
@@ -11,7 +11,7 @@ describe Briefcase::Commands::Git do
|
|
11
11
|
cleanup_dotfiles_directory
|
12
12
|
end
|
13
13
|
|
14
|
-
it "
|
14
|
+
it "passes commands through to git" do
|
15
15
|
create_file(dotfiles_path + '/test.txt', 'testing git integration')
|
16
16
|
run_command("git status")
|
17
17
|
|
data/spec/helpers/files.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: briefcase
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 13
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 4
|
9
|
-
-
|
10
|
-
version: 0.4.
|
9
|
+
- 1
|
10
|
+
version: 0.4.1
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Jim Benton
|
@@ -32,7 +32,7 @@ dependencies:
|
|
32
32
|
type: :runtime
|
33
33
|
version_requirements: *id001
|
34
34
|
- !ruby/object:Gem::Dependency
|
35
|
-
name:
|
35
|
+
name: minitest
|
36
36
|
prerelease: false
|
37
37
|
requirement: &id002 !ruby/object:Gem::Requirement
|
38
38
|
none: false
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
segments:
|
44
44
|
- 0
|
45
45
|
version: "0"
|
46
|
-
type: :
|
46
|
+
type: :development
|
47
47
|
version_requirements: *id002
|
48
48
|
- !ruby/object:Gem::Dependency
|
49
|
-
name:
|
49
|
+
name: open4
|
50
50
|
prerelease: false
|
51
51
|
requirement: &id003 !ruby/object:Gem::Requirement
|
52
52
|
none: false
|
@@ -59,24 +59,10 @@ dependencies:
|
|
59
59
|
version: "0"
|
60
60
|
type: :development
|
61
61
|
version_requirements: *id003
|
62
|
-
- !ruby/object:Gem::Dependency
|
63
|
-
name: open4
|
64
|
-
prerelease: false
|
65
|
-
requirement: &id004 !ruby/object:Gem::Requirement
|
66
|
-
none: false
|
67
|
-
requirements:
|
68
|
-
- - ">="
|
69
|
-
- !ruby/object:Gem::Version
|
70
|
-
hash: 3
|
71
|
-
segments:
|
72
|
-
- 0
|
73
|
-
version: "0"
|
74
|
-
type: :development
|
75
|
-
version_requirements: *id004
|
76
62
|
- !ruby/object:Gem::Dependency
|
77
63
|
name: rake
|
78
64
|
prerelease: false
|
79
|
-
requirement: &
|
65
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
80
66
|
none: false
|
81
67
|
requirements:
|
82
68
|
- - "="
|
@@ -89,11 +75,11 @@ dependencies:
|
|
89
75
|
- 2
|
90
76
|
version: 0.9.2.2
|
91
77
|
type: :development
|
92
|
-
version_requirements: *
|
78
|
+
version_requirements: *id004
|
93
79
|
- !ruby/object:Gem::Dependency
|
94
80
|
name: turn
|
95
81
|
prerelease: false
|
96
|
-
requirement: &
|
82
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
97
83
|
none: false
|
98
84
|
requirements:
|
99
85
|
- - ">="
|
@@ -103,16 +89,15 @@ dependencies:
|
|
103
89
|
- 0
|
104
90
|
version: "0"
|
105
91
|
type: :development
|
106
|
-
version_requirements: *
|
92
|
+
version_requirements: *id005
|
107
93
|
description: Command line program to migrate dotfiles to a git repo at ~/.dotfiles and generate static dotfiles with secret values.
|
108
94
|
email: jim@autonomousmachine.com
|
109
95
|
executables:
|
110
96
|
- briefcase
|
111
97
|
extensions: []
|
112
98
|
|
113
|
-
extra_rdoc_files:
|
114
|
-
|
115
|
-
- LICENSE
|
99
|
+
extra_rdoc_files: []
|
100
|
+
|
116
101
|
files:
|
117
102
|
- lib/briefcase/commands/base.rb
|
118
103
|
- lib/briefcase/commands/core/files.rb
|
@@ -138,7 +123,7 @@ files:
|
|
138
123
|
- spec/spec_helper.rb
|
139
124
|
- spec/sync_spec.rb
|
140
125
|
- spec/bin/editor
|
141
|
-
- README.
|
126
|
+
- README.md
|
142
127
|
- LICENSE
|
143
128
|
- briefcase.gemspec
|
144
129
|
- Rakefile
|
@@ -146,8 +131,8 @@ homepage: http://github.com/jim/briefcase
|
|
146
131
|
licenses: []
|
147
132
|
|
148
133
|
post_install_message:
|
149
|
-
rdoc_options:
|
150
|
-
|
134
|
+
rdoc_options: []
|
135
|
+
|
151
136
|
require_paths:
|
152
137
|
- lib
|
153
138
|
required_ruby_version: !ruby/object:Gem::Requirement
|
data/README.rdoc
DELETED
@@ -1,104 +0,0 @@
|
|
1
|
-
= briefcase
|
2
|
-
|
3
|
-
briefcase is a tool to facilitate keeping dotfiles in git, including those with private information (such as .gitconfig).
|
4
|
-
|
5
|
-
|
6
|
-
=== This is alpha software! I haven't published a gem yet for a good reason. Use at your own risk.
|
7
|
-
|
8
|
-
|
9
|
-
== Getting started
|
10
|
-
|
11
|
-
gem install briefcase
|
12
|
-
briefcase import ~/.bashrc
|
13
|
-
|
14
|
-
At this point, a git repository will have been created at ~/.dotfiles. At some point more of the git workflow will be automated (such as creating a repository at Github), but for now most git tasks are manual:
|
15
|
-
|
16
|
-
cd ~/.dotfiles
|
17
|
-
git commit -m "Added bashrc"
|
18
|
-
|
19
|
-
== Filesystem layout
|
20
|
-
|
21
|
-
With briefcase, dotfiles are stored in a centralized location (by default ~/.dotfiles), and symlinks are created for these files in the user's home directory. Here is a basic setup for a .gitconfig file:
|
22
|
-
|
23
|
-
+-~/ Home Directory
|
24
|
-
| +-.briefcase_secrets Secrets file
|
25
|
-
| +-.gitconfig Symlink to ~/.dotfiles/gitconfig
|
26
|
-
| +-.dotfiles/ Dotfiles directory
|
27
|
-
| | +-gitconfig Standard Dotfile
|
28
|
-
| | +-gitconfig.dynamic Redacted dotfile
|
29
|
-
|
30
|
-
=== Home directory (~)
|
31
|
-
|
32
|
-
Where the action happens. Dotfiles that normally exist here are replaced by symlinks to files in the dotfiles directory
|
33
|
-
|
34
|
-
=== Dotfiles directory (~/)
|
35
|
-
|
36
|
-
Where dotfiles are stored. There are two types of dotfiles.
|
37
|
-
|
38
|
-
==== Standard dotfiles
|
39
|
-
|
40
|
-
A basic config file that would normally live in a user's home directory.
|
41
|
-
|
42
|
-
==== Redacted dotfiles
|
43
|
-
A config file that contains some secret information. The file is stored, sans secret info, with a '.redacted' extension in the repo. The dotfile that is symlinked to the user's home directory is then generated from this file.
|
44
|
-
|
45
|
-
=== Secrets file
|
46
|
-
|
47
|
-
This file, be default located at ~/.briefcase_secrets, contains the information removed from dotfiles imported using the redact command.
|
48
|
-
|
49
|
-
== Commands
|
50
|
-
|
51
|
-
=== import PATH_TO_FILE
|
52
|
-
|
53
|
-
Imports a dotfile into thedotfiles directory, moving it to the dotfiles directory and replacing it with a symlink to its new location.
|
54
|
-
|
55
|
-
|
56
|
-
=== redact PATH_TO_FILE
|
57
|
-
|
58
|
-
Imports a dotfile that contains sensitive information. The user is presented with an editor, where the sensitive information can be removed by replacing secret information with a commented out call to a briefcase function
|
59
|
-
|
60
|
-
# before
|
61
|
-
password: superSecretPassword
|
62
|
-
|
63
|
-
# after
|
64
|
-
password: # briefcase(password)
|
65
|
-
|
66
|
-
This file is then saved with a '.redacted' extension, and the original file is added to ~/.dotfiles/.gitignore so it will not be added to the repository.
|
67
|
-
|
68
|
-
'superSecretPassword' will be stored using the key "password" in the secrets file.
|
69
|
-
|
70
|
-
|
71
|
-
=== sync
|
72
|
-
Creates a symlink in the user's home directory for each dotfile in the dotfiles directory.
|
73
|
-
|
74
|
-
|
75
|
-
=== generate
|
76
|
-
Creates local version of a redacted dotfile, using information found in the secrets file to fill in any that was removed.
|
77
|
-
|
78
|
-
|
79
|
-
== Configuration
|
80
|
-
|
81
|
-
The following environment variables can by used to customized the paths used by briefcase:
|
82
|
-
|
83
|
-
SHHH_DOTFILES_PATH: dotfiles path, defaults to SHHH_HOME_PATH/.dotfiles
|
84
|
-
SHHH_HOME_PATH: home path, defaults to ~
|
85
|
-
SHHH_SECRETS_PATH: secrets path, defaults to SHHH_HOME_PATH/.briefcase_secrets
|
86
|
-
|
87
|
-
== Note on Patches/Pull Requests
|
88
|
-
|
89
|
-
* Fork the project.
|
90
|
-
* Make your feature addition or bug fix on a topic branch.
|
91
|
-
* Add tests for it. This is important so I don't break it in a future version unintentionally.
|
92
|
-
* Commit, do not mess with rakefile, version, or history.
|
93
|
-
(if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
|
94
|
-
* Send me a pull request.
|
95
|
-
|
96
|
-
== Changelog
|
97
|
-
* 0.3.0 Added code documentation, internal renaming, general cleanup. First public release.
|
98
|
-
* 0.2.0 Added redact command, use .redacted for dynamic dotfiles
|
99
|
-
* 0.1.3 The sync command no longer creates symlinks for dynamic files
|
100
|
-
* 0.1.2 Added dynamic file generation
|
101
|
-
|
102
|
-
== Copyright
|
103
|
-
|
104
|
-
Copyright (c) 2010 Jim Benton. See LICENSE for details.
|