trump 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in trump.gemspec
4
+ gemspec
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 Jelle Vandebeeck
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,45 @@
1
+ # Trump
2
+
3
+ Add a gem to the Gemfile with more info in comments.
4
+
5
+ Below is an example of the output in the Gemfile:
6
+
7
+ # This is the gem description
8
+ # [gemname](http://gemurl.com)
9
+ gem "gemname", "0.0.1"
10
+
11
+ ## Installation
12
+
13
+ Install the gem:
14
+
15
+ $ gem install trump
16
+
17
+ ## Usage
18
+
19
+ There is only one command and this is explained below.
20
+
21
+ ### Add
22
+
23
+ Run the following command followed by the name of the gem.
24
+
25
+ trump gemname
26
+ trump add gemname
27
+
28
+ Both commands are the same.
29
+
30
+ Now check out your Gemfile and look at the info added to the gem.
31
+
32
+ ## TODO
33
+
34
+ - Edit an existing gem
35
+ - Choose the version number
36
+ - Remove a gem
37
+ - Add a gem in the development group
38
+
39
+ ## Contributing
40
+
41
+ 1. Fork it
42
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
43
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
44
+ 4. Push to the branch (`git push origin my-new-feature`)
45
+ 5. Create new Pull Request
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,19 @@
1
+ #! /usr/bin/ruby
2
+
3
+ require "thor"
4
+ require "trump"
5
+
6
+ class TrumpCommand < Thor
7
+ default_command :add
8
+
9
+ desc "add [NAME]", "Add the last version of the gem to the Gemfile with all the extra data supplied."
10
+ def add(name)
11
+ Trump::Base.add(name)
12
+ end
13
+ end
14
+
15
+ if ARGV[0] == "add"
16
+ TrumpCommand.start
17
+ else
18
+ TrumpCommand.new.add(ARGV[0])
19
+ end
@@ -0,0 +1,5 @@
1
+ require "trump/version"
2
+ require "trump/base"
3
+
4
+ module Trump
5
+ end
@@ -0,0 +1,73 @@
1
+ require "curl_wrapper"
2
+ require "json/pure"
3
+
4
+ module Trump
5
+ class Base
6
+ class << self
7
+ def add(name)
8
+ puts trump_text
9
+ puts_text("")
10
+
11
+ puts_text("Fetching data for gem '#{name}'")
12
+ curl = CurlWrapper.new do |config|
13
+ config.url "https://rubygems.org/api/v1/gems/#{name}.json"
14
+ end
15
+ curl.run
16
+
17
+ content = curl.to_s
18
+ if content == "This rubygem could not be found."
19
+ puts_text("This rubygem could not be found.")
20
+ puts_text("")
21
+ puts end_text
22
+ return
23
+ end
24
+
25
+ puts_text("Parsing data")
26
+ your_gem = JSON.parse(content)
27
+ url = your_gem["homepage_uri"] || your_gem["documentation_uri"]
28
+
29
+ puts_text("Detecting Gemfile")
30
+ if File.exists?("Gemfile")
31
+ File.open("Gemfile", 'a') do |file|
32
+ file.puts ""
33
+ file.puts "# #{your_gem["info"][0..75]}"
34
+ file.puts "# [#{name}](#{url})"
35
+ file.puts "gem \"#{name}\", \"#{your_gem["version"]}\""
36
+ end
37
+ puts_text("Adding gem '#{name}' to the Gemfile.")
38
+ else
39
+ puts_text("There is no Gemfile available in this directory.")
40
+ end
41
+ puts_text("")
42
+ puts end_text
43
+ end
44
+
45
+ def trump_text
46
+ <<TEXT
47
+ #############################################################################################################
48
+ ### TRUMP ###################################################################################################
49
+ #############################################################################################################
50
+ TEXT
51
+ end
52
+
53
+ def end_text
54
+ <<TEXT
55
+ #############################################################################################################
56
+ TEXT
57
+ end
58
+
59
+ def sharp_count
60
+ "#############################################################################################################".size
61
+ end
62
+
63
+ def puts_text(text)
64
+ printf "### %-#{sharp_count - 8}s ###\n", text
65
+ end
66
+ end
67
+ end
68
+ end
69
+
70
+
71
+
72
+
73
+
@@ -0,0 +1,3 @@
1
+ module Trump
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,26 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'trump/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "trump"
8
+ spec.version = Trump::VERSION
9
+ spec.authors = ["Jelle Vandebeeck"]
10
+ spec.email = ["jelle@fousa.be"]
11
+ spec.description = %q{Add a gem to the Gemfile with more info in comments.}
12
+ spec.summary = %q{Add a gem to the Gemfile with more info in comments.}
13
+ spec.homepage = "http://github.com/fousa/trump"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files`.split($/)
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_development_dependency "bundler", "~> 1.3"
22
+ spec.add_development_dependency "rake"
23
+ spec.add_dependency 'thor', '0.18.1'
24
+ spec.add_dependency "json_pure", "~> 1.8.0"
25
+ spec.add_dependency "curl_wrapper", "~> 0.0.3"
26
+ end
metadata ADDED
@@ -0,0 +1,137 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: trump
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Jelle Vandebeeck
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2013-05-23 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: bundler
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ~>
20
+ - !ruby/object:Gem::Version
21
+ version: '1.3'
22
+ type: :development
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ version: '1.3'
30
+ - !ruby/object:Gem::Dependency
31
+ name: rake
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ type: :development
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
46
+ - !ruby/object:Gem::Dependency
47
+ name: thor
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - '='
52
+ - !ruby/object:Gem::Version
53
+ version: 0.18.1
54
+ type: :runtime
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - '='
60
+ - !ruby/object:Gem::Version
61
+ version: 0.18.1
62
+ - !ruby/object:Gem::Dependency
63
+ name: json_pure
64
+ requirement: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - ~>
68
+ - !ruby/object:Gem::Version
69
+ version: 1.8.0
70
+ type: :runtime
71
+ prerelease: false
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ~>
76
+ - !ruby/object:Gem::Version
77
+ version: 1.8.0
78
+ - !ruby/object:Gem::Dependency
79
+ name: curl_wrapper
80
+ requirement: !ruby/object:Gem::Requirement
81
+ none: false
82
+ requirements:
83
+ - - ~>
84
+ - !ruby/object:Gem::Version
85
+ version: 0.0.3
86
+ type: :runtime
87
+ prerelease: false
88
+ version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
90
+ requirements:
91
+ - - ~>
92
+ - !ruby/object:Gem::Version
93
+ version: 0.0.3
94
+ description: Add a gem to the Gemfile with more info in comments.
95
+ email:
96
+ - jelle@fousa.be
97
+ executables:
98
+ - trump
99
+ extensions: []
100
+ extra_rdoc_files: []
101
+ files:
102
+ - .gitignore
103
+ - Gemfile
104
+ - LICENSE.txt
105
+ - README.md
106
+ - Rakefile
107
+ - bin/trump
108
+ - lib/trump.rb
109
+ - lib/trump/base.rb
110
+ - lib/trump/version.rb
111
+ - trump.gemspec
112
+ homepage: http://github.com/fousa/trump
113
+ licenses:
114
+ - MIT
115
+ post_install_message:
116
+ rdoc_options: []
117
+ require_paths:
118
+ - lib
119
+ required_ruby_version: !ruby/object:Gem::Requirement
120
+ none: false
121
+ requirements:
122
+ - - ! '>='
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
125
+ required_rubygems_version: !ruby/object:Gem::Requirement
126
+ none: false
127
+ requirements:
128
+ - - ! '>='
129
+ - !ruby/object:Gem::Version
130
+ version: '0'
131
+ requirements: []
132
+ rubyforge_project:
133
+ rubygems_version: 1.8.25
134
+ signing_key:
135
+ specification_version: 3
136
+ summary: Add a gem to the Gemfile with more info in comments.
137
+ test_files: []