rag 1.0.7 → 1.1.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.
- data/.gitignore +1 -0
- data/Gemfile +9 -5
- data/Gemfile.lock +29 -17
- data/README.md +39 -36
- data/bin/rag +15 -9
- data/data/home_config/_ragrc +5 -5
- data/lib/rag.rb +38 -4
- data/lib/rag/gem.rb +7 -9
- data/lib/rag/new.rb +141 -24
- data/lib/rag/rc.rb +6 -21
- data/lib/rag/ui.rb +61 -0
- data/lib/rag/util.rb +5 -0
- data/lib/rag/util/erb.rb +28 -0
- data/lib/rag/version.rb +3 -0
- data/rag.gemspec +13 -14
- data/rag.watchr +2 -2
- data/spec/data/_rag/default/hello.erb +1 -0
- data/spec/data/homerc +8 -0
- data/spec/data/systemrc +9 -0
- data/spec/rag/new_spec.rb +23 -0
- data/spec/rag/rag_spec.rb +6 -0
- data/spec/spec_helper.rb +4 -12
- data/tags +628 -0
- metadata +62 -68
- data/LICENSE +0 -20
- data/data/template/default.readme +0 -26
- data/data/template/default/.gitignore +0 -1
- data/data/template/default/.rspec +0 -1
- data/data/template/default/Gemfile +0 -8
- data/data/template/default/LICENSE.erb +0 -20
- data/data/template/default/README.md.erb +0 -46
- data/data/template/default/Ragfile +0 -5
- data/data/template/default/__project__.gemspec.erb +0 -21
- data/data/template/default/__project__.watchr +0 -22
- data/data/template/default/lib/__project__.rb.erb +0 -6
- data/data/template/default/lib/__project__/version.rb.erb +0 -9
- data/data/template/default/spec/spec_helper.rb.erb +0 -0
- data/lib/rag/new/project.rb +0 -152
- data/spec/rag/new/project_spec.rb +0 -27
- data/version.rb +0 -9
metadata
CHANGED
@@ -1,69 +1,72 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: rag
|
3
|
-
version: !ruby/object:Gem::Version
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.1.0
|
4
5
|
prerelease:
|
5
|
-
version: 1.0.7
|
6
6
|
platform: ruby
|
7
|
-
authors:
|
7
|
+
authors:
|
8
8
|
- Guten
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
- !ruby/object:Gem::Dependency
|
12
|
+
date: 2012-02-02 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
16
15
|
name: tagen
|
17
|
-
|
18
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
16
|
+
requirement: &16694440 !ruby/object:Gem::Requirement
|
19
17
|
none: false
|
20
|
-
requirements:
|
18
|
+
requirements:
|
21
19
|
- - ~>
|
22
|
-
- !ruby/object:Gem::Version
|
23
|
-
version: 1.
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: 1.1.0
|
24
22
|
type: :runtime
|
25
|
-
|
26
|
-
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: *16694440
|
25
|
+
- !ruby/object:Gem::Dependency
|
27
26
|
name: pa
|
27
|
+
requirement: &16677360 !ruby/object:Gem::Requirement
|
28
|
+
none: false
|
29
|
+
requirements:
|
30
|
+
- - ~>
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: 1.1.0
|
33
|
+
type: :runtime
|
28
34
|
prerelease: false
|
29
|
-
|
35
|
+
version_requirements: *16677360
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: optimism
|
38
|
+
requirement: &16664800 !ruby/object:Gem::Requirement
|
30
39
|
none: false
|
31
|
-
requirements:
|
40
|
+
requirements:
|
32
41
|
- - ~>
|
33
|
-
- !ruby/object:Gem::Version
|
34
|
-
version:
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: 3.0.0
|
35
44
|
type: :runtime
|
36
|
-
version_requirements: *id002
|
37
|
-
- !ruby/object:Gem::Dependency
|
38
|
-
name: thor
|
39
45
|
prerelease: false
|
40
|
-
|
46
|
+
version_requirements: *16664800
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: thor
|
49
|
+
requirement: &16653840 !ruby/object:Gem::Requirement
|
41
50
|
none: false
|
42
|
-
requirements:
|
51
|
+
requirements:
|
43
52
|
- - ~>
|
44
|
-
- !ruby/object:Gem::Version
|
53
|
+
- !ruby/object:Gem::Version
|
45
54
|
version: 0.14.0
|
46
55
|
type: :runtime
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
INSTALL: gem install --no-wrappers rag.
|
51
|
-
UPDATE: gem update --no-wrappers rag.
|
52
|
-
|
56
|
+
prerelease: false
|
57
|
+
version_requirements: *16653840
|
58
|
+
description: ! "A project helper, include create, develop, test, release helper. \n"
|
53
59
|
email: ywzhaifei@gmail.com
|
54
|
-
executables:
|
60
|
+
executables:
|
55
61
|
- rag
|
56
62
|
extensions: []
|
57
|
-
|
58
63
|
extra_rdoc_files: []
|
59
|
-
|
60
|
-
files:
|
64
|
+
files:
|
61
65
|
- .gitignore
|
62
66
|
- .rspec
|
63
67
|
- .yardopts
|
64
68
|
- Gemfile
|
65
69
|
- Gemfile.lock
|
66
|
-
- LICENSE
|
67
70
|
- README.md
|
68
71
|
- Rakefile
|
69
72
|
- bin/rag
|
@@ -77,59 +80,50 @@ files:
|
|
77
80
|
- data/license/gpl
|
78
81
|
- data/license/lgpl
|
79
82
|
- data/license/mit.erb
|
80
|
-
- data/template/default.readme
|
81
|
-
- data/template/default/.gitignore
|
82
|
-
- data/template/default/.rspec
|
83
|
-
- data/template/default/Gemfile
|
84
|
-
- data/template/default/LICENSE.erb
|
85
|
-
- data/template/default/README.md.erb
|
86
|
-
- data/template/default/Ragfile
|
87
|
-
- data/template/default/__project__.gemspec.erb
|
88
|
-
- data/template/default/__project__.watchr
|
89
|
-
- data/template/default/lib/__project__.rb.erb
|
90
|
-
- data/template/default/lib/__project__/version.rb.erb
|
91
|
-
- data/template/default/spec/spec_helper.rb.erb
|
92
83
|
- data/template/test/file_name.erb
|
93
84
|
- docs/OverView.md
|
94
85
|
- lib/rag.rb
|
95
86
|
- lib/rag/doc.rb
|
96
87
|
- lib/rag/gem.rb
|
97
88
|
- lib/rag/new.rb
|
98
|
-
- lib/rag/new/project.rb
|
99
89
|
- lib/rag/rc.rb
|
100
90
|
- lib/rag/test.rb
|
91
|
+
- lib/rag/ui.rb
|
92
|
+
- lib/rag/util.rb
|
93
|
+
- lib/rag/util/erb.rb
|
94
|
+
- lib/rag/version.rb
|
101
95
|
- rag.gemspec
|
102
96
|
- rag.watchr
|
103
|
-
- spec/
|
97
|
+
- spec/data/_rag/default/hello.erb
|
98
|
+
- spec/data/homerc
|
99
|
+
- spec/data/systemrc
|
104
100
|
- spec/rag/new_spec.rb
|
101
|
+
- spec/rag/rag_spec.rb
|
105
102
|
- spec/spec_helper.rb
|
106
|
-
-
|
103
|
+
- tags
|
107
104
|
homepage: http://github.com/GutenYe/rag
|
108
105
|
licenses: []
|
109
|
-
|
110
106
|
post_install_message:
|
111
107
|
rdoc_options: []
|
112
|
-
|
113
|
-
require_paths:
|
108
|
+
require_paths:
|
114
109
|
- lib
|
115
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
110
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
116
111
|
none: false
|
117
|
-
requirements:
|
118
|
-
- -
|
119
|
-
- !ruby/object:Gem::Version
|
120
|
-
version:
|
121
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
112
|
+
requirements:
|
113
|
+
- - ! '>='
|
114
|
+
- !ruby/object:Gem::Version
|
115
|
+
version: '0'
|
116
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
122
117
|
none: false
|
123
|
-
requirements:
|
124
|
-
- -
|
125
|
-
- !ruby/object:Gem::Version
|
126
|
-
version:
|
118
|
+
requirements:
|
119
|
+
- - ! '>='
|
120
|
+
- !ruby/object:Gem::Version
|
121
|
+
version: '0'
|
127
122
|
requirements: []
|
128
|
-
|
129
123
|
rubyforge_project: xx
|
130
|
-
rubygems_version: 1.8.
|
124
|
+
rubygems_version: 1.8.11
|
131
125
|
signing_key:
|
132
126
|
specification_version: 3
|
133
|
-
summary:
|
127
|
+
summary: A project helper, include create, developing, testing, release
|
134
128
|
test_files: []
|
135
|
-
|
129
|
+
has_rdoc:
|
data/LICENSE
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
Copyright (c) 2011 Guten
|
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 NONINFRINGEMENT.
|
17
|
-
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
18
|
-
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
19
|
-
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
20
|
-
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
@@ -1,26 +0,0 @@
|
|
1
|
-
|
2
|
-
file layout
|
3
|
-
|
4
|
-
bin/
|
5
|
-
|
6
|
-
lib/
|
7
|
-
\__project__/
|
8
|
-
...
|
9
|
-
\__project__.rb
|
10
|
-
|
11
|
-
spec/
|
12
|
-
spec_helper.rb
|
13
|
-
\__project__
|
14
|
-
...
|
15
|
-
\__project__.watchr
|
16
|
-
|
17
|
-
Gemfile
|
18
|
-
Ragfile
|
19
|
-
\__project__.gemspec
|
20
|
-
version.rb
|
21
|
-
|
22
|
-
LICENSE
|
23
|
-
README
|
24
|
-
|
25
|
-
|
26
|
-
# vim: filetype=markdown
|
@@ -1 +0,0 @@
|
|
1
|
-
*~
|
@@ -1 +0,0 @@
|
|
1
|
-
--color
|
@@ -1,20 +0,0 @@
|
|
1
|
-
Copyright (c) 2011 <%=author%>
|
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 NONINFRINGEMENT.
|
17
|
-
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
18
|
-
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
19
|
-
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
20
|
-
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
@@ -1,46 +0,0 @@
|
|
1
|
-
Foo, a very good library
|
2
|
-
========================
|
3
|
-
|
4
|
-
**Homepage**: [https://github.com/<%=github.username%>/<%=project%>](https://github.com/<%=github.username%>/<%=project%>) <br/>
|
5
|
-
**Author**: <%=author%> <br/>
|
6
|
-
**License**: <%=license%> <br/>
|
7
|
-
**Documentation**: [http://rubydoc.info/gems/<%=project%>/frames](http://rubydoc.info/gems/<%=project%>/frames) <br/>
|
8
|
-
**Issue Tracker**: [https://github.com/<%=github.username%>/<%=project%>/issues](https://github.com/<%=github.username%>/<%=project%>/issues) <br/>
|
9
|
-
|
10
|
-
Overview
|
11
|
-
--------
|
12
|
-
|
13
|
-
descripe your prjoect here.
|
14
|
-
|
15
|
-
Features
|
16
|
-
--------
|
17
|
-
|
18
|
-
a clearly list of features.
|
19
|
-
|
20
|
-
Usage
|
21
|
-
-----
|
22
|
-
|
23
|
-
how to use
|
24
|
-
|
25
|
-
Contributing
|
26
|
-
-------------
|
27
|
-
|
28
|
-
* join the project.
|
29
|
-
* report bugs/featues to issue tracker.
|
30
|
-
* fork it and pull a request.
|
31
|
-
* improve documentation.
|
32
|
-
* feel free to post any ideas.
|
33
|
-
|
34
|
-
Install
|
35
|
-
----------
|
36
|
-
|
37
|
-
install method
|
38
|
-
|
39
|
-
Resources
|
40
|
-
---------
|
41
|
-
|
42
|
-
some related resources to help each other.
|
43
|
-
|
44
|
-
Copyright
|
45
|
-
---------
|
46
|
-
Copyright © 2011 by <%=author%>. this library released under <%=license%>, See {file:LICENSE} for futher details.
|
@@ -1,21 +0,0 @@
|
|
1
|
-
$: << "."
|
2
|
-
require "lib/<%=project%>/version"
|
3
|
-
|
4
|
-
Gem::Specification.new do |s|
|
5
|
-
s.name = "<%=project%>"
|
6
|
-
s.version = <%=project.capitalize%>::VERSION::IS
|
7
|
-
s.summary = "a good lib"
|
8
|
-
s.description = <<-EOF
|
9
|
-
a good lib
|
10
|
-
EOF
|
11
|
-
|
12
|
-
s.author = "<%=author%>"
|
13
|
-
s.email = "<%=email%>"
|
14
|
-
s.homepage = "http://github.com/<%=github.username%>/<%=project%>"
|
15
|
-
s.rubyforge_project = "xx"
|
16
|
-
|
17
|
-
s.files = `git ls-files`.split("\n")
|
18
|
-
#s.executables = ["x"]
|
19
|
-
|
20
|
-
#s.add_dependency "x"
|
21
|
-
end
|
@@ -1,22 +0,0 @@
|
|
1
|
-
# lib/**/*.rb
|
2
|
-
watch %r~lib/(.*)\.rb~ do |m|
|
3
|
-
test "spec/#{m[1]}_spec.rb"
|
4
|
-
end
|
5
|
-
|
6
|
-
# spec/**/*_spec.rb
|
7
|
-
watch %r~spec/.*_spec\.rb~ do |m|
|
8
|
-
test m[0]
|
9
|
-
end
|
10
|
-
|
11
|
-
# Ctrl-\
|
12
|
-
Signal.trap('QUIT') do
|
13
|
-
puts "--- Running all tests ---\n\n"
|
14
|
-
test "spec"
|
15
|
-
end
|
16
|
-
|
17
|
-
def test path
|
18
|
-
cmd = "rspec #{path}"
|
19
|
-
puts cmd
|
20
|
-
system cmd
|
21
|
-
end
|
22
|
-
|
File without changes
|
data/lib/rag/new/project.rb
DELETED
@@ -1,152 +0,0 @@
|
|
1
|
-
require "tagen/yaml"
|
2
|
-
require "tagen/erb"
|
3
|
-
|
4
|
-
class Rag
|
5
|
-
=begin
|
6
|
-
|
7
|
-
== ERB support variables
|
8
|
-
* project # the name of your project, provided by `rag new <project_name>'
|
9
|
-
* others from .ragrc
|
10
|
-
|
11
|
-
== Configrauton
|
12
|
-
|
13
|
-
+ ~/.ragrc
|
14
|
-
+ APP/.ragrc
|
15
|
-
+ from cmdline
|
16
|
-
|
17
|
-
you can use arbitrary name in .ragrc, then you can use then in template file.
|
18
|
-
|
19
|
-
=end
|
20
|
-
class Project
|
21
|
-
module ClassMethods
|
22
|
-
def create name, o={}
|
23
|
-
Project.new(name, o).create
|
24
|
-
end
|
25
|
-
|
26
|
-
# find templates
|
27
|
-
def templates
|
28
|
-
templates = []
|
29
|
-
templates << Rc.pa.template.ls - %w(test)
|
30
|
-
home_template_pa = Pa('~/.rag/template' )
|
31
|
-
templates << home_template_pa.ls if home_tempate_pa.exists?
|
32
|
-
end
|
33
|
-
|
34
|
-
# call by `rag new -l'
|
35
|
-
def list_templates
|
36
|
-
puts self.templates.join('\n')
|
37
|
-
end
|
38
|
-
|
39
|
-
end
|
40
|
-
extend ClassMethods
|
41
|
-
|
42
|
-
attr_reader :options, :name, :project
|
43
|
-
def initialize name, o={}
|
44
|
-
@name = name
|
45
|
-
@options = o
|
46
|
-
@project = o["name"] ? o["name"] : (name=="." ? Pa.pwd2.base : name)
|
47
|
-
@dest = Pa(@name)
|
48
|
-
end
|
49
|
-
|
50
|
-
def create
|
51
|
-
create_project_directory
|
52
|
-
if name=="."
|
53
|
-
copy_files
|
54
|
-
else
|
55
|
-
copy_files :overwrite => true
|
56
|
-
end
|
57
|
-
end
|
58
|
-
|
59
|
-
def create_project_directory
|
60
|
-
if @name=="."
|
61
|
-
return
|
62
|
-
elsif @dest.exists?
|
63
|
-
puts "dest directory `#{@name}' already existing"
|
64
|
-
exit
|
65
|
-
else
|
66
|
-
@dest.mkdir
|
67
|
-
end
|
68
|
-
end
|
69
|
-
|
70
|
-
def template_path
|
71
|
-
path1 = File.join(ENV["HOME"], ".rag/template", options[:template])
|
72
|
-
return path1 if File.exists?(path1)
|
73
|
-
|
74
|
-
path2 = Rc.pa.template.join(options[:template]).p
|
75
|
-
return path2 if File.exists?(path2)
|
76
|
-
|
77
|
-
raise Error, "can't find template -- #{options[:template]}"
|
78
|
-
end
|
79
|
-
|
80
|
-
def copy_files o={}
|
81
|
-
Pa.each_r template_path do |pa, relative, e|
|
82
|
-
# skip *~
|
83
|
-
next if pa.b =~ /~$/
|
84
|
-
|
85
|
-
# convert __project__ to @name
|
86
|
-
dest = @dest.join(relative.gsub(/__project__/, project))
|
87
|
-
path_msg = relative.gsub(/__project__/,project).gsub(/\.erb$/,'')
|
88
|
-
|
89
|
-
# skip directory not file
|
90
|
-
next if dest.exists? and dest.directory?
|
91
|
-
|
92
|
-
if not o[:overwrite] and (dest.exists? or dest.sub(/\.erb$/, '').exists?)
|
93
|
-
print "Overwrite #{path_msg}? [yna] "
|
94
|
-
case $stdin.gets.rstrip
|
95
|
-
when "y"
|
96
|
-
puts "[overwrite] #{path_msg}"
|
97
|
-
copy_file pa, dest, o
|
98
|
-
when "a"
|
99
|
-
puts "[overwrite] #{path_msg}"
|
100
|
-
o[:overwrite] = true
|
101
|
-
copy_file pa, dest, o
|
102
|
-
when "q"
|
103
|
-
exit
|
104
|
-
else
|
105
|
-
puts "[skip] #{path_msg}"
|
106
|
-
next
|
107
|
-
end
|
108
|
-
elsif o[:overwrite] and dest.exists?
|
109
|
-
puts "[overwrite] #{path_msg}"
|
110
|
-
copy_file pa, dest, o
|
111
|
-
else
|
112
|
-
# classify: file dir/
|
113
|
-
puts "[create] #{path_msg}" + (dest.directory? ? '/' : '')
|
114
|
-
copy_file pa, dest, o
|
115
|
-
end
|
116
|
-
|
117
|
-
end
|
118
|
-
end
|
119
|
-
|
120
|
-
# not rescurive copy
|
121
|
-
def copy_file src, dest, o
|
122
|
-
if src.e=='erb'
|
123
|
-
copy_erb_file src, dest.sub(/\.erb$/,'')
|
124
|
-
else
|
125
|
-
Pa.cp src, dest, o.merge(special: true)
|
126
|
-
end
|
127
|
-
end
|
128
|
-
|
129
|
-
def copy_erb_file src, dest
|
130
|
-
content = ERB.new(File.read(src.p)).result(nil, get_erb_config)
|
131
|
-
File.write dest.p, content
|
132
|
-
dest.chmod(src.stat.mode)
|
133
|
-
end
|
134
|
-
|
135
|
-
def get_erb_config
|
136
|
-
# ~/.ragrc
|
137
|
-
home_config = YAML.load(Rc.pa.config)
|
138
|
-
# APP/.ragrc
|
139
|
-
app_config = Rc.pa.app_config.exists? ? YAML.load(Rc.pa.app_config) : {}
|
140
|
-
# cli
|
141
|
-
cli_config = options
|
142
|
-
|
143
|
-
config = home_config.merge(app_config).merge(cli_config)
|
144
|
-
config["project"] = project
|
145
|
-
|
146
|
-
o = OpenOption.new(config)
|
147
|
-
o
|
148
|
-
end
|
149
|
-
|
150
|
-
|
151
|
-
end
|
152
|
-
end
|