dotum 0.0.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.
Files changed (82) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +5 -0
  3. data/.groc.json +6 -0
  4. data/.rspec +4 -0
  5. data/.simplecov +5 -0
  6. data/.travis.yml +15 -0
  7. data/CONTRIBUTING.md +63 -0
  8. data/Gemfile +59 -0
  9. data/Guardfile +30 -0
  10. data/MIT-LICENSE.md +21 -0
  11. data/README.md +24 -0
  12. data/Rakefile +15 -0
  13. data/bin/dotum +7 -0
  14. data/data/default_rules.dotum +44 -0
  15. data/dotum.gemspec +19 -0
  16. data/extern/json/CHANGES.md +9 -0
  17. data/extern/json/COPYING +58 -0
  18. data/extern/json/README.rdoc +358 -0
  19. data/extern/json/lib/json.rb +62 -0
  20. data/extern/json/lib/json/.DS_Store +0 -0
  21. data/extern/json/lib/json/add/bigdecimal.rb +28 -0
  22. data/extern/json/lib/json/add/complex.rb +22 -0
  23. data/extern/json/lib/json/add/core.rb +11 -0
  24. data/extern/json/lib/json/add/date.rb +34 -0
  25. data/extern/json/lib/json/add/date_time.rb +50 -0
  26. data/extern/json/lib/json/add/exception.rb +31 -0
  27. data/extern/json/lib/json/add/ostruct.rb +31 -0
  28. data/extern/json/lib/json/add/range.rb +29 -0
  29. data/extern/json/lib/json/add/rational.rb +22 -0
  30. data/extern/json/lib/json/add/regexp.rb +30 -0
  31. data/extern/json/lib/json/add/struct.rb +30 -0
  32. data/extern/json/lib/json/add/symbol.rb +25 -0
  33. data/extern/json/lib/json/add/time.rb +38 -0
  34. data/extern/json/lib/json/common.rb +487 -0
  35. data/extern/json/lib/json/generic_object.rb +70 -0
  36. data/extern/json/lib/json/pure.rb +21 -0
  37. data/extern/json/lib/json/pure/generator.rb +522 -0
  38. data/extern/json/lib/json/pure/parser.rb +359 -0
  39. data/extern/json/lib/json/version.rb +8 -0
  40. data/lib/dotum.rb +11 -0
  41. data/lib/dotum/abstract_rules.rb +5 -0
  42. data/lib/dotum/abstract_rules/base.rb +56 -0
  43. data/lib/dotum/abstract_rules/globbable_files.rb +51 -0
  44. data/lib/dotum/abstract_rules/options_base.rb +33 -0
  45. data/lib/dotum/autoload_convention.rb +34 -0
  46. data/lib/dotum/cli.rb +35 -0
  47. data/lib/dotum/context.rb +55 -0
  48. data/lib/dotum/externs/json.rb +9 -0
  49. data/lib/dotum/logger.rb +50 -0
  50. data/lib/dotum/options_context.rb +21 -0
  51. data/lib/dotum/rule_dsl.rb +73 -0
  52. data/lib/dotum/rule_options_dsl.rb +116 -0
  53. data/lib/dotum/rule_runner.rb +16 -0
  54. data/lib/dotum/rules.rb +5 -0
  55. data/lib/dotum/rules/cd.rb +23 -0
  56. data/lib/dotum/rules/download.rb +32 -0
  57. data/lib/dotum/rules/link.rb +22 -0
  58. data/lib/dotum/rules/repo.rb +65 -0
  59. data/lib/dotum/rules/require_extension.rb +42 -0
  60. data/lib/dotum/rules/run.rb +23 -0
  61. data/lib/dotum/rules/use.rb +33 -0
  62. data/lib/dotum/rules/use_repo.rb +58 -0
  63. data/lib/dotum/standard_options.rb +5 -0
  64. data/lib/dotum/standard_options/destination.rb +22 -0
  65. data/lib/dotum/util.rb +5 -0
  66. data/lib/dotum/util/ansi_colors.rb +26 -0
  67. data/lib/dotum/util/path.rb +120 -0
  68. data/lib/dotum/version.rb +5 -0
  69. data/spec/fixtures/autoload_convention/abc_one_two_three.rb +7 -0
  70. data/spec/fixtures/autoload_convention/allcaps.rb +7 -0
  71. data/spec/fixtures/autoload_convention/mismatched.rb +3 -0
  72. data/spec/fixtures/autoload_convention/multi_token.rb +7 -0
  73. data/spec/fixtures/autoload_convention/single.rb +7 -0
  74. data/spec/fixtures/autoload_convention/string.rb +7 -0
  75. data/spec/spec_helper.rb +76 -0
  76. data/spec/unit/dotum/autoload_convention/const_missing_spec.rb +57 -0
  77. data/tasks/console.rake +9 -0
  78. data/tasks/spec.rake +7 -0
  79. data/tasks/spec/ci.rake +16 -0
  80. data/tasks/spec/coverage.rake +19 -0
  81. data/tasks/spec/mutate.rake +71 -0
  82. metadata +123 -0
