ruby_on_etags 0.0.2 → 0.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/Gemfile.lock CHANGED
@@ -1,43 +1,47 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ruby_on_etags (0.0.1)
4
+ ruby_on_etags (0.1.0)
5
5
  bundler (~> 1.0.0)
6
6
  rake (~> 0.8.7)
7
+ thor (~> 0.14.6)
7
8
  watchr (~> 0.7)
8
9
 
9
10
  GEM
10
11
  remote: http://rubygems.org/
11
12
  specs:
12
13
  archive-tar-minitar (0.5.2)
13
- aruba (0.2.6)
14
- background_process
15
- cucumber (~> 0.9.4)
16
- background_process (1.2)
17
- builder (2.1.2)
14
+ aruba (0.3.2)
15
+ childprocess (~> 0.1.6)
16
+ cucumber (~> 0.10.0)
17
+ rspec (~> 2.3.0)
18
+ builder (3.0.0)
19
+ childprocess (0.1.6)
20
+ ffi (~> 0.6.3)
18
21
  columnize (0.3.2)
19
- cucumber (0.9.4)
20
- builder (~> 2.1.2)
22
+ cucumber (0.10.0)
23
+ builder (>= 2.1.2)
21
24
  diff-lcs (~> 1.1.2)
22
- gherkin (~> 2.2.9)
25
+ gherkin (~> 2.3.2)
23
26
  json (~> 1.4.6)
24
27
  term-ansicolor (~> 1.0.5)
25
28
  diff-lcs (1.1.2)
26
- gherkin (2.2.9)
29
+ ffi (0.6.3)
30
+ rake (>= 0.8.7)
31
+ gherkin (2.3.3)
27
32
  json (~> 1.4.6)
28
- term-ansicolor (~> 1.0.5)
29
33
  json (1.4.6)
30
34
  linecache19 (0.5.11)
31
35
  ruby_core_source (>= 0.1.4)
32
36
  rake (0.8.7)
33
- rspec (2.1.0)
34
- rspec-core (~> 2.1.0)
35
- rspec-expectations (~> 2.1.0)
36
- rspec-mocks (~> 2.1.0)
37
- rspec-core (2.1.0)
38
- rspec-expectations (2.1.0)
37
+ rspec (2.3.0)
38
+ rspec-core (~> 2.3.0)
39
+ rspec-expectations (~> 2.3.0)
40
+ rspec-mocks (~> 2.3.0)
41
+ rspec-core (2.3.1)
42
+ rspec-expectations (2.3.0)
39
43
  diff-lcs (~> 1.1.2)
40
- rspec-mocks (2.1.0)
44
+ rspec-mocks (2.3.0)
41
45
  ruby-debug-base19 (0.11.24)
42
46
  columnize (>= 0.3.1)
43
47
  linecache19 (>= 0.5.11)
@@ -49,17 +53,19 @@ GEM
49
53
  ruby_core_source (0.1.4)
50
54
  archive-tar-minitar (>= 0.5.2)
51
55
  term-ansicolor (1.0.5)
56
+ thor (0.14.6)
52
57
  watchr (0.7)
53
58
 
54
59
  PLATFORMS
55
60
  ruby
56
61
 
57
62
  DEPENDENCIES
58
- aruba (~> 0.2.6)
63
+ aruba (~> 0.3.2)
59
64
  bundler (~> 1.0.0)
60
- cucumber (~> 0.9.0)
65
+ cucumber (~> 0.10.0)
61
66
  rake (~> 0.8.7)
62
- rspec (~> 2.1.0)
67
+ rspec (~> 2.3.0)
63
68
  ruby-debug19 (~> 0.11.6)
64
69
  ruby_on_etags!
70
+ thor (~> 0.14.6)
65
71
  watchr (~> 0.7)
data/README.rdoc CHANGED
@@ -7,17 +7,12 @@ date.
7
7
 
8
8
  gem install ruby_on_etags
9
9
 
