briefcase 0.4.1 → 0.4.2

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -11,6 +11,10 @@ installation and usage documentation.
11
11
 
12
12
  ## Changelog
13
13
 
14
+ * 0.4.2 Git command argument are properly escaped (Sebastian Spieszko)
15
+
16
+ Changed the instruction delimiter when redacting files to '!!'.
17
+
14
18
  * 0.4.1 Git command now properly passes options through to git, and also allows
15
19
  git output to display in color.
16
20
 
@@ -22,6 +22,7 @@ Gem::Specification.new do |s|
22
22
  s.test_files = Dir['spec/*.rb']
23
23
 
24
24
  s.add_runtime_dependency('commander')
25
+ s.add_runtime_dependency('escape')
25
26
  s.add_development_dependency('minitest')
26
27
  s.add_development_dependency('open4')
27
28
  s.add_development_dependency('rake', '0.9.2.2')
@@ -1,3 +1,5 @@
1
+ require 'escape'
2
+
1
3
  module Briefcase
2
4
  module Commands
3
5
 
@@ -20,7 +22,7 @@ module Briefcase
20
22
  # create an empty git repository.
21
23
  def execute
22
24
  verify_dotfiles_directory_exists
23
- command = @args.join(' ')
25
+ command = Escape.shell_command(@args)
24
26
  intro("Running git %s in %s", command, dotfiles_path)
25
27
  run_git_command(command)
26
28
  end
@@ -8,15 +8,15 @@ module Briefcase
8
8
  class Redact < Import
9
9
 
10
10
  EDITING_HELP_TEXT = <<-TEXT
11
- # Edit the file below, replacing and sensitive information to turn this:
12
- #
13
- # password: superSecretPassword
14
- #
15
- # Into:
16
- #
17
- # password: # briefcase(password)
18
- #
19
- ########################################################################
11
+ !! Edit the file below, replacing any sensitive information to turn this:
12
+ !!
13
+ !! password: superSecretPassword
14
+ !!
15
+ !! Into:
16
+ !!
17
+ !! password: # briefcase(password)
18
+ !!
19
+ !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
20
20
  TEXT
21
21
 
22
22
  private
@@ -37,14 +37,12 @@ TEXT
37
37
  redacted_path = destination + ".#{REDACTED_EXTENSION}"
38
38
  info "Creating redacted version at #{redacted_path}"
39
39
 
40
- content_to_edit = original_content = File.read(destination)
40
+ original_content = File.read(destination)
41
41
 
42
- unless Briefcase.testing?
43
- content_to_edit = EDITING_HELP_TEXT + content_to_edit
44
- end
42
+ content_to_edit = EDITING_HELP_TEXT + original_content
45
43
 
46
44
  write_file(redacted_path, content_to_edit)
47
- edited_content = edit_file_with_editor(redacted_path).gsub!(EDITING_HELP_TEXT, '')
45
+ edited_content = edit_file_with_editor(redacted_path).gsub(/^!!.*\r?\n/, '')
48
46
  write_file(redacted_path, edited_content)
49
47
 
50
48
  edited_content.lines.each_with_index do |line, line_index|
@@ -1,3 +1,3 @@
1
1
  module Briefcase
2
- VERSION = '0.4.1'
2
+ VERSION = '0.4.2'
3
3
  end
@@ -67,22 +67,22 @@ describe Briefcase::Commands::Import do
67
67
  symlink_must_exist(@original_path, @destination_path)
68
68
  end
69
69
 
70
- it "imports a redacted dotfile" do
70
+ it "imports a redacted dotfile xxx" do
71
71
  redacted_path = File.join(dotfiles_path, 'test.redacted')
72
72
  create_file @original_path, <<-TEXT
73
73
  setting: ABCDEFG
74
74
  TEXT
75
75
 
76
76
  stub_editor_response redacted_path, <<-TEXT
77
- # Edit the file below, replacing and sensitive information to turn this:
78
- #
79
- # password: superSecretPassword
80
- #
81
- # Into:
82
- #
83
- # password: # briefcase(password)
84
- #
85
- ########################################################################
77
+ !! Edit the file below, replacing and sensitive information to turn this:
78
+ !!
79
+ !! password: superSecretPassword
80
+ !!
81
+ !! Into:
82
+ !!
83
+ !! password: # briefcase(password)
84
+ !!
85
+ !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
86
86
  setting: # briefcase(token)
87
87
  TEXT
88
88
 
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: 13
4
+ hash: 11
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 4
9
- - 1
10
- version: 0.4.1
9
+ - 2
10
+ version: 0.4.2
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: minitest
35
+ name: escape
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: :development
46
+ type: :runtime
47
47
  version_requirements: *id002
48
48
  - !ruby/object:Gem::Dependency
49
- name: open4
49
+ name: minitest
50
50
  prerelease: false
51
51
  requirement: &id003 !ruby/object:Gem::Requirement
52
52
  none: false
@@ -60,9 +60,23 @@ dependencies:
60
60
  type: :development
61
61
  version_requirements: *id003
62
62
  - !ruby/object:Gem::Dependency
63
- name: rake
63
+ name: open4
64
64
  prerelease: false
65
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
+ - !ruby/object:Gem::Dependency
77
+ name: rake
78
+ prerelease: false
79
+ requirement: &id005 !ruby/object:Gem::Requirement
66
80
  none: false
67
81
  requirements:
68
82
  - - "="
@@ -75,11 +89,11 @@ dependencies:
75
89
  - 2
76
90
  version: 0.9.2.2
77
91
  type: :development
78
- version_requirements: *id004
92
+ version_requirements: *id005
79
93
  - !ruby/object:Gem::Dependency
80
94
  name: turn
81
95
  prerelease: false
82
- requirement: &id005 !ruby/object:Gem::Requirement
96
+ requirement: &id006 !ruby/object:Gem::Requirement
83
97
  none: false
84
98
  requirements:
85
99
  - - ">="
@@ -89,7 +103,7 @@ dependencies:
89
103
  - 0
90
104
  version: "0"
91
105
  type: :development
92
- version_requirements: *id005
106
+ version_requirements: *id006
93
107
  description: Command line program to migrate dotfiles to a git repo at ~/.dotfiles and generate static dotfiles with secret values.
94
108
  email: jim@autonomousmachine.com
95
109
  executables: