simple-templater 0.0.1.1 → 0.0.1.2

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/Rakefile CHANGED
@@ -1,79 +1,24 @@
1
- #!/usr/bin/env rake1.9
2
1
  # encoding: utf-8
3
2
 
4
- # http://support.runcoderun.com/faqs/builds/how-do-i-run-rake-with-trace-enabled
5
- Rake.application.options.trace = true
6
-
7
- task :setup => ["submodules:init"]
8
-
9
- namespace :submodules do
10
- desc "Init submodules"
11
- task :init do
12
- sh "git submodule init"
13
- end
3
+ require_relative "lib/simple-templater/version"
14
4
 
15
- desc "Update submodules"
16
- task :update do
17
- Dir["vendor/*"].each do |path|
18
- if File.directory?(path) && File.directory?(File.join(path, ".git"))
19
- Dir.chdir(path) do
20
- puts "=> #{path}"
21
- puts %x[git reset --hard]
22
- puts %x[git fetch]
23
- puts %x[git reset origin/master --hard]
24
- puts
25
- end
26
- end
27
- end
28
- end
29
- end
5
+ # ENV setup for external commands
6
+ ENV["RUBYLIB"] = Dir["vendor/*/lib"].join(":")
7
+ $LOAD_PATH.clear.push(*Dir["vendor/*/lib"])
30
8
 
31
- task :gem do
32
- sh "gem build simple-templater.gemspec"
33
- end
34
-
35
- namespace :gem do
36
- task :prerelease do
37
- require_relative "lib/simple-templater"
38
- gemspec = Dir["*.gemspec"].first
39
- content = File.read(gemspec)
40
- prename = "#{gemspec.split(".").first}.pre.gemspec"
41
- version = SimpleTemplater::VERSION.sub(/^(\d+)\.(\d+)\.\d+$/) { "#$1.#{$1.to_i + 1}" }
42
- File.open(prename, "w") do |file|
43
- file.puts(content.gsub(/(\w+::VERSION)/, "'#{version}.pre'"))
44
- end
45
- sh "gem build #{prename}"
46
- rm prename
47
- end
48
- end
49
-
50
- desc "Release new version of simple-templater"
51
- task release: ["release:tag", "release:gemcutter"]
52
-
53
- namespace :release do
54
- desc "Create Git tag"
55
- task :tag do
56
- require_relative "lib/simple-templater"
57
- puts "Creating new git tag #{SimpleTemplater::VERSION} and pushing it online ..."
58
- sh "git tag -a -m 'Version #{SimpleTemplater::VERSION}' #{SimpleTemplater::VERSION}"
59
- sh "git push --tags"
60
- puts "Tag #{SimpleTemplater::VERSION} was created and pushed to GitHub."
61
- end
9
+ # http://support.runcoderun.com/faqs/builds/how-do-i-run-rake-with-trace-enabled
10
+ Rake.application.options.trace = true
62
11
 
63
- desc "Push gem to Gemcutter"
64
- task :gemcutter do
65
- puts "Pushing to Gemcutter ..."
66
- sh "gem push #{Dir["*.gem"].last}"
12
+ # default task for RunCodeRun.com
13
+ task :default => ["submodules:init", :spec]
14
+
15
+ # load tasks
16
+ Dir["tasks/*.rake"].each do |taskfile|
17
+ begin
18
+ load File.join(Dir.pwd, taskfile)
19
+ rescue Exception => exception
20
+ puts "Exception #{exception.class} occured during loading #{taskfile}:"
21
+ puts exception.message
22
+ puts exception.backtrace
67
23
  end
68
-
69
- desc "Create and push prerelease gem"
70
- task :pre => ["gem:prerelease", :gemcutter]
71
- end
72
-
73
- desc "Run specs"
74
- task :default => :setup do
75
- rubylib = (ENV["RUBYLIB"] || String.new).split(":")
76
- libdirs = Dir["vendor/*/lib"]
77
- ENV["RUBYLIB"] = (libdirs + rubylib).join(":")
78
- exec "./script/spec --options spec/spec.opts spec"
79
24
  end
data/deps.rip CHANGED
@@ -2,6 +2,6 @@
2
2
 
3
3
  # Syntax:
4
4
  # repository [tag or commit to install]