10
- Add the following to Rakefile:
11
-
12
- require 'ruby_on_etags'
13
- RubyOnEtags.install_tasks
14
-
15
10
  == Usage
16
11
 
17
12
  To build TAGS file which includes definitions of your project modules, all
18
13
  dependecies gems and ruby version you use, run the following:
19
14
 
20
- rake ruby_on_etags:build
15
+ roetags build
21
16
 
22
17
  This task maintain cache to avoid building tags for static files like gems or
23
18
  ruby sources.
@@ -25,7 +20,7 @@ ruby sources.
25
20
  Also, you can use the following task to build TAGS everytime you change
26
21
  something in the project:
27
22
 
28
- rake ruby_on_etags:watch
23
+ roetags watch
29
24
 
30
25
  == Maintainers
31
26
 
data/Rakefile CHANGED
@@ -4,13 +4,11 @@ Bundler::GemHelper.install_tasks
4
4
  require 'cucumber'
5
5
  require 'cucumber/rake/task'
6
6
 
7
- Cucumber::Rake::Task.new(:cucumber) do |t|
8
- t.cucumber_opts = "features"
9
- end
7
+ Cucumber::Rake::Task.new(:cucumber)
10
8
 
11
9
  require 'rspec'
12
10
  require 'rspec/core/rake_task'
13
11
 
14
12
  RSpec::Core::RakeTask.new do |t|
15
- t.skip_bundler = true
13
+ t.skip_bundler = false
16
14
  end
data/bin/roetags ADDED
@@ -0,0 +1,4 @@
1
+ #! /usr/bin/env ruby
2
+
3
+ require 'ruby_on_etags/cli'
4
+ RubyOnEtags::CLI.start
@@ -1,4 +1,4 @@
1
- Feature: Integration with any ruby project
1
+ Feature: Integration using rake
2
2
  As a developer I want to able to easy install Ruby On ETags
3
3
  To have ability build TAGS with all ruby modules involved in a project
4
4
 
@@ -0,0 +1,23 @@
1
+ Feature: Using stand-alone binary to build TAGS
2
+ As a developer I want to able to easy install Ruby On ETags
3
+ To have ability build TAGS with all ruby modules involved in a project
4
+
5
+ Scenario: Building TAGS with standalone binary
6
+ Given I'm using a clean gemset "roetags"
7
+ And a standard ruby project directory structure
8
+ And I run "sh -c 'cd ../..; gem build ./ruby_on_etags.gemspec; gem install ruby_on_etags-*.gem; rm ruby_on_etags-*.gem'"
9
+ When I run "roetags build"
10
+ Then a file named "TAGS" should exist
11
+ # project sources
12
+ And the file "TAGS" should contain "StandardRubyProject"
13
+ # ruby standard library
14
+ And the file "TAGS" should contain "Array"
15
+ # used gem
16
+ And the file "TAGS" should contain "RubyOnEtags"
17
+
18
+ # Scenario: Running 'roetags watch'
19
+ # Given a standard ruby project directory structure
20
+ # When I run "roetags watch" interactively
21
+ # Then the output should contain "Watching..."
22
+ # When I type "^C"
23
+ # Then the output should contain "Quiting..."
@@ -12,6 +12,7 @@ Given /^a standard ruby project directory structure$/ do
12
12
  end
