mcc 0.1.0 → 0.2.0

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.
@@ -1,6 +1,16 @@
1
1
  = mcc
2
2
 
3
- Description goes here.
3
+ Magic Comment Checker.
4
+
5
+ It provides command "mcc" for check a magic comment.
6
+
7
+ == Installation
8
+
9
+ gem install mcc
10
+
11
+ == Usage
12
+
13
+ mcc ./lib/*.rb
4
14
 
5
15
  == Note on Patches/Pull Requests
6
16
 
data/Rakefile CHANGED
@@ -6,7 +6,7 @@ begin
6
6
  Jeweler::Tasks.new do |gem|
7
7
  gem.name = "mcc"
8
8
  gem.summary = %Q{Magic Comment Checker}
9
- gem.description = %Q{It provides command "mcc" for check a magic comment. }
9
+ gem.description = %Q{It provides command "mcc" for check a magic comment.}
10
10
  gem.email = "igaiga@gmail.com"
11
11
  gem.homepage = "http://github.com/igaiga/mcc"
12
12
  gem.authors = ["Kuniaki IGARASHI"]
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.0
1
+ 0.2.0
data/bin/mcc CHANGED
File without changes
data/lib/mcc.rb CHANGED
@@ -9,7 +9,10 @@ module MCC
9
9
  def self.run(files, format = '# coding: utf-8')
10
10
  files.each do |file|
11
11
  unless include_magick_comment?(file)
12
+ puts "#{file} => insert a magick comment!"
12
13
  insert_magick_comment(file, format)
14
+ else
15
+ puts "#{file} => ok!"
13
16
  end
14
17
  end
15
18
  end
@@ -21,6 +24,8 @@ module MCC
21
24
  end
22
25
  end
23
26
  false
27
+ rescue EOFError
28
+ false
24
29
  end
25
30
 
26
31
  def self.insert_magick_comment(file, magick_comment)
@@ -46,5 +51,7 @@ module MCC
46
51
  File.open(file) do |f|
47
52
  return !!(f.readline =~ /^#!/)
48
53
  end
54
+ rescue EOFError
55
+ false
49
56
  end
50
57
  end
File without changes
@@ -15,7 +15,8 @@ describe "Mcc" do
15
15
  {
16
16
  'with_magick_comment.rb' => true,
17
17
  'without_magick_comment.rb' => false,
18
- 'with_shebang_and_magick_comment.rb' => true
18
+ 'with_shebang_and_magick_comment.rb' => true,
19
+ 'empty.rb' => false
19
20
  }.each do |k, v|
20
21
  MCC.include_magick_comment?(fixture_file(k)).should be v
21
22
  end
@@ -23,8 +24,9 @@ describe "Mcc" do
23
24
 
24
25
  it 'should insert a magick comment' do
25
26
  {
26
- 'without_magick_comment.rb' => true,
27
- 'without_shebung_and_magick_comment.rb' => false
27
+ 'without_magick_comment.rb' => true,
28
+ 'without_shebung_and_magick_comment.rb' => false,
29
+ 'empty.rb' => false
28
30
  }.each do |file, include_shebang|
29
31
  begin
30
32
  tmp = Tempfile.open(file)
@@ -42,6 +44,7 @@ describe "Mcc" do
42
44
  it 'should check include a shebang' do
43
45
  MCC.include_shebang?(fixture_file('with_shebang_and_magick_comment.rb')).should be true
44
46
  MCC.include_shebang?(fixture_file('with_magick_comment.rb')).should be false
47
+ MCC.include_shebang?(fixture_file('empty.rb')).should be false
45
48
  end
46
49
 
47
50
  def fixture_file(filename)
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mcc
3
3
  version: !ruby/object:Gem::Version
4
- hash: 27
4
+ hash: 23
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
- - 1
8
+ - 2
9
9
  - 0
10
- version: 0.1.0
10
+ version: 0.2.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Kuniaki IGARASHI
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-09-10 00:00:00 +09:00
18
+ date: 2010-09-13 00:00:00 +09:00
19
19
  default_executable: mcc
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -34,7 +34,7 @@ dependencies:
34
34
  version: 1.2.9
35
35
  type: :development
36
36
  version_requirements: *id001
37
- description: "It provides command \"mcc\" for check a magic comment. "
37
+ description: It provides command "mcc" for check a magic comment.
38
38
  email: igaiga@gmail.com
39
39
  executables:
40
40
  - mcc
@@ -52,6 +52,7 @@ files:
52
52
  - VERSION
53
53
  - bin/mcc
54
54
  - lib/mcc.rb
55
+ - spec/fixtures/empty.rb
55
56
  - spec/fixtures/with_magick_comment.rb
56
57
  - spec/fixtures/with_shebang_and_magick_comment.rb
57
58
  - spec/fixtures/without_magick_comment.rb
@@ -94,6 +95,7 @@ signing_key:
94
95
  specification_version: 3
95
96
  summary: Magic Comment Checker
96
97
  test_files:
98
+ - spec/fixtures/empty.rb
97
99
  - spec/fixtures/with_magick_comment.rb
98
100
  - spec/fixtures/with_shebang_and_magick_comment.rb
99
101
  - spec/fixtures/without_magick_comment.rb