@@ -0,0 +1,5 @@
1
+ # encoding: utf-8
2
+
3
+ module Dotum
4
+ VERSION = "0.0.0"
5
+ end
@@ -0,0 +1,7 @@
1
+ # encoding: utf-8
2
+
3
+ module Fixtures; end
4
+
5
+ module Fixtures::AutoloadConvention
6
+ ABCOneTwoThree = :you_can_count!
7
+ end
@@ -0,0 +1,7 @@
1
+ # encoding: utf-8
2
+
3
+ module Fixtures; end
4
+
5
+ module Fixtures::AutoloadConvention
6
+ ALLCAPS = :yelling
7
+ end
@@ -0,0 +1,3 @@
1
+ # encoding: utf-8
2
+
3
+ module WrongConstant; end
@@ -0,0 +1,7 @@
1
+ # encoding: utf-8
2
+
3
+ module Fixtures; end
4
+
5
+ module Fixtures::AutoloadConvention
6
+ MultiToken = :multi
7
+ end
@@ -0,0 +1,7 @@
1
+ # encoding: utf-8
2
+
3
+ module Fixtures; end
4
+
5
+ module Fixtures::AutoloadConvention
6
+ Single = :single_and_stuff
7
+ end
@@ -0,0 +1,7 @@
1
+ # encoding: utf-8
2
+
3
+ module Fixtures; end
4
+
5
+ module Fixtures::AutoloadConvention
6
+ String = "I am a string!"
7
+ end
@@ -0,0 +1,76 @@
1
+ # encoding: utf-8
2
+
3
+ begin
4
+ require "spork"
5
+ require "spork/ext/ruby-debug"
6
+ rescue LoadError
7
+ # No spork? No problem!
8
+ module Spork
9
+ def self.prefork
10
+ yield
11
+ end
12
+
13
+ def self.each_run
14
+ yield
15
+ end
16
+ end
17
+ end
18
+
19
+ Spork.prefork do
20
+ # Allow requires relative to the spec dir
21
+ SPEC_ROOT = File.expand_path("..", __FILE__)
22
+ FIXTURE_ROOT = File.join(SPEC_ROOT, "fixtures")
23
+ $LOAD_PATH << SPEC_ROOT
24
+
25
+ require "rspec"
26
+ require "timeout"
27
+
28
+ # Load our spec environment (random to avoid dependency ordering)
29
+ Dir[File.join(SPEC_ROOT, "common", "*.rb")].shuffle.each do |helper|
30
+ require "common/#{File.basename(helper, ".rb")}"
31
+ end
32
+
33
+ RSpec.configure do |config|
34
+ config.treat_symbols_as_metadata_keys_with_true_values = true
35
+
36
+ # We enforce expect(...) style syntax to avoid mucking around in Core
37
+ config.expect_with :rspec do |c|
38
+ c.syntax = :expect
39
+ end
40
+
41
+ # Time out specs (particularly useful for mutant)
42
+ config.around(:each) do |spec|
43
+ timeout(0.5) { spec.run }
44
+ end
45
+
46
+ # Be verbose about warnings
47
+ config.around(:each) do |spec|
48
+ old_verbose = $VERBOSE
49
+ # Or not at all if we are mutation testing
50
+ $VERBOSE = ENV["MUTATION"] ? nil : 2
51
+
52
+ spec.run
53
+
54
+ $VERBOSE = old_verbose
55
+ end
56
+ end
57
+ end
58
+
59
+ Spork.each_run do
60
+ # The rspec test runner executes the specs in a separate process; plus it's nice to have this
61
+ # generic flag for cases where you want coverage running with guard.
62
+ if ENV["COVERAGE"]
63
+ require "simplecov"
64
+
65
+ if ENV["CONTINUOUS_INTEGRATION"]
66
+ require "coveralls"
67
+ Coveralls.wear!
68
+ end
69
+ end
70
+
71
+ # Because we're an autoloading lib, just require the root up front.
72
+ #
73
+ # Must be loaded _after_ `simplecov`, otherwise it won't pick up on requires.
74
+ require "dotum"
75
+ end
76
+
@@ -0,0 +1,57 @@
1
+ # encoding: utf-8
2
+
3
+ describe Dotum::AutoloadConvention, "#const_missing" do
4
+
5
+ let(:namespace) {
6
+ mod = Module.new do
7
+ class << self
8
+ def name
9
+ "Fixtures::AutoloadConvention"
10
+ end
11
+ alias_method :inspect, :name
12
+ end
13
+ end
14
+ mod.extend subject
15
+
16
+ mod
17
+ }
18
+
19
+ it "should raise a LoadError when referencing an unknown constant" do
20
+ expect { namespace::Foo }.to raise_error(LoadError)
21
+ end
22
+
23
+ it "should raise a NameError when the file exists, but the wrong constant is defined" do
24
+ expect { namespace::Mismatched }.to raise_error(NameError)
25
+ end
26
+
27
+ it "should load single-token files" do
28
+ namespace.should_receive(:require).with("fixtures/autoload_convention/single").and_call_original
29
+
30
+ expect(namespace::Single).to eq(:single_and_stuff)
31
+ end
32
+
33
+ it "should load multi-token files" do
34
+ namespace.should_receive(:require).with("fixtures/autoload_convention/multi_token").and_call_original
35
+
36
+ expect(namespace::MultiToken).to eq(:multi)
37
+ end
38
+
39
+ it "shouldn't split ACRONYMS" do
40
+ namespace.should_receive(:require).with("fixtures/autoload_convention/allcaps").and_call_original
41
+
42
+ expect(namespace::ALLCAPS).to eq(:yelling)
43
+ end
44
+
45
+ it "should split ACRONYMSEndingWithRegularNames" do
46
+ namespace.should_receive(:require).with("fixtures/autoload_convention/abc_one_two_three").and_call_original
47
+
48
+ expect(namespace::ABCOneTwoThree).to eq(:you_can_count!)
49
+ end
50
+
51
+ it "shouldn't pick up constants in parent namespaces" do
52
+ namespace.should_receive(:require).with("fixtures/autoload_convention/string").and_call_original
53
+
54
+ expect(namespace::String).to eq("I am a string!")
55
+ end
56
+
57
+ end
@@ -0,0 +1,9 @@
1
+ # encoding: utf-8
2
+
3
+ desc "Boot up a console w/ Dotum preloaded"
4
+ task :console do
5
+ require "dotum"
6
+ require "pry"
7
+
8
+ Pry.start
9
+ end
@@ -0,0 +1,7 @@
1
+ # encoding: utf-8
2
+
3
+ require "rspec/core/rake_task"
4
+
5
+ RSpec::Core::RakeTask.new(:spec) do |task|
6
+ # No special configuration yet.
7
+ end
@@ -0,0 +1,16 @@
1
+ # encoding: utf-8
2
+
3
+ namespace :spec do
4
+
5
+ desc "Run the tests in CI mode"
6
+ task :ci do
7
+ prev = ENV["CONTINUOUS_INTEGRATION"]
8
+ ENV["CONTINUOUS_INTEGRATION"] = "yes"
9
+
10
+ Rake::Task["spec:coverage"].execute
11
+ Rake::Task["spec:mutate"].execute
12
+
13
+ ENV["CONTINUOUS_INTEGRATION"] = prev
14
+ end
15
+
16
+ end
@@ -0,0 +1,19 @@
1
+ # encoding: utf-8
2
+
3
+ namespace :spec do
4
+
5
+ desc "Run tests with code coverage"
6
+ task :coverage do
7
+ prev = ENV["COVERAGE"]
8
+ ENV["COVERAGE"] = "yes"
9
+
10
+ Rake::Task["spec"].execute
11
+
12
+ if RUBY_PLATFORM.include? "darwin"
13
+ `open #{File.join(PROJECT_ROOT, "coverage", "index.html")}`
14
+ end
15
+
16
+ ENV["COVERAGE"] = prev
17
+ end
18
+
19
+ end
@@ -0,0 +1,71 @@
1
+ # encoding: utf-8
2
+
3
+ namespace :spec do
4
+
5
+ SPEC_TARGET_MATCHER = /^describe\s+(Dotum::[:\w]+)(?:,\s*"([^"]+)")?/
6
+
7
+ desc "Runs tests with code mutation"
8
+ task :mutate, [:focus_on] do |t, args|
9
+ # Skip known bad implementations for now.
10
+ unless mutant_supported?
11
+ $stdout.puts "Mutant isn't supported (or tested) on this Ruby implementation."
12
+ next
13
+ end
14
+
15
+ if args.focus_on
16
+ matchers = matcher_for_focus(args.focus_on)
17
+ else
18
+ matchers = all_matchers
19
+ end
20
+
21
+ ENV["MUTATION"] = "yes"
22
+ status = Mutant::CLI.run(["--rspec"] + matchers)
23
+ ENV["MUTATION"] = nil
24
+
25
+ raise "Mutation failed." if status > 0
26
+ end
27
+
28
+ def matcher_for_focus(focus)
29
+ # Method on Dotum?
30
+ if focus.start_with?(".") || focus.start_with?("#")
31
+ return ["::Dotum#{focus}"]
32
+ # Or regular constant?
33
+ else
34
+ return ["::Dotum::#{focus}"]
35
+ end
36
+ end
37
+
38
+ def all_matchers
39
+ # We can't just take a path and re-capitalize it. It might be an acronym,
40
+ # like ANSIColors.
41
+ Dir["spec/unit/**/*_spec.rb"].map { |spec_path|
42
+ File.open(spec_path) do |spec_file|
43
+ spec_target(spec_file)
44
+ end
45
+ }
46
+ end
47
+
48
+ def spec_target(spec_file)
49
+ spec_file.each_line do |line|
50
+ if match = SPEC_TARGET_MATCHER.match(line)
51
+ return "::#{match[1]}#{match[2]}"
52
+ end
53
+ end
54
+ end
55
+
56
+ def mutant_supported?
57
+ # uninitialized constant Mutant::Strategy::Rspec::StringIO
58
+ return false if RUBY_VERSION.start_with?("1.9.2")
59
+ # ambiguous option: --rspec
60
+ return false if defined?(RUBY_ENGINE) && RUBY_ENGINE == "rbx"
61
+
62
+ begin
63
+ require "mutant"
64
+ rescue LoadError
65
+ return false
66
+ end
67
+
68
+ true
69
+ end
70
+
71
+ end
metadata ADDED
@@ -0,0 +1,123 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: dotum
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Ian MacLeod
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2013-09-04 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description:
14
+ email:
15
+ - ian@nevir.net
16
+ executables: []
17
+ extensions: []
18
+ extra_rdoc_files: []
19
+ files:
20
+ - .gitignore
21
+ - .groc.json
22
+ - .rspec
23
+ - .simplecov
24
+ - .travis.yml
25
+ - CONTRIBUTING.md
26
+ - Gemfile
27
+ - Guardfile
28
+ - MIT-LICENSE.md
29
+ - README.md
30
+ - Rakefile
31
+ - bin/dotum
32
+ - data/default_rules.dotum
33
+ - dotum.gemspec
34
+ - extern/json/CHANGES.md
35
+ - extern/json/COPYING
36
+ - extern/json/README.rdoc
37
+ - extern/json/lib/json.rb
38
+ - extern/json/lib/json/.DS_Store
39
+ - extern/json/lib/json/add/bigdecimal.rb
40
+ - extern/json/lib/json/add/complex.rb
41
+ - extern/json/lib/json/add/core.rb
42
+ - extern/json/lib/json/add/date.rb
43
+ - extern/json/lib/json/add/date_time.rb
44
+ - extern/json/lib/json/add/exception.rb
45
+ - extern/json/lib/json/add/ostruct.rb
46
+ - extern/json/lib/json/add/range.rb
47
+ - extern/json/lib/json/add/rational.rb
48
+ - extern/json/lib/json/add/regexp.rb
49
+ - extern/json/lib/json/add/struct.rb
50
+ - extern/json/lib/json/add/symbol.rb
51
+ - extern/json/lib/json/add/time.rb
52
+ - extern/json/lib/json/common.rb
53
+ - extern/json/lib/json/generic_object.rb
54
+ - extern/json/lib/json/pure.rb
55
+ - extern/json/lib/json/pure/generator.rb
56
+ - extern/json/lib/json/pure/parser.rb
57
+ - extern/json/lib/json/version.rb
58
+ - lib/dotum.rb
59
+ - lib/dotum/abstract_rules.rb
60
+ - lib/dotum/abstract_rules/base.rb
61
+ - lib/dotum/abstract_rules/globbable_files.rb
62
+ - lib/dotum/abstract_rules/options_base.rb
63
+ - lib/dotum/autoload_convention.rb
64
+ - lib/dotum/cli.rb
65
+ - lib/dotum/context.rb
66
+ - lib/dotum/externs/json.rb
67
+ - lib/dotum/logger.rb
68
+ - lib/dotum/options_context.rb
69
+ - lib/dotum/rule_dsl.rb
70
+ - lib/dotum/rule_options_dsl.rb
71
+ - lib/dotum/rule_runner.rb
72
+ - lib/dotum/rules.rb
73
+ - lib/dotum/rules/cd.rb
74
+ - lib/dotum/rules/download.rb
75
+ - lib/dotum/rules/link.rb
76
+ - lib/dotum/rules/repo.rb
77
+ - lib/dotum/rules/require_extension.rb
78
+ - lib/dotum/rules/run.rb
79
+ - lib/dotum/rules/use.rb
80
+ - lib/dotum/rules/use_repo.rb
81
+ - lib/dotum/standard_options.rb
82
+ - lib/dotum/standard_options/destination.rb
83
+ - lib/dotum/util.rb
84
+ - lib/dotum/util/ansi_colors.rb
85
+ - lib/dotum/util/path.rb
86
+ - lib/dotum/version.rb
87
+ - spec/fixtures/autoload_convention/abc_one_two_three.rb
88
+ - spec/fixtures/autoload_convention/allcaps.rb
89
+ - spec/fixtures/autoload_convention/mismatched.rb
90
+ - spec/fixtures/autoload_convention/multi_token.rb
91
+ - spec/fixtures/autoload_convention/single.rb
92
+ - spec/fixtures/autoload_convention/string.rb
93
+ - spec/spec_helper.rb
94
+ - spec/unit/dotum/autoload_convention/const_missing_spec.rb
95
+ - tasks/console.rake
96
+ - tasks/spec.rake
97
+ - tasks/spec/ci.rake
98
+ - tasks/spec/coverage.rake
99
+ - tasks/spec/mutate.rake
100
+ homepage: https://github.com/nevir/dotum
101
+ licenses: []
102
+ metadata: {}
103
+ post_install_message:
104
+ rdoc_options: []
105
+ require_paths:
106
+ - lib
107
+ required_ruby_version: !ruby/object:Gem::Requirement
108
+ requirements:
109
+ - - '>='
110
+ - !ruby/object:Gem::Version
111
+ version: '0'
112
+ required_rubygems_version: !ruby/object:Gem::Requirement
113
+ requirements:
114
+ - - '>='
115
+ - !ruby/object:Gem::Version
116
+ version: '0'
117
+ requirements: []
118
+ rubyforge_project:
119
+ rubygems_version: 2.0.3
120
+ signing_key:
121
+ specification_version: 4
122
+ summary: Dotum manages your dotfiles and allows for piecemeal sharing.
123
+ test_files: []