13
13
  """
14
14
  }
15
+
15
16
  install_gems <<-G
16
17
  gem 'ruby_on_etags', :path => '../..'
17
18
  G
@@ -1,4 +1,6 @@
1
- require 'aruba'
1
+ require 'aruba/cucumber'
2
+
3
+ Dir["#{File.dirname(__FILE__)}/../../spec/support/*.rb"].each {|f| require f; puts f}
2
4
 
3
5
  ENV['RUBY_ON_ETAGS_CACHE'] = File.join("tmp", "ruby_on_etags_cache")
4
6
 
@@ -6,5 +8,5 @@ Before do
6
8
  FileUtils.rm_rf(ENV['RUBY_ON_ETAGS_CACHE'])
7
9
  FileUtils.mkdir_p(ENV['RUBY_ON_ETAGS_CACHE'])
8
10
  unset_bundler_env_vars
9
- @aruba_timeout_seconds = 3
11
+ @aruba_timeout_seconds = 300
10
12
  end
data/lib/ruby_on_etags.rb CHANGED
@@ -1,5 +1,4 @@
1
- require 'tempfile'
2
- require 'bundler'
1
+ require 'ruby_on_etags/core'
3
2
 
4
3
  module RubyOnEtags
5
4
 
@@ -8,99 +7,4 @@ module RubyOnEtags
8
7
  end
9
8
  module_function :install_tasks
10
9
 
11
- class Core
12
-
13
- def self.install_tasks
14
-
15
- namespace :ruby_on_etags do
16
-
17
- desc "Build TAGS for whole project. GEMS='some_gem-1.0.0, another_gem-0.2.1'."
18
- task :build do
19
- self.new.build_tags
20
- end
21
-
22
- desc "Watch for changes in project directory and build TAGS when needed."
23
- task :watch do
24
- system "watchr -e 'watch(\"\.rb\") { system \"rake ruby_on_etags:build &>/dev/null\" }'"
25
- end
26
-
27
- end
28
-
29
- end
30
-
31
- def build_tags
32
- remove_tags
33
- tags_files = []
34
- tags_files << build_tags_for_standard_library
35
- tags_files += build_tags_for_gems
36
- tags_files << build_tags_current_dir
37
- concatenate_tags_files(tags_files)
38
- end
39
-
40
- def build_tags_for_gems
41
- loaded_gems.map do |gem_spec|
42
- tags_filename = File.join(cache_dir,
43
- 'gems',
44
- "#{gem_spec.name}-#{gem_spec.version.version}",
45
- 'TAGS')
46
- etags(gem_spec.load_paths.join(' '), tags_filename)
47
- tags_filename
48
- end
49
- end
50
-
51
- def build_tags_for_standard_library
52
- File.join(cache_dir, 'rubies', RUBY_VERSION, 'TAGS').tap do |tags_filename|
53
- dirs = $:.delete_if { |path| path =~ %r|/gems/| }
54
- etags(dirs.join(' '), tags_filename)
55
- end
56
- end
57
-
58
- def build_tags_current_dir
59
- tags_file = Tempfile.new('ruby_on_etags-project-TAGS')
60
- tags_file.close
61
- etags(".", tags_file.path)
62
- tags_file.path
63
- end
64
-
65
- def concatenate_tags_files(tags_files)
66
- File.open("TAGS", 'w') do |tags|
67
- tags_files.each do |tags_filename|
68
- tags << IO.read(tags_filename)
69
- end
70
- end
71
- end
72
-
73
- def remove_tags
74
- FileUtils.rm_f("TAGS")
75
- end
76
-
77
- def loaded_gems
78
- File.exists?("Gemfile") ? Bundler.load.specs : []
79
- end
80
-
81
-
82
- private
83
-
84
- def run(cmd)
85
- system_with_rvm(cmd)
86
- end
87
-
88
- def system_with_rvm(cmd)
89
- system "$SHELL -c 'cd .; #{cmd}'"
90
- end
91
-
92
- def etags(dirs, output)
93
- if !File.exists?(output) || File.zero?(output)
94
- FileUtils.mkdir_p(File.dirname(output))
95
- run "etags -R -o #{output} #{dirs}"
96
- end
97
- end
98
-
99
- def cache_dir
100
- ENV['RUBY_ON_ETAGS_CACHE'] ||
101
- File.join(ENV['HOME'], '.ruby_on_tags', 'cache')
102
- end
103
-
104
- end
105
-
106
10
  end
@@ -0,0 +1,20 @@
1
+ require 'thor'
2
+ require 'ruby_on_etags/core'
3
+
4
+ module RubyOnEtags
5
+
6
+ class CLI < Thor
7
+
8
+ desc "build", "Build TAGS for whole project."
9
+ def build
10
+ RubyOnEtags::Core.new.build_tags
11
+ end
12
+
13
+ desc "watch", "Watch for changes in project directory and build TAGS when needed."
14
+ def watch
15
+ system "watchr -e 'watch(\"\.rb\") { system \"roetags build &>/dev/null\" }; puts \"Watching...\"'"
16
+ end
17
+
18
+ end
19
+
20
+ end
@@ -0,0 +1,126 @@
1
+ require 'tempfile'
2
+ require 'bundler'
3
+
4
+ require 'bundler/definition'
5
+ require 'bundler/dependency'
6
+ require 'bundler/dsl'
7
+ require 'bundler/environment'
8
+ require 'bundler/gem_helper'
9
+ require 'bundler/graph'
10
+ require 'bundler/index'
11
+ require 'bundler/installer'
12
+ require 'bundler/lazy_specification'
13
+ require 'bundler/lockfile_parser'
14
+ require 'bundler/remote_specification'
15
+ require 'bundler/resolver'
16
+ require 'bundler/runtime'
17
+ require 'bundler/settings'
18
+ require 'bundler/shared_helpers'
19
+ require 'bundler/spec_set'
20
+ require 'bundler/source'
21
+ require 'bundler/shared_helpers'
22
+ require 'bundler/ui'
23
+
24
+ module RubyOnEtags
25
+ class Core
26
+
27
+ def self.install_tasks
28
+
29
+ namespace :ruby_on_etags do
30
+
31
+ desc "Build TAGS for whole project. GEMS='some_gem-1.0.0, another_gem-0.2.1'."
32
+ task :build do
33
+ self.new.build_tags
34
+ end
35
+
36
+ desc "Watch for changes in project directory and build TAGS when needed."
37
+ task :watch do
38
+ system "watchr -e 'watch(\"\.rb\") { system \"rake ruby_on_etags:build &>/dev/null\" }'"
39
+ end
40
+
41
+ end
42
+
43
+ end
44
+
45
+ def build_tags
46
+ remove_tags
47
+ tags_files = []
48
+ tags_files << build_tags_for_standard_library
49
+ tags_files += build_tags_for_gems
50
+ tags_files << build_tags_current_dir
51
+ concatenate_tags_files(tags_files)
52
+ end
53
+
54
+ def build_tags_for_gems
55
+ loaded_gems.map do |gem_spec|
56
+ tags_filename = File.join(cache_dir,
57
+ 'gems',
58
+ "#{gem_spec.name}-#{gem_spec.version.version}",
59
+ 'TAGS')
60
+ etags(gem_spec.load_paths.join(' '), tags_filename)
61
+ tags_filename
62
+ end
63
+ end
64
+
65
+ def build_tags_for_standard_library
66
+ File.join(cache_dir, 'rubies', RUBY_VERSION, 'TAGS').tap do |tags_filename|
67
+ dirs = $:.delete_if { |path| path =~ %r|/gems/| }
68
+ etags(dirs.join(' '), tags_filename)
69
+ end
70
+ end
71
+
72
+ def build_tags_current_dir
73
+ tags_file = Tempfile.new('ruby_on_etags-project-TAGS')
74
+ tags_file.close
75
+ etags(".", tags_file.path)
76
+ tags_file.path
77
+ end
78
+
79
+ def concatenate_tags_files(tags_files)
80
+ File.open("TAGS", 'w') do |tags|
81
+ tags_files.each do |tags_filename|
82
+ tags << IO.read(tags_filename)
83
+ end
84
+ end
85
+ end
86
+
87
+ def remove_tags
88
+ FileUtils.rm_f("TAGS")
89
+ end
90
+
91
+ def loaded_gems
92
+ if File.exists?("Gemfile")
93
+ # Bundler.load.specs
94
+ Bundler::Definition.build(Bundler.default_gemfile,
95
+ Bundler.default_lockfile,
96
+ nil).specs
97
+ else
98
+ []
99
+ end
100
+ end
101
+
102
+
103
+ private
104
+
105
+ def run(cmd)
106
+ system_with_rvm(cmd)
107
+ end
108
+
109
+ def system_with_rvm(cmd)
110
+ system "$SHELL -c 'cd .; #{cmd}'"
111
+ end
112
+
113
+ def etags(dirs, output)
114
+ if !File.exists?(output) || File.zero?(output)
115
+ FileUtils.mkdir_p(File.dirname(output))
116
+ run "etags -R -o #{output} #{dirs}"
117
+ end
118
+ end
119
+
120
+ def cache_dir
121
+ ENV['RUBY_ON_ETAGS_CACHE'] ||
122
+ File.join(ENV['HOME'], '.ruby_on_tags', 'cache')
123
+ end
124
+
125
+ end
126
+ end
@@ -1,3 +1,3 @@
1
1
  module RubyOnEtags
2
- VERSION = "0.0.2"
2
+ VERSION = "0.1.0"
3
3
  end
@@ -20,12 +20,13 @@ date."
20
20
  s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
21
21
  s.require_paths = ["lib"]
22
22
 
23
- s.add_development_dependency("cucumber", "~>0.9.0")
24
- s.add_development_dependency("rspec", "~>2.1.0")
25
- s.add_development_dependency("aruba", "~>0.2.6")
23
+ s.add_development_dependency("cucumber", "~>0.10.0")
24
+ s.add_development_dependency("rspec", "~>2.3.0")
25
+ s.add_development_dependency("aruba", "~>0.3.2")
26
26
  s.add_development_dependency("ruby-debug19", "~>0.11.6")
27
27
 
28
28
  s.add_dependency("bundler", "~>1.0.0")
29
29
  s.add_dependency("watchr", "~>0.7")
30
30
  s.add_dependency("rake", "~>0.8.7")
31
+ s.add_dependency("thor", "~>0.14.6")
31
32
  end
@@ -7,12 +7,12 @@ describe RubyOnEtags do
7
7
  it "should be able to detect paths of used gems with Bundler" do
8
8
  unset_bundler_env_vars
9
9
  install_gems <<-G
10
- gem 'mechanize'
11
- gem 'org-ruby'
10
+ gem 'watchr'
11
+ gem 'thor'
12
12
  G
13
13
 
14
14
  in_current_dir do
15
- should have(5).loaded_gems
15
+ should have(3).loaded_gems
16
16
  end
17
17
  end
18
18
 
data/spec/spec_helper.rb CHANGED
@@ -1,6 +1,10 @@
1
1
  require 'ruby_on_etags'
2
2
  require 'aruba/api'
3
3
 
4
+ # Requires supporting ruby files with custom matchers and macros, etc,
5
+ # in spec/support/ and its subdirectories.
6
+ Dir["#{File.dirname(__FILE__)}/support/*.rb"].each {|f| require f; puts f}
7
+
4
8
  RSpec.configure do |config|
5
9
  config.include Aruba::Api
6
10
  end
@@ -0,0 +1,13 @@
1
+ module Aruba
2
+ module Api
3
+
4
+ def install_gems(gemfile)
5
+ write_file("Gemfile", gemfile)
6
+ if ENV['GOTGEMS'].nil?
7
+ run("gem install bundler")
8
+ run("bundle --no-color install")
9
+ end
10
+ end
11
+
12
+ end
13
+ end
data/tests.watchr CHANGED
@@ -17,12 +17,12 @@ def run(cmd)
17
17
  end
18
18
 
19
19
  def run_all_tests
20
- run "rake SPEC_OPTS=\"--format progress\" spec && rake cucumber CUCUMBER_FORMAT='progress'"
20
+ run "rake SPEC_OPTS=\"--format progress\" spec && rake cucumber features/ CUCUMBER_FORMAT='progress'"
21
21
  end
22
22
 
23
23
  def run_single_spec *spec
24
24
  spec = spec.join(' ')
25
- run "rspec --format documentation #{spec}"
25
+ run "bundle exec rspec --format documentation #{spec}"
26
26
  end
27
27
 
28
28
  def run_specs_with_shared_examples(shared_example_filename, spec_path = 'spec')
metadata CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
4
4
  prerelease: false
5
5
  segments:
6
6
  - 0
7
+ - 1
7
8
  - 0
8
- - 2
9
- version: 0.0.2
9
+ version: 0.1.0
10
10
  platform: ruby
11
11
  authors:
12
12
  - Aleksei Gusev
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-11-28 00:00:00 +02:00
17
+ date: 2011-01-08 00:00:00 +02:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -27,9 +27,9 @@ dependencies:
27
27
  - !ruby/object:Gem::Version
28
28
  segments:
29
29
  - 0
30
- - 9
30
+ - 10
31
31
  - 0
32
- version: 0.9.0
32
+ version: 0.10.0
33
33
  type: :development
34
34
  version_requirements: *id001
35
35
  - !ruby/object:Gem::Dependency
@@ -42,9 +42,9 @@ dependencies:
42
42
  - !ruby/object:Gem::Version
43
43
  segments:
44
44
  - 2
45
- - 1
45
+ - 3
46
46
  - 0
47
- version: 2.1.0
47
+ version: 2.3.0
48
48
  type: :development
49
49
  version_requirements: *id002
50
50
  - !ruby/object:Gem::Dependency
@@ -57,9 +57,9 @@ dependencies:
57
57
  - !ruby/object:Gem::Version
58
58
  segments:
59
59
  - 0
60
+ - 3
60
61
  - 2
61
- - 6
62
- version: 0.2.6
62
+ version: 0.3.2
63
63
  type: :development
64
64
  version_requirements: *id003
65
65
  - !ruby/object:Gem::Dependency
@@ -121,13 +121,28 @@ dependencies:
121
121
  version: 0.8.7
122
122
  type: :runtime
123
123
  version_requirements: *id007
124
+ - !ruby/object:Gem::Dependency
125
+ name: thor
126
+ prerelease: false
127
+ requirement: &id008 !ruby/object:Gem::Requirement
128
+ none: false
129
+ requirements:
130
+ - - ~>
131
+ - !ruby/object:Gem::Version
132
+ segments:
133
+ - 0
134
+ - 14
135
+ - 6
136
+ version: 0.14.6
137
+ type: :runtime
138
+ version_requirements: *id008
124
139
  description: |-
125
140
  Ruby on ETags is a set of rake tasks to help a developer keep TAGS file up to
126
141
  date.
127
142
  email:
128
143
  - aleksei.gusev@gmail.com
129
- executables: []
130
-
144
+ executables:
145
+ - roetags
131
146
  extensions: []
132
147
 
133
148
  extra_rdoc_files: []
@@ -138,14 +153,19 @@ files:
138
153
  - Gemfile.lock
139
154
  - README.rdoc
140
155
  - Rakefile
141
- - features/ruby_project.feature
156
+ - bin/roetags
157
+ - features/rake.feature
158
+ - features/stand-alone.feature
142
159
  - features/step_definitions/custom_steps.rb
143
160
  - features/support/env.rb
144
161
  - lib/ruby_on_etags.rb
162
+ - lib/ruby_on_etags/cli.rb
163
+ - lib/ruby_on_etags/core.rb
145
164
  - lib/ruby_on_etags/version.rb
146
165
  - ruby_on_etags.gemspec
147
166
  - spec/lib/ruby_on_etags_spec.rb
148
167
  - spec/spec_helper.rb
168
+ - spec/support/aruba.rb
149
169
  - tests.watchr
150
170
  has_rdoc: true
151
171
  homepage: https://github.com/hron/ruby_on_etags