cpgem 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,5 @@
1
+ lib/**/*.rb
2
+ bin/*
3
+ -
4
+ features/**/*.feature
5
+ LICENSE.txt
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ --color
data/Gemfile ADDED
@@ -0,0 +1,14 @@
1
+ source "http://rubygems.org"
2
+
3
+ gem "main", "~> 4.7.6"
4
+ gem "gems", "~> 0.5.0"
5
+ gem "clipboard", "~> 0.9.9"
6
+
7
+ group :development do
8
+ gem "aruba", "~> 0.4.6"
9
+ gem "rspec", "~> 2.6.0"
10
+ gem "cucumber", "~> 1.1.0"
11
+ gem "bundler", "~> 1.0.0"
12
+ gem "jeweler", "~> 1.6.4"
13
+ gem "rcov", "~> 0.9.10"
14
+ end
@@ -0,0 +1,68 @@
1
+ GEM
2
+ remote: http://rubygems.org/
3
+ specs:
4
+ arrayfields (4.7.4)
5
+ aruba (0.4.6)
6
+ bcat (>= 0.6.1)
7
+ childprocess (>= 0.2.0)
8
+ cucumber (>= 1.0.2)
9
+ rdiscount (>= 1.6.8)
10
+ rspec (>= 2.6.0)
11
+ bcat (0.6.2)
12
+ rack (~> 1.0)
13
+ builder (3.0.0)
14
+ childprocess (0.2.2)
15
+ ffi (~> 1.0.6)
16
+ chronic (0.6.4)
17
+ clipboard (0.9.9)
18
+ cucumber (1.1.0)
19
+ builder (>= 2.1.2)
20
+ diff-lcs (>= 1.1.2)
21
+ gherkin (~> 2.5.0)
22
+ json (>= 1.4.6)
23
+ term-ansicolor (>= 1.0.6)
24
+ diff-lcs (1.1.3)
25
+ fattr (2.2.0)
26
+ ffi (1.0.9)
27
+ gems (0.5.0)
28
+ gherkin (2.5.0)
29
+ json (>= 1.4.6)
30
+ git (1.2.5)
31
+ jeweler (1.6.4)
32
+ bundler (~> 1.0)
33
+ git (>= 1.2.5)
34
+ rake
35
+ json (1.6.1)
36
+ main (4.7.6)
37
+ arrayfields (~> 4.7.4)
38
+ chronic (~> 0.6.2)
39
+ fattr (~> 2.2.0)
40
+ map (~> 4.3.0)
41
+ map (4.3.0)
42
+ rack (1.3.3)
43
+ rake (0.9.2)
44
+ rcov (0.9.10)
45
+ rdiscount (1.6.8)
46
+ rspec (2.6.0)
47
+ rspec-core (~> 2.6.0)
48
+ rspec-expectations (~> 2.6.0)
49
+ rspec-mocks (~> 2.6.0)
50
+ rspec-core (2.6.4)
51
+ rspec-expectations (2.6.0)
52
+ diff-lcs (~> 1.1.2)
53
+ rspec-mocks (2.6.0)
54
+ term-ansicolor (1.0.6)
55
+
56
+ PLATFORMS
57
+ ruby
58
+
59
+ DEPENDENCIES
60
+ aruba (~> 0.4.6)
61
+ bundler (~> 1.0.0)
62
+ clipboard (~> 0.9.9)
63
+ cucumber (~> 1.1.0)
64
+ gems (~> 0.5.0)
65
+ jeweler (~> 1.6.4)
66
+ main (~> 4.7.6)
67
+ rcov (~> 0.9.10)
68
+ rspec (~> 2.6.0)
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2011 Jesus Lopes
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,36 @@
1
+ = cpgem
2
+
3
+ Copy Gemfile line to clipboard
4
+
5
+ == Basic Usage
6
+
7
+ cpgem googl
8
+
9
+ bundler: gem "googl", "~> 0.5.0"
10
+ install: gem install googl
11
+ name: googl
12
+ version: 0.5.0
13
+ 3166 downloads
14
+ 804 for this version
15
+ homepage: http://github.com/zigotto/googl
16
+
17
+ Type the Command+C in your Gemfile and have fun :)
18
+
19
+ == Installation
20
+
21
+ gem install cpgem
22
+
23
+ == Contributing to cpgem
24
+
25
+ * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
26
+ * Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
27
+ * Fork the project
28
+ * Start a feature/bugfix branch
29
+ * Commit and push until you are happy with your contribution
30
+ * Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
31
+ * Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
32
+
33
+ == Copyright
34
+
35
+ Copyright (c) 2011 Zigotto. See LICENSE.txt for
36
+ further details.
@@ -0,0 +1,52 @@
1
+ # encoding: utf-8
2
+
3
+ require 'rubygems'
4
+ require 'bundler'
5
+ begin
6
+ Bundler.setup(:default, :development)
7
+ rescue Bundler::BundlerError => e
8
+ $stderr.puts e.message
9
+ $stderr.puts "Run `bundle install` to install missing gems"
10
+ exit e.status_code
11
+ end
12
+ require 'rake'
13
+
14
+ require 'jeweler'
15
+ Jeweler::Tasks.new do |gem|
16
+ # gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
17
+ gem.name = "cpgem"
18
+ gem.homepage = "http://github.com/zigotto/cpgem"
19
+ gem.license = "MIT"
20
+ gem.summary = %Q{Copy Gemfile line to clipboard}
21
+ gem.description = %Q{Copy Gemfile line to clipboard}
22
+ gem.email = "jlopes@zigotto.com.br"
23
+ gem.authors = ["Jesus Lopes"]
24
+ # dependencies defined in Gemfile
25
+ end
26
+ Jeweler::RubygemsDotOrgTasks.new
27
+
28
+ require 'rspec/core'
29
+ require 'rspec/core/rake_task'
30
+ RSpec::Core::RakeTask.new(:spec) do |spec|
31
+ spec.pattern = FileList['spec/**/*_spec.rb']
32
+ end
33
+
34
+ RSpec::Core::RakeTask.new(:rcov) do |spec|
35
+ spec.pattern = 'spec/**/*_spec.rb'
36
+ spec.rcov = true
37
+ end
38
+
39
+ require 'cucumber/rake/task'
40
+ Cucumber::Rake::Task.new(:features)
41
+
42
+ task :default => :spec
43
+
44
+ require 'rake/rdoctask'
45
+ Rake::RDocTask.new do |rdoc|
46
+ version = File.exist?('VERSION') ? File.read('VERSION') : ""
47
+
48
+ rdoc.rdoc_dir = 'rdoc'
49
+ rdoc.title = "cpgem #{version}"
50
+ rdoc.rdoc_files.include('README*')
51
+ rdoc.rdoc_files.include('lib/**/*.rb')
52
+ end
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.0.1
@@ -0,0 +1,77 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ # coding: utf-8
4
+ $LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..', 'lib')
5
+
6
+ require 'cpgem'
7
+ require 'main'
8
+ require 'gems'
9
+ require 'clipboard'
10
+
11
+ Main do
12
+ description <<-__
13
+ cpgem power!
14
+ __
15
+
16
+ examples <<-__
17
+ Start the search:
18
+
19
+ cpgem
20
+
21
+ Specify an gem to search:
22
+
23
+ cpgem googl
24
+ __
25
+
26
+ argument("gem") do
27
+ required
28
+ description "Specifies an gem for search."
29
+ attribute
30
+ end
31
+
32
+ option('--do_not_copy', '-d') do
33
+ description 'Do not copy Gemfile line to clipboard.'
34
+ attribute
35
+ end
36
+
37
+ def run
38
+
39
+ info = Gems.info(params["gem"].value)
40
+ unless info
41
+ puts "Gem not found :("
42
+ exit_warn!
43
+ else
44
+
45
+ bundler = %@gem "#{info["name"]}", "~> #{info["version"]}"@
46
+ bundler_line = "bundler: #{bundler}"
47
+ install = %@install: gem install #{info["name"]}@
48
+ homepage = "homepage: #{info["homepage_uri"]}"
49
+ name = "name: #{info["name"]}"
50
+ version = "version: #{info["version"]}"
51
+ downloads = "#{info["downloads"]} downloads"
52
+ version_downloads = "#{info["version_downloads"]} for this version"
53
+ homepage = "homepage: #{info["homepage_uri"]}"
54
+
55
+ unless do_not_copy?
56
+ Clipboard.copy(bundler)
57
+ end
58
+
59
+ message = \
60
+ "#{bundler_line}\n" +
61
+ "#{install}\n" +
62
+ "#{name}\n" +
63
+ "#{version}\n" +
64
+ "#{downloads}\n" +
65
+ "#{version_downloads}\n" +
66
+ "#{homepage}"
67
+
68
+ puts message
69
+
70
+ end
71
+
72
+ rescue Exception => err
73
+ abort("<#{err.class.name}> #{err.message}\n\t" +
74
+ err.backtrace.join("\n\t"))
75
+ end
76
+
77
+ end
@@ -0,0 +1,27 @@
1
+ Feature: Search
2
+ In order to copy bundle command to my clipboard
3
+ As user using cpgem
4
+ I want to use the simple command
5
+
6
+ Scenario: Search gem googl
7
+ When I run "cpgem googl"
8
+ Then the output should contain exactly:
9
+ """
10
+ bundler: gem "googl", "~> 0.5.0"
11
+ install: gem install googl
12
+ name: googl
13
+ version: 0.5.0
14
+ 3166 downloads
15
+ 804 for this version
16
+ homepage: http://github.com/zigotto/googl
17
+
18
+ """
19
+
20
+ Scenario: Searching an invalid name
21
+ When I run "cpgem blebleble"
22
+ Then the output should contain:
23
+ """
24
+ Gem not found :(
25
+ """
26
+
27
+ Scenario: Do not copy bundler command
@@ -0,0 +1,14 @@
1
+ require 'bundler'
2
+ begin
3
+ Bundler.setup(:default, :development)
4
+ rescue Bundler::BundlerError => e
5
+ $stderr.puts e.message
6
+ $stderr.puts "Run `bundle install` to install missing gems"
7
+ exit e.status_code
8
+ end
9
+
10
+ $LOAD_PATH.unshift(File.dirname(__FILE__) + '/../../lib')
11
+ require 'cpgem'
12
+
13
+ require 'rspec/expectations'
14
+ require 'aruba/cucumber'
File without changes
@@ -0,0 +1,7 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
2
+
3
+ describe "Cpgem" do
4
+ it "fails" do
5
+ fail "hey buddy, you should probably rename this file and start specing for real"
6
+ end
7
+ end
@@ -0,0 +1,12 @@
1
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
2
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
3
+ require 'rspec'
4
+ require 'cpgem'
5
+
6
+ # Requires supporting files with custom matchers and macros, etc,
7
+ # in ./support/ and its subdirectories.
8
+ Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
9
+
10
+ RSpec.configure do |config|
11
+
12
+ end
metadata ADDED
@@ -0,0 +1,170 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: cpgem
3
+ version: !ruby/object:Gem::Version
4
+ prerelease:
5
+ version: 0.0.1
6
+ platform: ruby
7
+ authors:
8
+ - Jesus Lopes
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+
13
+ date: 2011-09-23 00:00:00 Z
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: main
17
+ requirement: &id001 !ruby/object:Gem::Requirement
18
+ none: false
19
+ requirements:
20
+ - - ~>
21
+ - !ruby/object:Gem::Version
22
+ version: 4.7.6
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: *id001
26
+ - !ruby/object:Gem::Dependency
27
+ name: gems
28
+ requirement: &id002 !ruby/object:Gem::Requirement
29
+ none: false
30
+ requirements:
31
+ - - ~>
32
+ - !ruby/object:Gem::Version
33
+ version: 0.5.0
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: *id002
37
+ - !ruby/object:Gem::Dependency
38
+ name: clipboard
39
+ requirement: &id003 !ruby/object:Gem::Requirement
40
+ none: false
41
+ requirements:
42
+ - - ~>
43
+ - !ruby/object:Gem::Version
44
+ version: 0.9.9
45
+ type: :runtime
46
+ prerelease: false
47
+ version_requirements: *id003
48
+ - !ruby/object:Gem::Dependency
49
+ name: aruba
50
+ requirement: &id004 !ruby/object:Gem::Requirement
51
+ none: false
52
+ requirements:
53
+ - - ~>
54
+ - !ruby/object:Gem::Version
55
+ version: 0.4.6
56
+ type: :development
57
+ prerelease: false
58
+ version_requirements: *id004
59
+ - !ruby/object:Gem::Dependency
60
+ name: rspec
61
+ requirement: &id005 !ruby/object:Gem::Requirement
62
+ none: false
63
+ requirements:
64
+ - - ~>
65
+ - !ruby/object:Gem::Version
66
+ version: 2.6.0
67
+ type: :development
68
+ prerelease: false
69
+ version_requirements: *id005
70
+ - !ruby/object:Gem::Dependency
71
+ name: cucumber
72
+ requirement: &id006 !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ~>
76
+ - !ruby/object:Gem::Version
77
+ version: 1.1.0
78
+ type: :development
79
+ prerelease: false
80
+ version_requirements: *id006
81
+ - !ruby/object:Gem::Dependency
82
+ name: bundler
83
+ requirement: &id007 !ruby/object:Gem::Requirement
84
+ none: false
85
+ requirements:
86
+ - - ~>
87
+ - !ruby/object:Gem::Version
88
+ version: 1.0.0
89
+ type: :development
90
+ prerelease: false
91
+ version_requirements: *id007
92
+ - !ruby/object:Gem::Dependency
93
+ name: jeweler
94
+ requirement: &id008 !ruby/object:Gem::Requirement
95
+ none: false
96
+ requirements:
97
+ - - ~>
98
+ - !ruby/object:Gem::Version
99
+ version: 1.6.4
100
+ type: :development
101
+ prerelease: false
102
+ version_requirements: *id008
103
+ - !ruby/object:Gem::Dependency
104
+ name: rcov
105
+ requirement: &id009 !ruby/object:Gem::Requirement
106
+ none: false
107
+ requirements:
108
+ - - ~>
109
+ - !ruby/object:Gem::Version
110
+ version: 0.9.10
111
+ type: :development
112
+ prerelease: false
113
+ version_requirements: *id009
114
+ description: Copy Gemfile line to clipboard
115
+ email: jlopes@zigotto.com.br
116
+ executables:
117
+ - cpgem
118
+ extensions: []
119
+
120
+ extra_rdoc_files:
121
+ - LICENSE.txt
122
+ - README.rdoc
123
+ files:
124
+ - .document
125
+ - .rspec
126
+ - Gemfile
127
+ - Gemfile.lock
128
+ - LICENSE.txt
129
+ - README.rdoc
130
+ - Rakefile
131
+ - VERSION
132
+ - bin/cpgem
133
+ - features/cpgem.feature
134
+ - features/step_definitions/cpgem_steps.rb
135
+ - features/support/env.rb
136
+ - lib/cpgem.rb
137
+ - spec/cpgem_spec.rb
138
+ - spec/spec_helper.rb
139
+ homepage: http://github.com/zigotto/cpgem
140
+ licenses:
141
+ - MIT
142
+ post_install_message:
143
+ rdoc_options: []
144
+
145
+ require_paths:
146
+ - lib
147
+ required_ruby_version: !ruby/object:Gem::Requirement
148
+ none: false
149
+ requirements:
150
+ - - ">="
151
+ - !ruby/object:Gem::Version
152
+ hash: -1778759636349177698
153
+ segments:
154
+ - 0
155
+ version: "0"
156
+ required_rubygems_version: !ruby/object:Gem::Requirement
157
+ none: false
158
+ requirements:
159
+ - - ">="
160
+ - !ruby/object:Gem::Version
161
+ version: "0"
162
+ requirements: []
163
+
164
+ rubyforge_project:
165
+ rubygems_version: 1.8.10
166
+ signing_key:
167
+ specification_version: 3
168
+ summary: Copy Gemfile line to clipboard
169
+ test_files: []
170
+