5
- git://github.com/botanicus/cli.git
6
- git://github.com/botanicus/rubyexts.git
7
- git://github.com/genki/erubis.git
5
+ git://github.com/botanicus/cli.git 76a7985d78673426814017d6a1d6ebec2ba1bcc8
6
+ git://github.com/botanicus/rubyexts.git 41ef70523b4b6a19cac52e6c024330103faef993
7
+ git://github.com/genki/erubis.git b4fc63f1e75574676707768680ad72c83e77a001
data/deps.rip.rbe ADDED
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env rip install
2
+
3
+ # Syntax:
4
+ # repository [tag or commit to install]
5
+ git://github.com/botanicus/cli.git #{commits["cli"]}
6
+ git://github.com/botanicus/rubyexts.git #{commits["rubyexts"]}
7
+ git://github.com/genki/erubis.git #{commits["erubis"]}
@@ -6,7 +6,6 @@ require "simple-templater/discoverer"
6
6
  require "simple-templater/generator_set"
7
7
 
8
8
  class SimpleTemplater
9
- VERSION ||= "0.0.1.1"
10
9
  GeneratorNotFound ||= Class.new(StandardError)
11
10
  TargetAlreadyExist ||= Class.new(StandardError)
12
11
 
@@ -63,7 +63,7 @@ class SimpleTemplater
63
63
  self.parse_argv(args)
64
64
  self.run_hook("setup.rb")
65
65
  if self.full? && Dir.exist?(self.target) # has to run after setup.rb hook, because setup.rb can manipulate with target
66
- raise TargetAlreadyExist, "#{full.name} already exist, aborting."
66
+ raise TargetAlreadyExist, "#{self.target} already exist, aborting."
67
67
  end
68
68
  SimpleTemplater.logger.info("[#{self.name} generator] Running before hooks #{self.before_hooks.inspect}")
69
69
  self.run_hooks(:before)
@@ -0,0 +1,7 @@
1
+ # encoding: utf-8
2
+
3
+ # NOTE: Do not edit this file manually, this
4
+ # file is regenerated by task rake version:increase
5
+ module SimpleTemplater
6
+ VERSION ||= "0.0.1.3"
7
+ end
@@ -30,7 +30,7 @@ Gem::Specification.new do |s|
30
30
  s.require_paths = ["lib"]
31
31
 
32
32
  # Ruby version
33
- s.required_ruby_version = ::Gem::Requirement.new(">= 1.9.1")
33
+ s.required_ruby_version = ::Gem::Requirement.new("~> 1.9")
34
34
 
35
35
  # runtime dependencies
36
36
  s.add_dependency "cli"
@@ -23,7 +23,7 @@ Gem::Specification.new do |s|
23
23
  s.require_paths = ["lib"]
24
24
 
25
25
  # Ruby version
26
- s.required_ruby_version = ::Gem::Requirement.new(">= 1.9.1")
26
+ s.required_ruby_version = ::Gem::Requirement.new(">= 1.9")
27
27
 
28
28
  # runtime dependencies
29
29
  # s.add_dependency "rubyexts"
