chef-steel 0.0.1 → 0.0.2

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0347e49b84d3e3d0e0075ce03507cbff50721da7
4
- data.tar.gz: 289cfe57544a0f38d6ea7135f04a651a9055d39d
3
+ metadata.gz: f2057aa9a1c5a8ac12d94ca01bcce96d475baf54
4
+ data.tar.gz: 29b45285a443fe0a62c5a524f276d8c5f6fac0c1
5
5
  SHA512:
6
- metadata.gz: 27be27899ebd28569bd4fe2527066d7e09eae74e48c4cf65e215415ccadeb53f735e1b1cea681236a7a9b53363f00c37983b1cced34362547c558e008556755c
7
- data.tar.gz: 9806a3bcc0a3a19b157179892792171df82f8f49ba81da29fbc0aa469831da06a2e94892aa9ae5a7ae444134bd5d7ac5a87a551324cc8ea8371bc31854c372a2
6
+ metadata.gz: 9fd8fd7caf7ee1f1c89b4fd7b4ca41507ce23f0ce515eaf9f53ca3e0e6ea43d7c146e40e1d661a168bea95b8354fbc0d5ebcb58b77c51aa0d1fb215ac605613f
7
+ data.tar.gz: 2ead2883757812f0c34e320982b5f5902a8badf8a9622eb9e5011ba1632e239369f68da9437cd7007453c6bdfdcba49f153f5b1be47119f490452452353fd998
data/README.md CHANGED
@@ -1,5 +1,54 @@
1
1
  # chef-steel
2
- A tool to keep testing-related configurations up-to-date
2
+
3
+ Hone your tools with chef-steel!
4
+
5
+ `chef-steel` is a tool that can keep testing-related configurations up-to-date
6
+ within one or more repos. If you work within many different repos that share
7
+ a common set of testing tools (i.e. Rubocop, Foodcritic, Travis, Jenkins, etc.)
8
+ it can be easy for their configuration to drift. With `chef-steel` you can
9
+ update one or more of these configuration files from a central repository,
10
+ as needed.
11
+
12
+ **NOTE**: This tool ain't just for Chef developers! Use it for *any* repo whose
13
+ testing-related configurations you want to keep up-to-date.
14
+
15
+ ## Installing `chef-steel`
16
+
17
+ To begin honing your tools, install `chef-steel` via `gem`:
18
+
19
+ `gem install chef-steel`
20
+
21
+ ## `chef-steel` Usage
22
+
23
+ ```
24
+ [ryanleefrantz@remington ~/git/chef-steel] (master) $ steel -h
25
+ Usage: steel [-efrvy]
26
+
27
+ Hone your tools!
28
+
29
+ Options:
30
+ -e, --exclude-files *XFILES One or more explicit file names (space-separated) to *exclude* from being copied from the repo
31
+ Ex. -e README.md
32
+ Ex. --exclude-files README.md metadata.rb
33
+ Default: [".gitignore", "Policyfile.rb", "README.md", "metadata.rb"]
34
+ -f, --files *FILES One or more explicit file names (space-separated) to copy from the repo
35
+ Ex. -f .rubocop.yml
36
+ Ex. --files .rubocop.yml .rspec
37
+ Default: All top-level files in the repo (excluding the value if --exclude-files)
38
+ -r, --repo The full URL of a repo containing config files to clone
39
+ -v, --version Show version and exit
40
+ -y, --yes Answer "yes" to all prompts
41
+ Default: false
42
+ ```
43
+
44
+ `chef-steel` has a few command line options. See above for the help output.
45
+
46
+ Each of the command line options can be defined in a config file (command line
47
+ options always take precedence). `chef-steel` will look for `/etc/steel/steel.yml`
48
+ and `./steel.yml`, in that order, applying configuration values in a last-defined-wins
49
+ manner.
50
+
51
+ See [steel.yml.example](/steel.yml.example) for more details.
3
52
 
4
53
  ## See `chef-steel` in Action!
5
54
 
@@ -29,14 +29,14 @@ module Chef
29
29
  end
30
30
 
31
31
  # A hash of values describing our config.
32
- def config
33
- @config ||= {}
34
- end
32
+ def config
33
+ @config ||= {}
34
+ end
35
35
 
36
36
  # An array of path names for files that are candidates for being copied.
37
- def file_candidates
38
- @file_candidates ||= []
39
- end
37
+ def file_candidates
38
+ @file_candidates ||= []
39
+ end
40
40
 
41
41
  # Create a temporary directory to clone the repo into.
42
42
  def clone_destination
@@ -48,7 +48,7 @@ module Chef
48
48
  # Order matters with latter configs' definitions overriding
49
49
  # previous configs' values.
50
50
  def parse_config
51
- %w(/etc/steel/steel/yml steel.yml).each do |cfg|
51
+ %w(/etc/steel/steel.yml steel.yml).each do |cfg|
52
52
  if File.exist?(cfg)
53
53
  begin
54
54
  y = YAML.load_file(cfg)
@@ -72,11 +72,8 @@ module Chef
72
72
  header 'Options:'
73
73
 
74
74
  default_xfiles = %w(
75
- .gitignore
76
- Policyfile.rb
77
- README.md
78
- metadata.rb
79
75
  )
76
+
80
77
  option :exclude_files do
81
78
  short '-e'
82
79
  long '--exclude-files *XFILES' # Yeah, XFILES!
@@ -93,7 +90,7 @@ module Chef
93
90
  desc 'One or more explicit file names (space-separated) to copy from the repo'
94
91
  desc 'Ex. -f .rubocop.yml'
95
92
  desc 'Ex. --files .rubocop.yml .rspec'
96
- desc 'Default: All top-level files in the repo (excluding the value if --exclude-files)'
93
+ desc 'Default: All top-level files in the repo (excluding the value of --exclude-files)'
97
94
  end
98
95
 
99
96
  option :repo do
@@ -144,15 +141,15 @@ module Chef
144
141
  # provide a native way to minimize depth (like the `find` command).
145
142
  # File::FNM_DOTMATCH is handy flag that surfaces dotfiles.
146
143
  def find_top_files(clone_destination)
147
- globule = File.join(clone_destination, '*') # Define a variable here to the next line is legible.
148
- Dir.glob(globule, File::FNM_DOTMATCH).each do |path|
149
- next if File.directory?(path) # Should omit '.' and '..' as well.
144
+ globule = File.join(clone_destination, '*') # Define a variable here so the next line is legible.
145
+ Dir.glob(globule, File::FNM_DOTMATCH).each do |path|
146
+ next if File.directory?(path) # Should omit '.' and '..' as well.
150
147
  next if config['exclude_files'].include? File.basename(path)
151
148
  unless config['files'].nil? || config['files'].empty?
152
149
  next unless config['files'].include? File.basename(path)
153
150
  end
154
- file_candidates << path
155
- end
151
+ file_candidates << path
152
+ end
156
153
  end
157
154
 
158
155
  # Copy files from the cloned repo into this local repo.
@@ -1,5 +1,5 @@
1
1
  module Chef
2
2
  module Steel
3
- VERSION = "0.0.1"
3
+ VERSION = "0.0.2"
4
4
  end
5
5
  end
@@ -4,18 +4,23 @@
4
4
 
5
5
  # Set 'repo' to the URL of a repository from which steel will clone and copy
6
6
  # top-level files.
7
+ # Command line option: -r, --repo
7
8
  repo: git@github.com:RyanFrantz/chef-testing-configs.git
8
9
  #repo: https://github.com/RyanFrantz/chef-testing-configs.git
9
10
 
10
11
  # Set 'answer_yes' to true to perform any operation that steel would normally prompt for.
12
+ # Command line option: -y, --yes
13
+ # Default is false.
11
14
  #answer_yes: true
12
15
 
13
16
  # 'files' is a list of files that should explicitly be copied.
17
+ # Command line option: -f, --files
14
18
  #files:
15
19
  # - .rubocop.yml
16
20
  # - Jenkinsfile
17
21
 
18
22
  # 'exclude_files' is a list of files that should not be copied.
23
+ # Command line option: -e, --exclude-files
19
24
  #exclude_files:
20
25
  # - .gitignore
21
26
  # - .rspec
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chef-steel
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Frantz
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-10-03 00:00:00.000000000 Z
11
+ date: 2018-04-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: choice