code2rubylearning 0.1.4 → 0.1.5

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 CHANGED
@@ -3,20 +3,22 @@ command line tool that formats, given source code files, making them ready for p
3
3
 
4
4
  ## Installation
5
5
  gem install code2rubylearning
6
-
6
+
7
7
  Or add this line to your application's Gemfile:
8
8
 
9
- gem "code2rubylearning", "~> 0.1.3"
9
+ gem "code2rubylearning", "~> 0.1"
10
10
 
11
11
  And then :
12
12
  bundle install
13
-
13
+
14
14
  ## Usage:
15
15
 
16
16
  $ code2rubylearning [options] file1 file2 file3 ...
17
17
 
18
18
  Check your clipboard, the files should be ready to paste to the forum.
19
19
 
20
+ For more, see the [Usage Examples](https://github.com/rudicode/code2rubylearning/wiki/Usage-examples)
21
+
20
22
  ## Contributing
21
23
 
22
24
  1. Fork it
@@ -25,6 +25,11 @@ begin
25
25
  options[:filenames] = false
26
26
  end
27
27
 
28
+ options[:prg_link] = true
29
+ opt.on( '-p', '--noprglink', 'Suppress program link line in output' ) do
30
+ options[:prg_link] = false
31
+ end
32
+
28
33
  opt.on( '-h', '--help', 'Display help screen' ) do
29
34
  puts opt
30
35
  exit 1
@@ -1,3 +1,3 @@
1
1
  module Code2rubylearning
2
- VERSION = "0.1.4"
2
+ VERSION = "0.1.5"
3
3
  end
@@ -17,6 +17,9 @@ module Code2rubylearning
17
17
  @buffer << filter.apply(current_data, file)
18
18
  end
19
19
 
20
+ if options[:prg_link]
21
+ @buffer << "<a href=\"https://github.com/rudicode/code2rubylearning/wiki\">Posted with code2rubylearning v#{ VERSION }</a>\n"
22
+ end
20
23
  Clippy.copy @buffer unless @buffer.empty?
21
24
  puts @buffer if options[:stdout]
22
25
  end
@@ -1,11 +1,13 @@
1
1
  require "spec_helper"
2
2
 
3
3
  describe Code2rubylearning do
4
+ before :each do
5
+ @options = { :stdout => false , :prg_link => false }
6
+ end
4
7
 
5
8
  it "should convert a single file" do
6
9
  files = ["spec/assets/file-1.rb"]
7
- options = { :stdout => false }
8
- Code2rubylearning.start files, options
10
+ Code2rubylearning.start files, @options
9
11
 
10
12
  # check if clipboard contents equal converted file
11
13
  # be careful clippy adds \r to new lines ( see clippy docs )
@@ -16,8 +18,7 @@ describe Code2rubylearning do
16
18
 
17
19
  it "should convert multiple files" do
18
20
  files = ["spec/assets/file-1.rb", "spec/assets/file-2.rb"]
19
- options = { :stdout => false }
20
- Code2rubylearning.start files, options
21
+ Code2rubylearning.start files, @options
21
22
 
22
23
  # check if clipboard contents equal converted file
23
24
  # be careful clippy adds \r to new lines ( see clippy docs )
@@ -27,5 +28,17 @@ describe Code2rubylearning do
27
28
 
28
29
  end
29
30
 
31
+ it "should add a program link to the end if :prg_link is true" do
32
+ @options = { :prg_link => true }
33
+ files = ["spec/assets/file-1.rb", "spec/assets/file-2.rb"]
34
+ Code2rubylearning.start files, @options
35
+
36
+ # check if clipboard contents equal converted file
37
+ # be careful clippy adds \r to new lines ( see clippy docs )
38
+ from_clipboard = Clippy.paste
39
+ correct_response = "<a href=\"https://github.com/rudicode/code2rubylearning/wiki\">Posted with code2rubylearning v"
40
+ from_clipboard.must_include correct_response
41
+
42
+ end
30
43
 
31
44
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: code2rubylearning
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-12-31 00:00:00.000000000 Z
12
+ date: 2013-01-02 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: clippy
@@ -70,7 +70,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
70
70
  version: '0'
71
71
  segments:
72
72
  - 0
73
- hash: -949178893
73
+ hash: -534321971
74
74
  required_rubygems_version: !ruby/object:Gem::Requirement
75
75
  none: false
76
76
  requirements:
@@ -79,7 +79,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
79
79
  version: '0'
80
80
  segments:
81
81
  - 0
82
- hash: -949178893
82
+ hash: -534321971
83
83
  requirements: []
84
84
  rubyforge_project:
85
85
  rubygems_version: 1.8.24