@@ -0,0 +1,11 @@
1
+ # encoding: utf-8
2
+
3
+ # http://github.com/somebee/rbench/tree/master
4
+ desc "Run all benchmarks"
5
+ task :bm do
6
+ abort "Benchmarks doesn't work at the moment"
7
+ require "rbench"
8
+ Dir["#{Dir.pwd}/benchmarks/bm/*.rb"].each do |benchmark|
9
+ load benchmark
10
+ end
11
+ end
data/tasks/gem.rake ADDED
@@ -0,0 +1,23 @@
1
+ # encoding: utf-8
2
+
3
+ desc "Build the gem"
4
+ task :build do
5
+ sh "gem build simple-templater.gemspec"
6
+ end
7
+
8
+ namespace :build do
9
+ desc "Build the prerelease gem"
10
+ task :prerelease do
11
+ gemspec = "simple-templater.gemspec"
12
+ content = File.read(gemspec)
13
+ prename = "#{gemspec.split(".").first}.pre.gemspec"
14
+ # 0.1.1 => 0.2
15
+ version = SimpleTemplater::VERSION.sub(/^(\d+)\.(\d+\.){2}.*$/) { "#$1.#{$2.to_i + 1}" }
16
+ puts "Current #{SimpleTemplater::VERSION} => #{version} pre"
17
+ File.open(prename, "w") do |file|
18
+ file.puts(content.gsub(/(\w+::VERSION)/, "'#{version}.pre'"))
19
+ end
20
+ sh "gem build #{prename}"
21
+ rm prename
22
+ end
23
+ end
data/tasks/hooks.rake ADDED
@@ -0,0 +1,12 @@
1
+ # encoding: utf-8
2
+
3
+ desc "Install Git hooks"
4
+ task :hooks do
5
+ if Dir.exist?(".git/hooks")
6
+ abort "You must remove .git/hooks first"
7
+ else
8
+ # do not symlink them, otherwise git will add samples
9
+ # FIXME: permissions
10
+ cp_r "support/hooks", ".git/hooks"
11
+ end
12
+ end
@@ -0,0 +1,68 @@
1
+ # encoding: utf-8
2
+
3
+ desc "Release new version of simple-templater"
4
+ task release: ["deps.rip", "version:increase", "release:tag", "release:gemcutter"]
5
+
6
+ namespace :version do
7
+ task :increase do
8
+ puts "Which version are you just releasing (previous version is #{SimpleTemplater::VERSION})"
9
+ version = STDIN.gets.chomp
10
+ File.open("lib/simple-templater/version.rb", "w") do |file|
11
+ file.puts <<-EOF
12
+ # encoding: utf-8
13
+
14
+ # NOTE: Do not edit this file manually, this
15
+ # file is regenerated by task rake version:increase
16
+ module SimpleTemplater
17
+ VERSION ||= "#{version}"
18
+ end
19
+ EOF
20
+ end
21
+
22
+ SimpleTemplater.const_set("VERSION", version) # so other release tasks will work
23
+ # sh "git commit lib/simple-templater/version.rb -m 'Increased version to #{version}'"
24
+ end
25
+ end
26
+
27
+ namespace :release do
28
+ desc "Create Git tag"
29
+ task :tag do
30
+ puts "Creating new git tag #{SimpleTemplater::VERSION} and pushing it online ..."
31
+ sh "git tag -a -m 'Version #{SimpleTemplater::VERSION}' #{SimpleTemplater::VERSION}"
32
+ sh "git push --tags"
33
+ puts "Tag #{SimpleTemplater::VERSION} was created and pushed to GitHub."
34
+ end
35
+
36
+ desc "Push gem to Gemcutter"
37
+ task :gemcutter => :build do
38
+ puts "Pushing to Gemcutter ..."
39
+ sh "gem push #{Dir["*.gem"].last}"
40
+ end
41
+ end
42
+
43
+ desc "Create and push prerelease gem"
44
+ task :prerelease => "build:prerelease" do
45
+ puts "Pushing to Gemcutter ..."
46
+ sh "gem push #{Dir["*.pre.gem"].last}"
47
+ end
48
+
49
+ dependencies = FileList["vendor/*/.git"].sub(/\/\.git$/, "")
50
+
51
+ desc "Regenerate deps.rip"
52
+ file "deps.rip" => dependencies do
53
+ commits = Hash.new
54
+ commits = dependencies.inject(Hash.new) do |hash, path|
55
+ Dir.chdir(path) do
56
+ revision = %x(git show | head -1).chomp.sub("commit ", "")
57
+ hash[File.basename(path)] = revision
58
+ hash
59
+ end
60
+ end
61
+ template = File.read("deps.rip.rbe")
62
+ deps_rip = eval("%Q{#{template}}")
63
+ File.open("deps.rip", "w") do |file|
64
+ file.puts(deps_rip)
65
+ end
66
+ sh "chmod +x deps.rip"
67
+ sh "git commit deps.rip -m 'Updated deps.rip'"
68
+ end
data/tasks/spec.rake ADDED
@@ -0,0 +1,27 @@
1
+ # encoding: utf-8
2
+
3
+ desc "Run specs"
4
+ task :spec, :path do |task, args|
5
+ exec "./script/spec --options spec/spec.opts #{args.path || "spec"}"
6
+ end
7
+
8
+ desc "Create stubs of all library files."
9
+ task "spec:stubs" do
10
+ Dir.glob("lib/**/*.rb").each do |file|
11
+ specfile = file.sub(/^lib/, "spec").sub(/\.rb$/, '_spec.rb')
12
+ unless File.exist?(specfile)
13
+ %x[mkdir -p #{File.dirname(specfile)}]
14
+ %x[touch #{specfile}]
15
+ puts "Created #{specfile}"
16
+ end
17
+ end
18
+ (Dir.glob("spec/simple-templater/**/*.rb") + ["spec/simple-templater_spec.rb"]).each do |file|
19
+ libfile = file.sub(/spec/, "lib").sub(/_spec\.rb$/, '.rb')
20
+ if !File.exist?(libfile) && File.zero?(file)
21
+ %x[rm #{file}]
22
+ puts "Removed empty file #{file}"
23
+ elsif !File.exist?(libfile)
24
+ puts "File exists just in spec, not in lib: #{file}"
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,33 @@
1
+ # encoding: utf-8
2
+
3
+ # === Helpers === #
4
+ def submodules(&block)
5
+ File.foreach(File.join(File.dirname(__FILE__), "..", ".gitmodules")) do |line|
6
+ if line.match(%r{submodule "(.+)"})
7
+ block.call($1)
8
+ end
9
+ end
10
+ end
11
+
12
+ # === Tasks === #
13
+ namespace :submodules do
14
+ desc "Init submodules"
15
+ task :init do
16
+ sh "git submodule init"
17
+ end
18
+
19
+ desc "Update submodules"
20
+ task :update do
21
+ submodules do |path|
22
+ if File.directory?(path) && File.directory?(File.join(path, ".git"))
23
+ Dir.chdir(path) do
24
+ puts "=> #{path}"
25
+ sh "git reset --hard"
26
+ sh "git fetch"
27
+ sh "git reset origin/master --hard"
28
+ puts
29
+ end
30
+ end
31
+ end
32
+ end
33
+ end
data/tasks/yardoc.rake ADDED
@@ -0,0 +1,9 @@
1
+ # encoding: utf-8
2
+
3
+ # template, textile or rdoc or md
4
+ # -t: template [available: default, javadoc]
5
+ # -m: markup style used in documentation [available: textile, markdown, rdoc]
6
+ desc "Generate Yardoc documentation for simple-templater"
7
+ task :yardoc do
8
+ sh "yardoc -r README.textile lib/**/*.rb -t default"
9
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simple-templater
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1.1
4
+ version: 0.0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - "Jakub \xC5\xA0\xC5\xA5astn\xC3\xBD aka Botanicus"
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain:
11
- date: 2009-12-03 00:00:00 +00:00
11
+ date: 2009-12-11 00:00:00 +00:00
12
12
  default_executable: simple-templater
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
@@ -53,6 +53,7 @@ files:
53
53
  - bin/simple-templater
54
54
  - CHANGELOG
55
55
  - deps.rip
56
+ - deps.rip.rbe
56
57
  - lib/simple-templater/argv_parsing.rb
57
58
  - lib/simple-templater/builder.rb
58
59
  - lib/simple-templater/discoverer.rb
@@ -68,6 +69,7 @@ files:
68
69
  - lib/simple-templater/hooks/postprocess/github.rb
69
70
  - lib/simple-templater/hooks/preprocess/full_name.rb
70
71
  - lib/simple-templater/hooks/preprocess/github.rb
72
+ - lib/simple-templater/version.rb
71
73
  - lib/simple-templater.rb
72
74
  - LICENSE
73
75
  - Rakefile
@@ -131,6 +133,13 @@ files:
131
133
  - stubs/stub/metadata.yml
132
134
  - stubs/stub/postprocess.rb
133
135
  - stubs/stub/setup.rb
136
+ - tasks/benchmark.rake
137
+ - tasks/gem.rake
138
+ - tasks/hooks.rake
139
+ - tasks/release.rake
140
+ - tasks/spec.rake
141
+ - tasks/submodules.rake
142
+ - tasks/yardoc.rake
134
143
  - TODO.txt
135
144
  - vendor/abstract/abstract.gemspec
136
145
  - vendor/abstract/ChangeLog
@@ -934,9 +943,9 @@ require_paths:
934
943
  - lib
935
944
  required_ruby_version: !ruby/object:Gem::Requirement
936
945
  requirements:
937
- - - ">="
946
+ - - ~>
938
947
  - !ruby/object:Gem::Version
939
- version: 1.9.1
948
+ version: "1.9"
940
949
  version:
941
950
  required_rubygems_version: !ruby/object:Gem::Requirement
942
951
  requirements: