github-copywriter 0.0.3 → 0.0.4

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: 9f4bb77f61c5e0420a50ce4734c58ad605bbfc8c
4
- data.tar.gz: 2ad28f7e9248f55b40e04b2d24d54694d3226198
3
+ metadata.gz: b396521603f3abc0c5c59e95a36202035a28f13c
4
+ data.tar.gz: 3f835c331628069bd7ebdb97c286ee82344fd948
5
5
  SHA512:
6
- metadata.gz: 408ede2d6c21479a5c0c5f91df3035cf3ec5573ec438441eec6afecc452e5b32f17e272a6cb27b5e08f9d2bfe43eca335f03a9d2bdf8bded7e73f761581718a1
7
- data.tar.gz: 9e58da01128b53539260afbc911eee94383843c47c5a521a7b1d1d36bb5649078a8cd70b0850c8ef6a7d4201e2729f4cee0ef152973abfc2cb4f6d0eee7c36dd
6
+ metadata.gz: 1c52bacd633c7a65f040ff860962d7073f89232bab961e9258277572c34e6cb21eefc0ee1eaf5961a886522db8d8a1bc7572ba806564ef8937ada3c8f218b1df
7
+ data.tar.gz: 741a0f59c1e960feb414189b872222d1d7231bbaaa3490fabd0e9b9dcf4f88b44b5614b8cc5020030fc3055ae62555f78d8daa3ba49c5d46d2fb8055342350cd
@@ -29,6 +29,10 @@ Usage: #{executable_name} [repos...]
29
29
  options[:skip_forks] = true
30
30
  end
31
31
 
32
+ opts.on("-y", "--year YEAR", "Update copyrights to a give year.") do |year|
33
+ options[:year] = year
34
+ end
35
+
32
36
  opts.on_tail("-h","--help", "Show this message.") do
33
37
  puts opts
34
38
  exit
@@ -13,13 +13,9 @@ require "pp" # debug tool
13
13
  module Copywriter
14
14
  extend self
15
15
 
16
- VERSION = "0.0.3"
16
+ VERSION = "0.0.4"
17
17
  COMMIT_MSG = "Update copyright. ♥ github-copywriter\nFor more info, visit http://ryanmjacobs.github.io/github-copywriter"
18
18
 
19
- # Get time/date
20
- time = Time.now
21
- CUR_YEAR = time.year
22
-
23
19
  def login!
24
20
  # Grab username and pass
25
21
  puts "Obtaining OAuth2 access_token from github."
@@ -83,10 +79,10 @@ module Copywriter
83
79
  # (C) 2014
84
80
  # © 2014
85
81
  begin
86
- content.gsub!(/([Cc]opyright( \([Cc]\)| ©)?|\([Cc]\)|©) \d{4}/, "\\1 #{CUR_YEAR}")
82
+ content.gsub!(/([Cc]opyright( \([Cc]\)| ©)?|\([Cc]\)|©) \d{4}/, "\\1 #{@cur_year}")
87
83
  rescue
88
84
  # try w/o "©" symbol if we had errors
89
- content.gsub!(/([Cc]opyright( \([Cc]\))?|\([Cc]\)) \d{4}/, "\\1 #{CUR_YEAR}")
85
+ content.gsub!(/([Cc]opyright( \([Cc]\))?|\([Cc]\)) \d{4}/, "\\1 #{@cur_year}")
90
86
  end
91
87
 
92
88
  # Only commit if we need to
@@ -94,7 +90,7 @@ module Copywriter
94
90
  @modified_files << {:path => file_path, :content => content}
95
91
  puts " #{file_path} is now up-to-date.".green
96
92
  else
97
- puts " #{file_path} was already up-to-date."
93
+ puts " #{file_path} is already up-to-date."
98
94
  end
99
95
  end
100
96
 
@@ -142,7 +138,7 @@ module Copywriter
142
138
 
143
139
  def run!(options={})
144
140
  # Default options
145
- options = {all: false, skip_forks: false}.merge(options)
141
+ options = {all: false, skip_forks: false, year: nil}.merge(options)
146
142
 
147
143
  if options[:all] then
148
144
  repos = @client.repositories()
@@ -159,9 +155,13 @@ module Copywriter
159
155
  end
160
156
  end
161
157
 
158
+ # Get copyright year
159
+ @cur_year = options[:year] || Time.now.year
160
+
162
161
  # Loop through each repo
163
162
  repos.each do |repo|
164
163
 
164
+ # Skip if repo is a fork and --skip-forks is on
165
165
  next if options[:skip_forks] and repo[:fork]
166
166
 
167
167
  # Get repo info
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: github-copywriter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Jacobs